Answers 111

From LXF Wiki

Answers 111

<title>Video Eeencoding</title>

<question>I am enjoying my Eee a great deal and following your tutorials with interest. One thing I would like to do with my Eee is use it to watch my DVD movies when travelling. I know I could attach an external DVD drive, but this defeats the purpose of an ultra-portable system, so I would prefer to copy my DVDs to one or more SD cards. Do I need to use a 4GB SD card for each DVD or is it possible to reduce them in size? </question>

<answer>The normal way to do this is to copy the main film from the DVD to a video file, which you can copy on to an SD card and watch with the Eee's video player, SMPlayer. The only disadvantage of this is that you lose any DVD extras like angles, subtitles and alternate audio tracks. While it is possible to rip a DVD on the Eee, with the addition of an external DVD drive, transcoding video like this uses a lot of CPU horsepower and memory and would take quite a while on the Eee. This task is best done on a more powerful desktop or laptop system. There are a number of programs available for ripping DVDs to video files, one of the best being DVD Rip, which is almost certainly in your distro's repositories. The program presents a lot of options, most of which can be left at the defaults. The main decision for you to make is the format and bitrate of the video file you create. The format decision is fairly cut and dried ­ go for Xvid, as it gives good-quality, small files without requiring a lot of CPU power for playback. Bitrate determines the size and quality of the file you produce. The lower the bitrate, the smaller the file and the worse the quality. DVD Rip lets you specify the bitrate, and shows you the size of file it will produce, or you can tell it how much space you want to use and let it work out the bitrate for you. While DVD Rip has a convenient point-and-click interface, this becomes less convenient when you want to rip a number of DVDs. This is when the command line comes into its own. Mencoder is part of the MPlayer package, and can encode anything that MPlayer can play including DVDs. Mencoder has a huge number of options, making its man page one of the longest around. An easier approach is to use AcidRip (, which lets you choose settings from a GUI and then calls Mencoder. Once you have everything set up as you like in Mencoder, click on the Export button in the Queue panel to generate a shell script,, that calls Mencoder with the correct options. You can reuse this script for each DVD you wish to rip, just changing the track number and output filename for each one. The track number is given after dvd:// on each call to Mencoder. You could even edit the script to take the track number and output filename as arguments. Replace each instance ofthe track number (once for each pass, and Mencoder works better with two passes) with $1 and the output filename with $2. Then you can run it with

sh 1 mydvd.avi

$1 is replaced by the first argument after the script name and $2 by the second, so this rips the first track to mydvd.avi in the current directory. Now you can copy the files to your SD card ready for viewing anywhere. </answer>

<title>Email forwarding</title>

<question>I enjoyed Andy Chanelle's article on email forwarding in the August issue (LXF107), as I'm trying to grapple with this issue to help with email when I'm out and about. Right now I'm using a smartphone running Windows Mobile to pick up email. It works great, but the small screen and weeny keyboard are driving me nuts. I have an Eee PC 901 Linux version on order and I'm hoping that a mobile broadband account will soon enable me to enjoy a much more comfortable mobile email experience. But how will I configure mobile email on my Eee? I have my email address which everyone knows, but I don't want to migrate everyone to my new generic bob3876@googlemail account. I want to keep my account. Why would I want to give up my personal email address for a generic Gmail/Yahoo AOL account? Right now, my mobile phone downloads messages but leaves a copy on the server, so I can pick them up again when I'm back home. I need to keep that facility, but it would be nicer to have the Eee PC with a synchronised copy of all the messages in my email application on my home PC. I can't end up having some messages on the Eee and others on the home PC. Can I use IMAP to achieve this? Equally, when the Eee isn't available, and I'm using web-based email from another PC, can I still see all my emails? Can I have home, web and Eee PC mail clients synchronised? Equally, can I ensure that mails sent from any location appear to the recipient as coming from Am I setting my goals too high? </question>

<answer>IMAP will indeed do what you want. Unlike POP, which was designed as a method of retrieving mails from your ISP's mailbox to your computer, IMAP is designed to work with mails in the remote mailbox, although it can keep local copies too for when you are offline. With IMAP, the concept of leaving mail on the server no longer applies, because it is left there wherever you read it from, The only time mail is deleted from the IMAP server is when you delete it on a connected computer. Similarly, the concept of having all mail clients synchronised doesn't really exist with IMAP, because all are using the IMAP mailbox as the same data store. The main disadvantage of using IMAP with an ISP mail account is, as mentioned in Andy's article, that you may be limited in the amount of storage you have, plus you have the hassle of changing email addresses when you switch ISPs. You can avoid the latter by using your own domain name, which is cheap enough these days. One way to remove any storage limitations for IMAP is to run your own IMAP server, assuming you have an always-on internet connection at home and your home PC is always on. This was covered in greater detail in LXF99, but in brief you should install Fetchmail and Procmail to pull email from your ISP using POP3 and configure them by creating a file called .fetchmailrc.

set daemon 300
poll with proto POP3
     user `myispuser' there with password
`mypass' is `myuser' here options keep
mda `/usr/bin/procmail -d %T'

Configure Procmail to deliver the mail by putting this in ~/.procmailrc:


and set Procmail to run when your desktop starts, using ~/.kde/Autostart, the Gnome session manager or whatever applies to your desktop. This will download mail from your ISP and store it locally (the keep option leaves mail on the server until this is working properly). Now you need an IMAP server, like Dovecot. Install it and edit /etc/dovecot.conf to change the lines

#listen= [::]
#mail_location =


listen = *
mail_location = /var/spool/mail/%u

Set Dovecot to start when you boot, using your distro's services manager, and test it by setting your mail client to make an IMAP connection to localhost. Once it works, you will need some way to connect to your machine from outside, so register a domain name at to get round your ISP's dynamic addressing. Finally, set your router to pass through ports 143 and 993 (143 is plain IMAP, 993 is secure IMAP). </answer>

<title>Starting over</title>

<question>I am presently building my own computer and have installed Debian. Whatever I have now done, I can no longer log in. Could you please tell me how to format the Maxtor SATA hard drive? I wish to start again and install two partitions ­ one for Vista and one for Linux. I have tried using command instructions but these seem very cryptic. I wish to fully reformat and reinstall both operating systems. I have tried different shell commands but with no success. </question>

<answer>Both Vista and Ubuntu have options to completely reformat the hard drive before installation. You should install Vista (or any Windows variant) first, because the Ubuntu installer will see the Windows system and add a suitable boot menu, whereas Vista will simply try to overwrite any other OS it finds. You could install Windows and take the option to use the whole disk. Then run the Ubuntu installer and let its guided partitioner shrink your Windows partition to create those needed for Linux. However, this involves an unnecessary resizing of the Windows filesystem. A better method is to boot from the Ubuntu install disc using the `Try Ubuntu Without Making Any Change To Your Computer' option, and run System > Administration > Partition Editor and delete all your partitions, then create one partition at the start of the disk for Windows. Make it whatever size you want to give to Windows and leave the rest of the drive empty ­ do not try to create the Linux partitions. Click on Apply and wait for the partition editor to do its stuff. Now reboot, swap discs and install Windows into the partition you created, which Windows should see as C:. Once the Windows installation is complete and working, reboot from the Ubuntu disk, choose the `Try Ubuntu Without Making Any Change To Your Computer' option again and then run Install from its desktop icon. Let the partitioner install into the unused space you left, which it should do by default, although you may want to tell it to create a separate partition for /home. When the Ubuntu installer finishes, you should be able to reboot and see a menu offering you a choice between Windows and Linux. While all of this is possible using the command line, and faster when you know what you're doing, all the GUI tools you need to do it are on the installation disc, so there should be no need to learn the commands you find so cryptic. They aren't really cryptic, just unfamiliar if you haven't used them before, but that's why we have friendly GUIs to do the same job. </answer>

<title>Mail agents</title>

<question>I am just trying to work out the whole Linux mail server scenario. I understand that the mail transfer agent (MTA) is a program such as Sendmail or Postfix that actually does the SMTP sending, receiving and so on. I also understand the obvious mail user agent examples such as Evolution. I am trying to understand exactly what a mail delivery agent like Procmail does. Do I need to have one installed on my system? </question>

<answer>When someone sends a mail to your server that is addressed to you, the MTA handles accepting the connection from the remote server and receiving the mail. It also handles the opposite transaction: when you send a mail through it, it finds the next server in the chain and passes the mail to that. Once the MTA has received the mail, it has to deliver it, usually into your mailbox. Most MTAs can do this themselves, especially if it is a simple case of adding the mail to a local user's mailbox, but it is more common to use a separate mail delivery agent (MDA) to take care of this. So an MDA is not absolutely necessary, but it is usually desirable, for a number of reasons. An MDA like Procmail adds a lot more options ­ mails can be processed before delivery, for example, to strip annoyingly huge mailing-list footers from them, or filtered into separate mailboxes. Procmail can also handle things like vacation messages (do those after you've filtered for mailing lists, or you will get yourself kicked off a few lists when you go on holiday). All this can be done before the mail is delivered to the user. Another reason for using something like Procmail is that, in addition to any global rules in /etc/procmailrc, each user can set up processing or filtering rules in .procmailrc in their home directory. On a multi-user system, this gives each user individual control over their mail delivery. If they want copies of their mail forwarded to their Gmail account while they are away, a simple rule will cover it. It is also possible to have the MTA pass the mail to a program other than an MDA, like a virus scanner or spam filter. These then pass the message to the MDA for delivery (or not) after doing their job. So the mail could go from MTA to spam filter to virus scanner to MDA and then into the user's mailbox. Collecting or reading your mail via POP3 or IMAP requires another program, which reads the mail from the mailbox where it was placed by the MDA. </answer>

<title>Scanner startup</title>

<question>I have installed Ubuntu 8.04 on my Dell Vostro 1500. With my old Snapscan E50 scanner connected, XSane can see my scanner but shows the following:

Error: "Failed to open device `snapscan:
libusb:003:006': Invalid argument."

But if I plug the scanner into my PC running Windows XP for a moment and then plug it back to my Dell, XSane kicks in and works beautifully. I can reboot the laptop, or turn it off and on again, with no problem. However if I switch off the power to the scanner, the problem appears again. I have to plug the USB cable into the Windows computer and back into the Dell to be able to use the scanner on the laptop. What is missing from my Ubuntu machine that it can't start the scanner? </question>

<answer>When a device works only after having been used in Windows, you can be sure it requires a firmware upload. Many devices, particularly communication devices, do not have all of their operating code built in. Some ­ maybe most ­ of the code is contained in a firmware file that is uploaded by the driver when the device is first used, and the device itself may contain only enough code to permit it to receive and use the firmware upload. The firmware then stays in place until the device is switched off, so when you switch from Windows to Linux without power cycling the scanner, it will still work. Why do manufacturers do it this way? Because it is cheaper and more convenient for them. They can have different firmware versions to comply with the laws of various countries without having to produce specific versions of the hardware. This is why it is particularly commonplace on wireless devices, because countries have different restrictions on power, channels and so on. It also makes updates easy, as they only have to replace the driver. This whole process is transparent to Windows users as it is all handled by the driver, and a driver update automatically installs the latest firmware. The process is almost as automatic on Linux ­ you just have to know about the need for a firmware file in the first place. The details are on but all you need is the file called snape50.bin, which will be installed on your Windows partition. Copy this to somewhere on your Linux setup (/lib/firmware is the standard location for such files), and edit /etc/sane.d/snapscan.conf to include the line

firmware /lib/firmware/snape50.bin

You'll need to use sudo to do this as root and the path you put in snapscan.conf must match the location of the file. Now that Sane's snapscan driver knows about the firmware file, it will upload it for you, removing another dependency on Windows. If you ever install an updated driver on Windows, you may want to copy the new firmware file over, although if the old one works for you, why mess with it? </answer>

<title>Wireless conundrum</title>

<question>How do I get my D-Link router (DSL-2640B) and D-Link adaptor (DWL-111) to work with Linux (OpenSUSE 10.3). I don't know if the attached Windows info helps. Thing is, if I change these settings, it may not function under Windows anymore. Also, is it the router or the adaptor that needs to be compatible with Linux? </question>

<answer>The router connects to the internet, so the settings for that should not be touched, and it does so regardless of any operating system your computer may be running. The adaptor connects the computer to the router and needs a suitable driver to work with Linux. Unfortunately, model numbers are not enough to determine which is the correct driver for your particular hardware, as manufacturers have a habit of changing the chips used inside a device without altering the model number. I was caught out with a D-Link USB adaptor like this. I bought one because it was supported by the Linux prism drivers, only to find that they had just switched to an unsupported chipset. There is a way out if it turns out that there's no Linux driver for your chip, but it's possible that there is a native solution. Your card is quite likely to be based on the Ralink RT73 chipset. OpenSUSE 10.3 includes a driver for this but does not install it by default. Go to the Software Management section of Yast and install rt2x00-kmp-default. Now plug in your network adaptor and go into the Hardware Information section of Yast. If your device is now listed in the Network Card section, you can go to the Network Card section and set it up. If it isn't listed, unplug the adaptor, open a terminal and run

tail -f /var/log/messages

Plug in the adaptor and watch the output in the terminal. You should see some details whizz past (press Ctrl+C to stop the output). Run

modprobe rt73usb

and if you get no feedback, you have the right driver. Go into the Network Card section of Yast and set up your network connection. You may need to specify the driver module (rt73usb) for the device here. If all of the above fails, there is an option to use the Windows drivers for the adaptor, using a package called NdisWrapper. This emulates the Windows network driver interface, so that Windows drivers can be used in Linux, so install this with Yast. Dig out the driver CD that came with the device and locate the driver .inf file, then in the terminal window you should still have open, run

ndiswrapper -i /path/to/driver.inf
modprobe ndiswrapper

The first command should install the driver where NdisWrapper can find it; the second loads the NdisWrapper module and should give no output if all is well. Now create the interface in Yast using the Add button, set the Device Type to Wireless and the Module Name to NdisWrapper, leaving everything else on the default settings, and follow the usual prompts to set it up. </answer>

<title>Partition planning</title>

<question>I am a beginner with Linux. I've divided the hard drive on my notebook into five partitions: two 50GB ext3 partitions (for / and /home), two NTFS partitions of 50GB and 30GB each and 1GB for /boot. I want to know how I can reconfigure my distro (I'm running Ubuntu 8.04) to stop using the home partition on hda3 and to move it to hda1 (/root) without re-installing. I noticed that on the /root partition there's also a /home folder. Are these files duplicates of the users' profile in the /home partition (hda3 partition)? I have another question: is there a script to install Realtek RTL8187B wireless card under Linux, in general? I googled around and found out that I need to use Windows driver files during installation. Do you know any native Linux driver for this wireless card? </question>

<answer>The home directory on the root partition is where your separate home partition is mounted. Unlike Windows, where each drive or filesystem appears as an independent drive letter, Linux mounts all devices within the original filesystem. The home directory on your root partition is empty as its only function is to provide a means of accessing the files on the home partitions. So the files are not duplicates; they are the same files. You can copy the files from the separate partition to the root partition, but this is a bad idea. We get a lot more mails from people wanting to know how to perform the opposite manoeuvre. By keeping your home directory separate, you can reinstall or upgrade the operating system at a later date without affecting your personal data and settings. If you do want to make this move, boot from a Live CD or DVD distro, such as Knoppix. This will mount your partitions separately, as /media/hda1 and media/hda3. You can now move the files from /media/hda3 to /media/hda1/home (which you will see is indeed empty) but you should think very carefully about the consequences of such a move ­ almost no one will recommend this as a good idea. What you could do is alter your partitioning setup, as you're wasting a huge amount of space at the moment. This can be a complex task, best done by running QtParted from the Knoppix live disc or GParted from the Ubuntu Live disc. Your root partition needs no more than 10GB, and most installs will use less than half of that. 50MB is ample for /boot, as it only needs to contain a couple of kernels and the bootloader (my /boot currently contains less than 12MB). The real space hogs are /home, which contains all your personal data (which is why you don't want to tie it into the operating system), and your Windows partition, also because all of the user files it holds. The NdisWrapper driver does require a Windows driver file to be copied over, but the Linux kernel includes a driver for this now. To avoid a conflict between the two, go into the Synaptic package manager and make sure that no NdisWrapper packages are installed. Your card should then be detected and appear in your network settings when you reboot. </answer>

<title>Share options</title>

<question>I have a remote drive (rw) on a server connected by NFS which the client computer mounts at boot time using fstab. If the server computer is rebooted this seems to require any clients to be rebooted and the server disk remounted. On my Amiga I can do this by issuing a diskchange command on the client. Is there a way to do this on Linux without having to reboot the client or manually unmount and remount, or can I do this automatically? </question>

<answer>Thankfully, it's a simple task to remount a device in Linux: just use mount /mount/point -o remount However, this should not be necessary. NFS is capable of restoring a mount when the server comes back up, and should do this by default, but it can have problems when the reboot is lengthy (ie, around five minutes or more). Does the server have a static IP address? If it uses DHCP, it is possible that it gets a different address after a reboot. It is more likely to be an error with the original mounting or exporting of the filesystems. What do the system logs on the server and client machines show? These usually contain valuable clues. Check the export options on the server with

exportfs -v

particularly the sync or async setting. It also helps to have either the soft or intr option in the /etc/fstab entry on the individual client computers. The exportfs man page lists the various options for the server, and the NFS man page shows the various mount options. Intr is often preferable to soft as it is less likely to result in data loss if the server reboots. The alternative option, which is the default when none is given, is hard. These all determine how the client handles a lack of response from the server. As soft can sometimes cause data loss on the server, it is best used when exports are mounted read-only ­ intr is the best general-purpose setting, as it allows the client to respond to signals instead of just locking things up when the server goes away. It is really a matter of trying the various options, and seeing which works best for you, but intr is my preferred way of avoiding timeout problems. </answer>

<title>School server</title>

<question>I manage a Linux-based (PCLinuxOS/Karoshi) infrastructure in a school. I want to add a streaming media server with a web-based interface so that staff can easily access videos stored on a NAS. Can you suggest any open source solutions/projects which might help me do this? </question>

<answer>MediaTomb, from may fit your needs. It's available for several distros, with unofficial RPMs for PCLinuxOS available from Once it's installed, the first decision you have to take is how you want MediaTomb to store its data. The first time you start MediaTomb, it will create a default config file at ~/.mediatomb/config.xml. Edit this to set either sqlite3_enabled or mysql_enabled to `yes' or `no' Some distros use a global configuration file in /etc/mediatomb/config.xml. If you choose SQLite, MediaTomb will create the database file the first time you run it, but a MySQL server would probably be better for a larger collection. To use MySQL, you need to create a database called mediatomb and populate it by running

mysql -p mediatomb </usr/share/mediatomb/ mysql.sql

Then create a user with a password and read/write privileges for the mediatomb database. You can do this using the MySQL command line client if you are familiar with it, or take the easy way out and use PHPMyAdmin. Edit the config file to set the correct username and password. Start MediaTomb and load http://localhost:49152 into Firefox (it doesn't work with Konqueror) If you are administering this from another PC on the network, use the address of the server instead. You'll see a very bare window, so click the + button to start adding content. When adding a video file, set the type to Item, the title to the name you want shown and Location to the absolute path to the file. The MIME type setting is important here; one way to determine the correct value is to use the file command on the video file

file -i /path/to/video.avi

You can add directories to the server using the filesystem view, and edit the properties of these directories in the database view to enable autoscanning. This means you can have one or more directories that will automatically make available any content dropped into them. There are several UPnP (universal plug and play) programs that can browse and play the contents of your server, but for Linux computers, you can also make the content available to any program. Install DJmount from (you will need the Fuse filesystem in place to use this). Create a suitable mount point, say/mnt/media, and mount it with djmount /mnt/media The /mnt/media directory will now contain a MediaTomb directory, plus one for any other UPnP server on the network, with subdirectories for each type of content, such as /mnt/media/MediaTomb/Video. </answer>