14 June 2009

crazy linux: so easy and so complicated

Linux-Fans would probably claim it as an advantage of their OS that you can easily move an installation from one hard-disk or partition to another, only need to update boot-manager and fstab, can even keep all your directory-names.
In reality, this simple maneuver can easily lead to a big mess (as in: the system does not boot any more and gives loads of contradictory messages). Here's what happened to me.

I wanted to update my Ubuntu from 8.04 to 8.10 (and maybe 9.x later). One reason to do it is that apparently I can then install Facebook-chat in Pidgin. But this update needs 1.5 Gigs of free space on the root partition and so I had to make a larger partition and move my installation there.

First, it was really easy to create a new partition. Before formatting it, however, I had to restart the computer, just as I would have needed with Windows. Formatting it, was also easy, just call "mkfs.ext3" which I don't remember exactly because it pops up conveniently when pressing TAB at the shell. (Yes, I did partitioning and formatting by hand, because there was no graphical tool for it installed by default and finding one to install would have taken longer...)

Second, I googled on how to copy files, read something about "cp -a" and tried it out. That was a big mistake. The correct command would have been "cp -ax" where the "-x" makes sure that file systems which are mounted under / are not also copied. I was not only so unlucky to waste a lot of time by copying useless stuff (had my windows partition mounted...), it also apparently crashed my computer when it tried to copy some of the virtual file systems under /sys.
After this crash, I copied the remaining data individually (so as to not copy things twice). Since all is working now, I think I didn't miss anything.

Third, making the new partition the one being used is really as easy as changing GRUB's menu.lst and /etc/fstab, and it did it right on the third try, but I still do not know at all what when wrong on my previous tries. On the first try, I just walked into menu.lst and replaced the kernel's root= parameter with the new partition name sda7, ignoring all the fancy UUID names for other partitions which I found very confusing. (And still don't get the point... it makes the system transparent for hard-disk switches, but makes it vulnerable to hard-disk reformatting...).
This first try actually booted my system from the new partition (yay!), but when I typed 'mount' at the prompt, it would show the old partition to be mounted on /. But it actually was the new one. What a blatant lie! This is a severe error on 'mount's side.
Anyway, I decided to do the update of 'fstab', hoping this would solve the problem. I added a line mounting the new partition as /, and changed the line for the old partition to mount as /part1. All obvious things you would think, right? But this actually messed up my boot and brought me more blatant lies. After restarting, there was a weird text-mode message box signed by 'gdm' about X not being able to start. Part of the box was overwritten by a text-mode logon prompt. I logged in and had 'mount' lie to me again. It told me that no partition but the former / was mounted when in fact everything else was mounted. Sucker!
I booted back into the old system (which still worked), google for UUID and then changed the 'menu.lst' as well as 'fstab' to use the UUID instead of /dev/sda7. I also corrected a mistake in fstab where I had typed "default" instead of "defaults". Anyway, in my opinion none of those things should have made a difference, but in reality the new system booted thereafter and I couldn't find any problems any more. Case considered close. Reason for trouble unknown.

It's weird how my perception of computers has changed. It used to be that I wanted to understand how things work, usually helped by reading the manual and trying different things out, and then from that understanding knew how to achieve what I wanted. But now, understanding is totally absent from the process. I just assume that everything will somehow work and when I run into trouble (and only then), I ask Google and try out what somebody else wrote, not even caring who posted it and where.
This is really a black vision of computing; one that's totally opposed to my research approach: in verified programming and refinement, everything is meant to be transparent to people and every step understandable. I really sucks that computers in practice have become like black boxes that we can only control by trial and error, not logic or understanding.
After all, it was easy to copy the Ubuntu installation onto a new partition and I am now happily downloading my update. But the way it went is just not right.

Edit: I had the update run overnight because the download rate was so slow (that's GradHouse...) and it bothered me in the early morning with some decisions that pop up randomly during the update. Overall, Ubuntu now uses 0.9 Gigs more of hard disk space, has a new "switch computer off or change chat status" button, needed reconfiguration of my Quickstart-buttons (those extra keys on the laptop-keyboard), because their keycodes apparently got renamed... Most other things still seem to work and most importantly: I could install Facebook-chat for Pidgin from Google-Code and that works, too. Yay!

0 comments:

Post a Comment