Answers 85

From LXF Wiki

Answers 85

<title>Questions for SUSE</title>

<question>I have just installed SUSE 10.1 and have the following queries. First, where do I install Mozilla plugins? I can't find a mozilla/plugins directory. Second, I created a user during installation but this doesn't have root privileges. How can I achieve this? </question>

<answer>Mozilla and Firefox plugins can be installed in one of two places, depending on whether you install as root or a user. System-wide plugins and extensions are stored in /usr/lib/firefox/plugins and /usr/lib/firefox/ extensions, respectively. Those installed by a user, which happens when you install directly from a website such as http://plugindoc.mozdev.org or http://addons.mozilla.org, go into the appropriate directory under the user's home directory. This is .mozilla/firefox/xxx.default, where xxx is some random string of characters. You shouldn't normally need to manipulate these files directly; installing, updating and removing extensions can be done from within Firefox. Your normal user does not, and should not, have root privileges ­ otherwise what's the point of a separate root user? When you need to run something that requires root privileges, Yast (or whatever program you are using) will usually ask for the root password, which you set during installation. The program will switch to root for as long as is needed and then switch immediately back to your normal user. If you need to run a terminal command as root, type

su -c "command you want to execute"

to run a single command or

su -
somecommand
someothercommand
...
logout

In both cases, you will need the root password. </answer>

<title>Installing CentOS</title>

<question>I installed CentOS 4.3 on my Pentium III, Windows 98 computer and it worked great. At the top of page 70 of LXF81 [Coverdisc], it says I need a Pentium CPU. I also have an AMD FX-53 with Windows XP and Fedora 5. I would like to replace my Fedora 5 with CentOS 4.3 on this computer also, but am afraid to try. Would it be OK to try to install CentOS on my AMD computer? If not, is there a way to do it with some third-party software or will there be an AMD version in the future? </question>

<answer>That should really say "Pentium-class CPU" That is, anything compatible with an i586 processor. Pentium is Intel's trademark, but AMD CPUs are compatible. You can run CentOS from the coverdisc on your FX-53, but you wouldn't be getting the most out of the chip. The FX-53 is a 64-bit processor, but would switch to 32-bit mode to run the supplied version of CentOS. That will still be faster than most 32-bit CPUs, and it will be fine for trying out CentOS to see whether you like it, but if you want the best performance, you would be better off with the 64-bit version of CentOS, available for download from www.centos.org. If you are not able to download it, check the adverts at the back of the magazine for someone who will be able to supply you with it on a disc. </answer>

<title>Hung up</title>

<question>I'm trying to mount an NFS export from my server to my workstation, and it keeps hanging. There is nothing in any logs to indicate what's going wrong ­ are there any common causes? </question>

<answer>NFS relies on a number of RPCs, or remote procedure calls. The key to all of this is the portmap service. This processes RPC requests and sets up connections to the correct RPC. Check that it's running by looking at the process list:

[root@test gnump3d-2.9.8]# ps -ef | grep portmap
rpc    2584 1 0 Jul23 ?         00:00:00 portmap
root 30843 30474 0 07:45 pts/4 00:00:00 grep
portmap

Assuming your NFS server service is started, you should see the following RPCs running: mountd, nfsd, lockd, statd, lockd, rquotad and idmapd. Depending on your distribution these may be started by the startup script for NFS. If they aren't, it's possible to start them manually:

[root@test]# rpc.mountd
[root@test]# ps -ef | grep mountd
root 30906 1 0 07:54 ?            00:00:00 rpc.
mountd

You can repeat this for the other services, but you will need to add them to the appropriate startup script to ensure that they are restarted at boot time. </answer>

<title>Silence is not golden</title>

<question>I am quite a new user of Linux and have just installed SUSE 10.1. When I tried to use Amarok on this installation I got no sound, even though the soundcard appeared to be working (it sounds at startup, for instance). I noticed that you had a new version (1.4) on your coverdisc [LXF82] so I have tried to install it through Yast. Can you tell me how I specify the new program on the LXFDVD to Yast? I know this must be a very basic question but at the moment I do not know how to do it. </question>

<answer>There are two separate questions here: one about Amarok and one about software installation. Look at the status bar at the bottom left of the Amarok window when you try to play a song ­ this will give you some feedback. If the song appears to be playing but you hear nothing, open the mixer (usually a speaker icon in the taskbar) and make sure that the volume controls are set high enough. If Amarok refuses to play the song, it is probably your sound engine configuration at fault. Look in the Engine section of the Settings window. If this is set to 'aRts' and you are running a Gnome desktop, you are unlikely to hear anything; because Arts is the KDE sound engine. The best setting for this, in terms of both quality and compatibility with all desktops, is Xine. You may also need to set the output plugin ­ Autodetect normally works; if not, set it to ALSA. Yast is more suited to installing software from the repositories that it knows about. These include the SUSE directory of the install disc and any online update servers that may have been added automatically during installation, or manually by you later. You can tell Yast to install from individual RPM files from the command line, as root, with

su
yast2 --install /media/LXFDVD82/Sound/AmaroK/SUSE/*.rpm

to ask it to install the packages from the DVD. However, Yast doesn't handle dependencies when run this way and may well fail without telling you why. It is better to use the rpm command directly:

su
rpm -Uhv /media/LXFDVD82/Sound/AmaroK/SUSE/*.rpm

It may still fail, but at least it will tell you what is missing. A more satisfactory solution is to add a repository to Yast containing the newer software. You can find a list of such repositories, along with instructions for adding them to Yast, at http://en.opensuse.org/Additional_YaST_Package_Repositories. </answer>

<title>Logjam!</title>

<question>Can you help me reduce the number of identical log messages? When I first started using Linux there were lines of 'message repeated x times', but these have become rare. The problem is not really the size of the files but the difficulty of finding importan single messages. I have appended below some of the common sequences that occur with Mepis 3.4. The first group of messages comes from my Zip drive breaking up the log through booting and beyond. The larger figure is the total size of the disc. Only the smaller is supplied by the partition table. The second group looks as if something is sending pings at one-minute intervals. So 10.10.10.134 is the local IP address and 10.10.10.91 is remote. The third group produces hundreds of these messages within a few seconds but this occurs only occasionally. You can see the signs of a race condition. There seems to be little effect on the functioning of my machine but I would like to be able to find more serious errors without having to trawl through so much guff. Here are examples of the messages:

Jul 18 19:07:40 localhost kernel: hdd: The disk
reports a capacity of 752896000 bytes, but the
drive only handles 752877568
Jul 18 19:07:40 localhost kernel: hdd: hdd4
Jul 18 19:13:20 localhost kernel: martian source
10.10.10.255 from 10.10.10.134, on dev eth1
Jul 18 19:13:20 localhost kernel: ll header: ff:ff:ff:ff:
ff:ff:00:0a:5e:1d:53:c2:08:00
Jul 18 19:14:00 localhost kernel: [unmap_page_
range+217/232] unmap_page_range+0xd9/0xe8
Jul 18 19:14:00 localhost kernel: [unmap_
vmas+172/376] unmap_vmas+0xac/0x178
Jul 18 19:14:00 localhost kernel: [unmap_
region+125/242] unmap_region+0x7d/0xf2

</question>

<answer>I can think of three approaches to this. The first is to investigate the cause of the messages and deal with it, preventing them ever appearing. The system.txt file you sent was extremely helpful, as it helps pinpoint the cause of the third set of messages, which occur because you are using a 2.6.15 kernel with an Nvidia graphics card. The solution is to either upgrade to a newer kernel, or install SimplyMepis 6.0, which was included on the LXF84 coverdisc. The 'martian' network entries refer to unroutable packets. In this case they are coming from an unroutable address ­ 10.10.10.255. You can stop their being logged by doing echo "0" >/proc/sys/net/ipv4/ip_log_martians as root, but it would be a good idea to find the cause first. These could be caused by faulty or misconfigured network equipment, or they could be a sign of someone trying to exploit your computer. If they still occur while your network is disconnected from the internet, the cause is local, otherwise check your firewall. The Zip error may be unavoidable, which brings us to the next approach: filter out everything you don't want to see. Run the logfile through grep to remove the 'noise' before viewing it, for example

grep -v -f /var/log/filter /var/log/messages | less

where /var/log/filter is a file containing the patterns you wish to filter out, one per line, such as

localhost kernel: *hdd:

The third approach to try is the most comprehensive, but also the most complex. You can configure the system logger to filter messages into different files (or even /dev/null). Mepis uses sysklogd, which has fairly limited filtering. You could replace sysklogd with syslog-ng and put this in /etc/syslog-ng/syslog-ng.conf to have all messages relating to hdd sent to a separate file.

destination messages { file("/var/log/messages");
};
destination d_zip { file("/var/log/zip"); };
filter f_zip { match("hdd"); };
filter f_nozip { not match("hdd"); };

Then replace the line that reads

log {source(src); destination(messages); };' with
log { source(src); filter(f_nozip); destination(messages); };
log { source(src); filter(f_zip); destination(d_zip); };

The first filter matches all messages about hdd, which are sent to a separate file. The second matches those that don't contain hdd, which go to the standard log. You may need to tweak the search string, but keep it the same for both filters or you could lose messages. </answer>

<title>Printing and scanning</title>

<question>I recently installed a version of SUSE from the cover DVD of your April issue [OpenSUSE Slick, LXF78]. It all works fine but for the fact that it will not print from any application. My printer (an HP 1200) is recognised correctly but when I try to print, the jobs are processed and wait in the printer queue indefinitely ­ any ideas? Also, I am trying to find a flat-bed scanner for home use (not too expensive) that will work with, say, Xandros (or SUSE). Linux scanner compatibility seems a problem. A final question: why is the /dev directory such an apparent mess? Why not have the software interrogate the hardware and create the device files in /dev as required? Extra device files could be manually added if needed. </question>

<answer>It is difficult to say exactly what is wrong with your printer setup without more information. Did a test print work when you first set up the printer? The best source of information is the CUPS error log. Run this command in a terminal:

tail -f /var/log/cups/error_log

If you get an error message about inability to read the file, use su to log in as root then run it again. Now try to print something and you will see messages from the CUPS print system in the terminal. The error messages should help you find the cause. It is possible that the printer is simply disabled (this happens after an error). To fix this, you would clear the print queue and try again. You can do this from the Gnome or KDE print manager, or from the command line with

/usr/bin/enable PrinterName

This should be done as root, and you must give the full path to the command. Scanner support in Linux is good these days, using the SANE (Scanner Access Now Easy) system. The website (www.sane-project.org) has a comprehensive list of supported scanners. If you want a personal recommendation, I bought a Canon LiDE 60 a few months ago. It gives good scan quality and works well with SANE. There is no support for the buttons on the front of the scanner (yet) but scanning from applications gives excellent quality. Many of the device nodes in /dev are created on demand. Plug in a scanner, printer or USB stick and its device node appears; remove it and they disappear. The /dev directory looks busy because there are so many device nodes used by the system, even though users may remain blissfully unaware of them. A static /dev directory used to be the norm, but modern Linux systems use udev to create device nodes in response to hardware detection. </answer>

<title>Everything in its right place</title>

<question>I've heard the term FHS banded about. What exactly is it and what is it for? </question>

<answer>The FHS or Filesystem Hierarchy Standard is a set of requirements or guidelines for where file and directories are located under Unix systems, and what some system files should contain. For instance, it advises that "applications must never create or require special files or subdirectories in the root directory", so that root partitions can be kept simple and secure to adminstrate. Most Linux distributions adhere to the FHS loosely, which is why the filesystem layout is fairly similar from one distro to another. Each of the folders in the FHS has a defined purpose. For example, /dev contains entries referencing devices attached to the system, /lib houses libraries required to run binaries in /bin and /sbin, while /usr holds most of the binaries and libraries which are used by you, the user, and as such is one of the key folders in any Linux system. In a nutshell, the FHS is essential to the organised chaos within Linux. It means that users like you can come to expect certain directories in certain locations, and it also means that programs can 'predict' where files are located. The first filesystem hierarchy for Linux was released in 1994. In 1995, this was broadened to cover other Unix-like systems and take in BSD knowhow, and was renamed FHS. It is overseen by the Free Standards Group, which also runs the Linux Standards Base project. While all distros stick to the principles of FHS, some use the layouts in slightly different ways, or omit some of the usual directories, which is one of the reasons why different Linux systems are sometimes incompatible. </answer>

<title>Archiving images</title>

<question>When using mogrify to resize and change the format of a collection of images, how do I set a target directory for the output, and also make the name of the file contain a numeric string as a timestamp? I work with groups of young kids and things can get very busy. Often I am stalled by opening a digital photograph in Gimp, resizing it and saving it to the $HOME/.tuxpaint /saved/ directory as a PNG file so they can use it with Tux Paint. But the delay means that the other kids are left waiting. So far, my command would something look like this:

mogrify -antialias -geometry 448x376 -format png digicampic.jpg

but this does not place the finished file into $HOME/.tuxpaint/saved/, and I would also like the command to rename the file with a timestamp such as 20060719162549.png. </question>

<answer>Firstly, well done for getting kids working with Linux at such an early age. The more that grow up realising that Windows is one choice of several and not compulsory, the better. ImageMagick's mogrify command is for modifying images in place, so saving to another directory is out. For this, you need the convert command from the same package. This should do what you need:

for PIC in *.jpg
do
  convert -antialias -resize 448x376 ${PIC}
$HOME/.tuxpaint/saved/$(date
+%Y%m%d%H%M%S).png
done

The main problem with this is that you could end up overwriting one picture with the next if they are processed within a second of each other. You could get around this by testing if a file of the same name already exists and adding an extra digit to the name if it does. But as you are using the time of conversion, not the time at which the picture was taken, you could simply pause for a second if there is a clash.

for PIC in *.jpg
do
  while true
  do
   DEST=$HOME/.tuxpaint/saved/$(date
+%Y%m%d%H%M%S).png
   [ -f ${DEST} ] || break
   sleep 1
  done
  convert -antialias -resize 448x376 ${PIC}
${DEST} && mv ${PIC} done/
done

This version also moves the picture to another directory if the conversion is successful, so you can run the command again to process newly added images. If you want to use the time the photo was taken in the filename, replace the$(date... part of the command with

$(date -r ${PIC} +%Y%m%d%H%M%S).png

This will use the last modified time of the file for the timestamp. The date man page details the various options. A more sophisticated approach would involve reading the EXIF information from the picture. There are a number of programs for this ­ I prefer Exiftool (www.sno.phy.queensu.ca/~phil/exiftool). </answer>

<title>I want both!</title>

<question>I have installed Fedora Core 4, but nowI'm in a quandry. I don't know which is better: Gnome or KDE. Can I have them both installed on the same computer? Also, I tried to download K3b but I could not install it. Do you know why? </question>

<answer>Yes, it is possible to have more than one desktop environment installed on your computer. Below the username box on the Gnome login screen, there is a menu named Session. This lets you choose which of the installed desktop environments you load. If your system is set up to boot straight into Gnome, select Log Out from the System menu and you'll see the Session menu in the login screen Of course, you have to have KDE installed for this to work, but that's as easy as selecting the KDE group from the package manager. The most likely reason why K3b failed to install is that you don't have the KDE libraries installed. You don't have to be running on KDE to use K3b, but you do need the basic KDE libraries available. Similarly, when you are running KDE, you will still be able to use Gnome programs on it, because you have the Gnome framework installed. </answer>

<title>Proc of gold</title>

<question>When I issue a mount command, I see a filesystem called /proc that is not on my hard drive. Can you tell me what is it, and why is it there? </question>

<answer>On a typical Linux system, when you issue the mount command you will see at least two filesystems that don't appear to be accessible in the normal way. The first of these is the /proc filesystem, and the second will show as something like 'none on /dev/shm'. As you may know, /dev/shm is a filesystem that is used to manage virtual memory on your system, and doesn't create anything on your local disk. The /proc filesystem contains virtual files that are like a window into the current state of the running kernel. It does not occupy any space on the hard drive, and therefore is referred to as a virtual filesystem, but acts and looks like a disk-based filesystem. Viewing some of the files in /proc can give a great deal of information about your system. If you look at /proc/meminfo, you'll get a nice stack of information about the memory on your system:

 # cat /proc/meminfo
 MemTotal:       515484 kB
 MemFree:        74656 kB
 Buffers:       5912 kB
 Cached:       352464 kB
 SwapCached:          12 kB
 Active:      126788 kB
 Inactive:    289772 kB

Looking at this information, you will see that not only does it tell you how much memory you have, including swap and real memory, but it tells you exactly what the current state of the memory is in terms of free space, and how it's allocated. Chances are that if you run this command again, some of the information will have changed, and this is generally the whole point behind /proc. It's like a snapshot of the current system state. The more advanced user can actually change the functionality of the kernel temporarily by editing the files in the /proc filesystem. For example, to turn on IP forwarding (to allow your system to act as a router passing network traffic arriving on one network interface out on another interface), you can issue the following command:

 echo 1 > /proc/sys/net/ipv4/ip_forward

Do be aware, however, that this status is not permanent and will be lost at the next reboot. To make it permanent, you need to edit the /etc/sysctl.conf file to include the following:

 net.ipv4.ip_forward = 1

To learn more about your system, have a root around in /proc. You can't break anything just by looking, and even if you do make a mistake and edit one of the /proc files accidentally, a quick reboot will wipe any changes you've made. </answer>

<title>Lost in the Ether</title>

<question>I would like to sign up for NTL's cable broadband package, but they tell me they do not support Linux. Does this mean the system will not work with Linux, or just that they cannot provide advice? I do not doubt that if I plug the modem into the Ethernet card it will be picked up, but how do I connect it to the broadband system? Do I use KPPP with different settings or what? I'm wondering if I need a specialist provider or if I can use any provider as long as I have 'the knowledge'. </question>

<answer>I can assure you that you can use NTL broadband internet with Linux ­ I had it myself. All you do is connect the Ethernet port of the modem to the Ethernet port of your computer (you should not need a cross-over cable) and set your network interface to use DHCP. You do not need KPPP, KDE's internet dialler, as cable broadband does not use PPP. You will need to switch on the modem and wait for the RDY and SYNC lights to become stable. This means that the modem is connected to NTL. Now you can bring up your Ethernet interface and it will get its IP address, routing and DNS information from the modem. However, you will find that with NTL, as with most ADSL broadband providers, Linux will work with their service but they don't provide support. The notable exceptions (in the UK at least) are UK Linux and The UK Free Software Network, at www.uklinux.net and www.ukfsn.org respectively. Whichever provider you choose, the most important decision is that you use an Ethernet-based modem. NTL provides one, whereas most ADSL ISPs, especially the cheaper ones, offer a USB modem as standard. Accept the 'free' modem by all means, but budget £20 or so for an Ethernet ADSL modem. </answer>

<title>Fast track learning</title>

<question>I am a new Linux user, and through fiddling with distros (the best way to learn) I have become adequate with Linux. I can use the terminal and enter commands, open RPMs and debug the system (as in if I have a problem, I run to the internet for help). I would appreciate it if you could run a series of sections to help beginners get to grips with the OS. I know there are so many distros that it may be hard to make a beginner's guide that covers them all, but perhaps I could look around and get the best learning distro. If not, could you at least point me in the direction of a guide that I can read at my leisure? </question>

<answer>The First Steps series of tutorials that we have been running for a couple of years have covered much of what you want. But the best distros for learning Linux tend to be the ones that are less friendly to beginners. There's an old saying 'Use Red Hat and you learn about Red Hat, use Slackware and you learn about Linux'. While it is not as cut and dried as this, the likes of Mandriva and SUSE also fall into the first category, while Debian and (most definitely) Gentoo fall into the latter. GUI tools 'protect' the user from the inner workings, so impeding the learning process. There are a number of websites that provide excellent documentation for those learning Linux, at all levels. One of the most highly rated is Rute, at http://rute.2038bug.com. You can read this online, download it in PDF or HTML format for offline reading, buy it as a genuine treeware book or read it in the Help section of this month's DVD. One of the best introductions to command line usage is LinuxCommand.org (http://linuxcommand.org). </answer>