LJ Archive

Best of Technical Support

Various

Issue #92, December 2001

Our experts answer your technical questions.

Best of Technical Support

128-Bit Precision with GCC

I am using the command xlC to compile C++ programs on a UNIX platform. When I need to increase the precision of my mathematical calculations from 64b-128b, the following command is helpful:

xlC128 -qldbl128 <filename> [-lm]

where -lm is used to include mathematical libraries, if required. Now, I want to perform the same calculation with the same precision on Linux. Please guide me as to how I should proceed. If any mathematical libraries are required, please also indicate the source from where I can obtain them.

—Pramod, l_pramod@hotmail.com

Get GMP (Gnu Math Precision), a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers and floating-point numbers. You can find it at www.swox.com/gmp.

—Paul Christensen, pchristensen@penguincomputing.com

Upgrade Causes Weekly Crash

After I upgraded one of our systems to Red Hat 7.1 from 7.0, the system crashes frequently, something like once a week. The crashes always occur soon after 4:00 A.M. (after cron.daily is executed). Kernel output is

Unable to handle kernel NULL pointer dereference
at virtual address 00000000.

I upgraded kernel to 2.4.3-12, but there's not much improvement.

—Atsuko Crum, acrum@hood.edu

I had similar problems with a different distribution but a 2.4.x kernel. It turned out that a BIOS upgrade for the motherboard took care of most of my problems. Although I still have similar occurrences, they are much less frequent.

—David Brown, david@caldera.com

While hardware problems can happen at any time, if this started after you upgraded, you should try downgrading the kernel to the version you had on Red Hat 7.0, or if you don't mind rebuilding a kernel, you can try getting the latest 2.4 available (2.4.10 at the time of this writing). Many bugs were fixed in the first versions of the 2.4 kernel. If you want to rule out hardware issues, you can try an excellent stress tester, Cerberus, which you can get from SourceForge at sourceforge.net/projects/va-ctcs.

—Marc Merlin, marc_bts@valinux.com

Insufficient Space for Install

Slackware kept prompting that I had no space left for the installation to proceed. I could not believe it because I had 10GB reserved. I partitioned my hard drive like this:

5GB WinNT 4.0512MB for root512MB for swap4GB for usr4GB for home

—Cheppy, banggae@fisika.ui.ac.id

After formatting your partitions and setting up their mountpoints, switch to a second virtual console (Alt-F2) and verify, using df or mount, that they actually are mounted. If not, you will be installing Slackware on your 512MB root partition. That size may be too small if you are installing X or other large applications.

—Chad Robinson, crobinson@rfgonline.com

I am betting here that you are mislabeling the / (root) with a /root label. Try labeling your partitions like this: 5GB WinNT 4.0512MB /512MB swap4GB /usr4GB /home That should give you adequate space for the installation.

—Paul Christensen, pchristensen@penguincomputing.com

PAM on Slackware?

As I install more applications on my Slackware server for my users, I find that many require authentication, but there are a few that don't read data from the passwd file. The result is that users need to change their password in multiple locations.

There seems to be a movement toward PAM and LDAP so that if I could switch to support them, users could change their password to all of the services, including Samba, e-mail, pppd and phpgroupware from one location (such as a web-based password change application). However, Slackware doesn't support PAM, and I can't find a HOWTO to install PAM.

—Brian Johnson, bjohnson@jecinc.on.ca

It is possible to install PAM on a non-PAM-aware distribution, but it involves, among other things, replacing all your applications that do authentication with PAM-aware ones (and if your distribution doesn't provide them, you have to get the source, find PAM patches if they're not integrated and recompile everything with the right options for your system). It is a lot of work, and unless you're looking for a special challenge, I recommend you switch to a modern distribution like Debian Linux or Red Hat Linux (which both support PAM natively). Those are only two examples; many other distributions support PAM too.

—Marc Merlin, marc_bts@valinux.com

SCSI Emulation for Just One Drive

I have an HP IDE CD-Writer, so I am using SCSI emulation to use it with cdrecord. Under the 2.2.18 kernel, I could tell the ide-scsi module only to make use of my burner and leave my ATAPI CD-ROM alone. I did this via an append option in lilo.conf:

append="hdc=ide-scsi"

This worked well, as /dev/hdc is my burner and /dev/hdd is my ATAPI CD-ROM. Unfortunately, under the 2.4 kernel, this no longer works. The ide-scsi module grabs both devices, making /dev/hdd unavailable, preventing cdparanoia from working with it and forcing me to mount it with /dev/scd1. How do I get the same effect under 2.4 and force the ide-scsi module to emulate only /dev/hdc?

—Michael Soulier, michael.soulier@home.com

What you want is for hdc to do SCSI emulation and hdd to continue to be used as an IDE device. Usually IDE-CD support is disabled and SCSI emulation is enabled so that both drives are seen as SCSI devices. See www.wizball.co.uk/linux/cd_rewriter.php and www.teknospy.com/pages/howtos/cdburn.php for tutorials.

—Paul Christensen, pchristensen@penguincomputing.com

What Does This RPM Depend On?

I maintain 39 Red Hat servers and am always adding more (web hosts). I always try to install the bare minimum of packages during an install, figuring that if I don't include something the customer decides they want later, I can always figure out how to add it. Occasionally, a package requested will have such a fun list of dependencies requested that what should be a simple rpm -ivh package.rpm becomes a 30 minute dependency adding game. Is there a simple switch I can enter to have RPM tell me what one package needs before I try to install it?

—Bruce D. Meyer, gh1@rocsoft.net

You describe one of the reasons why many Linux server administrators use Debian Linux instead of a Red Hat derivative. With Debian, it is just a matter of typing apt-get install foo. Last I checked, RPM doesn't have a magic switch to do what you want. One way to do this on Red Hat is to use gnorpm or rpmfind. The problem is that in either case, with RPM-based solutions, RPMs are often incompatible across distributions and even within different versions of the same distribution (like RH 6.2 and RH 7.1). While rpmfind/gnorpm will probably be your best bet, if you get the option to install Debian Linux next time, it would solve all these problems.

—Marc Merlin, marc_bts@valinux.com

One little gem is Red Carpet. Documentation and downloads can be found at the www.Ximian.com web site.

—Paul Christensen, pchristensen@penguincomputing.com

Welcome, Guest Printer Users

I have a Linux box that acts as my DHCP server, firewall and gateway to the Internet. Many of my clients are visiting Windows users. Is it possible to set up the Linux box to be a print server such that a Windows client can print via the Linux print server without the client having to install printer drivers?

—Danny Patel, dharmesh@yahoo.com

I would set up a Samba Share for both the printer and the Windows drivers for that printer.

—Christopher Wingert, cwingert@qualcomm.com

You might want to look into using CUPS (Common UNIX Printing System). It supports IPP, LPD, SMB (Windows) and AppSocket (JetDirect) protocols.

—David Brown, david@caldera.com

cron Won't Run a Shell Script

I can't execute a shell script with crontab. I get this error:

cannot execute binary file

—Leonardo Fermoselle, lfermose@hotmail.com

Does your script start with #!/bin/sh as the very first characters of the file? It should. If this isn't the problem, was the script written on a DOS machine? Open the file with the joe text editor and if you see funny M characters at the end of every line, that is your problem. You can use a tool found at freshmeat.net/projects/fixdos to fix that.

—Ben Ford, ben@kalifornia.com

Run the command file /usr/backup/myscript.sh, or load this file in vi and make sure it does not have any junk characters in the file. Make sure that you can run the script from command line.

—Usman Ansari, uansari@yahoo.com

LJ Archive