Monday 16 March 2009

Fresh Install with Fucked-up CD-ROM




I bet the web is full of this sort of information already, but this is only to show a more personal view, by retelling how I adressed the problem and how it worked for me.
The problem is the following:
1. I own a laptop [1].
2. Its DVD/CD-ROM is NOT reliable [2].
3. My OS (Slack11) doesn't work that well now [3].
4. My PhoenixBIOS DOES NOT recognize any removable devices (USB/FireWire) on boot, although it 'seems to say' it should.
5. Slackware 12.2 is WAY TOO AWESOME to ignore, I must have it.

What do I have to make it work?
I have a corrupt Slackware Linux 11.0 that 'does' work, but fails with audio, glibc, most compilers, and pretty much anything fun.
How did I make it work?

First, let's review the hard drive partition scheme[4], to see what I did.
My disk was thus:
hda1: swap partition for Slack (about 600 MB)
hda2: root partition (/) for Slack (about 7 GB)
hda3: home partition (/home) for Slack (about 17 GB)
hda4: free space to install Windows XP (about 15 GB)
I didn't need to change that, it seemed reasonable, so I left it as was.

Fact 1: Linux installation CDs run the kernel before anything else. This, you might not realise, is a HUGE advantage. Since once you get a nice kernel working, all media (including removable) works as well. So, what I really needed was to run the kernel from somewhere besides the faulty DVD/CD tray... such as a hard drive partition.

Step 1: As root, I made a slack12 directory on the /home partition (hda3). Basically: "mkdir /home/slack12." I then used the external DVD-RW to get the kernel and RamDisk images and copy them to my newly created directory: "mnt /dev/sr0 /media/dvd; cp /media/dvd/isolinux/initrd.img /home/slack12; cp /media/dvd/kernel/hugesmp.s/bzImage /home/slack12". Done. Those steps can be done differently, or from a GUI, but shell commands work EVERY TIME on ALL SYSTEMS, so you can copy-paste them (without the quotation marks, obviously...) The semi-colon, as you know, separates commands, you could run each at a time (I recommend that you do, actually.)

Fact 2: LILO[5] is pretty awesome (although probably GRUB is even better), because you can really tune your multi-booting with it, and launch pretty much any OS you run. But the automatic-guess script of liloconfig is not that neat. So, manual edition of the lilo.conf file is the way to go. Isn't that dangerous? No, as long as you only add entries, and don't change the ones already working. If something goes awry, however, LILO will warn you and refuse to reinstall (remaining fine.)

Step 2: As root, I opened the lilo.conf file ("vim /etc/lilo.conf", but doing so from a GUI with kate/kwrite is much easier), and added the following lines:
image = /home/slack12/bzImage
root = /dev/hda3
initrd = /home/slack12/initrd.img
label = Slack12
I do not know how important the order is, but the 'label' part simply contains the name LILO will display, you can put anything you want there.
Now we reinstall LILO: "lilo". If it works fine, it will list the boot options, marking the default one with a *:
Linux*
Slack12
Oh, if you were booting only one OS, you probably have to add these lines to lilo.conf (between the lines "# Start LILO global section" and "# End LILO global section"):
prompt
timeout = 100
Those lines will make LILO prompt you as to what OS to run, and wait $timeout/10 seconds for your choice (with timeout=100, 10 seconds.)

Fact 3: Slackware is the only distro to use a console-based installer? Probably. Is there a difference? No. Cute and easy-looking, graphical, mouse-intensive installers such as Anaconda (Red Hat, Fedora) or those on LiveDVD distros (Ubuntu) might seem easier. They only seem easier, because the options are pretty much the same. And if you CAN READ, YOU WILL get through a Slackware installation. If you can use a keyboard, you won't have major troubles. Still, there is some info you need to know for a non-typical (even weird) installation such as this one (on my oddly beaten laptop.) In fact, for this kinds of installation, you will find that the console-driven Slackware install is in fact ideal, since it offers immense flexibility.

Step 3: Rebooted. Chose Slack12 entry. Waited for kernel to load. Done.
"Enter 1 to select keyboard map:" 1 (this is what I typed, then pushed Enter).
Now we get the keyboard select option, and since my keyboard was bought in Argentina, I use a qwerty/es.map form. Just scroll down until you find it (If you type "r" and then "e" and get exactly there, no scrolling).
"Slackware login:" root (this is a no-brainer, the help tells you to do so.)
Now the system tells you a bit about partitions, I did not "cfdisk" because my partitions were fine. If you need to, cfdisk is extremely easy to use [6]. fdisk, not so much.
Then I ran "setup" which launched the Slackware installer. The program is NOT sequential, you get to choose which part of the installation to do, but if you go from top to bottom, you can't go wrong. The first entries are help and something else, ignore.
I chose "Setup swap partition". If your partitions are fine, and you have ONE swap, you'll get what I got, one choice only. I entered the name of the partition that it showed me "/dev/hda1". You are asked if you want to check the swap partition for bad blocks before activating it... not necessary if your computer is not old enough to vote.
"Select Linux installation partition". I had only one, so only one option: /dev/hda2. Chose "Quick format", as "ReiserFS".
"Other partitions". Added the "/dev/hda3" FAT32[7], mount point "/fat".

And here is the real key to the whole process... "Source media selection". Now we get to chose where to Install Slackware 12.2 from. You have many options (including ftp/http), but I chose "1. Install from a Slackware CD or DVD". Then I chose "Manual" (manually specify device or something), and then I scrolled down to "/dev/sr0" (which is the first SCSI CD/DVD drive). Piece of cake. "Slackware installation disc detected..." Thank you.

Now we get to a sequence, started by "Package series selection". By default, Slack selects all but the KDEi part, which is multi-language support for KDE. I recommend that you add that (in case you didn't know, space-bar checks an option).
You are now prompted on what specific packages you want installed, I chose (as should everyone else) FULL Installation (4.8+ GB). It is actually 5.5 GB when newly installed (which is very slim for such a killer distro.)

Then we are taken to the setup scripts. Some of them automatic, some ask for very silly and easy information. The netconfig script is quite straight-forward, but I should add something: if you have cablemodem or other DHCP-discovered service, your hostname and domain are irrelevant, anything will do. As with the rest, that script is very Enter-intensive, you seldom type anything at all.
I did not create an USB Boot Disk (no more floppy bootdisk, things got big).
I tried the LILO automatic configuration, on the MBR, it failed. Something to do with the /dev/hda3 partition, fuck it. No matter, I'll fix later. More options, like local time setting and the like. Easy, scroll-and-enter options.
Done. Exeunt the setup program. The system is installed, we should reboot.. NO!
Since LILO was not correctly installed, it will boot to... NOTHING.

So, before that, I needed to install LILO properly. The ideal form is the Expert mode, which is very easy. Yes, easy. On the prompt, once you exited the setup program:
"pkgtool"
That shows some options, similar to the installer, but not quite. I chose "Setup scripts" or something of the order... A list of scripts, most of them were run during system install (as configuration scripts). I checked "liloconfig" (space-barred it) and 'Entered', then chose "Expert mode".
"Header" (which is the first option, I'm certain), followed by a few Enters, "no UTF" (Enter, since it's default), "Slackware logo" (probably default as well), "Master Boot Record".
Now I get back to the liloconfig menu, "Linux partition", and I added the only one, "/dev/hda2".
Back to the menu. And here I realised what the problem with the automatic install was: it added the /dev/hda3 partition as a Windows partition, and there is no Windows to launch there.
I DID NOT add a Windows partition, instead I just chose "Install LILO". That worked, since I got no error messages.

And then I was done.
Rebooted.
LILO prompt, now with the Slackware logo, Linux as only option...
Like a charm. Slackware 12.2 with the wicked 2.6.27.7 kernel. And Compiz.

So, that's all.
If you had the same problem, I hope that helps.

Notes on [x]:
[1] Kind of. Since its battery has died already, the CD/DVD thingie is fucked, and the keyboard has been destroyed, and I HATE the popular mouse-like touch-screen thingie, it is pretty much a smaller desktop PC: I needs to be plugged, and it has an external DVD-RW, a keyboard and a mouse plugged at all times.
[2] That's a serious understatement. It works ONLY with a few DVDs. And not very well. It simply ignores CDs.
[3] Installing it with the 'faulty' DVD-ROM resulted in many missing packages and some more corrupted material. It works pretty much like a government.
[4] Unix* users are quite familiar with the concept, especially multi-distro-Freenixers (such as myself.) It isn't hard: first IDEs are hda and hdb, first partitions are hda1 and hda2... Logical partition are >4, like hda5-hda15 (since an HD can hold only 4 primary partitions). It's a no-nonsense scheme (unlike in other systems...)
[5] When installing LILO, you get to choose among installing on root partition, Master Boot Record and somewhere else (can't remember). It usually advises against the last choice (MBR), because it "can be dangerous." It has ALWAYS worked perfectly for me on MBR. I find that LILO/GRUB on MBR is the best way to multi-boot Unix*+Windows OSs. But that's just my experience.
[6] Although when choosing filesystems you might feel a bit overwhelmed, since it features all FSs known by GNU/Linux... around 100.
[7] FAT32 sucks, but I intent to use it to install Windows. Then it will probably be an XFS migrated /home partition.

Disclaimer: I probably missed some options, if I did it is because they were too obvious to note. If they weren't, I'm sorry, my mistake. And most of the option titles are not quite textual... they are still obvious and you will recognize them.

No comments: