Writing /var/lib/dokuwiki/data/meta/tutorials/installing_ros_fuerte_from_a_chroot_image.meta failed
tutorials:installing_ros_fuerte_from_a_chroot_image
This is an old revision of the document!
Table of Contents
Installing ROS fuerte from a chroot image
Deprecated
- Install dependencies:
sudo apt-get install dchroot
- Create necessary directories:
sudo mkdir -p /srv/chroots/
- Download the pre-made chroot image and uncompress it:
cd /srv/chroots/ wget arcoslab.eie.ucr.ac.cr/sid-amd64-2013.02.25-rosbase.tar.bz2 tar -xjf sid-amd64-2013.02.25-rosbase.tar.bz2
- Create a script for mounting, entering, exiting and unmounting the necessary system directories (this is instead of using the fstab file which can be dangerous when, for example, you decide to delete the chroot with the system directories still mounted. If you do rm -rf /srv/chroots/sid-amd64-2013.02.25-rosbase, you may not only delete the chroot directory but the system directories as well!!): This is the script: (copy it to /usr/local/bin/sid-amd64-2013.02.25-rosbase.sh)
#!/bin/bash CHROOT_DIR=/srv/chroots/ CHROOT_NAME=`basename $0 .sh` if [ ! -e /var/run/$CHROOT_NAME ] then sudo touch /var/run/$CHROOT_NAME sudo bash -c "echo 1 > /var/run/$CHROOT_NAME" else sudo bash -c "echo `expr 1 + \`cat /var/run/$CHROOT_NAME\`` > /var/run/$CHROOT_NAME" fi if [ `cat /var/run/$CHROOT_NAME` -eq 1 ] then echo "First chroot invocation. Mounting host system directories" sudo mkdir -p $CHROOT_DIR/$CHROOT_NAME/hostfs #mount -o bind /home/ $CHROOT_DIR/$CHROOT_NAME/home sudo mount proc -t proc $CHROOT_DIR/$CHROOT_NAME/proc sudo mount -o bind /dev $CHROOT_DIR/$CHROOT_NAME/dev sudo mount sys -t sysfs $CHROOT_DIR/$CHROOT_NAME/sys sudo mount none -t devpts $CHROOT_DIR/$CHROOT_NAME/dev/pts sudo mount -o bind / $CHROOT_DIR/$CHROOT_NAME/hostfs fi echo "Starting chroot." #dchroot -c $CHROOT_NAME sudo chroot $CHROOT_DIR/$CHROOT_NAME su - $USER echo "Chroot closed." if [ `cat /var/run/$CHROOT_NAME` -eq 1 ] then echo "Closing last invocation. Unmounting host system directories" for i in dev/pts hostfs proc dev sys do sudo umount $CHROOT_DIR/$CHROOT_NAME/$i sleep 0.5 done fi sudo bash -c "echo `expr \`cat /var/run/$CHROOT_NAME\` - 1` > /var/run/$CHROOT_NAME" if [ `cat /var/run/$CHROOT_NAME` -eq 0 ] then sudo rm /var/run/$CHROOT_NAME fi
- Please remember to name the above script with a name exactly as the directory where the chroot is plus “.sh” at the end. The script uses this name to find the chroot and to do other things.
- Also, don't forget to give execute permissions to this script.
- Now configure the /etc/schroot/schroot.conf file with: (please use between the [] the exact same name of the subdirectory containing the chroot, otherwise the script will not work)
[sid-amd64-2013.02.25-rosbase] description=Debian sid (unstable) directory=/srv/chroots/sid-amd64-2013.02.25-rosbase users=memeruiz # CHANGE!!!! #groups=sbuild root-groups=root aliases=unstable,default preserve-environment=true
Now you are done. With:
sid-amd64-2013.02.25-rosbase.sh
You will get your chroot running. (this will not work because you don't have your same user in chroot yet, look down)
Some things to do initially
- Start the chroot as root user:
sudo sid-amd64-2013.02.25-rosbase.sh
- Add a normal user
adduser username
Notes
If you have questions regarding chroot please check Debian Unstable inside a Chroot for more information.
tutorials/installing_ros_fuerte_from_a_chroot_image.1538510572.txt.gz · Last modified: 2022/09/20 00:08 (external edit)