Answers 106

From LXF Wiki

Answers 106

<title>Pretend XP</title>

<question>I finally got a half-decent machine that runs Ubuntu. My girlfriend won't touch a computer unless it runs Windows XP, so it's dual booting. I read in Linux Format ages ago about kiosk machines that would load Firefox on startup then shut down when Firefox was closed. Can I do this with a virtual machine, and how difficult is it likely to be? I'd like her to put in her username and password at the GDM screen (made to look XP-ish) and when she logs in it loads up an XP VM to her desktop with nothing else, not even panels, loaded with it. I'd then like the machine to shut down when she tells the XP VM to do so. She won't be keen on the whole `shut down Windows, then shut down Ubuntu' because she's often in a hurry. </question>

<answer>This is possible with both VirtualBox and VMware Workstation. To do it with VirtualBox, first create the VM as normal and make sure everything works. Then test that you can run it from the command line with

VBoxSDL -fullscreen -vm "VM name"

The name is the name shown in the list of VMs in the VirtualBox GUI ­ there's no need for a path. This should start up your Windows XP virtual machine and return to the command line when you shut down Windows. Now you need to have it do this automatically when the user logs in. The first step, if you haven't already done so, is to create a user from the System > Administration > Users And Groups menu item. As you're running the virtual machine full-screen, there's no need for anything more than the most minimal of window managers underneath ­ you certainly don't want anything as heavyweight as Gnome running when Windows will want so much of your memory. My favourite for this is EvilWM, which you can install hrough Synaptic. Then create the file .xsession in the user's home directory, containing this

#!/usr/bin/env bash
   /usr/bin/evilwm &
   sleep 3
   exec VBoxSDL -fullscreen -vm "VM name"

Log out and type the other user's login name into GDM. Before you give the password, click on the menu at the bottom-left to call up the Sessions window. Select `Xclient Script' and click the Make Default button when asked. Now, whenever that user logs in, the .xsession file will run, starting VirtualBox full-screen as if they've logged into Windows. When they shut down Windows, VBoxSDL will exit, and the .xsession file will finish, returning you to the GDM login screen. </answer>

<title>Time, gentlemen, please</title>

<question>I have a small, self-contained network for testing VoIP, and every machine has a static IP in the range 192.168.254.x. I've assigned the machine with address to be the NTP server. NTPD is installed and starts fine, but if I ask another machine to sync with it using ntpdate I get:

no servers suitable for synchronisation.

This happens on both my Linux servers and on my Mac, so the problem appears to be in the config of the NTP server rather than the clients. I've also got some Cisco IP phones that use Simple NTP rather than full NTP and they pick the time up from the server no problem. NTP configuration seems to be very poorly documented. The ntp.conf file on the server contains the following (and I just want machines on the network to be able to get the time):

restrict mask
nomodify notra

As I understand it, that will allow any machine with an IP in the range 192.168.254.x to get the time off the server for itself but not to modify the time on the server. I also tried setting the stratum level, but to no avail. </question>

<answer>The first step to diagnosing this is to run ntpdate with the -d (debug) argument. This causes ntpdate to show details of the communication with the server, but not alter the system clock. I suspect you'll see something like Server dropped: strata too high

This is usually caused by the server being too far out of sync with the upstream servers, so it sets an artificially high stratum value to prevent other computers trusting it. In effect, the server is saying, "Here's the time, but I'm not that sure of it", to which the client responds, "OK, I'll leave it, thanks" This probably also accounts for the more simple clients accepting its time. Leave the server running for a few hours to allow it to bring itself into sync with the upstream servers from or wherever you've set in ntp.conf. Running ntpq -p will give some useful information, reporting the peers known to the server and their accuracy. You want most of them to have a * or + in the first column and a low value in the st (stratum) column for them to be considered authoritative. The stratum setting in ntpd.conf can only be used to increase the stratum level, which won't help here. You're right about the NTP documentation. It's written by those with thorough knowledge of the subject, which is good, but assumes a similar level of understanding among readers, which is not. </answer>

<title>MySQL Administrator</title>

<question>I've never been able to get MySQL Administrator to work on a Linux workstation. I've tried different workstations connecting to different servers ­ I enter server, username and password, click Connect and the window disappears. It's not the server, because I've tried connecting to several, and I can connect to them using MySQLAdmin on Mac OS X, but the Linux version just appears to be permanently broken. When starting it from the terminal it still crashes when I log in and tells me

/home/andrew/mysql-gui-tools-5.0/mysql-administrator-bin: symbol
lookuperror: /usr/lib/ undefined

I'm using Ubuntu 7.04 `out of the box' Do I need to use a different version of libbonoboui? </question>

<answer>Did you install mysql-gui-tools from the MySQL website or install mysql-admin via Synaptic? It seems this is an old problem that only occurs when using the MySQL download. It's still open on the MySQL bug system, where it was reported in June 2007. Most of the reports involve Ubuntu, which was at version 7.04 when this bug was reported, but it also affects 7.10. The cause appears to be a conflict between libraries included with the download and those installed on your system. This isn't a problem when using Ubuntu's own packages. If possible, uninstall the current version and start again from Synaptic. If you want to use the MySQL download, there are a few suggestions for fixing it, not all of which work for everyone. The most complete is to build the package from source, which explains why the program works perfectly on my Gentoo systems. Less extreme solutions involve removing libraries from the MySQL Administrator install directory, causing it instead to use the system libraries, which are consistent with one another. Before you do anything like this, do not be tempted to delete libraries. You may find you need them later, so rename them instead. The first candidate is /opt/mysql-gui-tools-5.0/lib/ ­ rename that and try again. If it still fails, try renaming all of the libraries in /opt/mysql-gui-tools-5.0/lib (or rename the directory) forcing the program to use only the system libraries. With the latter, you may get failures from missing libraries, in which case you should replace them one by one until everything works. That way you use only the minimum of the bundled libraries, avoiding version clashes with the system. It has also been reported that creating the empty directory /etc/mysql/conf.d helps with Ubuntu, although we were unable to verify this. This does highlight one of the drawbacks of using packages created for another system, which is why we always recommend installing from your distro's repositories wherever possible ­ that way someone else will already have dealt with any compatibility matters. </answer>

<title>Talk-Talking point</title>

<question>As a complete newcomer to Linux, I find the whole idea of open source software and the independence it offers appealing. However I seem to have fallen at the first hurdle. Having installed Mandriva Powerpack 2008 as the sole operating system on my old Packard Bell desktop, which used to run XP Pro with no problem, I am unable to set up an internet connection. We have a wireless setup, courtesy of Talk-Talk, which happily handles one desktop, a laptop and a Wii. When I insert the disc to load up the software on the Linux machine it recognises the disc but I can find no way of loading it. Am I missing something obvious, or do I need to import another program to help with the setup? </question>

<answer>That CD is for Windows only, and it's not even needed there. Such CDs just set up the modem to log on and sometimes install branded versions of software such as Internet Explorer. All configuration can be done via a browser, but you need to use a wired connection for this. Many wireless routers only enable configuration changes via the wired connection, otherwise anyone who could connect to your network wirelessly could make changes. Ensure your wired network is set to use DHCP to obtain an address automatically ­ you do this in the network section of the Mandriva Control Centre. Plug in the cable, load up Firefox and type in the address bar. This will get you to the router's administration page, where you will be asked for a login and password ­ the default is `admin' for both, but you should have changed this by now. Provided the router is already connecting to the internet, there is no further action needed here, and you should now be able to access the internet using the wired connection. Wireless setup is slightly more complicated, but it would appear that you already have the router correctly configured as it works with your other systems. There are two possibilities here ­ one is that you haven't set up the encryption system, which is done from the Network & Internet section of the Mandriva Control Centre. The other is that the drivers for your wireless adaptor are not included by default and need to be installed separately. Unfortunately, you have not included any information about your hardware. The output from lshw would have identified your hardware and the drivers you may need to install for it ­ very straightforward. </answer>

<title>Command line mail</title>

<question>In a recent issue there was a mention of a program that could use my ISP's SMTP server to send emails from the CLI. Can you remind me what its name was? </question>

<answer>Any of the standard mail transfer agents, such as Postfix or Sendmail, can do this, but you probably don't want to install a full-blown MTA for this simple task. The standard mail program will do this too, but it requires a local MTA. If all you want to do is send mail via your ISP's mail server, the best program for the job is ssmtp ( Although this is a Debian program, Fedora, Mandriva and Ubuntu also have it in their repositories, and Gentoo installs it as part of the core system package set. However, this is one of those programs that you must set up before you can use it, by editing /etc/ssmtp/ssmtp.conf as root. The key setting is mailhub, which must be set to the name of your ISP's SMTP server. If you want to send mail via a port other than the standard 25, you need to append this to the address, as in

Other options you may need to set, depending on your ISP's setup, are UseTLS for secure communication with the server and AuthUser/AuthPass if you are required to log in before sending mail. A simple rule of thumb is that whatever you need to change for the defaults in your normal mail client needs to be set here. Using ssmtp is the same as using sendmail. In fact, it also installs a sendmail program, so any program that expects to send via a local MTA can send via your ISP with ssmtp. Sending mail via ssmtp is done by feeding it the mail on standard input and giving the destination address on the command line.

/usr/sbin/ssmtp -t <<EOF
From: My Name <>
To: Your Name <>
Date: $(date -R) Subject: Just a test
This is a test of ssmtp

In this case, the destination address is included in the headers sent to ssmtp ­ the -t option enables this. Everything between <<EOF and EOF is fed to the program's standard input, so it's much easier than a bunch of echo lines. At other times, you may want to send the output of a program or script by email, in which case you may use

myprogram | ssmtp

The program called mail, which needs an MTA to run, provides more options for sending mail, such as including the subject on the command line. Since ssmtp emulates sendmail, you can use this with ssmtp if you want the extra features. This requires no extra setting up ­ just install the mailx package for your distro and read the man page for the extra options ­ but for starters try

myprogram | Mail -s "Output from myprogram"


<title>Writing to NTFS</title>

<question>I administrate a PC that dual boots Vista and Slackware. It has a shared partition, formatted NTFS. I can get read-only access under Linux, but I cannot create files. I don't need fancy permissions on the shared partition, as it will hold only one user's files. </question>

<answer>There are three separate approaches to using NTFS filesystems with Linux. You're currently using the driver included with the kernel, which reliably supports only reading ­ you can write to an existing file as long as the length is unchanged. Creating files or directories is not possible, nor is any file write that changes the length of the file. The second option is NTFS-3G (, a Fuse filesystem. This runs in userspace, but is reliable, reasonably fast and available in most distros' repositories. The third option is Paragon NTFS for Linux, which we reviewed last year. This is a commercial product that comes with a number of utilities and is available from As always, the choice is yours, but the in- kernel driver is by far the most limited and I would recommend trying NTFS-3G next. </answer>

<title>DVD sources</title>

<question>I have recently bought issues LXF102 and LXF103. Please could you tell me if there is any source code for the distros on the DVDs? I have just bought a Zoom USB modem, model 3095, which has tar and rpm files on its CD that need the source code of a Linux distro to be able to compile the driver. I installed the Mandriva Free 2008 distro but could not find the directory for the source code. Please can you also tell me where in the Mandriva Free 2008 distro the Dial up Software/KDE menu option is, as I don't have broadband at the moment. </question>

<answer> You don't need the source code of the entire distro for this, but any time you want to compile a kernel module, you need the source code for the kernel you'll run it with. All distros have a kernel source code package as part of their standard package list, though it's often not installed by default. The source code must match the kernel you use, so if you are using the default kernel-desktop-2.6.22-1mdv2008.0 package that comes with Mandriva Free 2008, you need to install kernel-source-2.6.22-1mdv. It is a good idea to install the kernel-source-latest package too, which will always install the latest source, as you have kernel-desktop-latest installed by default. Whenever the updates system wants to install a new kernel, you get the matching source code at the same time. All of this is done in the Software Management section of the Mandriva Control Centre. Bear in mind that a kernel upgrade will stop your modem working until you recompile the drivers, so getting the new source at the same time is definitely a good thing. To install the dialer software, type `kppp' into the software manager's search box. You can configure it in the Network & Interface section of the Mandriva Control Centre.</answer>

<title>3G ­ Go, Go, Go</title>

<question>I have a three-USB broadband modem, Huawei E220, which automatically sets up on Windows and a Mac but not on Linux. Please let me know if any distro produces drivers for this, so I can use it on Linux. </question>

<answer> This modem has been supported by the Linux kernel since 2.6.20, so any recent distribution should have support for it. When connected, it should set up the device node /dev/ttyUSB0, which you use as the modem device in whatever dial-up software you choose. This configuration is reported to work for WvDial.

[Dialer mobile]
Modem = /dev/ttyUSB0
Baud = 460800
Init2 =AT
Init3 = AT&FE0V1X1&D2&C1S0=0
ISDN = 0
Modem Type = Analog Modem
Phone = *99***1#
Username = username
Password = password

This modem actually contains two devices: the modem and a read-only USB mass storage device. The latter contains drivers for Windows, saving the expense of distributing a driver CD with the device, but as you're running Linux, you don't need it. The kernel should configure the modem side of the device when it detects it, but some people report a problem with this, with the device appearing as a memory stick instead. There is a program called HuaweiAktBbo that switches between the two modes. You will find it in the vodafone-mobile-connect-card-driver-for-linux package, which you can download from Although this is marked as a Vodafone package, other providers use the same hardware and the program works with them all. Running this program after inserting the stick forces it into modem mode. Do this automatically when you insert the stick with a suitable udev rule. Put this in /etc/udev/rules.d/10-local.rules (create the file if it does not exist)

SYSFS{idVendor}=="12d1", SYSFS{idProduct}=="
1003", RUN+="/usr/sbin/huaweiAktBbo"

The vendor and product IDs may be different for your device; lsusb will show the correct values. Now the modem should appear as a modem at /dev/ttyUSB0 whenever you plug it in. Some people report success at 926100 bits per second (enabling you to use up your monthly allowance even sooner), but get it working at 460800bps before trying any tweaks. </answer>

<title>Invisible USB</title>

<question>I am trying to get access to a USB memory stick. Grepping dmesg for USB results in the following

USB Universal Host Controller Interface driver
uhci_hcd 0000:00:1f.2: new USB bus registered,
assigned bus number 1hub 1-0:1.0: USB hub found

So it appears the USB system is recognised. However, I can't access the stick from the desktop. How do I mount the stick (without being arrested or ending up in casualty)? </question>

<answer>While dmesg shows information about your USB interface, any mention of the device itself is suspiciously absent. It's often easier to look at the system log for this sort of information. This is usually /var/log/messages or /var/log/current, depending on which system logger is in use (you don't mention which distro you use so it's impossible to say for sure). Run

tail -f /var/log/messages

as root, before you plug in the USB stick, then watch the output as the stick is recognised. You should see something like this

usb 7-5: new high speed USB device using ehci_
hcd and address 16
usb 7-5: configuration #1 chosen from 1 choice
scsi14 : SCSI emulation for USB Mass Storage
usb-storage: device found at 16
usb-storage: waiting for device to settle before
scsi 14:0:0:0: Direct-Access Generic USB Flash
sd 14:0:0:0: [sde] 2007040 512-byte hardware
sectors (1028 MB)
sd 14:0:0:0: [sde] Write Protect is offsd 14:0:0:0:
[sde] Mode Sense: 23 00 00 00
sd 14:0:0:0: [sde] Assuming drive cache: write
sd 14:0:0:0: [sde] 2007040 512-byte hardware
sd 14:0:0:0: [sde] Write Protect is offsd 14:0:0:0:
[sde] Mode Sense: 23 00 00 00
sd 14:0:0:0: [sde] Assuming drive cache: write
sde: sde1
sd 14:0:0:0: [sde] Attached SCSI removable disk
sd 14:0:0:0: Attached scsi generic sg6 type 0
usb-storage: device scan complete
hald: mounted /dev/gigabyte on behalf of uid 1000

In this case, the device is recognised as /dev/sde with one partition, which is automounted. If you see no references to usb-storage, make sure the usb storage module is loaded by examining the output from lsmod:

 sudo lsmod | grep storage

If the module isn't loaded, try loading it with sudo modprobe usb-storage and inserting the device again. If the usb-storage module is loaded, it's very unusual for a device to be unrecognised. Try it on a different computer: Flash memory has a limited lifetime for writes and the FAT table is often the first place to stop working on a FAT formatted device, which could result in this behaviour. </answer>

<title>Back to Windows</title>

<question>How do I return to Windows XP after installing Ubuntu on my laptop? </question>

<answer>Are you asking how to use Windows XP instead of Ubuntu, or how to remove Ubuntu and go back to Windows? The first question is most easily answered. During installation, Ubuntu will have given you the option to resize your Windows partition and, provided you took this option, moved the Windows data over to install Ubuntu alongside it. It then added a boot menu to choose between the operating systems each time you start up. This menu is hidden with Ubuntu. There's a brief countdown while "Press ESC to enter the menu" is displayed on screen. If you don't press the key, it boots Ubuntu, so press Esc and select Windows from the menu. If you want to remove Ubuntu, use any partitioning tool to delete the Linux partitions and resize the Windows partition to fill the drive. You can do this with Partition Magic on Windows, or use the Ubuntu installation disc. Boot from the disc and run System > Administration > Partition Editor. From here you can delete the Linux partitions. Ubuntu uses two by default; a smallish swap partition and a large one for everything else. Make sure you only remove partitions that are marked as type swap or ext3 ­ any NTFS or FAT partitions are for Windows. This removes the Ubuntu data from your computer but leaves the Grub bootloader. You this need to boot from your Windows CD to remove this. Select the rescue option and run fixmbr. This will restore the disk's boot code back to the Windows settings and your computer will now boot straight into Windows when you power up. All of this assumes that you took the installation option to resize the Windows partition. If you told the installer to use the whole disk, it will have wiped your Windows installation from the hard drive. In this case, the only way to get Windows back is to reinstall it. NB


<title>Custom security</title>

<question>I want to set up a firewall but I'm not sure where to start. The default firewalls in the distros I've tried are a bit basic ­ I need something with more control. I've heard that Iptables is the way to go, but it seems very complicated, with some arcane-looking rules. Is there something that gives me decent control over what is and isn't allowed, but in a more accessible way? </question>

<answer>All firewalling takes place inside the Linux kernel, using the netfilter modules. These actually do a lot more than firewalling, handling anything to do with routing, forwarding, blocking and tracking network packets. Iptables is the user space application that controls netfilter, and is usually used in conjunction with a file containing a series of rules that are applied to netfilter. It's possible to write the rules file with a text editor, and many people do, but it requires a decent knowledge of the various options and their consequences. Remember that computers do what you tell them to do, not what you want them to. It's possible to create a set of rules that leaves your computer open to attack, while believing that it's locked down. That's where the various firewall front-ends come in; they enable you to specify your needs and create the Iptables rules for you. The rule files they create are then read by Iptables at startup and you can even create rules on one machine and transfer them to another. One popular firewall front-end is Guarddog ( Guarddog works with zones, defined for the local computer and the internet to start with. You group computers or networks in these zones, so the first step may be to create a LAN zone for other computers on your network. If you have only one computer, the local and internet zones will be enough. Once the zones are defined, use the Protocols tab to specify what types of communication you allow to and from other zones. For example, you may want to allow NFS or SMB connections from the LAN so other computers can see your shared directories, but you almost certainly don't want this open to the internet. The protocols are grouped by category and the lower left pane shows a description of the selected protocol. By default, everything from other zones to the local machine is turned off, so enable the services you need and click Apply. Now try to use services that you haven't enabled to see whether the results are as expected. The Logging tab controls writing of blocked and rejected packets to the system log. This can be useful when testing a setup but can also fill up the filesystem containing /var/log if overused. In the Advanced section you can disable the firewall, which is a good test if something doesn't work. If it starts working when you disable the firewall, you need to look at the firewall rules. You can also enable DHCP ­ useful if you're following the LTSP tutorial in this issue ­ and export a set of rules for use on another machine. The final tab, Port Reference, is useful to see what each port number generally handles. </answer>