Answers 90

From LXF Wiki

Answers 90

<title>Disappearing buttons</title>

<question>I am using Ubuntu 6.06 from LXF83 on a Compaq Presario SR1720NX and am very new to this. When I try to add an Epson Stylus CX4800 printer using Gnome CUPS, the bottom of the screen, which should show Cancel, Back and Forward or Apply buttons, is missing. I can use the Enter key instead of Forward, but on screen 3 I can't find a way to activate the Apply button. </question>

<answer>This would appear to be a problem with your screen resolution. If Ubuntu's installer was unable to get accurate information about your graphics card and monitor, it would have defaulted to a safe 640x480 resolution. This is too small to display the full Add Printer window. A quick fix is to hold down the Alt key, click in the middle of the window and drag it upwards to expose the buttons. Alt+clicking means you can drag from any part of the window, so you can move it upwards even if that means moving the titlebar off the screen. This will allow you to add your printer, but does not fix the cause. To change the screen resolution to something more suitable, use Preferences > Screen Resolution from the System menu. This should offer all the resolutions that are suitable for your combination of graphics hardware and display. If only 640x480 is offered, your hardware was not identified during installation. The Device Manager, from the System > Administration menu, will show you if your graphics card was identified correctly ­ it should be an ATI Radeon XPress 200 IGP on your computer. To change the settings for graphics card or monitor, you should run dexconf to probe the hardware and write a configuration file. It is wise to back up the existing configuration file first, so run this in a terminal:

cp /etc/X11/xorg.conf ~
sudo dexconf

This will generate a new configuration file in /etc/X11/xorg.conf after making a copy of the original in your home directory. Once you have done this, you will need to restart the X server. This can be done from the command line, but as you're a new user, restarting the computer is probably the easiest way to do it. If 640x480 is still the only resolution available to you, you will need to edit the xorg.conf file. Without seeing your existing configuration, it is impossible to say what needs changing. If you get this far and still cannot get past 640x480, I recommend you ask on our Help forum at www.linuxformat.co.uk, including the contents of /etc/X11/xorg.conf, the output from running lspci -v and details of your monitor. </answer>

<title>Timing tasks</title>

<question>I am having some minor trouble with Cron jobs on my SUSE 9.3 system. Placing scripts in the cron.hourly, cron.daily and cron.weekly folders works fine, but how do I control when the files in those directories are executed? Can I set whether weekly jobs are done every Sunday or Friday and whether daily jobs are done at noon or midnight? I have tried to track down the way this works but it isn't clear. As best I can tell, there is only one Cron job scheduled in the crontabs file that runs every few minutes for all of the folder-based Cron jobs. That Cron job seems to call a script that looks in all of the cron.* directories, keeps track of successes and failures, and somehow keeps track of which jobs need to be done when. </question>

<answer>SUSE 9.3 does this slightly differently from some other distros. Instead of running the contents of these directories at a specific time, it runs them according to when they were last run. You've got most of the way to discovering this yourself: the single line in /etc/crontab calls the run-crons script every 15 minutes. This looks for marker files associated with each of the /etc/cron.* directories in /var/spool/cron/lastrun. If the marker file is more than an hour/day/week old, it runs the scripts in the directory and updates the timestamp on the marker. If no marker file is present, it runs the scripts and then creates one. This all means that instead of, say, running the daily scripts at 4:30 every morning when system load is low, it runs them a day after they were last run. You can force a particular time by altering the timestamp on the files in /var/spool/cron/lastrun. This script will change the timestamp of each of the monthly, weekly and daily files to 4:30 am while leaving the date unchanged (otherwise you'd never run the weekly or monthly scripts).

#!/bin/sh
cd /var/spool/cron/lastrun
for i in daily weekly monthly
do
           if [ -f cron.$i ]
           then
                        touch -t $(date -r cron.$i
+%Y%m%d)0430 cron.$i
           fi
done

This uses the date command to extract the file's current date in YYYYMMDD format, adds the time you want (0430) and passes this to the touch command to update the file's timestamp. You can change the day for weekly scripts in a similar way. While this will switch the runtimes to a time of day more suited to you, bear in mind that any delay in running the scripts later, such as the computer being turned off at 4:30, will set the runtime to whenever the scripts were run. You could automate this by setting up a separate task in /etc/crontab to run this script at 0400 every day. </answer>

<title>Gentoo printing</title>

<question>I'm getting on surprisingly well with the installation I made of Gentoo, but I can't get my USB printer to print. I've gone through the Gentoo Printing Guide and other USB documentation most carefully. I've checked (and triple-checked) my kernel config options and I'm sure I've included everything I need. I've tried compiling with the USB parameters compiled into the kernel or as loadable modules and neither works. Neither does genkernel, so I don't believe it's a kernel issue. The printer is a Samsung ML-1210. It's a discontinued host-based printer, but it serves my needs adequately and has always worked fine with Linux. And it prints fine from Ubuntu Edgy from another partition on the same machine using the same USB port, so neither CUPS per se nor the hardware is the problem. If I open the Gnome Print Manager app, the printer is autodetected and the wizard offers me the same CUPS driver as other distros, but when I go to print a test page, nothing comes out the other end. The same happens when I use OpenOffice.org. OOo seems to think it has printed a document, but nothing appears. Doing lsusb shows:

   `Bus 002 Device 003: ID 04e8:300c
   Samsung Electronics Co., Ltd ML-1210 Printer'.

I checked /var/log/cups/error_log, and it showed nothing untoward that I can see. </question>

<answer>The first thing to do when encountering CUPS problems is to turn up the logging level. Edit /etc/cups/cupsd.conf by changing LogLevel from `info' to `debug'; then restart CUPS. In this case, there is a clue in the logs you supplied. You are using GPL Ghostscript, which doesn't properly support the binary drivers needed by a GDI printer (aka WinPrinter) like your Samsung. So unmerge ghostscript-gpl and emerge ghostscript-esp, which has better printer support, like this:

emerge --unmerge ghostscript-gpl
emerge --oneshot ghostscript-esp

It is also probable you need the openslp package, even though this is supposed to be an optional dependency of CUPS. SLP (Service Locator Protocol) is useful for other programs too, so add it to your USE flags in etc/make.conf. It is also worth adding foomaticdb, which doesn't affect CUPS directly but increases the level of printer support for some programs. Now rebuild any packages that make use of your changed flags, including CUPS, with

emerge --newuse --deep --verbose --ask world

This will display a list of packages that will be updated or installed thanks to your changed USE flags, which should include CUPS and OpenSLP. Press Enter to install them and restart CUPS when it has finished. USE flags are an important part of Gentoo and they are all described in /usr/portage/profiles/use.desc and /usr/portage/profiles/use.local.desc. Or you may find it easier to emerge Profuse and search, browse or set them in a GUI. </answer>

<title>Wi-Fi woes</title>

<question>I was wondering if you could help with a Wi-Fi/NdisWrapper problem. I'm trying to get a Belkin card to work under NdisWrapper using the rt2500 Windows XP driver. The online instructions are great and I detected the card, worked out what driver I needed and so on. I've installed NdisWrapper, installed the XP driver and when I type ndiswrapper-l it shows the driver installed and hardware present. I then did modprobe to load NdisWrapper into the kernel, configured the wireless LAN settings and it all worked fine. When I rebooted, of course, it forgot everything and I now can't get it work. NdisWrapper still shows the driver installed and hardware present, but the lights are off on the card and when I try to configure it and get an IP using DHCP it says `no link present check cable'. I've rerun modprobe ndiswrapper, and had the card out and back in again, but the card still doesn't light up. </question>

<answer>This sort of problem is not uncommon with NdisWrapper, but it should not affect you. There is no need to use NdisWrapper with an rt2500 wireless card, because it should only be used when there is no Linux driver for the card (running Windows code as root is not something you should do if you can avoid it). Linux kernel drivers for the rt2500 chipset are available from http://rt2x00.serialmonkey.com and http://sourceforge.net/projects/rt2400. Don't worry about the 2400 in the name ­ the same project produces drivers for the rt2400 (802.11b) and rt2500 (802.11g) chipsets. These are semi-official drivers in that they are based on the original closed source drivers from Ralink, which it was subsequently encouraged to release under the GPL. As well as the drivers themselves, the project includes a GUI for wireless scanning and configuration. Some distros, such as Debian, include the drivers in their repositories, while with others you need to build from source. Without knowing your distro it is hard to give specific installation advice, but if you want to install from source, you will need the kernel sources installed. These are usually in a package called something like kernel-sources, linux-sources or kernel-devel. Make sure you install the package with the same version as your running kernel. As with all external kernel modules, if you ever upgrade your kernel you will need to reinstall the module. Because you may not have internet access until you do, I'd advise you to keep a copy of the source tarball or installation package somewhere safe. If you insist on using NdisWrapper, it looks like you need to run ndiswrapper -m to set up an alias for wlan0 in the NdisWrapper configuration. This forces NdisWrapper to load the module and driver </answer>

<title>House clearance</title>

<question>After installing various distros I have a cluttered /home/username folder and a menu full of unusable program entries. How can I delete these dead entries and sort the files into folders by extension, for example putting all GIF, PNG and JPEG files into one directory? I would also need to deal with duplicate files. This is in preparation for reinstalling Ubuntu. </question>

<answer>I would rename the /home/username folder before installation, then only copy over the files you need. This is probably easier than trying to clean out the detritus from a live home directory. The best program I have found for identifying and removing redundant files is Kleansweep, from http://linux.bydg.org/~yogin. Finding duplicate files is best done with Fdupes from http://netdial.caribe.net/~adrian2/fdupes.html. Use it like this:

 fdupes --recurse ~
 fdupes --recurse --omitfirst ~ | xargs rm

The first line will show all duplicate files, the second will remove all but the first occurrence of each file ­ use this with care. Sorting files by name is best done with the find command. You can move the files you mention with

 mkdir pics
 find ~ -iname `*.jpg' -o -iname `*.png' -o -iname
 `*.gif' -exec mv "{}" pics `;' 

</answer>

<title>Linux on a stick</title>

<question>I have a 2GB USB stick on which I have installed Slax Popcorn Edition. I can easily boot my computer from the stick and save all my changes to the system. Once in a while I run into a system where I would really need to boot it from the USB stick but rebooting is not possible, and because the host system is configured `tight' I can't use Qemu. I have been trying to find the solution to this problem. I tried VMplayer, Qemu and Moka to no avail: there is always something missing. My ultimate solution would be VMplayer installed in the USB stick with the OS image, but I haven't found a way to do this. Is there a solution in the market that would allow me to run my own OS from the USB stick regardless of the host machine? </question>

<answer>There are a number of reasons why you may not be able to boot a USB Flash device on some hardware. Some computers are incapable of booting from USB devices, although these are thankfully few now. Another scenario, which you seem to be experiencing, is that the owner of the computer has configured the BIOS to not boot from USB. If this is the case, trying to circumvent such restrictions is usually wrong and often illegal, unless you have the owner's permission. If you do have the go-ahead, you can often use a bootable CD to start the boot before passing control to the USB device; the Slax website (www.slax.org) contains just such a CD image. Another obstacle to booting from USB devices is that there are at least three ways of doing this. The device can be set up to boot as if it were a floppy disc, Zip disc or hard disk; the Slax USB installer appears to use the first option. Not all BIOSes can boot all three types, so you may need more than one USB stick. Damn Small Linux (DSL, reviewed last month) has a USB installer capable of creating either a USB-ZIP or USB-HDD-style bootable device, so it may be worth investigating. My laptop will not boot the Slax image but will boot a DSL installation on the same USB key. Some computers will not boot a USB Flash device from a partition larger than 256MB, so you should partition your drive with a 256MB partition for the OS and the rest for your data. Your VMware solution is ingenious, as it removes the need to reboot, but VMplayer needs files to be installed on the host operating system. Moka would appear to avoid that need, but it works by temporally installing files to the host Windows system, so needs to be run as an administrator. If the configuration of the computer is stopping you from booting a USB device, you should accept that or ask the owner to change it. If it is the way the computer boots from USB devices causing your problem, try a different distro. Mandriva has just announced Mandriva Flash, a complete desktop on a 2GB USB key. I haven't tried it yet ­ but you can find more information at www.mandriva.com/linux/2007/flash. </answer>

<title>OnTheGo... stalled</title>

<question>I am trying to create an `OnTheGo' disk from the Live distro version of SimplyMepis 6.0, but the disk selection box remains blank with no options offered. I have tried:

1 Booting with the USB Flash drive in place, then mounting it.
2 Inserting it after the computer has booted, then mounting it.
3 Logging on as both `demo' and `root'  .
4 Both an Advent 2GB and a Huke 512MB USB2 drive.

I know that the drive has been successfully mounted because I am able to save files to it ­ I have dragged and dropped the selection of background pictures supplied, and they are still there after a hard reboot. My computer is about six years old; it's a Pentium 3 with Windows 98SE installed and a USB2 PCI card as an upgrade. My only experience with Linux is with the Live distros on magazine coverdiscs over the past few months. As a Linux newbie I am at a loss as to what else to try. </question>

<answer>You have to be logged in as root to set up OnTheGo, and the USB device must not be mounted. After logging in as root, plug in the device. If the KDE dialog pops up asking you what you want to do, select Do Nothing. If the disc automounts, use KwikDisk from the Kicker panel to unmount it or type unmount /dev/sda1 in a terminal. Do not use the Safely Remove option from the disc's icon as this also removes the device's node in /dev, rendering it unavailable to the installer. Now run Mepis Utilities ­ select the option to create an OnTheGo disc and your drive should be available, most likely as sda. Once the process is complete, remove the USB disc (there's no need to unmount it) and select Log Out from the K menu, followed by End Current Session. When the login screen appears, plug in the USB disc, wait ten seconds for it to be detected and log in with a username and password of `onthego' If you created OnTheGo with encryption, you will be asked for the encryption password later. The OnTheGo disc only contains your personal data, which can be encrypted; you still need to boot from the Mepis CD. On the other hand, you won't run into any of the problems booting from a USB device mentioned in Linux On A Stick, and you can copy the .onthego.iso file to a different USB disc if you wish. </answer>

<title>Linux plans</title>

<question>I am looking at implementing Moodle as a course management system (ultimately with a web hosting service that already has Linux, Apache and MySQL). But is there a version of Linux that is best to start with? Moodle permits a Windows install but I think it is best to go all the way and do it right. </question>

<answer>Is there a version of Linux best to start with? I guess it depends on your preferences. As a Debian user, I would say try Debian, as it's very stable and easy to install. If you are a beginner I would opt for Ubuntu (which is based on Debian). The latest version is Ubuntu 6.06 LTS Server. I have experience on Debian and I can say it would take you 30 minutes maximum to install a Debian server from the moment you insert the CD and boot from it. The Debian package administration is extremely simple to use, using the command dselect. </answer>

<title>Batch editing</title>

<question>I need to grep for a particular `string' in a file and remove the entire line where the occurrence of the string is found. I want it to work across with a collection of files. Can you help? </question>

<answer>It is possible to use grep for this: grep -v string file will output all lines that do not contain the string. But sed is a more suitable tool for batch editing.

sed --in-place `/some string/d' myfile

will delete all lines containing `some string' To process a collection of files, you need to use a for loop (or find) because sed 's --in-place option only works on single files. One of these commands will do it:

for f in *.txt; do sed --in-place `/some string/d'
"$f"; done
find -name `*.txt' -exec sed --in-place=.bak `/some
string/d' "{}" `;'

Adding =.bak in the latter example makes sed save a backup of the original file before modifying it. </answer>

<title>VNC please!</title>

<question>I connect to my home server using VNC (not over SSH yet!). However, it doesn't bring up my `start' bar on KDE and I automatically log in as the person who started the VNC server (not tested with root!). I would like my system (Slackware 10.2) to start VNC on boot so I can vnc to the XDM/KDE login screen. My init is currently set to level 4. Any ideas, hints or advice on better software? My server doesn't have a monitor. </question>

<answer>Here's what you need to do to configure a VNC server. Note: the VNC server must be running, and it must be configured to run your preferred window manager. You can do this by editing the file $HOME/.vnc/xstartup to call your preferred window manager. Use startkde & for KDE, gnome-session & for Gnome or fvwm2 & for Fvwm2. Also, make sure you have run vncpasswd in $HOME/.vnc/passwd to create the password file. Red Hat provides an easy way to start up the VNC desktop at boot time. Use linuxconf to set the vncserver boot script (in /etc/init.d/vncserver) to come up at boot. The default bootscript, however, doesn't quite give the flexibility that I'd prefer. Edit /etc/init.d/vncserver, looking for the line that says

   su - ${display##*:} -c \"cd && [ -f .vnc/
   passwd ] && vncserver :${display%%:*}\"

Change it to look like this:

   su - ${display##*:} -c \"cd && [ -f .vnc/
   passwd ] && vncserver ${ARGS}
   :${display%%:*}\"

Then edit /etc/sysconfig/vncservers to this:

   # The VNCSERVERS variable is a list of
   # display: user pairs.
   # Uncomment the line below to start a VNC
   # server on display :1 as my `myusername'
   # (adjust # this to your own).
   # You will also need to set a VNC password;
   # run `man vncpasswd' to see how to do
   # that.
   # DO NOT RUN THIS SERVICE if your local
   # area network is untrusted! For a secure
   # way of using VNC, see <URL:http://www.
   # uk.research.att.com/vnc/sshvnc.html>.
   VNCSERVERS="1:jdimpson"
   ARGS="-geometry 1024x768 -alwaysshared"

Change the value 1024x768 in ARGS to represent the size of your actual X desktop. Add any other VNC server arguments that you wish to this ARGS variable. Also change jdimpson in VNCSERVERS to whatever user you wish to run the VNC desktop. The value 1 in VNCSERVERS makes the VNC server run as display 1. You can have additional desktops come up like this:

   VNCSERVERS="1:jdimpson 2:phred
   3:sysadmin"

On a Red Hat system, make sure the VNC server is running by executing this:

/etc/init.d/vncserver start

At this point, you can connect to the VNC desktop using any VNC client. </answer>

<title>Rather one-dimensional</title>

<question>I have successfully installed Mandriva Linux 2007 and am trying to enable 3D desktop effects. When I click on the 3D icon under Configure Your Computer/Hardware, everything is greyed out, with a message at the top saying `Your System does not support 3D desktop effects'. I have an Nvidia GeForce 6800GT, which ran perfectly with Mandriva 2006. What can I do to get the 3D desktop working? </question>

<answer>The most likely cause of this is that you are using the free nv driver for your graphics card. This driver does not support any sort of 3D acceleration ­ you need Nvidia's own drivers for that. These can be downloaded from www.nvidia.com as a single file that you run to install them. However, you will need several other packages installed before you can do this. At the very least you will need the kernel sources to match your running kernel. Mandriva no longer includes these on its DVDs, so you will need to add Mandriva's online repository to the Mandriva Control Center before you can install it. You may also need a compiler installed. The Nvidia installer comes with precompiled modules for a few kernel variants, but compiles them on the fly for others. Once the drivers are installed, you will have to edit your X configuration to use the new drivers. The Nvidia installer requires that you do all of this without X running, working entirely from a virtual console. Fortunately, there is a much easier way. The Penguin Liberation Front (PLF) is the "official unofficial" repository for Mandriva, containing a number of non-free (as in speech) packages and others that cannot be included in the main distro because of legal complications; such as libdvdcss, needed to watch encrypted DVDs. The first step to easy Mandriva software installation is to add this and the official Mandriva repositories to your system. Go to http://easyurpmi.zarb.org and select suitable mirrors for the Mandriva and PLF sources; those closest to you are usually best. Click on Proceed and it will display a screed of text for you to type in a terminal, but even that is easy. Open a terminal from the Mandriva menu with System > Terminals > Konsole and type su to become root, then drag your mouse over the text in the browser so that all of the text in the box, and nothing else, is highlighted. Now place the mouse over the terminal window, press its middle button to paste in the highlighted text and press Enter. You'll need to be online to do this and it will take a few minutes as it downloads lists of available packages. Now fire up the Mandriva Control Center (System > Configuration > Configure Your Computer), go to the software section and type `nvidia' in the search box. Select the package (it is currently nvidia-8774-4plf but the numbers may change as the 9000 drivers could be out by the time you read this), and click Apply. If any other packages are needed, they will be installed automatically ­ you only need to select the one package. Finally, go into the Hardware > Graphical Server section of the Control Center and select the Nvidia option for your graphics card. When you reboot you will be using Nvidia's drivers in all their 3D glory and you will be able to set up the 3D desktop effects. Have fun! </answer>

<title>From @ to "</title>

<question>I have had a hopefully minor glitch in installing SUSE 10.1. When I key in the at sign I get ". Similarly, double quotes gives @. I definitely selected English and UK in the setup as this was shown in the confirmation before the installation panel. Hopefully there is a way to correct this mishmash without reinstalling. Can you help? </question>

<answer>You will have to change the keyboard mapping. To do this, you need to edit the file /etc/X11/xorg.conf. Make sure you do take a backup of that file, in case you delete or edit the wrong line. This needs to be done logged as root (su -) ­ just open up a terminal and navigate to the folder /etc/X11. To back up the file it's as easy as doing this:

 cp xorg.conf xorg.conf-back

Edit the file using your favourite editor. Look for the line Option "XkbLayout" "whatever" change whatever for gb, save the file and restart your workstation (shutdown -r now). </answer>

<title>Seeking Zen calm</title>

<question>This may sound a little strange, but, I want to stop the little Zen-updater icon from appearing when a user logs in. Can you tell me how I should go about this? The reason why I want to disable it is that when a domain user logs in, Zen crashes, giving a lovely exception message. I am assuming this is because the domain users do not have a `local' user ID and cannot be looked up by the system. Also, it is not required for users to be able to perform system updates. </question>

<answer>The fix is very simple. There is a file called zen-updater-auto.desktop in the folder /etc/xdg/autostart. You would need to edit that file with your favourite editor (Vi, Pico or whatever) and comment out the line `Icon=zen-icon' You might then need to restart the Zen-updater application. </answer>