Answers 75

From LXF Wiki

Answers 75

<title>Port short</title>

<question>I am having a couple of problems with ports. First, as root my pilot is available on ttyS0 in KPilot, but when I'm logged in as myself KPilot tells me that it is not read/writeable and automatic detection will not find it. It seems that I cannot access ttyS0 as myself, only as root. How do I change permissions if that is the problem? Second, when I'm using Kino it tells me in the preferences that the IEEE1394 subsystem is not responding, whether I am logged in as root or as myself. The modules raw1394, ieee1394, ohci1394 and dv1394 are all loaded. </question>

<answer> You do not have permission to access /dev/ttyS0 as your normal user. While it is possible to change the permissions of the devices, this is not the way things are meant to be done, and will probably result in your having to make the changes each time you reboot. The first thing to do is check who can access each device with

[nelz@localhost ~]$ ls -l /dev/ttyS0
crw-rw---- 1 root uucp 4, 64 Oct
4 00:14

This shows that ttyS0 can only be accessed by members of the uucp group, so you'll need to add your user to that group with

su
gpasswd -a yourusername uucp

You will have to log out and back in for your membership of the uucp group to be recognised. Your Kino problem appears to be due to a missing module. The Lsmod output you gave in your forum post shows ieee1394, raw1394 and ohci1394 loaded, but not video1394. You do have dv1394, but that is used in high-end professional equipment, not consumer level digital video cameras. Once you have the correct modules loaded, you will hit a similar permissions problem as with /dev/ttyS0, but the solution is a little more complex as the devices are owned by root only. To fix this, create a video group and add yourself to it (as root):

groupadd video
gpasswd -a yourusername video

Then ensure the devices are owned by the video group by adding these lines to /etc/udev/10-udev.rules (create the file if it doesn't exist):

KERNEL=="raw[0-9]*",
NAME="raw/%k", GROUP="video"
KERNEL=="video1394*",
NAME="video1394/%n",
GROUP="video"

After a restart, all your permissions should be fixed ­ you only need to be sure that the correct modules are loaded for KPilot and Kino to work fully. </answer>

<title>Remote removed?</title>

<question>I bought a cheap TV card, installed it ­ and guess what? No go using TVTime. Rather than curse and swear, I did a quick check of dmesg, which showed that bttv had picked up the card and detected it OK but registered it to /dev/video1 rather than video0. Easily fixed but still no pictures. Googling found that the tuner had been detected at a type 5 and should have been 38. It all runs well now. My question now is how do I get the remote control running? The remote control provided connects to the TV card and not to a USB port. I can find a lot on how to use the remote with Lirc [Linux Infrared Remote Control] but I am stuck as I cannot find the device remote0 anywhere. I get the following putput from dmesg:

bttv: driver version 0.9.15 loaded
bttv0: detected: Leadtek TV 2000
XP [card=34], PCI subsystem ID is 107d:6609
bttv0: using: Leadtek WinFast 2000/
WinFast 2000 XP [card=34,insmod option]

Any suggestions on how to proceed? I have Mandriva and Debian 3.1 dual booting. </question>

<answer>I have the same card, and it took a bit of digging to get things running. First, bttv is the wrong driver for this card. You need to use the cx8800 driver. Both of your distros have this driver installed with the 2.6 kernels (but not the default 2.4 kernel of Debian). The cx8800 driver also handles the remote, sending its signals to /dev/input/eventN, where N is a number. If you have more than one such file,

 cat /proc/bus/input/devices

will tell you which is the right one. Copy http://linux.bytesex.org/v4l2/ linux-input-layer-lircd.conf to /etc/lircd.conf (there's a copy of this file on the LXF coverdisc) and start Lircd (the Lirc daemon) with the following options.

--driver dev/input --device /dev/input/eventN

with the correct value for N, of course. Your remote should now work fully, with any Lirc-aware programs responding to the remote. </answer>

<title>Mapped out</title>

<question>I have been supplied with some *.ecw files containing detailed survey maps. They came with a viewer called ER Viewer 2, which allows zooming and traversing of the maps. It is very basic, but it only works on Windows. Is there an alternative `viewer' out there that is open source and works on Linux (32-bit or 64-bit SUSE 9.3 Pro)? I also need to be able to work with the data from these files; to enter data, transfer it to a database and work with GPS coordinates. I have looked on SourceForge for suitable software and Geomview and SciGraphica look like they may be of use, but I was hoping you could make some recommendations. I would prefer to work within a GUI as I'm not very familiar with the command line ­ if not, well, I'll just have to get familiar with it! </question>

<answer> This has got to be one of the most specialised questions I have received (no readers, that is not a challenge). There is a Linux viewer for .ecw (Enhanced Compressed Wavelet) files but it is not open source. The program is XnView (it has a companion program, Nconvert) and is available from www.xnview.com. For a more complete solution to handling this and your other data, it seems you need a GIS (Geographic Information System) program. There are a number of these available; Grass GIS (http://grass.itc.it/index.php) would be a good starting point. Originally developed for the US Army Corp of Engineers, Grass is now used by academic, commercial and government organisations across the world. This means that not only is development active and wide ranging, but there is a large body of users and knowledge for you to draw upon when trying to apply the software to your particular needs. Grass supports .ecw files through its use of Gdal, a library for translating geospatial data formats. If Grass is not suitable for your needs, you may also consider the following projects:

UDig http://udig.refractions.net/confluence/display/UDIG/Home
Quantum GIS http://qgis.org Saga www.saga-gis.uni-goettingen.de/html/index.php

</answer>

<title>Mailing from afar</title>

<question>I run a local mail server that acts as my mail gateway and storage. This works well when connected to my LAN, but when I connect from elsewhere (I have a static IP address), I can receive mail but not send it. I am using Postfix and Dovecot on Gentoo. I found something on this in the Gentoo documentation, but it was part of a virtual mail hosting setup, and I don't need anything that complex. </question>

<answer>Postfix is set up to deny relaying by default. It can only accept mail either to or from your domain, to avoid being used by spammers. You need to configure it to use SASL (Simple Authentication and Security Layer) to allow remote users to log in with a password to send mail. First, ensure that Postfix has SASL support. If you don't already have sasl in your USE flags, add it and re-emerge Postfix (users of binary distros don't have to worry about this step). This will also install SASL for you. Next, edit /etc/sasl2/smtpd.conf and change the pwcheck_method line to

pwcheck_method:saslauthd

With some distros, this file may be /usr/lib/sasl/smtpd.conf. You should also edit /etc/conf.d/saslauthd to tell SASL how to authenticate users. Change the SASLAUTHDOPTS line to ONE of the following:

SASLAUTHD_OPTS="${SASLAUTH_
MECH} -a pam"
SASLAUTHD_OPTS="${SASLAUTH_
MECH} -a shadow"

depending on whether or not you use PAM (pluggable authentication modules for Linux). Now you need to make a couple of changes to Postfix's configuration. Edit /etc/postfix/main.cf and add these lines to the end:

# SASL SUPPORT FOR CLIENTS
#
# The following options set
parameters needed by Postfix to
enable
# Cyrus-SASL support for
authentication of mail clients.
#
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options =
noanonymous
smtpd_sasl_local_domain =
$myhostname
smtpd_recipient_restrictions =
permit_sasl_authenticated,permit_
mynetworks,check_relay_domains
broken_sasl_auth_clients = yes

The last line is only needed to accept connections from older versions of Outlook Express and Exchange. Finally, start Saslauthd, set it to start on boot and tell Postfix to load the changed configuration.

/etc/init.d/saslauthd start
rc-update add saslauthd default
/etc/init.d/postfix reload

If you want more information, there is a detailed Howto at http://postfix.state-of-mind.de/patrick.koetter/smtpauth. </answer>

<title>Lack of speed kills</title>

<question>My USB flash memory has recently become very slow, giving only around 5Kb/s on writes. I run Gentoo Linux and this problem seems to have started since I upgraded to a 2.6.12 kernel. </question>

<answer>This is due to a change in the way the kernel handles the sync option with FAT filesystems. Previous kernels only kept the data in sync and updated the FAT table at the end of the operation. The later revisions update the FAT table each time a block is written. This slows down writing substantially, but far more importantly, it also seriously shortens the life of the drive with so many writes to the same place. I managed to destroy a 1GB memory stick (and three weeks' work) in a few weeks before learning of this. It is normal practice to mount removable devices with the sync option, to reduce the chances of corrupting data by unplugging them without unmounting, but this new kernel `feature' means you should now mount your device without this option. If you mount manually, this is easy: just change the entry in /etc/fstab to remove the sync option. If you use HAL to mount drives automatically, you can change the default mounting policy from sync to async by saving the following in a file called /etc/hal/fdi/policy/storage-policy.fdi (there's also a copy on this issue's coverdisc):

<match key="volume.size" compare_
lt="2147483648">
  <match key="@block.storage_
device:storage.hotpluggable"
bool="true">
<merge key="volume.policy.
mount_option.sync"
type="bool">false</merge>
            <merge key="volume.
policy.mount_option.noatime"
type="bool">true</merge>
  </match>
 <match key="@block.storage_
device:storage.removable"
bool="true">
           <merge key="volume.
policy.mount_option.sync"
type="bool">false</merge>
           <merge key="volume.
policy.mount_option.noatime"
type="bool">true</merge>
 </match>
</match>

If you use Ivman, find the line in /etc/ivman/IvmConfigActions.xml that reads

<ivm:Match name="hal.volume.fstype" value="vfat">

and add

 <ivm:Option name="mountoption" value="async" />

immediately after it. You will need to restart HAL/Ivman after making these changes, and don't forget to unmount devices before unplugging them! </answer>

<title>Bish bash bosh</title>

<question>While experimenting with a Red Hat Enterprise Linux 3 installation and trying to break and fix things, I unintentionally deleted /bin/bash. The operating system obviously crashed but I found mysel at odds with what to do next. I was unable to boot the machine into runlevel 1 as this still, apparently just like everything else, uses Bash. I would appreciate any insight on what could be done should a similar situation ever happen on a live machine. </question>

<answer>Most of EL3's startup scripts require /bin/bash or /bin/sh, which is no more than a symbolic link to the former. At the kernel selection menu in Grub, hitting `A' allows for parameters to be passed to the selected kernel. Adding init=/bin/bash would typically bypass all the init scripts and drop you straight into a shell. This is not much use if Bash has been deleted. However, most distributions include a number of other shells, including Ksh and Tcsh. In this case init=/bin/ash is a valid option. With the system booted straight into the chosen shell, the / partition finds itself mounted as read-only. The first task is to remount as read/write:

  # mount -o rw,remount /dev/hda2 /

If the missing files are available they can be copied over and the right ownership and permissions set. Alternatively, mounting the installation media, the Bash RPM can be forcibly re-installed (the RPM with EL3 came on the second CD). Run

  # mount /mnt/cdrom
  # rpm -Uvh --force /mnt/cdrom/RedHat/RPMS/bash*.rpm

A somewhat more elegant way is to boot the server off the installation media into the Red Hat rescue mode (linux rescue). The rescue mode tries to mount the root partition as /mnt/sysimage. The Bash RPM could then be copied to /mnt/sysimage/tmp and installed form an alternative shell chrooted to /mnt/sysimage, thus:

  # chroot /mnt/sysimage /bin/tcsh
  # rpm -Uvh --force /tmp/bash*.rpm

</answer>

<title>LVM or hate 'em</title>

<question>I'm working on upgrading our school computers to Fedora Core 4. Up until now we were on Fedora Core 2, which seems to use ext3. Basically, I set up one computer on FC4 and do all the upgrades. Then I do a minimal install on the other drives (to correctly partition them) before transferring the files across by mounting the drives as secondary in my main computer for the operation (I can put both drives in my computer at the same time, performing the main file swapping operation using a Knoppix CD) Problem: while the /dev/hdb1 directory (Grub boot partition) can be mounted, the /dev/hdb2 cannot. Attempts to mount /dev/hdb2 result in reports that /dev/hdb2 is already in use or cannot be mounted. When I launch Parted it does not show a filetype for the /dev/hdb2 partition. Launching Fdisk shows that it is of type 8e ­ `Linux LVM' format. How do I mount a partition that has been written in LVM format? Is it simply a -t option to the mount command? Please give me an example if it is. </question>

<answer>You do not mount an LVM partition directly. This is a container holding the data for the logical partitions, which are what you need to mount. Knoppix does not support LVM, so either use Recovery Is Possible (RIP, www.tux.org/pub/people/kent-robotti/looplinux/rip) or the Gentoo install disc from LXF72. After booting from the RIP disc, you need to type

sh /etc/rd.d/rc.lvm2 start

Type lvdisplay to see a list of your logical partitions. Each one will have a device name in the form: /dev/volume-group/volume-name. Use that to mount the logical volume, eg:

mount /dev/vg0/vol1 /mnt/otherroot

However, if both disks have been prepared by the Fedora Core installer, they will both have the same volume group name of VolGroup00, so you will not be able to access both at the same time. Remove the slave disc or disable it in the BIOS, then type

vgscan
vgchange --available n
vgrename VolGroup00 VolGroup01

Reconnect the slave drive and type

vgscan
vgchange --available y

Now your master drive's LVM partitions will be in /dev/VolGroup01 with the slave's partitions in /dev/VolGroup00. You could use a more descriptive name for the master drive's volume group if you prefer. You will need to edit /etc/fstab to reflect the changed names so that you can still boot into Fedora Core 4. </answer>

<title>What modem?</title>

<question>I'm entirely new to Linux, and am not particularly great with computers in general ­ any technical terms I've learned have all been in the space of a week! I was enticed by Debian 3.1 on the cover CD of September's magazine [LXF70] and decided to have a go at installing it over WinXP. I've managed to get to get to the GUI, and I've had a look around KDE and it looks brilliant. However, my modem doesn't work. I've discovered that it is a Winmodem, and that apparently I can install a driver called slmodem to make it work. But it is just so complicated! There are swathes of information but it's technical. I had a go at installing slmodem, following the advice on www. laclinux.com, and things seemed to be going OK until I needed to find a file /etc/modprobe.d/slmodem, which didn't exist. Here is some info about my system.

Machine IBM Thinkpad G40
OS Debian 3.1
Kernel 2.6.8
Modem Agere Systems AC'97(COM3)

lspci gives the following:

`0000:00:1f.6 Modem: Intel Corp. 82801DB/DBL/DBM(ICH4/ICH4-L/ICH4-M) AC'97
   modem controller (rev 01)(prog-if 00[Generic])'.

I'd really hate to go back to Windows having looked at Debian Linux. Please help, because I am almost converted! </question>

<answer> The instructions you refer to are not particularly verbose; they presume a reasonable familiarity with installing from source and configuring by hand. Fortunately, you don't need to do any of this, as the slmodem drivers are already available for Debian, although not included on the LXF70 cover CD. You can install them easily with Synaptic, but first you need to add the standard Debian repositories to your sources list. Add the following lines to /etc/apt/sources.list:

deb http://http.us.debian.org/debian/stable main contrib non-free
deb http://non-us.debian.org/debian-non-US/ stable/non-US main contrib
non-free
deb http://security.debian.org/ stable/updates main contrib non-free

Now fire up Synaptic, search for `sl-modem', right-click Sl-modem-daemon and mark it for installation, then press Apply to install this and all its dependencies. Synaptic will also take care of configuration for you, including creating the files mentioned in the Readme you read. </answer>

<title>Wireless networking</title>

<question>I'm trying to get online. I have an ADMtek 802.11b wireless card, and Ubuntu has found a driver for it. I'm trying to connect to our LAN, which has WEP encryption. The settings are:

Mode Managed
ESSID Eleven
Key *** (number 4)
Interface eth1
Channel 1

Would it be possible to walk me through the steps? So far (in a terminal window) I have:

iwconfig eth1 mode Managed
iwconfig eth1 essid eleven
iwconfig key restricted *** [4]
iwconfig eth1 channel 1
ifconfig eth1 broadcast

It won't connect, so have I forgotten anything here? I would prefer to do it using a terminal, as I'm not too sure what the tools do. </question>

<answer> It looks like you have done just about everything needed, except bring up the interface. Does your LAN use DHCP? If so, you need to drop the ifconfig command you are using and run

dhclient eth1

after the iwconfig commands. This will cause the interface to go online and fetch its IP address along with DNS and routing information from the network. Otherwise you will have to do this with the ifconfig and route commands, for example:

ifconfig eth1 192.168.1.3 up
route add default gw 192.168.1.1

Obviously, you will need to replace the addresses of your computer and the Internet gateway/router with the correct values. You will also need to add the addresses of your LAN or ISP DNS servers to /etc/resolv.conf. None of this is necessary if you use DHCP. Most wireless access points and routers have an option to provide DHCP services. It is usually turned on by default, so running the iwconfig commands you gave followed by dhclient should be enough. However, there is a much easier way. Select System > Administration > Network from the Gnome menu bar and enter your settings. The only drawback with this method is that it only allows you to set one WEP key and it defaults to open mode. This is easily fixed by editing the entry in the /etc/network/interfaces file to look like this:

iface eth1 inet dhcp
   # wireless-* options are
implemented by the wireless-tools
package
   wireless-mode managed
   wireless-essid eleven
   wireless-key restricted
   wireless-key4 123456789ABCDEF

Now you should find the interface starts as soon as the card is detected with no need for any action on your part. </answer>

<title>Wrong cron</title>

<question>I have been writing a small script that makes a backup of some files from one server to another over FTP. The script works fine when executed at the command line over SSH. However, when scheduled to run every two hours something is not working and the script gets run repeatedly.

 * */2 * * * /bin/bash /home/aport/backupfiles.sh >/dev/null 2>&1

To work around the problem I modified the script to repeat itself every two hours in an infinite loop. This worked when signed in interactively over SSH. Yet disaster struck again when I started the script in the background as /bin/bash ./backupfiles.sh >/dev/null 2>&1 & All works well until I try to exit the SSH session where my SSH client, Putty, inexplicably hangs and has to be closed manually. If I log in again I see that the script is still running through ps. Help! </question>

<answer>Since the minute field in the above crontab has not been populated, the scheduled job above finds itself running the script every minute for every second hour. The amended crontab should run the script at five minutes past every two hours:

  5 */2 * * * /bin/bash /home/aport/backupfiles.sh >/dev/null 2>&1

The second issue seems to relate to the fact that when the script was executed in the background it was not fully detached from the controlling terminal. The following recipe will allow you to background the script and exit the SSH session.

  $ nohup /bin/bash backupfiles.sh  >/dev/null 2>&1 >/dev/null &

Besides having both standard output and standard error redirected to /dev/null, standard input is redirected from /dev/null while nohup makes the executed command immune to any hangup signals. If output is not redirected, nohup will write any output to the file nohup.out, which may be desirable to audit the outcome of your backup script. </answer>

<title>Je ne comprend pas</title>

<question>Whenever I connect to my Linux server (Fedora Core) over Putty I get funny French-looking characters replacing some punctuation characters when viewing man pages. This does not happen when I log in at the console. </question>

<answer>Unicode is a character coding system designed to support more than just the Latin alphabet and the various European accentuations and other eccentricities. UTF-8 is an 8-bit encoding form for the Unicode character set and is quickly becoming the encoding scheme of choice across the board. For a good read on Unicode and UTF-8 check out their entries in Wikipedia and Paul Hudson's PHP tutorial on page 92. Most recent Linux distributions use UTF-8 as the default encoding for most locales yet your SSH client may be defaulting to the Latin-1 character set (ISO-8859-1). This will surely garble up more than just man pages, making Ncurses-based applications that use pretty borders and so forth look impressively hideous. To set Putty to use UTF-8, follow the menus through Window > Translation > Character Set On Received Data = UTF-8. While there is nothing to gain in permanently changing the default character set away from UTF-8, it is easy to switch to Latin-1 when logged in by changing the LANG environment variable:

$ export LANG=en_GB.ISO-8859-1

</answer>

<title>Boot locker</title>

<question>I have tried all I can to get the Debian and Fedora Core LXF70 CD booting. But all my efforts proved abortive. I have used the method on page 116, Booting The CD, but it didn't work. The Smart Manager Bootloader could boot any other CD but not my ISO CD. Could you tell me anything else I can do to boot the CD? There is nothing wrong with the disc itself, the problem is with the BIOS of my machine that is not recognising the ISO on the CD. </question>

<answer>I assume you mean Smart Boot Manager for Smart Manager Bootloader. Your mention of ISO and CD leads me to believe that you have created CD ISO images for the DVD, using mkiso or winmkiso, and written them to CD-Rs. Especially as you also mention Fedora Core, which wasn't on the CDs. The usual cause of this problem is the way you write the ISO to the disc. If you copy it as a file, the disc will not boot. Look at the contents of one of the discs. If all you see is the single ISO file, you have copied the file instead of using it as an image. You should see a lot of files on each disc. This is because each ISO file is a complete image of the contents of the CD, all the files plus the booting information, so it needs to be copied to the disc in a different way.

In K3b, select Tools > Burn CD Image, pick the image file and click Start. If you want to burn the images in Windows, Nero is probably the best choice. Go to File > Burn Image from the menu and select the ISO image file in the dialog. When the Write CD dialog opens, go to the Burn tab and select Write then Finalise. Press the Write button to create the CD.

To use Easy CD Creator, select File > Record CD From CD Image from the menu. When the file dialog opens, set the Files Of Type drop-down to ISO Image Files. Select the ISO image you wish to burn and click Open. In the Record CD Setup window, choose Track-at-once and Finalise CD. Click OK to create the CD. You can find more information on using (and obtaining) ISO images on the LinuxISO.org website. The most relevant information is at www.linuxiso.org/viewdoc.php/howtoburn.html and www.linuxiso.org/viewdoc.php/isofaq.html. </answer>