Answers 110

From LXF Wiki

Answers 110

<title>Eee, no net</title>

<question>I have only been using Linux for a week or two but need to tweak a number of Eee PCs. I followed the tutorial to add a repository in LXF107 but it didn't seem to work. Did I do something wrong? If I browse to the websites the directory structure does not seem to fit the lines in sources.list. I added this line to sources.list:

deb http://xnv4.xandros.com/xs2.0/upkg-srv2 etch main contrib non-free

then I got several messages like the following after doing sudo apt-get update:

Failed to fetch http://update.eeepc.asus.com/p701/
dists/p701/Release.gpg Could not resolve `update.
eeepc.asus.com'
Failed to fetch http://xnv4.xandros.com/xs2.0/
upkg-srv2/dists/etch/Release.gpg Could not
resolve `xnv4.xandros.com'
Reading package lists... Done
W:Couldn't stat source package list http://update.
eeepc.asus.com p701/main Packages (/var/lib/apt/
lists/update.eeepc.asus.com_p701_en_dists_
p701_main_binary-i386_Packages) - stat (2 No
such file or directory)
W:Couldn't stat source package list http://xnv4.
xandros.com etch/main Packages (/var/lib/apt/
lists/xnv4.xandros.com_xs2.0_upkg-srv2_dists_
etch_main_binary-i386_Packages) - stat (2 No
such file or directory)
W:You may want to run apt-get update to correct
these problems
E: Some index files failed to download, they may
have been ignored, or old ones used instead.

</question>

<answer>The errors you saw relate to all repositories in sources.list, not just the Xandros one you added. It appears that your Eee is unable to connect to any of the repositories, which means that you either have no internet connection or your firewall is blocking access to asus.com and xandros.com. Are you able to browse the sites from the Eee? If so, this could be a proxy setting somewhere. If your network requires you to set a proxy server in the web browser, you need to set it up in /etc/apt/apt.conf by adding this line (obviously using the correct address and port for your proxy server)

Acquire::http::Proxy "http://proxy.server.address:port";

You can also use the following syntax; both do the same job, so use whichever you prefer.

Acquire {
  HTTP {
    Proxy "http://proxy.server.address:port";
  };
};

It may also be a good idea to set the http_proxy environment variable, which you will need to do if you ever want to download files with Curl or Wget. While you may not be aware that you are using them, a number of programs make use of these for file downloading. You can set the variable by adding this line to /etc/profile

export http_proxy="http://proxy.server.address:port" 

</answer>

<title>Disappearing magic</title>

<question>I've been trying to work through Doc Brown's `The Magic of SysRq' article [Dr Brown's Administeria, LXF107]. I foolishly assumed it would be easy and that I would be able to do it without any problems. All it involved was pressing four keys at once. Still, I failed miserably and didn't get it to work. I'm using a Dell XPS M1719 laptop and whenever I press Fn+Alt+SysR +B the screenshot dialog box pops up (SysRq shares a button with Print Screen). I looked at the keyboard preferences but couldn't find a keyboard model for the XPS. Can you let me know how to fix this. It's making me a bit depressed not being able to follow the simplest instructions in the world. </question>

<answer>SysRq and Print Screen are often the same key, even on desktop keyboards, so you may not need the Fn key. On most laptop keyboards, features that need the Fn key are highlighted in a different colour. If this is not the case on your keyboard, try the standard three keys of Alt, SysRq and the command you want to use. Speaking of commands, B (reBoot) is probably not the best key to use for testing. S (Sync) is harmless, and you can see the results if you switch to a virtual console with Ctrl+Alt+F1. Press Alt+SysrRq+S and you should see

SysRq : Emergency Sync

printed to the console, and written to the system log. If nothing happens, the most likely explanation is that your kernel has been built without the necessary options, but first check whether the file /proc/sysrq-trigger exists. If it does, you do have Magic Key support in your kernel. That file is an alternate interface to the same functions, you can send the commands by writing to this file, which is useful for remote sessions

echo s >/proc/sysrq-trigger

If the file does not exist, your kernel certainly does not have the option CONFIG_MAGIC_SYSRQ set. This is more likely than your keyboard being unable to send the correct command, after all, the same key provides a common function for Windows. In this case, the only reasonable option is to recompile the kernel yourself. This is not a difficult task (see the Quick Reference box on p111 for instructions). The other possibility is that your kernel has Magic Key support but it is disabled on your system. Run, as root, sysctl kernel.sysrq. If this returns a value of zero, edit /etc/sysctl.conf to change this for the next boot, and change it with

sysctl kernel.sysrq=1

</answer>

<title>Separate OS, separate drive</title>

<question>I would like to install Ubuntu on a separate SATA drive from the current SATA drive that has Windows XP. After doing some research on this, the installation process seems fairly straight forward. My one big question has been with the installation of Grub. Is it possible to install Grub on the Ubuntu drive only and keep the XP drive untouched? </question>

<answer>Yes it is possible, but not necessarily the best option. If you install Grub into the master boot record of the Windows disk, it will not touch the partition containing your Windows install. The Ubuntu installer will take care of this and create a boot menu with options to use Windows or Ubuntu. The only drawback of this is that it will fail to boot if you remove the Ubuntu disk, which is easily remedied by running fixmbr from the Windows rescue CD. If you want to keep the bootloaders separate, you have a couple of options. You could install to the Ubuntu drive's MBR and use your BIOS's boot menu to choose which drive to boot. Most motherboards now pop up a menu if you hold down a key while they boot; see the initial BIOS screen or the manual to see which key. This has the advantage that it doesn't touch your Windows disk at all, but you have to be quick to hit the menu key at the right time. The alternative is to modify the Windows bootloader to add an option to pass control to Grub on the other disk. Install Ubuntu by booting from the disc and running the installer, telling it to use the second disk in the partitioning window. hen the `Ready To Install' window is displayed, press the Advanced button and set the device for bootloader installation to /dev/sdb, the second disk. You also need to take this step if you want to use the BIOS boot menu to choose between disks. Now let the install run but do not reboot at the end (if you do, you will not have an option to use Ubuntu and will need to boot from the install disc again for the next steps). Open a terminal (Applications > Accessories > Terminal), switch to the root user and mount your Windows filesystem with

sudo -i
mkdir /mnt/windows
mount /dev/sda1 /mnt/windows

Then create a file on there containing the bootloader code from your Ubuntu install with

dd if=/dev/sdb of=/mnt/windows/ubuntu.img
bs=512 count=1

This creates a file called ubuntu.img (the name is unimportant) that contains the first 512 bytes of the second disk, with the Ubuntu bootloader. Now reboot into Windows and edit C:\boot.ini in something like Notepad to add this line to the end

C:\ubuntu.img="Ubuntu"

You could edit this file in Ubuntu, but Windows uses different line endings from Linux and ntldr can be a bit fussy, so play safe and subject yourself to Notepad. Reboot again and the Windows bootloader should show you a menu with options to boot Windows or Linux. </answer>

<title>Have you seen my eth0?</title>

<question>I am running Ubuntu 8.04 on a Dell e1505 with a Broadcom Ethernet controller. A while ago (I may have been running 7.04 or 7.10 around that time) I installed Windows and updated my BIOS. After that, I noticed the eth0 was gone and I reverted to the old BIOS version, but the problem remained. I formatted the entire hard drive and reinstalled Ubuntu. My eth0 interface did not appear when I ran ifconfig. I ran lspci, and the Ethernet controller was not listed (Network Controller was still listed). /etc network/interfaces lists the loopback interface, but that's it. I tried manually changing the file to include eth0, and then ran ifup -a, but to no avail. I reset the BIOS configuration to factory settings. Wireless works fine with Ndiswrapper. When I plug a cable into the Ethernet port, the little lights show orange/red, but not green. What is the problem? Is it BIOS related, is it driver related? What do I do? </question>

<answer>If the interface does not show up in lspci, it is almost certainly not there. Even if the device were not recognised, which would be surprising for a Broadcom device, lspci would show the manufacturer and product ID numbers. Do you have any unrecognised devices in the lspci output? If so, search the web for those PCI ID numbers. Ifconfig shows only configured devices, although adding -a shows all interfaces, it is still limited to devices for which a driver is available and loaded. If there is no sign of the device, there are two likely causes: that you have had some sort of hardware failure or that it is disabled in the BIOS. The lack of cable detection also points to a non-working Ethernet port. The chances of a hardware failure coinciding with a BIOS update are only likely if you are a follower of the teachings of Murphy, so I would start by looking at the BIOS options. Updating the BIOS often wipes the settings, resetting everything to the default. If the default of this BIOS update is to disable the wired Ethernet and leave only the wireless active, you have found the cause. Check the BIOS options and experiment with anything relating to the network controller. I would also see if there is a further BIOS update available, because the one you installed may well be the cause of the problem. If your Ethernet controller is truly broken, and the laptop is out of warranty, the easiest option would be to use a USB or PC-Card Ethernet controller. Several of these devices are supported in recent Linux kernels, so find out what is available and check for support before you buy, or find a helpful dealer who will let you plug the device into your machine before buying it. lsusb should show the device and ifconfig -a will show the network interface if the driver is loaded, even if the network is not configured or even connected. </answer>

<title>Distro sharing</title>

<question>I finally built up a computer and installed Ubuntu from LXF100. It went smooth as silk. Major kudos to you and the entire Linux community. I divided my 750GB SATA drive into several partitions: /boot, swap, /, /usr, /local, /var, /home as per the recommendations in Practical Guide to Ubuntu Linux. I'm interested in installing an additional real-time kernel-type Linux such as 64 Studio or Ubuntu Studio for some audio and video projects. Can any of the existing partitions be used by the additional install? Do any packages used in both installs have to be installed into each Linux install? I would expect that /home data would at least be shared. How about /usr, /local and /var? Perhaps it is just my ignorance, but it seems that the differences could potentially be confined to /boot and a configuration file. </question>

<answer>The only two partitions that it is really safe to share are /home and swap. Swap data is temporary anyway and not expected to survive between reboots, so a common swap partition makes a lot of sense. Running a separate home partition is a good idea, because your data survives reinstallation, but it can be a little tricky to share /home between two distros. Because of differences in program versions, and possible conflicts of user IDs, it's not a good idea to share a home directory between two distros, so you're better off using one home partition but a different home directory on that partition for each distro. You can either use a different username with each distro, or use the same name but a different directory. The convention of using /home/username as the home directory is just that, and is only a default setting, not a requirement. If your username is bryan, you could have home directories of /home/bryan-ubuntu, /home/bryan-studio and so on. Each distro installation is a separate entity: you cannot share installed program and library files between two. Some distros modify programs to suit their own needs, and it is very rare for them to update versions at exactly the same time. You could share /boot in theory, but it can be a lot of work to set up and maintain, and a separate /boot partition is not really necessary with modern hardware. Using the number of partitions per distro that you are using is sure to exceed the partition limits of the system before long. You have a couple of options here. The simplest is to have a single root partition for each distro, plus common swap and home partitions. Each distro is then a self-contained entity within its own partition. A more flexible option, especially if you want to run multiple distros, is to use the Logical Volume Manager (LVM). This would entail having a small /boot partition for each distro plus a large partition given over to LVM. This would then contain logical `partitions' for the various distros, as well as /home and swap. The advantage of this approach is flexibility, volumes can be created, resized and removed on the fly, which is useful when experimenting. Many distros have an option to use LVM during installation. There is another option when experimenting with different distros: virtualisation. You can install VirtualBox on Ubuntu and create virtual machines within that for any distros you would like to experiment with. Only when one convinces you that you want to use it long term do you need to worry about partitioning the disk to install it. </answer>

<title>Reluctant partition</title>

<question>My mum has just got a new digital camera and I have made a partition on /dev/hda2 for all the photos from it. I made it using GParted and everything worked, but when I tried to open the partition, I received an error from Nautilus:

libhal-storage.c 1401 : info: called
libhal_free_dbus_error but
dbuserror was not set.
process 5222: applications must
not close shared connections - see
dbus_connection_close() docs.
This is a bug in the application.
error: device /dev/hda2 is not
removable
error: could not execute pmount

This is the second partition on the disk, and I have tried doing it multiple times both on Ubuntu 8.04 and 64 Studio but I just cannot access the partition. On top of that, I can't access the Ubuntu partition on the first partition of hda1 either. It just gives the same error. PS My girlfriend thinks Linux is boring. Please give me good reason to tell her otherwise! </question>

<answer>There are two messages here, the first two lines are usually caused by your not being in the correct group for automounting, plugdev. You can check which groups you are in by running groups from a terminal. If plugdev is not listed, add yourself to the group with

sudo gpasswd -a username plugdev

You need to run this for your own username and your mum's. If you are already in plugdev, it is likely that this is only a warning and it is the second error that's causing the mount to fail. Most systems now use Pmount to mount removable drives, because it allows devices to be mounted by a user without giving them root access. Because of the security issues involved with this, it is restricted to removable devices. If a device does not report itself as removable, such as a hard disk, Pmount will refuse to mount it. You can override this behaviour by adding the device name to /etc/pmount.allow. Create the file if it does not exist and add /dev/hda2 to it. You can add as many devices as you need, one per line. However, if this is a fixed disk, why you are using automounting in the first place? It may be easier to simply mount the partition somewhere in your directory tree. Create a directory to use as a mount point, say /mnt photos, and add a line to /etc/fstab like

/dev/hda2 /mnt/photos ext3  defaults 0 0

then make sure it is both readable and writable by your user with

chmod username: /mnt/photos

PS You're 14; I'm sure you can find other ways of impressing your girlfriend. Sheesh! Kids these days have no imagination! </answer>

<title>ISOlated errors</title>

<question>I am trying to install on to a machine that does not have a DVD drive, only a CD. I have figured out that I need to burn an ISO image on to a CD, using a different machine that does have a DVD reader. However, your setup notes don't provide much information in this area. My son explained that I should use the Nero copy utility to `Burn Image To Disc. I then had to hunt through the various directories on the DVD to find something likely. On LXFDVD107 I found D:\Distros\Ubuntu\Alternate\ubuntu-8.04-alternate-i386.iso, and copied this to a CD. However, when I tried to install from this, it gave me an error:

File :///cdrom/pool/main/l/langpack-locales/
locales-2.7.9.4_all.deb was corrupt

then failed to install the kernel. I was then completely stuck, and had to power off the machine. From LXFDVD103 I could not find an ISO file for Ubuntu, but found one in D:\Distro\Debian so tried to use that. However, this time I was told that

File :///cdrom/pool/main/m/man-db_2.4.3-6_i386.deb was corrupt

and that man-db could not be installed. Again I was left with a totally unresponsive system and had to power down. I fully appreciate that any error messages coming from the distro itself are outside your control, but would have thought you could provide a few tips about what to do with installation errors. I next looked through older DVDs I have, and found an ISO for Ubuntu on DVD94, but this seems to be for AMD64 bit systems ­ would this be worth trying? </question>

<answer>There are a number of common problems that can occur when trying to install from ISO images from the DVD. The first is that you must choose the correct image for your machine: those for 32-bit PCs usually contain i386 or i586 in the name, while those for 64-bit machines are labelled x86_64 or amd64 (because for a while only AMD provided the x86_64 architecture, although these work on Intel Core 2 Duo systems too). The next step is to make sure you write the data as an image file, using something like the `Burn Image To Disc' option you mention. It is difficult to give precise instructions for this because each piece of CD writing software does it slightly differently. It is easy enough to tell whether you have done this correctly though ­ look at the contents of the CD in any file manager (even Windows Explorer) ­ if it contains a directory structure, you have done the job correctly, if it contains a single file, the ISO image, you have not selected the right option when burning it. Since you have booted from the CD into the installer, it is clear that you have no problems with these steps, but the error messages you see indicate that files on the CD you have written are corrupt. It is highly unlikely that this error exists in the ISO file. Each file is tested as part of the ISO image creation process, so the problem is with the discs you write. It could be one (or both) of two factors. The discs you are using could be scratched or otherwise damaged, not enough to prevent them working in the drive on the DVD-enabled computer but causing them to fail in the other drive. This is a definite possibility with well-used CD-RW discs. One possible solution is to write them at a slower speed; use your burning software's option to reduce the write speed to 4X or even 2X. A simpler solution is to use a disc in better condition. CD-Rs are so cheap nowadays that I rarely bother with CD-RWs, as the slower speed and risk of these sort of problems make them too much hassle. The other possibility is that the CD drive in the older computer is wearing out. As the drives age, their laser power can reduce and the laser lens can get dirty, exacerbating the problem. This is a particular problem if you smoke near the computer. Combine this with a dirty or scratched disc and you're asking for trouble. A lens cleaner is one possible solution, although if this is a desktop computer, replacing the drive with a DVD drive is a lost-cost option ­ a new DVD-ROM drive can be bought for around £10. </answer>

<title>Module options</title>

<question>When I'm compiling my own kernel I can build modules into the kernel or compile them separately to load when required. If I run lsmod in a terminal, will it list the modules that are built into the kernel, or it will show just the modules that have been loaded separately? </question>

<answer>lsmod lists only the modules that are currently loaded into your kernel. To see a list of all modules available for the current kernel, run modprobe -l. Each of these commands work with loadable modules only, so if you want to know what is compiled into your kernel, you need to inspect the kernel config file with either /boot/config-<version>, /usr/src/linux/.config or, if your kernel has this option enabled, use /proc/config.gz for the running kernel. Look for lines ending in =y, although this also includes options that enables features, not just modules. Use one of these two lines:

grep `=y$' /usr/src/linux/.config
zgrep `=y$' /proc/config.gz

These automate the process of searching for configuration options in the kernel. </answer>

<title>IPv6 revisited</title>

<question>On page 111 of the July 2008 issue [LXF107] you have given three ways to disable IPv6. The one with the Firefox web browser worked for me but nothing else is working. I set about doing /etc/modprobe.d/aliases in the terminal as root, but I got a terse message telling me: `permission denied' Can you tell me why that is? I have Ubuntu studio 7.10 and I need the other things working as well. This has been a nightmare for me trying to disable IPv6. My modem is a D-Link ADSL DSL-G624T, my ISP is Virgin. I went to the Ubuntu website and followed their instructions to disable IPv6. As root I put in the terminal,

gksudo gedit/etc/modprobe.d/aliases

Nothing happened (I believe a list is supposed to come up on a web browser or something). I am a Linux newbie and I really would like an answer to this terrible nightmare. Others out there have the same problem as me. Can't the Ubuntu people make an update for this, I think IPv6 is not even being used yet, and will not be used for some time to come. </question>

<answer>/etc/modprobe.d/aliases is a data file, not a program, so you cannot run it: you need to edit it. This is what the command you found on the Ubuntu website does, but you mistyped it. The correct command is

 gksudo gedit /etc/modprobe.d/aliases

note the space after gedit. This does not open a browser; it runs the Gedit text editor, loading the aliases file ready for you to modify. The gksudo program is used to run the program as root, because only the root user can modify system files like this. In fact, plain old sudo will do the job just as well. Once it's loaded, add the lines

 alias net-pf-10 off
 alias ipv6 off

reboot and you should be able to use the net. It is true that IPv6 is not presently in common use, but ISPs will have to begin the switch over fairly soon. The best solution is to fix the broken part of the system, which is not your distro for having IPv6 capability, nor your ISP for not using it yet. The fault lies with your router for not handling the fallback correctly. Many manufacturers have released firmware updates for their routers, which fix this problem without your having to hack at the operating system setup. </answer>

<title>Control a remote machine</title>

<question>I have seen security cameras for sale that come with Windows software to detect movement, record video and send alerts via email or SMS. Can these cameras be used with Linux? What sort of software is available to record, are the other services available in Linux, and what type of camera should I use? </question>

<answer>You'll be pleased to hear that you can do all of this with Linux. There are plenty of programs that will record a camera feed, including that Swiss Army Knife of video, MPlayer, but there are also dedicated programs to provide security features, like motion detection, alerts, handling multiple cameras and so on. The most complete of these is almost certainly ZoneMinder (www.zoneminder.com). There are various types of camera you can use, the most common being a standard security amera that provides composite video output. This connects to the composite input connector found on many TV and frame grabber cards. ZoneMinder works with these and with USB cameras, usually webcams. Any camera supported by the Video4Linux framework will do. You can also use IP cameras that connect directly to your network, either wired or wireless, but these are a lot more expensive. ZoneMinder can handle any number of cameras, but the principles are the same whether you use one or a dozen. Once ZoneMinder is installed, you need to modify the Apache configuration. Open a terminal and run

sudo ln -s /etc/zm/apache.conf /etc/apache2/sites-enabled/010-zm
sudo /etc/init.d/apache2 restart

to include the provided configuration and restart apache to use it. This is for Ubuntu 8.04; it may be different for other distros. Now open Firefox and browse to http://localhost/zm and click on Add New Monitor ­ each monitor is associated with a camera. Give the monitor a name in the General tab. The type should be local for a wired camera or webcam, and set the function to Modect (Motion Detection). Pick the camera's device name and number in the source tab, usually /dev/video and 0 for the first camera. You can leave the other tabs as they are for now and press Save. If the function and source items show green in the main browser display, your camera is working, click on its name to view its output. Whenever ZoneMinder detects changes between frames from the camera, it begins recording. These `events' are listed in the window that opens when you click on the camera name, and you can view them as a movie or stills. Of course, you don't want any type of movement to trigger an event ­ if there's a tree in your camera's field of view, a windy day will fill your hard disk. ZoneMinder supports zones within the field of view that can be prioritised or ignored. A lot more is possible with this software, read the documentation in the ZoneMinder wiki (www.zoneminder.com/wiki.html to see just how much. </answer>