Ask Klaus!


Klaus Knopper is the creator of Knoppix and co-founder of the LinuxTag expo. He currently works as a teacher, programmer, and consultant. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: klaus@linux-magazine.com.

Knoppix on USB

Question:

I've been using Knoppix for about two years now, and I've got the following question. Could you describe, in a step-by-step guide, how to boot Linux (Knoppix) from a USB device. I've read some articles about this issue, but I haven't been lucky so far. As far as I understand from these articles, it's a matter of creating an initrd, which, after initial boot, should be able to mount the file system from the ultimate USB device on / (root). I did manage to make myself a new initrd but I still get the following error at book:

Kernel panic not syncing : VFS: Unable to mount root fs on unknown block (8, 17)"

I currently think that this is due to the fact that my initrd has USB & SCSI support as loadable modules, whereas I think this support has to be build into the kernel, which I don't know how to do. Maybe I'm quite wrong in my efforts. Is there another way to make this work? Maybe you can write an article about this issue in Linux Magazine.

Answer:

If you get this error message immediately after the kernel loads, you may have neglected to add the initial ramdisk file containing the USB modules to your linux loader. Whether you use grub, sys/extlinux or lilo, there should be an "append" line that says initrd=some-filename.gz, with some-filename.gz being the initrd that you have previously created.

Booting from USB can be a little more difficult than expected because USB devices usually need some time to get into a state where they are recognized by the kernel. You may think that just adding the right drivers to the kernel will make it possible to directly access /dev/sda* partitions when the kernel is mounting the root file system, but unfortunately, it's not that easy. After loading the USB modules (ohci-hcd, uhci-hcd, or ehci-hcd) and usb-storage, there is a time period of about 5-20 seconds in which the initialization procedure just has to WAIT, until the USB device is ready and all partitions are recognized by the kernel. Before that, the partitions and the USB device itself are not even visible anywhere in kernel space.

The general procedure to make an external USB harddisk or pendrive bootable with Linux depends very much on the partitioning and desired filesystem configuration. If you have a FAT partition on /dev/sda1, you could use syslinux and put a kernel and an initrd with all necessary drivers there, and add a root=/dev/sda2 directive in the boot loader, which makes it mount the ext2 Linux filesystem from the second partition. I don't think that the standard initrd-utils of Debian will support this, because of the aforementioned period of waiting for the USB disk/stick to get ready, so, you will have to set up an initrd manually with a long enough delay between loading the driver modules and accessing the /dev/sda* partitions.

It should not matter whether you put all USB drivers into the kernel (one or several of *-hcd, plus usb-strage) or on the initial ramdisk, because you will have to delay mounting of / from the USB device in both cases.

There is a description for how to load Linux on a USB stick in the Knoppix case at http://www.knoppix.net/wiki/USB_Based_FAQ. In this document, you just put a live Linux system on a USB stick that's formatted with a FAT file system (default). The description should match a "hard disk installation on USB" as well.

Please also note that not all USB stick and board combinations are bootable, in spite of all the vendor promises to the contrary. There are several "designed for USB boot" GNU/Linux versions around that you can experiment with if you are interested. See http://spblinux.sourceforge.net/ or http://www.damnsmalllinux.org/.

Figure 1: Look for drivers at the www.kernel.org website.

SATA Drivers

Question:

I just had a Linux box built for me. The box is very much a "State of the Art" machine with components as follows:

When I attempt to install Linux (Red Hat version 9), I get part of the way into the process. After I have selected (US) as the language, Linux complains that I must select "a device driver."

Please note, none of the device driver selections will work. I do not believe that it is the CD-RW, since it is reading the installation media. I have disabled the sound card and Internet access in the BIOS.

Since SATA2 drives are new on the market, I'm working on the assumption that Linux is complaining about these new drives.

I have sent the following questions to Red Hat, ASUS and Western, and I have not received any response.

Klaus, maybe you could shed some light on this problem. What should I do?

Answer:

Drivers for SATA2 are not dependent on a specific distribution (or rather: distributions should not depend on a specific kernel). So the chances are good that you can get SATA2 drivers for your setup from the "normal" kernel resources at www.kernel.org.

Compiling a kernel (or kernel modules) is not terribly difficult, but choosing the right options for your setup can be. You would need to know which SATA2 CHIPSET your board uses, and which other hardware components, in order to know which options to check or uncheck in the kernel setup. There are quite a few commercial open source companies, as well as Linux user groups, who can help you with this.

I have found a few mentions of your board in the success list for Ubuntu, so it should already be well supported by the current Linux kernels. You can try to see if your disks are detected using a current Knoppix or Ubuntu live CD.

Once you know that your disks are working with a newer kernel, it should be possible to just update the kernel on your existing system, or else just install a distribution of your choice that has that kernel.

Suspend-to-Disk with APM

Question:

I read your article in Linux Magazine (issue #66 / May 2006, p62) with interest, because I've also had no end of trouble trying (and failing) to get suspend-to-disk working on my Toshiba Satellite Pro 4600 under Mandriva LE2005. It works under Windows 2000 Pro, but I don't know whether Windows 2000 uses APM or ACPI. I would like to ask two questions: how can I tell if my box supports APM and, if it does, what would I have to do to initiate suspend-to-disk under LE2005?

Answer:

In order to find out if your laptop supports APM or ACPI, just try both methods. You could, for example, boot Knoppix with knoppix acpi=force to force ACPI mode, and later check with dmesg if anything useful shows up (also try the acpi command), or boot with knoppix acpi=off to check on apm as fallback (dmesg, apm ...). Check the Mandriva documentation for equivalent commands.

If your laptop supports APM and already has a suspend-to-disk partition or file created by the manufacturer yourself (there are DOS programs that modify the harddisk accordingly), you should be able to hit the suspend-to-disk hotkey and your laptop will write all necessary data to that partition or file (and hopefully wake up from suspend later, too).

With newer laptops, you will probably have to use ACPI for this, because newer laptops don't implement hardware-aided suspend anymore. So, with the method supported by Kernel 2.6.15 and up, just make your swap partition large enough to store the entire RAM plus the swap amount that's already in use.

The kernel option for your lilo.conf or grub menu.list is resume2=swap:/dev/hda3, given as APPEND for the kernel options, with /dev/hda3 being a swap partition in this example, and reboot so that the kernel is aware of this feature. You start suspend-to-disk by

echo 4 > /proc/acpi/sleep

as root. Strange and wonderful things may happen after this command. When booting again, your kernel will try to restore the system state from the suspend data stored in the swap partition, which may or may not succeed at the first attempt.

Unfortunately. it is not easy to find out which of your computer's components support hardware suspend, and which need to be unloaded and reinitialized after waking up. This involves a lot of trial-and-error. So, when using suspend-to-disk for the first couple of times, make sure all the data that you still need is backed up properly.

If echo 4 > /proc/acpi/sleep doesn't do anything for your kernel, check the dmesg command for obvious errors. It could be that your kernel simply doesn't support for suspend-to-disk, or ACPI is switched off.

Portable PC with Projector Settings

Question:

We recently had a Linux event (Namur Linux Days, in Belgium), and I was invited to do a presentation at this event on the topic of Evolution.

We arrived with a portable PC, but we have had some difficulty with having the presentation sent to the projector. The solution was to boot the PC with the projector plugged in. But in this case, nothing appeared on the portable PC's screen.

I would like the PC screen to display what is projected, or at least have a command or a function key to allow me to toggle.

I have looked through many articles on Internet but have not found a solution. Can you help us?

Answer:

I know what you are talking about. I happen to own a laptop with similarly strange "intelligent" hardware that decides on the graphics operation mode depending on whether the projector is plugged in at cold boot time or not.

Usually, for my laptop, if the projector is plugged in at boot time, I get a picture that "almost" matches the internal display. But, about 25% of the outer area of the screen is cut off. When trying to switch resolutions with Control +alt +numpad + or -, I get all kinds of funny effects on the projector...

This is primarily a hardware problem, but that doesn't mean we don't have Linux software workarounds for it.

Workaround 1:

Start a framebuffer X Server for your presentation. The framebuffer server usually outputs a picture in "projector-friendly" frequencies to ALL video ports. Doing this, you would just copy your /etc/X11/xorg.conf (or /etc/X11/XF86Config-4 if you use XFree86 rather than Xorg) to a new location, and change

Driver "your-accelerated-driver"

to

Driver "fbdev"

in the "Device" section of the copy. You may also wish to change the Modes statement to match the projector's favorite resolution.

Now, working as root, you can lauch the new X Server by typing

Xorg :1 -nolisten tcp -config /etc/X11/xorg.conf-projector

and pull up the new screen from the "old" session (toggle back to the other X Server instance by pressing Ctrl-Alt-F7 if it's on console 7) by typing:

export DISPLAY=:1 # Set the "default display" for that shell
kpdf my-presentation.pdf & # Start the PDF presentation
twm &     # Add a quick & small windowmanager

Workaround 2:

For certain laptops, booting with the internal display disabled, so you have ONLY the projector picture, could help. Apparently, the chipsets used by these laptops can't handle the internal and external display at the same time. You will have to use the appropriate hotkey for switching to "external port only" when the boot screen shows up.

This workaround for the problem is admittedly kind of inconvenient, but for some laptops, it seems to be the only workable solution.

Workaround 3:

KDE comes with a "quick resolution changer" plugin in the Control Center that allows you to change the resolution, and adjust the desktop size, at the same time. Sometimes, it helps to switch to 800x600 mode in order to get both the projector and the internal display working properly at the same time.

Sometimes the refresh rate is also a factor in getting the projector work with the screen. Changing the refresh rate to something around 75Hz might do the trick if you have an older projector.