LJ Archive CD

Best of Technical Support

Various

Issue #60, April 1999

Our experts answer your technical questions.

Accessing /dev/fd0

I successfully installed Red Hat v5.1 with X as the GUI. I have O'Reilly's book Learning Linux, which is a good reference. The only problem I have is that I cannot access /dev/fd0. When I type this command in an xterm, a message states that access to the device is forbidden. What am I supposed to do? I have looked up information on the Linux USENET listing, but I cannot find anything specific. —P. Kincaid, pkincaid@osf1.gmu.edu

You either need to be root to access /dev/fd0 or belong to a group (e.g., floppy) to which users with access permissions to /dev/fd0 belong. On my system, it looks like this:

 brw-rw-r--  1 root  floppy  2,  0 mai  5  1998 /dev/fd0

—Marc Merlin, marc@merlins.org

The simplest way is to run the following command as root:

chmod 666 /dev/fd0

Bear in mind that this has security implications, especially on a multiuser system. —Scott Maxwell, s-max@pacbell.net

Hidden config File in X

When I want to start the X Window System, the system shows error messages—the first few lines look like this:

Could not find config file!
 -Tried:
      /root/XF86Config
      /etc/XF86Config
      /usr/X11R6/lib/X11/XF86Config.slackware
      /usr/X11R6/lib/X11/XF86Config
 Fatal Server error:
 No config file found! ...

—Fazli Yusof, fazliona_14@hotmail.com

You have not set up X on your system; it is installed, but not configured. A good way to get started is to run xf86config. This program will step you through several questions and then set up a simple XF86Config file that should get you up and running quickly. Once you get X running you can make any other changes you might need. —Chad Robinson, chadr@brt.com

Upgrading an Old Kernel

I want to upgrade my kernel. The one I am currently using is a few years old. Can I upgrade all the way to 2.0 or 2.1? One of the things I need in a new kernel is support for the CMD 640 chip. Right now, Linux can see only one of my hard drives. I am also looking for something that will play audio CDs from my NEC 260 2X CD-ROM. A few more specifics: I downloaded kernel 2.0.33 (I think). It has the support for the CMD chip. I can get all the way through make config, but then I get errors when trying to compile the kernel. It tells me I need gcc 2.6.3 or above. I got 2.7.2 from an FTP site and installed it along with the current libraries. However, now when I type gcc, it says it cannot execute the binary file. What's up? —Jim Coonradt, coonmanx@yahoo.com

A lot has changed since your system was brought up. Linux went through three binary formats (a.out, elf/libc5 and elf/libc6 aka glibc). There is a lot to fix and upgrade on your system to get a recent kernel to compile and run properly. If you are interested in doing so, you can look at /usr/src/linux/Documentation/Changes/ on a recent kernel, and learn about the three binary formats, but be prepared to do a lot of reading. A much easier alternative is to back up your user data, and install a brand new Linux distribution. If you are interested in running 2.1 and the upcoming 2.2 kernels, you should consider installing Red Hat 5.2, Debian 2.0 or higher, or SuSE 5.3. —Marc Merlin, marc@merlins.org

Wrong Date

The date on my Linux box is not correct. My time is GMT+5. I set the universal time so it starts by subtracting five hours from it. My current date shows this:

# date
Sun Jan  3 05:17:39 GMT+5 1999
# date -u
Sun Jan  3 10:17:43 UTC 1999

—Bilal Iqbal, storm@compucraze.net

To set the timezone, you should make the following symbolic link:

ln -s /etc/localtime /usr/share/zoneinfo/US/Pacific

To set the time, you can do it relative to UTC or your local time; it depends on what time you stored in the BIOS' clock. Read the man pages for hwclock (or clock if the first doesn't exist) for more information. —Marc Merlin, marc@merlins.org

When Not to be root

When I use TELNET to log in to my system, I cannot log in as root (I get the login incorrect message). However, I can log in as myself and use su to become root using the root password. What's up? —Scott Hall, shall@ccae.org

The file called /etc/securetty defines the terminals a root user may log in to. Make sure ttyp0, ttyp1 and so forth are defined in that file. Each TELNET session uses one of these terminals, so define several. If you don't and normal users are logged in on p0 and p1, you will not be able to log in as root on p2. —Chad Robinson, chadr@brt.com

TELNET is set up to deny root access as a deliberate security measure. This keeps a cracker from compromising the root account directly—he has to first compromise a user account, thereby making it twice as hard to become root on your Linux box.

Incidentally, the potential cracker's job is made even harder by not indicating that no password will work for root when logging in remotely. The cracker can't tell whether his login attempt is failing because he has the wrong password, or because remote root logins are entirely disabled. —Scott Maxwell, s-max@pacbell.net

Shells and a.out vs. ELF

I think they are somewhat similar so I'll group my questions:

How can I tell if I have a.out binaries on my system? Any mention of these suggest them to be an old format. Is there anything still around that I'm likely to be using that requires a.out support in the kernel?

Also, how can I tell which shell(s) I need on my system? It seems several get installed, but I'd be happy to stick to just one. Do I need to scan for scripts that may use something other than the default shell? If so, could someone suggest an appropriate scan script to demonstrate “The Power” to a newbie, please?

Perhaps the savings are modest for each of these, but so are the resources for my foray into the Linux world! —Barry Johnson, barryjj@ibm.net

To search for a.out binaries, type:

find / -mode +400 -exec file {}\; | grep MAGIC

The find command looks for files with the executable bit set. file prints what they are and grep extracts a.out files (identified as either ZMAGIC or NMAGIC or similar strings. System scripts use only /bin/sh (no csh, zsh or other shell). On the other hand, some scripts may be written in other languages, and their interpreter is sometimes called shell. These dependencies, however, are managed by your packaging system. If you are curious, repeat the find command line looking for —Alessandro Rubini, alessandro.rubini@prosa.it

On the first question: typing file progname will tell you whether progname is ELF or a.out.

Listing 1

As for the second, Listing 1 is a short Perl script that prints the shell and file name of all executable shell scripts on your system. Run it as root. The shells are printed first so that you can pipe the script's output through sort to sort the results by shell; this helps you quickly skip past the shells you decide to keep. It will take some time to run and probably will produce a great deal of output, so you should redirect the output to a file. —Scott Maxwell, s-max@pacbell.net

Paging or Performance Questions

This is my first Linux system and I'm having trouble tracking down some information. Maybe you can help me out or point me in the right direction.

1. I have Red Hat 5.2, Netscape 4.5 and cable internet access. My FTP throughput is excellent, but general browsing on the Internet is almost unbearable. My 9.6 modem could be faster (well, almost). It's kind of disappointing, compared to my NT system. Anyway, my first question: I hear regular disk activity, every five seconds or so. It's like some kind of paging is going on. What do you think is going on in the background? If I leave the PC alone for 15-20 seconds, it quiets down.

2. My second question is: while a web page is loading, I can start up top in an xterm window, move the window around and actually get faster downloads. I can't explain it. I can be sitting with a partially loaded page for 30 seconds, then bring up top and it's like Linux woke up and started updating the screen. —Daryle Dianis, ddianis@home.com

1. I take it this disk activity isn't linked to a cron job, but indeed to paging. A good way to make sure is to install and run procmeter; it can show you all kinds of activity meters, including disk activity and paging.

2. You don't give any details about your hardware, but it sounds like some kind of hardware and/or driver problem. Make sure you are running the latest version of X (3.3.3.1), and you don't have any interrupt conflicts. For example, you may have an interrupt configured for your video card (you don't need one) that conflicts with the interrupt of your network card. You can also try changing the interrupt of your network card. —Marc Merlin, marc@merlins.org

This may be a long shot, but do you have power management turned on? If your hard drive is spinning up and down, it might be producing this type of problem. Anything that represents more frequent activity (like top) that kept your drive from spinning down (or your CPU from slowing, etc.) would seem to speed up your computer.

An interesting thing to try would be to go into your BIOS at boot time and turn off all of your power management features. If that turns out to be helpful, you can turn it back on one feature at a time until you isolate the issue. —Chad Robinson, chadr@brt.com

LJ Archive CD