Using chroot to fix bootup issues…

Yesterday when I upgrade my Ubuntu Edgy via apt-get, it told me that I can safely remove sysvinit as it is no longer required, and told me to use apt-get autoremove for that. I thought maybe the Ubuntu team has decided to replace sysvinit with upstart for good, so I did as it told me and removed sysvinit.

Some time later, when I had to reboot my system because of a system crash (kinda like to blame those on Beryl). And then Ubuntu tells me it can’t find /bin/init, and takes me to a BusyBox shell. It took me some time to realise that this was not a hard disk crash, and just because I uninstalled sysvinit without installing upstart.

The Fix.

Ok, so what do I do? I figure that I have to install sysvinit somehow, and I need to use apt-get or dpkg somehow. But I can’t boot up my system to call commands!

I have never used chroot in an administrative situation before. I tried chrooting from the BusyBox shell, but my root was mounted readonly by default. And my /dev/ device files were missing – I tried creating them using mknod – but I wasn’t too sure about the what are the major and minor numbers that I have to enter.

So I booted it up from a Ubuntu 6.06 LTS CD, and then did the required work:


# sudo mkdir /r2
# sudo mount /dev/hda1 /r2
# sudo chroot /r2

I’m now almost like being in my old system, my /var/cache/apt/archives/ show a sysvinit package, so I don’t think I’ll need to setup a network connection. I just do

# sudo apt-get install sysvinit

and it works.

I reboot and I’m back into my trusted Ubuntu system.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: