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

Install Ubuntu on LVM Partition

Question:

Dear Klaus: I have a PC with two 1TB hard disks. How do I partition them in Ubuntu so that I can set up LVM and have maximum disk space available? Can you please guide me? Thanks. Prashant

Answer:

I could tell you how to partition a hard disk and install logical volumes in general with the standard command-line tools, but I think that is not what you intended. Because you asked specifically how to install Ubuntu on LVM, I would just pass you over to the Ubuntu installer documentation. Current versions of Ubuntu have the option to install on LVM in the "expert" section of the installer menu. For older versions, refer to a HowTo [1].

Modelines Ignored with KVM Switch

Question:

Hi. I use three computers attached to a KVM switch (not the hypervisor), and this works fine with Windows XP and Ubuntu 9.04 and earlier. However, I am having a problem with Ubuntu 9.10 and Fedora 12. I tried Fedora 12, hoping the problem would be different. It seems that neither of these current distros can read the EDID block, so I am not able to set the display above 800x600. There is no xorg.conf file, so I had one generated by:

Xorg -configure :1

I also tried using the modeline instructions, but the X server would not start until I removed them. I have tried adding to Section "Display"

Subsection "Display"
  Modes "1280x800"
EndSubSection

but it seems that this is ignored.

My question is this: How can I get the X server to set display modes above 800x600 when it cannot read EDID (through a KVM switch) and it seems to be ignoring settings in xorg.conf? Thanks, Rob Solomon

Answer:

Modelines are ignored for two possible reasons. The first is that xorg can't match the modelines against any auto-detected monitor frequencies, and the second is that modelines are (mostly) ignored if the X server can set resolutions on the fly by the xrandr extension. The xrandr program, which is part of the x11-xserver-utils package in Debian, has a safety feature that does not allow setting resolutions higher than allowed by the graphics card, as read by xrandr, which in turn uses several mechanisms of getting the information from an attached monitor (and fails because the KVM switch does not pass on the information).

Because this is a quite common and annoying problem, I have built an xrandr package with a tiny modification, that simply ignores any X server-provided limits and just sends the command for resolution change (which might or might not then be executed by the server). The package is online [2] in sources or packages under the name xrandr-knoppix.

Another solution, which gets back the "old" behavior of xorg, is disabling the RandR extension in /etc/X11/xorg.conf so that modelines are working again:

Section "ServerLayout"
  ...
  Option "RandR" "off"
EndSection

Modelines that you created by yourself can become invalid if the xorg server has insufficient information about supported frequencies. If you know the monitor-supported frequencies, add them in Section "Monitor":

Section "Monitor"
  Identifier "Monitor0"
  VendorName "Monitor Vendor"
  ModelName "Monitor Model"
  HorizSync 28.0 - 96.0
  VertRefresh 50.0 - 90.0
EndSection

For an LCD/TFT display, VertRefresh should be in the range 60-75. If you still have no success, check your X server's /var/log/Xorg.0.log for any hints on why higher modelines are ignored.

Windows Dual Boot

Question:

Dear Klaus: For a long time I have occasionally used Linux openSUSE; however, I am considering migrating to a 64-bit operating system, and I prefer to select between openSUSE 11.2, Ubuntu, or Linux Enterprise Server. In fact, I don't need my computer to be set up as a server, but maybe I will! As a Linux Magazine subscriber, I will really appreciate your answer. Can you have (any) Linux OS and Vista (or Windows 7) installed as a dual-boot system? Thanks and best regards, Richard Welvaert

Answer:

Yes ... . OK, that might be too short of an answer. ;-) In general, most bootloaders (even the Windows internal one) support a menu from which you select the operating system of your choice. Distribution-specific install programs automatically find other operating systems on your hard disk and create a boot menu entry for them.

The procedure, if you want to have Windows with Linux as a dual boot, is in general:

1. Install Windows (because this is where most things can go wrong, including destruction of anything else on a hard disk).

2. Reduce the Windows partition to a smaller size to create free space for the necessary Linux partitions. Linux will need at least one data partition for the operating system and your user data and an additional partition for swap (making use of a disk area as additional virtual RAM). The Linux installers know how to create partitions, so you don't have to do this part before starting the installation.

3. Install Linux and watch out for "dual-boot" options.

The procedure is the same for 32- and 64-bit versions. The only problematic case with 64-bit is running 32-bit applications inside the otherwise 64-bit system. This requires a special chroot setup and the presence of 32-bit versions of all the necessary libraries, if you plan to use software that's not available as a 64-bit derivative. However, this is unrelated to your question.

MonoDevelop Problems

Question:

Dear Mr. Knopper: I'm a fan of Knoppix since version 3.1. However, in the recent DVD versions 6.1 and 6.2, I couldn't use the MonoDevelop program successfully. Is the Window Manager LXDE the culprit or something else? Do you have any solution for this? Best regards, Michel Pinczewski

Answer:

I did not notice that MonoDevelop did not work, but I will check on this for the next release. Thanks for reporting this! Generally, if you have a precise startup error message that you would like to report as a hint for me about what went wrong, please send it to bugs@knopper.net.

GCC on HP Mini-Note

Question:

I have an HP 2133 Mini-Note Netbook with SUSE Linux Enterprise Desktop 10 SP1 installed. The processor is a VIA C7-M. I am quite happy with it, except for the absence of GCC. I found out recently that a compiler is required when I attempted to install the Perl Tk module. What is involved in building a version of GCC specifically for the Mini-Note? I have another machine available that is running openSUSE 11.1. Regards, Andrew Dennis

Answer:

Actually, you don't need a special compiler for this netbook because GCC can optimize for a platform by means of its run-time settings and options. After you install GCC from your distribution's install disks or repositories, you can use these options to generate code that should work well on the VIA C7 processor:

gcc -O2 -march=i686 -mmmx -msse -msse2 -msse3 ...

If you give no special options, GCC will use the defaults that came with the distribution, which should not be too much of a performance loss. If GCC is completely missing on your install disks, try to get an i*86 GCC version from a different branch of your distribution. It should work as well.

nVidia Install on Fedora

Question:

Hello Klaus: In the December 2009 column you answered a question regarding nVidia drivers for Fedora. While your answer would have worked, there is a better way.

RPMFusion (rpmfusion.org) has nVidia drivers in both kmod and akmod forms. While the kmods must be matched to their respective kernels, the akmods provide an automatic kmod installation if there is no existing kmod for the kernel being booted. I have used this successfully for a number of versions of Fedora. As you no doubt are aware, RPMFusion is the source of packages for Fedora that can't be in the Fedora repos because of licensing issues.

On another subject, the nv driver has been overtaken by the nouveau driver as the default nVidia driver in F12. Neither provide 3D, though, so the proprietary driver is still needed.

Hope this is useful. Jim Dean

Answer:

Thanks for the update! I have looked into the nouveau driver, but it requires compiling the kernel in the i585 instruction set or up because of CMPXCHG, so a generic kernel that works from the 486 to most modern CPUs would not be possible. Therefore, I cannot include the driver on Knoppix right now. If you have different information or a hint on how to compile it in i386 compatibility mode, please let me know. The nouveau driver should provide enough acceleration and DRI so that Compiz would probably work.

Rescue Tasks on the Command Line

Question:

Sir: I'm a new user of Ubuntu 9.10. I had Win XP, 7, and Ubuntu 9.10 installed on my PC, but due to some problem, I was compelled to uninstall Win 7 and format the partition, and as a consequence, I could not find GRUB for Ubuntu. Now, when I want to install GRUB with the command sudo grub in the Live CD terminal, it shows me that no Ubuntu is installed on my system It was a mess, and I wanted to reinstall Ubuntu. When I tried to boot from the installation disc, the partition selection window showed "this system has no OS installed in it." Neither my Win XP nor the other NTFS partition was visible. I just can't make out what the problem really is. If you can please help me install Ubuntu without losing my XP and other partition, I will remain ever grateful to you. Please help me! Pallab Bhattacharya

Answer:

I think what has happened is that you accidentially deleted the wrong partition, or even all partitions. Another explanation could be missing or wrongly autodetected drivers for your system's hard disk. But to make sure, I'll look at a few useful commands that might help you do a quick rescue.

I assume that you have booted a Live CD or DVD (most of them should contain the tools I describe) and have an open root shell on your computer.

First, find out which disks and partitions have been detected on your computer,

cat /proc/partitions

which should show something like:

major minor  #blocks name
  8        0   3907512  sda
  8        1   3903763  sda1
  8       16   3872256  sdb
  8       17   3868160  sdb1

Meaning: Two disks are here - /dev/sda and /dev/sdb (the /dev directory path is not shown) - each containing a single partition (sda1 and sdb1). From the size, given in 1Kb blocks, it looks like the partitions span over the entire drive. This is just an example, of course.

Now that I know I have two disks (or drives of some kind - they could also be USB flash disks), I can look at their partitioning more closely,

fdisk -l /dev/sda

which results in Listing 1. So disk sda contains one partition of type 83 (which is a Linux filesystem), and it is 4GB in size (probably a flash disk). Windows partitions will show up as type c (FAT32) or type 7 (NTFS). If you see none of these or just miss your Windows XP partition, something during the partitioning phase of the installation must have gone wrong. A program that scans your entire disk for "lost" partitions, making recommendations on how to restore them, is testdisk. Although its name suggests that it just does checks, it is really a powerful partition restoration program. Scanning the entire disk for lost partitions and filesystems can be a time-consuming procedure, but if you manage to find your data, it's worth the effort.

At this point, I recommend creating a backup of the entire disk so you can return to the current state at any time, just in case rescue attempts make things worse. Mount a fresh disk (in this example, /media/sdc1, you need a filesystem that supports files of more than 4GB, so please use a Linux filesystem or NTFS-3G, not FAT32), and make a copy of the disk, optionally compressed:

dd if=/dev/sda bs=1M | gzip -1c > /media/sdc1/sda1.img.gz

If you create an uncompressed file instead, you could also work with the copy when rescuing files, which is useful if the original hard disk seems to suffer from a headcrash or other hardware defect that could get worse during rescue attempts.

Whenever you need to play back the backup to disk in case of a failed rescue attempt, you can just unzip the backup to the disk like this:

gzip -dc /media/sdc1/sda1.img.gz > /dev/sda

(Note that this will overwrite the entire disk!) Both the backup and restore commands can take a very long time depending on the disk size, and these commands produce no output that indicate how long it will take. Time to get a cup of tea. ;-)

If testdisk restored your old hard disk partitioning, you can check the filesystems for consistency. Newer versions of NTFS-3G do this on the fly; otherwise, ntfsfix partitionname might be able to repair a partition that Windows will recognize. If during a Linux installation a new master boot record was created, Windows will not boot if it was not entered correctly into the bootloader. To bring back the master boot record to a default boot state, enter:

ms-sys -s /dev/sda

for the first hard disk in this example.

If you have found a Linux partition and want to make it bootable again using a master boot record, just mount that partition somewhere (e.g., under /media/sda2) and run grub-installer,

grub-install --root-directory=/media/sda2 /dev/sda

which also installs the necessary boot files in the grub directory on /media/sda2/boot/grub. To add the Windows partition, add an entry to /media/sda2/boot/grub/menu.lst that looks like this:

# title         Windows 95/98/NT/2000
# root          (hd0,0)
# makeactive
# chainloader   +1

You don't need to call GRUB again, but don't forget to umount /media/sdb2 after your changes so they actually get written to disk before reboot.

Other advanced commands also restore deleted files and partly overwritten data, wrong filesystem limits, or corrupt partition tables without reinstallation.

Listing 1: fdisk Results
01 Disk /dev/sda: 4001 MB, 4001292288 bytes
02 255 heads, 63 sectors/track, 486 cylinders
03 Units = cylinders of 16065 * 512 = 8225280 bytes
04 Disk identifier: 0x7f09951d
05
06    Device Boot      Start      End      Blocks     Id  System
07 /dev/sda1   *           1         486     3903763+  83  Linux
INFO
[1] Installing Ubuntu on LVM partitions: http://www.debuntu.org/how-to-install-ubuntu-over-lvm-filesystem
[2] Knoppix source repository: http://debian-knoppix.alioth.debian.org/