Booting Ubuntu on a different machine

So, I’m now on Jogja again… (actually since 12 November)

Some days ago I plugged my harddisk and revived my abandoned box. My harddisk had Breezy on its third partition, but that Breezy was configured for my cousin’s computer (installed when I was in Jakarta). I wanted to see Breezy fail again, so I proceeded.

(The Breezy which was installed on my computer failed to boot on my cousin’s computer, so I reinstalled it there)

At boot a message came which told me that /dev/hdc3 was not found. Understandable, since on my cousin’s computer the hard disk was plugged as secondary master while here it was plugged as primary master. The last message was something along “dropping to shell”.

(On my cousin’s machine I stopped at this point, but I was feeling quite adventrous so I continued on…)

Shell = typing commands, so I tried to type. However there was no characters written on the screen. Since I believed Ubuntu’s last message, I tried to switch to other terminals (CTRL+ALT+F2, CTRL+ALT+F3, etc). As expected, the shell sh was waiting on one of them.

(Actually when we’re in terminal, pressing ALT+Fx will suffice to switch. We only need to add CTRL when we’re on X)

sh is a very very primitive shell. It has no code completion (TAB key), it has no history (UP and DOWN keys), it has nothing fancy. Just a plain bare shell.

ls showed some directories already created on the filesystem. Take in mind that no drive had been mounted. Those files were created on the fly and existed only in memory.

So, I created /mnt/slash and mounted /dev/hda1 on it. I thought the problem was with /mnt/slash/etc/fstab so I proceeded to edit it.

The problem is, I couldn’t find vi (or vim, or whatever). It was not on /mnt/slash/bin, /mnt/slash/usr/bin, and /mnt/slash/usr/local/bin. Luckily there was nano on /mnt/slash/bin.

(it turns out that vi is actually on usr/bin of my root partition. Creepy. Probably I mislooked it)

Oops, however nano failed to load a library (ncurses stuff). It probably searched on /lib while the library was on /mnt/slash/lib.

Suddenly chroot came to mind. I used it when mindlessly following the installation procedure of Gentoo. I remembered faintly (from the name) that it is used to fake the location of / to applications. The Gentoo installation manual said that the command was very powerful. Time to test it…

After “chroot –help”, I did a “chroot . bin/nano etc/fstab” (I was on /mnt/slash) and nano starts like wonder, loading fstab. After changing some stuffs (most notably hdc to hda) I confidently rebooted, only to find…

The same error popped out! I wondered, what could’ve caused it. The only possible program seemed to be grub, so I rebooted and viewed the grub boot command (can be done by pressing e from the grub menu). It was:

kernel        /boot/vmlinuz-2.6.12-9-386 root=/dev/hdc3 ro quiet splash

Changing hdc3 to hda3 made Breezy boot just fine. However..

X failed to start. Luckily I remembered someone suggesting “sudo dpkg-reconfigure xserver-xorg” on ubuntuforums.org to reconfigure X automatically. After the text-based wizard, I could use X just fine. Sound is working OK. Heh, never thought I would’ve wasted my time doing it :).

We can see 2 different approaches here (Windows vs Linux). On one side, it seems that Windows will reconfigure itself when a critical hardware change is detected (video card, disk configuration, etc). The priority is booting up to the graphical shell and making all hardware usable by the user. On the other side, Linux don’t want to play smart and change our precious configuration files (/etc/fstab among others). The priority is honoring user files and probably speed (e.g. don’t waste time detecting changes and reconfiguring, just follow the configuration files blindly).

I don’t know whether changing Linux to be more automatic (in this particular problem) is a good thing. The problem is, Linux can be awfully customized. You can separate /, /home, and /boot for example. You can’t just mount all visible partitions on /media/a, /media/b, /media/c and expect things to work as intended. Well, probably this should be left as is, since booting a harddisk on another computer configuration isn’t what everyone do everyday :).

Share and Enjoy:
  • bodytext
  • del.icio.us
  • Technorati
  • Slashdot
  • StumbleUpon
  • Sphinn
  • Facebook
  • Mixx
  • Google
  • TwitThis
  • Live

Leave a Reply