Answers 101

From LXF Wiki

Answers 101

<title>Custom CD Boot</title>

<question>I loved your article on Building your own Ubuntu in your LXF97 issue. I tried it in my HP DV9308nr laptop, added the BCM43xx firmware to the ISO image I was creating, burned it, booted from it, and everything worked as expected. How do I edit the menu.lst file under /boot/grub/ in the ISO image so that it adds the following entries to the kernel at boot time;

vga=791 pnpbios=off irqpoll nomsi nomce

This laptop will lock-up without these settings. </question>

<answer>Ubuntu doesn't use Grub for its CDs, it uses isolinux instead. The configuration file for this is isolinux/isolinux.cfg on the CD. The syntax of the file will be reasonably familiar to anyone who has used Lilo. When you have completed the second step of the instructions on page 45, you will have a copy of the CD's contents in the ubuntu-rebuild directory. Now edit ubuntu-rebuild/isolinux/isolinux.cfg and find the first menu entry, which looks like this for Ubuntu 7.10

 LABEL live
  menu label ^Start or install
  kernel /casper/vmlinuz
  append file=/cdrom/preseed/
 ubuntu.seed boot=casper initrd=/
 casper/initrd.gz quiet splash --

The append line contains the parameters that are passed to the kernel when booting, just like the append line in lilo.conf, so add your options to this line, before the final "--" and save the file. Now continue with the rest of the tutorial and your remastered disc will boot with the options you need. Any more problems? Let us know! </answer>

<title>Moving hard disk</title>

<question>I have a Seagate 250GB USB hard drive attached to my Dell Inspiron laptop running Ubuntu 7.04. There is no problem with the drive being recognised, but every time I boot up, it appears at a different place in dev ­ anything from /dev/sdb to /dev/sdh and all points in between to date. This makes auto mounting of the various partitions I've defined on the drive awkward, to say the least. Is there any way I can get this drive to always appear as a specific device in /dev so that I can add it into /etc/fstab and save myself the frustration of having to find out where Ubuntu thinks the drive is today and then manually mounting all the partitions? Or is there some way of entering the partitions into /etc/fstab so that, whatever their /dev location, they will always mount at the same point in /media? Ubuntu does mount the partitions on startup, but as most of them are 40GB it's not too helpful having them called `40GB disc-1' `40GB disc-2' etc. I need them to automount in more descriptive locations. </question>

<answer>It is possible to tell fstab to mount partitions by their unique ID instead of the traditional /dev/sd? node. If you look in /dev/disk/by-id, you will see symbolic links to the various partitions using their IDs. These IDs stay the same and are updated to point to the correct node when udev (the Linux device handler) starts. You could use these in /etc/fstab instead of the traditional node names, but these are really intended for use with fixed disks. The advantage for fixed disks is that if you add another partition, causing the numbering to change, /etc/fstab will still work, and Ubuntu uses this system by default. When using removable disks, it is best if you avoid putting them in /etc/fstab at all. In that case the Gnome Volume Manager will automount them when they are detected, at boot or any time later. However, this leads to the problem you have, so we use another udev feature to ensure the device names do not change. Udev supports rules that can, among other things, specify the /dev node name for a particular device or filesystem. This persistent naming means that you can also give your devices meaningful names, like /dev/ extdisk for your external disk and /dev/camera for, well, I'm sure you get the idea. To use these rules, you need to be able to uniquely identify the device, and the udevinfo command helps here. If your disk is currently /dev/sda, run

udevinfo --attribute-walk --path /block/hda | less

If you want to query a specific partition, say sda1, use /block/sda/sda1 for the path. Looking through the output you will see lines like


that can be used to identify the device. Then edit or create the file /etc/udev/rules.d/10-local.rules and add the line

BUS=="usb", KERNEL=="sd*",
ATTRS{model}=="model_code", ATTRS{vendor}=
="manufacturer", NAME:="extdisk%n",

the items using == are tests, all of them must match for the rule to apply. The first two make sure you are dealing with a USB disk device or partition, the next two are copied directly from the udevinfo output. The next item sets the node name to /dev/extdisk for the disk and /dev/extdiskN for the Nth partition. The final part creates symlinks to the devices using the original names that would have been used without this rule. This rule applies to the disk and any partitions on it, but you can also match individual partitions, which is useful for things like cameras, MP3 players or memory cards in your card reader that appear as a single partition. For example

BUS=="usb", KERNEL=="sd?[0-9]",
ATTRS{model}=="model_code", ATTRS{vendor}=
="manufacturer", NAME:="camera",

In this case only partitions are mounted by the pattern sd[a-z][0-9], which means sd followed by any single letter then any single number, and the partition appears as /dev/camera instead of /dev/camera1. There is plenty of useful information on writing udev rules at You may still find the Gnome Volume Manager mounts with names like /dev/disk-n. The easiest solution to this is to give the partitions labels when you create them, then the volume manager will use these. To name an ext3 partition when you create it, use

mke2fs -j -L Volume_Name /dev/sda1

and to add or change a volume name on an existing filesystem

tune2fs Volume_Name /dev/sda1


<title>Of dcop, slideshows and wobbly windows</title>

<question>I have just read David Feeley's Desktop Art Gallery tutorial in LXF98. I found this really interesting and I hoped it would be useful to me. I currently use KDE's random wallpaper feature (Slide Show wallpaper set to random display) and every now and then a picture crops up that I want to leave on view longer or sometimes copy out and put on my laptop or work PC. The problem is I have nearly 3000 wallpapers in my collection and finding the image can be difficult. I also use Beryl as the window manager although I would go back to kwin if it worked (for following this tutorial I did go back to kwin). I got the first command to work (current desktop (I only use one desktop) but the second one, currentWallpaper, failed with an `object not accessible' message. I'm assuming this is because of the slide show feature but don't really know. What I was hoping to end up with was a small batch script that once run would use kdialog or something similar to tell me the picture name. Do you have any suggestions on how to modify the tutorial, preferably to work with Beryl? </question>

<answer>The command certainly works with a slideshow, as I use a variant of it to delete the current wallpaper (that way I can dump a load of images in my wallpaper directory, then get rid of any I don't like when they appear on the desktop. I did manage to reproduce the "object not accessible" message by inadvertently using KWinInterface instead of KBackgroundIface with currentWallpaper. I find the easiest way to experiment with dcop is to run kdcop, with which you can browse the dcop interfaces and commands ­ you can even cut and paste from the kdcop window to your shell or script. This script below will display the current wallpaper name:

IMAGE=$(dcop kdesktop KBackgroundIface
currentWallpaper 0)
kdialog --title "Current desktop wallpaper" --
msgbox "The path to the current wallpaper is\

Even if you use a single desktop (we didn't think anyone still did that unless they were homesick for Windows), you need to specify the desktop number. Using 0 here means "the current desktop" so it saves having to check which desktop we are on. You can condense this to a single line using command substitution, which means you can assign the command to an alias or a hotkey without the need for a separate script.

kdialog --title "Current desktop wallpaper" --
msgbox "The path to the current wallpaper is\
n$(dcop kdesktop KBackgroundIface
currentWallpaper 0)"

Because you use Beryl instead of KWin as your window manager, any dcop calls to kwin will fail, but the kdesktop calls used here will still work (at least, they do with compiz-fusion). Kdcop will show you exactly what is available. </answer>

<title>Multi core CPUs</title>

<question>With the low cost of dual- and quad-core processors, I am interested in how Linux will be able to access and use this technology now and in the near future. I have done some looking, and while some information is available, I was unable to determine how it would benefit me on a Linux desktop computer. Also is there one particular distro or version of Linux better at implementing the new processors than other versions? </question>

<answer>Linux has supported multiple processors (or processor cores) for some years: I am writing this on a Core2Duo system (although Kate doesn't really need all the power of both cores to check even my spelling). Most distros support multiple processors out of the box, the important criterion is that the kernel has been build with SMP (Symmetric multiprocessing) support. Some distros enable this in their generic kernel, others have a separate SMP-enabled kernel that is used when the installer detects more than one CPU core. There are a number of easy checks for SMP support; does the output from

cat /proc/cpuinfo

shows a figure for "cpu cores"? Try running top in a terminal and pressing 1 (that's the number one, not the letter L), which should toggle the CPU usage display between showing an overall figure and individual CPU loads. Running

zgrep SMP /proc/config.gz

will show CONFIG_SMP=y if SMP support is enabled, providing your kernel has support for /proc/config.gz, otherwise you'll see an error that tells you nothing. SMP support in the kernel means improved multitasking, as programs can be run on whichever processor has the least load, but most individual programs still use only one processor. However, some CPU-intensive programs can split their load between more than one CPU core. For example, the -threads option for ffmpeg will split a video transcoding task across the given number of processors for a substantial reduction in processing time. Software compilation can also benefit, as most programs have a lot of smaller files that need to be compiled and this can be done in parallel. By setting the MAKEOPTS environment in your profile to -j3 for a dual core system, or -j5 for quad core, programs will usually compile much faster. Note that the number used here is usually one more than the number of CPUs (-j2 is used for single processor systems) to ensure the processors are loaded most effectively. If you are going to load the system with intensive tasks like software compilation or video transcoding, try using the nice command (see the Quick Reference box on page 108) to keep your desktop responsive while this is going on. </answer>

<title>Random upgrade crashes</title>

<question>I have a Compaq Deskpro 650MHz with 128MB RAM and a 10GB hard disk. I am running Mandrake 10.0 on it, which is quite out of date, so I have been trying to upgrade to ­ or install from scratch ­ Mandriva 2007. The computer seems to crash every time mostly during install. Sometimes I can install but when I try to boot the system, everything locks up too. I get a lot of text on the screen that makes me think that it's something with the kernel. I have tried other distros; Fedora, Ubuntu, Slackware and Gentoo, they all have the same problem. Is there a way to install newer distros (even Mandrake 10.1 doesn't work) and make them work? </question>

<answer>The fact that you experience problems with various distros, and they don't always appear at the same point, indicates that this may be a hardware problem. The most common of these are faulty memory, overheating and a substandard PSU. Before you try any of these, I recommend you try running the installers in text mode. The graphical installers require a lot of memory, far more than it needs to run the installed distro, because they load everything into a huge ramdisk so it is still available when you change CDs. A text mode install reduces the memory requirements substantially. If that fails, you need to check for the previously mentioned problems. Testing memory is easy, most distro install discs include memtest as an option on the boot menu. Select this and let is run for as long as possible. You need to let it make at least two passes, running overnight is best. Overheating can be caused by failing fans or a build up of crud (sorry to use such a technical term here) in the fans, heat sinks or vents. Use one of those cans of compressed air to blow everything clear. A failing power supply can also cause random reboots and lockups, but the only way to test it is to try a replacement. If none of that works, make a note of the last dozen or so lines of text on the screen when it fails. While some of these messages come from the kernel, many are from the various programs that are run when a system boots. Knowing the content of these messages will help to pinpoint the problem. If the messages are not consistent, you almost certainly have a hardware fault. </answer>

<title>Missing files?</title>

<question>I have not been able to install any software applications, ever. I cannot make the instructions in the magazine work despite many attempts. However, I can decompress and extract the archive so that is not a problem. To take an example I tried to install Digikam, when I ran configure every thing went OK until almost the end. At this point I got the error message that the program could not find the important file kde-config and asks if I installed KDE correctly. Debian was loaded from an official DVD and the installation went like clockwork. Also, the installation works well, clearly I am unable the stray from the desktop. I do not have this machine on the Internet. I would be grateful if you could tell me where I can, or should, find kde-conf. I can't find it anywhere. </question>

<answer>First of all, the instructions in the magazine for installing from source are generic instructions. They work for more than 90 per cent of source releases, but the definitive instructions are usually contained within the source tarball, in files named README and/or INSTALL. The usual problem that users of Debian and RPM based systems face is that most packages are split into two, the standard foo-x.y.z and a foo-devel-x.y.z package. The former is the only one you need to run foo, but the latter contains header files that are needed if you want to compile other software to work with this program. Generally, when you get an error message along the lines of "libfoo not found" and you know you have foo installed, it means you need to install the foo-devel package too. That may not be the case in the specific example, kde-config is part of kdelibs. Run which kde-config in a terminal, it should return the path to the program (/usr/bin/kde-config). If it does not, check whether /usr/bin/kde-config exists. If the file is there but which cannot find it, there is something wrong with your $PATH setting. The output from echo $PATH should include /usr/bin, if it does not, check the setting in /etc/profile. If kde-config is not where it should be, you need to reinstall the package providing it. "How do I know which package that is?" I hear you ask. Debian provide a very useful package search engine at Go to `Search the contents of packages,' enter kde-config and select `packages that contain files named like this' and it will tell you that this is provided by kdelibs4c2a, which you should certainly have installed if you are using KDE programs. Re-install the package, and kdelibs4-dev because you are going to need that, and check that the file is now in place. </answer>

<title>Playing my DVDs</title>

<question>My work takes me to many locations worldwide and when I have some free time, like many other people, I enjoy watching DVD movies. I am running Fedora 7 on my T60 Thinkpad and installed VLC and all other plugins from the Livna repository but I am only able to watch non-encrypted DVDs. I do have libdvdcss installed but am still unable to watch the majority of films that come my way, I have heard that the Matshita DVD drive will not play encrypted disks. Is this true? If not, is there a software fix that could cure this problem? </question>

<answer>Your drive is locked to a specific region and will only play encrypted discs from that region. The DVD Consortium divided the world into six regions and a drive can only play discs of the region it is set to. The regions are numbered in the following way:

1 North America (USA and Canada)
2 Europe, Middle East, South Africa and Japan
3 Southeast Asia, Taiwan, Korea
4 Latin America, Australia, New Zealand
5 Former Soviet Union (Russia, Ukraine, etc),
   rest of Africa, India
6 China

It is possible to change the region of most drives, by using something like regionset ( but there is a catch. Most drives only allow you to change the region setting four or five times, then it stays locked to the last set region, which isn't much use if you are travelling from region to region and buying DVDs on your travels. With a laptop, you don't even have the option of swapping the drive for a region free one. Some drives can have their firmware updated to either allow unlimited region changes or even work with all regions. However, this is not true for all Matshita drives, so you may be out of luck. There is information on many different drives at If it is not possible to update the firmware on your drive (some drives use encrypted firmware) you are left with the option of ripping your DVDs to another format on another computer, one with a region-free DVD drive. This would work well, and saves you taking the DVDs on your travels as you can store the ripped files on your hard drive, but it only works with DVDs you have before you travel, you still cannot play DVDs you buy abroad. dvd::rip ( is a good choice for this. </answer>

<title> and Java</title>

<question>I have installed 2.3 from LXF99 as per the instructions in the magazine. While most parts seem to run without any issues, when I try to open my Base files they demand an updated Java runtime which seems to have disappeared. I have tried downloading and reinstalling Java from Sun but I still can't access my database files ­ I get a message asking me to locate Java via Tools > Options, but I can't locate any Java installation. </question>

<answer> needs Java for the database and help systems, but the rest of the suite will work without it. The best way to install Java is through your distro's package manager. The download from Sun will work, but keeping as much software as possible inside the package management system reduces dependency and conflict problems later on. Getting to work with Java can be less than intuitive. Select Options from the Tool menu and pick >Java. Enable Java by ticking the `Use a Java runtime environment' box then wait for it to scan your system for suitable Java installations. This can take from a few seconds to a minute, depending on the speed of your system. This is Java, so it seems appropriate to make a cup of coffee while you are waiting. Eventually, you should see a list of your Java Runtime Environment (JRE) installations, select one and press OK. You need to quit and restart for the change to take effect. If fails to find your JRE, you can click the Add button and give the path to it manually. This should be something like /opt/sun-jdk- If you have installed through your distro's package manager (not the package manager), you can generally use that to view the contents of a package, which will tell you where it is installed. </answer>

<title>Long filenames aren't</title>

<question>I use a USB stick in a Windows computer and I download files on the stick from the Internet. Then I plug this USB stick in a Linux computer at home and I find that all the files with long names have been renamed using "~" For example, mylongfile3.mp3 will be renamed mylong~1.mp3 If you could help me with this I would appreciate it as I haven't got a clue of what may be wrong. I primarily use, a Debian based distro, but I have found this problem also happens in other distros like Knoppix, (Debian based too). </question>

<answer>This appears to be a problem with the options used to mount the USB stick's filesystem. The default filesystem on these devices is usually with FAT16 or FAT32, neither of which support long filenames directly, so they use a kludge (yes, I know, it's shocking that a Windows system contains kludges) to map the short names you are seeing to the correct long ones. The vfat filesystem in the Linux kernel handles this, but the msdos filesystem does not. Run the mount command in a terminal and you should see a line like this for your USB stick

/dev/sda1 on /media/usbstick type msdos (rw)

If the type is shown as msdos, you have found the root of the problem, now you need to make sure your stick is mounted correctly. If you are using an entry in /etc/fstab to mount this, change the filesystem type, the third item on the line, from msdos to either vfat or auto. If you are using your distribution's automounting system, then the filesystem type should be correctly identified. Does this happen with every USB stick you have tried, or only this one? If it is only this one, you could have some filesystem corruption that is causing the mount command to misidentify the filesystem. The are ways to work around it, but the best option would be to reformat the stick to get rid of the corruption (or even replace the stick if that does not fix it). I was unable to reproduce this problem with, so I suspect you may have a corrupted, or broken, USB stick. The flash memory used in these devices has a limited lifetime, it may simply be worn out. </answer>

<title>Booting from USB</title>

<question>I have a Pentium 3, 866MHz laptop with a 20GB hard disk and Mandriva 2005LE booting with Grub. I wish to install Ubuntu 7.04 on an external USB hard disk, making the machine dual boot. I do realise that access to a USB2 enabled HD will be rather slow since the above machine has USB1.1 ports. My problem is that the laptop's BIOS cannot make a USB-HD the first booting device. How do I modify the bootloader to access above USB-HD or use a floppy to install a bootloader. I find it difficult to find appropriate info on this subject, but maybe this topic has possibly already been discussed in LXF. </question>

<answer>You can use your existing bootloader to boot from the USB disk. It is best to use the Ubuntu alternate install CD for this purpose, as it gives more control over installation options. Install Ubuntu on the external disk in the usual way, but do not let it write the bootloader to the MBR as it usually does. Instead, have it install Grub to the root partition, which will probably be /dev/sdb1 with the internal disk being /dev/sda. Then boot into Mandriva as normal and mount your Ubuntu partition. Mandriva 2005 still uses /dev/hd* for IDE hard disks, so your USB drive will now be /dev/ sda. Open a root terminal and run

mkdir /mnt/tmp
mount /dev/sda1 /mnt/tmp
YourFavouriteEditor /boot/grub/
menu.lst /mnt/tmp/boot/grub/

to load both bootloader configurations into your favourite text editor. You now have two choices, the quick and easy method, or the slicker-looking but- slightly-more-fiddly-to-set-up method. For quick and easy, add this to the end of the Mandriva menu.lst file.

title Ubuntu menu
root (hd1,0)
chainloader +1

This adds an extra menu entry that runs the Ubuntu bootloader. To do everything from the one boot menu, you need to copy the Ubuntu bootloader menu entries to the Mandriva menu. Look for the main title option, the one that appears first in the menu. It will consist of three lines; the title to show on the boot menu, the kernel to load with a number of options and the initrd to use. Copy these lines to the Mandriva menu.lst and change the title to something appropriate. Then change the device paths to reflect the correct locations. Grub counts from zero, so (hd1,0) is the first partition (0) on the second disk. You can either include the path in each of the kernel and initrd lines or (my personal preference) as a separate root item. Your menu.lst entry will look something like this example (for Ubuntu 7.10):

 title Ubuntu 7.10
 kernel /boot/vmlinuz-2.6.22-14
 root=/dev/sda1 quiet splash
 initrd /boot/initrd.img-2.6.22-14

You could also copy the other Ubuntu menu entries in the same way, or leave the Ubuntu menu option as above for the rare occasions you will need anything but the default. If you get a File not found error when selecting this menu, you have probably got the paths wrong. The drive ordering depends on BIOS settings, and even then, Grub cannot boot from USB on all systems. To check the correct path for the kernel, run grub from a root terminal (or you can press C at the Grub menu) to enter the Grub shell. Then run

 find /boot/vmlinuz-2.6.22-14

The command should show the correct path for the kernel, including the drive numbers. Make sure this matches up with the root command in your menu. </answer>