charlieg
April 2nd, 2008, 09:04 PM
I have two linux partitions - a handy set up that allows me to admin one from the other should something go wrong (e.g. with an upgrade) or I want to install something without booting into the other. I have discovered this through various tutorials / docs scattered around the web but nothing had them all in one place so here it is: charlieg's ace and simple guide to using chroot
This is a very handy way to update between major distro versions and I have done it for Gutsy->Hardy - if it doesn't boot, you can boot into the working partition and solve the problem from there!
The following howto should apply to most Linux distributions. You should even be able to boot into a liveCD and do this from the console.
You will need to install 'chroot', and 'mount' should be there by default.
You gotta be root (sudo is ok)
So, here it is:
[charles@localhost ~]# sudo -s -H
Password:
[root@localhost ~]# mount --bind /dev/ /media/ubuntu/dev
[root@localhost ~]# mount --bind /dev/pts /media/ubuntu/dev/pts
[root@localhost ~]# mount --bind /dev/shm /media/ubuntu/dev/shm
[root@localhost ~]# chroot /media/ubuntu
root@localhost:/# mount -t sysfs sysfs /sys
root@localhost:/# mount -t proc proc /proc
And that's it! You're in! The environment is set up to basically use the core devices from your active partition. Now you should be able to admin-away without trouble.
root@localhost:/# aptitude update && aptitude dist-upgrade
This is a very handy way to update between major distro versions and I have done it for Gutsy->Hardy - if it doesn't boot, you can boot into the working partition and solve the problem from there!
The following howto should apply to most Linux distributions. You should even be able to boot into a liveCD and do this from the console.
You will need to install 'chroot', and 'mount' should be there by default.
You gotta be root (sudo is ok)
So, here it is:
[charles@localhost ~]# sudo -s -H
Password:
[root@localhost ~]# mount --bind /dev/ /media/ubuntu/dev
[root@localhost ~]# mount --bind /dev/pts /media/ubuntu/dev/pts
[root@localhost ~]# mount --bind /dev/shm /media/ubuntu/dev/shm
[root@localhost ~]# chroot /media/ubuntu
root@localhost:/# mount -t sysfs sysfs /sys
root@localhost:/# mount -t proc proc /proc
And that's it! You're in! The environment is set up to basically use the core devices from your active partition. Now you should be able to admin-away without trouble.
root@localhost:/# aptitude update && aptitude dist-upgrade