Most popular:

Archives

Chroot into Ubuntu [from Debian]

While I haven’t posted in a long time, testing out Ubuntu development builds has been a constant. I have so far gone from Jaunty Beta through all the Karmic Alphas, then the Beta, the RC and the Gold without much hassle. The reason I decided to go all the way through the Karmic schedule was the very annoying Intel driver regression/bug with my i965 graphics card which plagued the 9.04 release.

I found myself enjoying the bleeding edge of Ubuntu which pushed me to upgrade to Lucid in its pre-Alpha state in late November. All went smooth for a couple of weeks until X started failing to load, leaving me with a black screen and unable to switch to a tty for debugging. This left me with the new Debian sid installation (review coming soon) which demanded a look after months of deferring from my part, and which I had just installed the day before. The unusable Ubuntu was a problem in need of fixing. I will entail the steps taken to get into the system and run # aptitude update && aptitude safe-upgrade which I knew would upgrade to Xorg 7.5 and possibly fix the issues facing my Lucid Lynx.

The solution was mind-boggingly simple; chroot into Ubuntu from Debian (or a LiveCd):
Note: # means you should be entering the command as root. You may use sudo in Ubuntu or su to become root. X in sdaX is your partition number which should be replaced accordingly. For me, it was sda1

# cd /media

# mkdir ubuntu

# mount /dev/sdaX /media/ubuntu

It was also pointed out that I should bind /proc, /dev and /dev/pts to /media/ubuntu/proc, /media/ubuntu/dev and /media/ubuntu/dev/pts, respectively;

# mount --bind /proc /media/ubuntu/proc

# mount --bind /dev /media/ubuntu/dev

# mount --bind /dev/pts /media/ubuntu/dev/pts

We are now ready to chroot, using this command:

# chroot /media/ubuntu

I am now in my Ubuntu Lucid as root.  Next step was attempting to update my system through aptitude;

# aptitude update

Unfortunately connecting to my Romanian Ubuntu mirror host (ftp.astral.ro) was failing, an issue easily fixed by adding the IP address and name to my /media/ubuntu/etc/hosts file. You may need to do the same with any PPAs installed if upgrading them is also your intent.

# nano /etc/hosts
added 193.230.240.8   ftp.astral.ro somewhere in the file and Ctr+x to exit, Y to save, Return to save to /etc/hosts
# aptitude update && aptitude safe-upgrade

It was smooth sailing from here on, with more than 500 updates and new packages to install, the Lynx had its work cut out for it. I’m happy to report that Lucid is now opperational, finally getting the gnome-panel to stop restarting every few seconds.

You may run commands as if you were logged into the system and with this I wish you happy typing ;) There are many more uses to chroot, like debootstrapping, but that is beyond the scope of this tutorial – Google is your friend, use him.

Edit: Unified the first two commands.

4 comments to Chroot into Ubuntu [from Debian]

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>