[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]

More 2¢ Tips!

Send Linux Tips and Tricks to tag@lists.linuxgazette.net


Fri, 1 Feb 2002 11:32:44 -0800
Dan Wilder (The Answer Gang)
asked by piyush moghe

respected sir
i have a problem with linux instalation on 20Gb or more capacity disks,i had installed on p3,20gb hd,64 mb ram.i make 2 1Gb partition as linux native & one 200 mb as swap the instalation goes on smoothly but at the end it gives error that first partition not lies in 1024 cylinders what i can do to solve this problem

Actually we're several guys, and one or more gals. If you respect us, that's nice, but not essential.

Upgrade to current LILO. Most new distributions should contain a LILO able to overcome the 1024 cylinder limit, and so a newer distribution might be the easiest way to do it.

Or, re-partition the disk so that its first partition, about 16Mb, is mounted at /boot, second partition is swap, and the third partition containing the remainder of the disk is mounted as /, the root partition. The installation scripts on the distribution will probably give you an opportunity to specify how you want the hard drive partitioned, and that's where you do this.

Make sure your kernel boot image (usuall vmlinuz) is located in /boot, and is referenced from /etc/lilo.conf as such. You may have to move things around and rerun lilo after the installation stuff completes.

Let us know how you are doing.

File cache...

Thu, 14 Feb 2002 22:25:24 -0800
Dan Wilder (dan from ssc.com)
asked by Matthew Koundakjian

Is there a way to control in a 2.4.x kernel how large the file cache can grow?

File cache always seems to take as much as it can and we really would prefer to keep it low.

The main user is routinely running tasks upwards of 1.5GB at time and there are times when the system thrashes and thrashes.

3:55pm  up 2 days, 23:36, 19 users,  load average: 0.60, 0.72, 0.75

162 processes: 160 sleeping, 2 running, 0 zombie, 0 stopped
CPU0 states: 76.0% user,  0.0% system,  0.0% nice, 23.0% idle
CPU1 states: 31.0% user, 13.0% system,  0.0% nice, 55.0% idle
Mem:  2059412K av, 2053732K used,    5680K free,       0K shrd,   41576K buff
Swap: 3072112K av,  703596K used, 2368516K free                 1236900K cached

Big file cache is not necessarily A Bad Thing. As long as it unloads fast when demand grows.

I'd look to other problems first.

  1. Are you running 2.4.17 or something older and buggier? If not 2.4.17, upgrade now.
  2. Are you running an AMD Duron or Athlon + AGP video? If so, you'll need a kernel boot parameter to cut cache page size, there's an interference between the way the kernel handles DMA and the way AMD handles AGP, leading to sporadic random cache corruption.
  3. You're 700M into swap. That's never a Good Idea. Unless what's swapped out is more or less permanently swapped out. If so why are you running it? If possible, get another gig of memory. The slowest memory is much faster than the fastest hard drive.

Hello Dan...

Thanks so much. Yes, we're running an older kernel ... mostly, 2.4.6 ... I'll fix that.

As far as the swap, originally, we had no swap, but because the file cache is so "hungry", I threw in swap as a brute force means because processes were dying from lack of memory...

As it is, we run a computational fluid dynamics code that periodically dies with no more than "broken pipe" as the error diagnostic, which, if I had to make a W.A.G., I would assume a process died. Before, it was a LOT worse... It was ugly when something like portmap would croak. So, lacking any coherent solution and having unhappy users, I threw some swap in and it seemed to help with stability tremendously.

But most recently, with one user process running, allocating about 1.7G, the system was apparently thrashing horribly... very unresponsive and with a system load on the order of 10.

As far as the swap versus file cache, it would seem to be silly to have a file cache that's so large that swap starts coming into play.


Answer for "getting volume label from CD".

Thu, 24 Jan 2002 16:09:19 -0700
Sean Reifschneider (jafo from tummy.com)

The URL:


asks the question "How do I get the volume label from a data CD", and then the three guys go on to not provide a very good answer...

If you would like to add the following, it may be useful to other readers.

There are two problems in identifying CDs -- one is identifying a data CD, the other is identifying an audio CD. Mr. Bray is asking specifically about data, but it's also possible to determine a fairly unique ID for audio CDs as well.

Data CDs are easy -- a 32-byte string is written in the ISO at offset 32808. Some systems have a program called "volname" (part of the eject package), which can pull this data out. Otherwise, "dd" can be used:

dd if=/dev/cdrom bs=1 skip=32808 count=32

This is the volume label specified via the "-V" argument to "mkisofs" when creating the CD image.

For audio CDs, it's (unfortunately) not as easy. The CD Digital Audio standard does not include a location for storing CD or track identification information. The answer for this that I've heard is that they felt it was too hard a problem to solve initially.

While it may seem easy to add a few strings on the CD, it becomes harder when you have to deal with an international market -- how do you make it so that Japanese tracks can be identified, for example. Remember, this was back in the <gasp> '80s, when Unicode wasn't common.

So, the way people go about identifying audio CDs is by generating a signature. This signature consists of information about the length of tracks, number of tracks, and various other information. You can then condense this information down into a single value.

This value can then be used to submit and request more specific data about a disc or track.

Thanks to the LinuxDoc CDROM-HOWTO for the dd command to pull this data off the CD.


Compiling from source

Fri, 1 Feb 2002 09:03:21 -0800
John Davies (johnny5_tc from yahoo.co.uk)

Hi, I've just read your informative article on installing from source in this months Linux Gazette.

You mention that it would be good if make files has and uninstall target and that most don't. Well, if you have a look at Checkinstall (http://asic-linux.com.mx/~izto/checkinstall-en.html) it allows you to uninstall programs built from source.

What it does is to replace the "make install" command with checkinstall. It makes a note of which files were installed and allows you to uninstall the program using the package management tools on your machine (in my case dpkg). It also creates a .deb (or .rpm) so you can install it on another machine.

I've played with it for a few days now and it is extremely useful.

Regards John


Thanks for that tip. I'm a moderately long-time member of The Answer Gang, and had not heard of checkinstall before. I often build from source, and had until now resorted to clumsy and time-consuming expedients to manage uninstalls.

"checkinstall" is just what we need here at SSC, host of The Answer Gang's mailing list server and The Linux Gazette's web site.

This is pretty much the reason that I forwarded this to TAG. I've had seven or eight e-mails telling me me about "buildpkg", "rpm", etc.; under Debian, I'm familiar with "alien" - but none of these deal with the real issue of "remembering" what the "make" did. They just convert the tarball (which often cannot be done due to layout, etc.) into RPMs or DEBs, etc. This tool - although I have not yet had the time to check it out - sounds like a very nice possibility, and I'm going to be looking into it. -- Ben

Well thanks, Ben, for forwarding it.

It sounds like this tool does something like what I've been doing by hand. After building a package, I often

  su root
  make install

(that's "CTRL-D", an EOT character, to log out of script) then edit the resulting "typescript" file to build a roster of what was installed, which I then save in an "ssc" subdirectory of the build directory, against a day when I wish to know what was installed.

You're absolutely right about alien et al. They work from a tarball, .deb, .rpm, etc.

However, most stock GNU packages don't even build an install tarball. They just install directly, leaving a cryptic trail of what they installed in the output from the "make install". Without analyzing that output you don't even get a tarball to "alien".

There are exceptions. Debian-modified source trees build the .deb packages directly, which can then be installed. Slackware-modified source trees build a tarball directly. No doubt Red Hat et al has something similar ... brainfade prevents me from saying at the moment ...

All too often I find I must go directly to the original release of some package, rather than using the distribution's source, either because the package is not available under the appropriate distribution, or because the distribution's package doesn't do it for us. Wrong or broken version, etc etc etc.

If this checkinstall does what it looks like it might do, it solves that problem of "what do you do if you've only the original source code". -- Dan

Automate dialing?

Wed, 20 Feb 2002 18:26:42 -0500
Ben Okopnik (The Answer Gang)
asked by gagandgupta

I want to write a program that on getting some sort of trigger will automatically connect to the internet by dialling the ISP's telephone number. After it has established connection it should store the IP address assigned to it by the ISP in a file.

Two major hints that, together, should give you the solution:

  1. Search the Net for "linux" and "dial-on-demand". The standard answer to this used to be "Diald", but nowadays it's built into pppd, so reading the man page may be an even better solution.
  2. Read "/etc/ppp/ip-up", paying special attention to "PPP_REMOTE".

That's it. There's no deep science to it.

Redhat 7.2 Linux firewall-Howto

Tue, 5 Feb 2002 22:01:56 -0800
Dan Wilder (The Answer Gang)
asked by Franco Fernandes


Can anyone tell me from where can i get the Redhat 7.2 Linux firewall-Howto download

Thanks & Regards

I don't know about a Redhat 7.2 firewall howto ... if there is such, I'd expect to find it by searching www.redhat.com.

A generic Linux howto, now ...


There's a lot of other great stuff in that same directory. -- Dan

Not the question you were asking - but if you want to get a basic iptables firewall in place you could want to look at firestarter or something similar -- Mike E

File System problem

Fri, 8 Feb 2002 11:53:32 +0000 (GMT)
Thomas Adam (The LG Weekend Mechanic)
asked by Ben Wood

i require help fixing my linux hard drive, it is a ext2 file system and during startup it fails to pass the file system check, it says "Directory inode 38381, block 0, offset 0: directorty corrupted" how do i fix it, can it be fixed?

You can do the following.....

If you need any help, let me (us) know.
Kind Regards,
Thomas Adam

Quick C function lookup

Thu, 24 Jan 2002 22:24:21 -0500
Ben Okopnik (The Answer Gang)

In your ".bashrc" file, add the following line:

alias chlp="info --file libc.info.gz --node \"Function Index\" --index-search $1"

The next time you log in (or even open another xterm or console), you'll have this as an alias. Call it this way:

chlp setuid

to have it drill down to where the "setuid" function is defined in the documentation. For those of you that use "vi", you can also redefine your "man page lookup" key:

set kp=chlp

Put your cursor on a function name and press 'K'; Magic Will Happen. :)


Thu, 21 Feb 2002 18:25:10 -0500
Jay R. Ashworth, Chris Gianakopoulos (The Answer Gang)
asked by Rafel Burrial

What in the hell does GNU mean?

It's this uncommon African animal, also called a white bearded wildebeest. -- Jay

In hell, it's the ... -- Ben
I really think Ben needs to stop talking about dark things like that... Poor Chris, who specializes in our cross-MSwin questions, got bit by a nasty mailerdevil for that one. Just in case, I didn't print it :D -- Heather
I think if you go to (D'oh!) www.gnu.org, and look at the first page -- and I might point out that this is the first hit on Google for 'gnu' and the answer is in the frigging page title -- you'll probably find the answer to your question. -- Jay
GNU's not Unix like Unix is not Multics!!!!! !! Ho! Ho! Ho! <laugh from down there in h*ll>
A day late, because I've had no mail for the last 24 hours!! -- Chris

Is there a way to check if a dial up ppp connection is REALLY up?

Tue, 29 Jan 2002 08:54:08 -0500
Chuck & Crystal Shepherd (cc_shep from yahoo.com)
with points from Ben and John K. of The Answer Gang

I have a linux box (RH 7.1) set up to serve as mail and internet server for my two other home computers.

It is set up to dial on demand. Therefore ifconfig shows ppp0 up and running all the time (when it is working properly)

I would like to be able to check the status of the modem without lifting the telephone from it's cradle.

I have checked into using the lock file which can be written by pppd but this is not very reliable when if pppd goes down unexpectantly it does not always clean up after itself.

I haven't done anything with "diald" in a couple of years, but doesn't it use SLIP to do its dirty work (i.e., the PPP link you request is actually to a local VT; "diald" feeds your PPP daemon lots of baloney and sweet talk while it actually makes the connection behind its back)? If so, then you could always check if the 'sl0' interface is up without tripping off the dial-up. -- Ben

The querent doesn't specifically mention 'diald', which does use the slip interface as part of its mechanism. The newer versions of pppd also support dial on demand, and uses a different type of mechanism. Unfortunately, I can't be too specific, as I've never set it up. I would guess that you could simply check to see if ppp0 (assuming only one dial-up connection active at a time) is up, much the same way as was suggested for diald. Actually IIRC, in the case of diald, (which AFAIK, is no longer actively supported) the slip interface goes away when the ppp link gets established; so simply checking for a ppp interface would work for diald as well. -- John Karns

I am a big LG fan. Thanks for all the tips and advise.

<smile> We do what we can. Good luck - let us know how it goes! -- Ben

Thanks for your response.

I think I have got my solution by using lsof /dev/ttyS1

(ttyS1 is my serial port)

It does not seem to initiate a connection and does not seem to interrupt an existing connection.

Thanks for your help!


large file support detection

Mon, 21 Jan 2002 22:37:22 -0500
Robos (robos from geekmail.de)
and Ben from The Answer Gang

On Tue, Jan 22, 2002 at 01:35:56AM +0100, Robos wrote:

Hi Gang! Maybe I already told you about my little program to copy dvd's to harddisk, called vobcopy (look on freshmeat). In the next release I want to incorporate large file support (lfs - no, not linux from scratch ;-). I found Jim Dennis' answer in the 67 issue and read around various places (info libc, the suse-page, the large file summit papers) but I am still unable to detect if the usersystem has support for large files. We (another person joined me and did most of the lfs stuff) found out about the -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE (the last one being redundant if not even close to being wrong in my opinion) and off_t. But we are not sure if this works correctly on both systems (supporting/not supporting). I would think its better to know if the users system has support or not and compile accordingly. My approach would be somthing along the lines of look whats defined in <linux/*file.h> and what the file system is the file gets written to. But kinda ugly and probably wrong. Does one of you happen to know how to figure it out?

Check for the presence of "ftello64" (declared in <stdio.h> ;). From "info libc -> I/O on streams -> File Positioning":


- Function: off64_t ftello64 (FILE *STREAM)

This function is similar to `ftello' with the only difference that the return value is of type `off64_t'. This also requires that the stream STREAM was opened using either `fopen64', `freopen64', or `tmpfile64' since otherwise the underlying file operations to position the file pointer beyond the 2^31 bytes limit might fail.

If the sources are compiled with `_FILE_OFFSET_BITS == 64' on a 32 bits machine this function is available under the name `ftello' and so transparently replaces the old interface.


"ftello" is the 'fixed' version of "ftell", but can be found on systems with or without LFS. From the above, it looks like "ftello64" would only exist on systems with LFS, where "ftello" would be an alias for it. I've got to hand it to the GNU folks: cute trick.

Re: [LG 75] 2c Tips #5 Linux with win2000

Fri, 22 Feb 2002 15:26:13 +0530
sanjay sharma (sanjayjisuno from hotmail.com)

this related with redhat linux

  1. if you have free space in your harddisk for windows 2000 partition then
  2. if there is no free space
    use partition magic to make some free space for windows 2000 and use the same steps

Basic Newbie Question

Thu, 21 Feb 2002 22:11:03 -0500
Faber Fedor (The Answer Gang)
asked by Steven Bruce

I've just installed RH 7.2 on a sony vaio, and was quite surprised by the ease with which it went on (Far cry from RH5.5). Anyway, I created the suggested user so that I wouldn't be logging in as Root all the time, however, the user I created can not create, delete, copy, etc, files in ROOT, or USR, or even HOME.

Of course you can't! This isn't That Other Operating System. :-)

I am assuming I have to login as ROOT and join the user to the administrators group, or some such group which will allow the user the appropriate permissions, but I am not sure. Is thre something I am missing or something I should be doing different?

You're missing something. :-) In Linux (and unix in general) users don't have the right to willy-nilly create files and run any old program. Would you like it if user jane had the rights to delete files in you home directory? Of course not!

Linux has rather strict rules about what you, a normal user can do. The root user, OTOH, can do anything. This is a very dangerous thing if you're not careful. Let's say you wanted to delete all the files in your home directory (you're allowed to do that, they're your files). That would be done with the command

rm -rf /home/steve

If you accidentally typed it as

rm -rf / home/steve

You would get some error about not having permissions, etc. And depending where you were in the directory, ypou might or might not wipe out your home directory.

However, if you were logged in as root and type the accidental line, you would, literally, wipe out every file on the hard drive.

You might want to add the normal user to various groups, but you should proabbly read up on Linux and permissions and all that. Start by reading the Dos/Windows User to Linux User HOWTO ( http://www.linuxdoc.org/HOWTO/DOS-Win-to-Linux-HOWTO-4.html ) to get an idea on what's going on.

Reading the HOWTOs in general is a good idea (maybe not all at once, mind you). You can find all of them and more at www.linuxdoc.org

Any help would be greatly appreciated!

A little appreciation is just fine, thank you. :-)


Re: [LG 75] 2c Tips #15 posters

Thu, 31 Jan 2002 15:22:52 -0500
Boyer, Charles (Charles.Boyer from tycoelectronics.com)

Probably old news...but just in case:


backPosters are available free with a $50 purchase at the following O'Reilly conferences and tradeshows:

O'Reilly Conferences:




Thu, 31 Jan 2002 22:11:58 -0600
Jack Berger (jhb from mapp.org)

You mention that you are having problems w/your epson printer.

I'm not too familiar w/printer defs in things like ghostscript or gimp, but my printing w/an hp 970 improved by orders of magnitude for all applications when I installed turbo print. Colors come out good, speed is improved. Just works nice.


Linux rocks!

Thu, 21 Feb 2002 23:21:00 -0500
Ben Okopnik (The Answer Gang)

Today, the curiosity bug bit me again, so I poked my nose into the Linux Visor USB mailing list, and - lo and behold - there it was. Seems that the new version of "coldsync", at least the beta, now handles the m125! I downloaded it, configured it, compiled it, made a config file - and... ta-daa! Palm USB synchronization, under Linux.

Life is good. :)

Setting up telnet in a Linux server.

Thu, 24 Jan 2002 18:43:04 -0800
Dan Wilder (The Answer Gang)
asked by Subroto Sengupta

Hello Sir,

I would like to know how to set up a Linux 7.1 server and configure it properly to be able to telnet into it from a Windows client machine.

A reply would be greatly appreciated.


Well, that's a whole lot of questions.

There's no "Linux 7.1". The Linux kernel's current versions are 2.5.2 (pretty wild), 2.4.17 (conditionally stable), and 2.2.20 (quite stable). (labels mine).

Linux is distributed by several vendors, who label their own distribution with a version number. You may be thinking about Red Hat Linux 7.1. Don't. Get Red Hat Linux 7.2 or 6.2. Other vendors (Debian, Mandrake, Slackware, SuSE, Caldera, to name just a few) each use their own numbering schemes, which have not much to do with those of the others.

How to set up a server? Best advice I can give is "follow the vendor's directions, and ask questions here when you get lost".

Telnet? Only on a protected network, I hope! Telnet exchanges a password in the clear, OK if just your immediate family is watching the 'net, not so good if the password traverses six ISPs and a few chunks of the backbone.

That said, during install, select the telnet package. Sometimes that's part of some other package, sometimes not. Consult the vendor documentation and help.

On exposed networks, use the ssh (secure shell) package on Linux, and get "putty" secure shell client for Windows. It's much better than windows telnet, and it'll even telnet, if you must.


or search google.com for "putty.exe".

-- Dan Wilder

Linux Journal's Weekly News Notes Tech Tips

ssh -n

Use ssh -n to run an X program from one computer on another. For example,

ssh -n frodo gimp &

will run the GIMP on the host frodo, but display locally.

Using ssh for this is much easier and more secure than setting it up in X manually.

The -n option means prevent reading of stdin. Many times you don't need this, but if your application hangs waiting for input or does something else strange, try it.

The simplest way to process a web form

You can put a simple form on your web site even if you don't have CGI privileges. Just use <form method=GET action="result.html"> where result.html is a "thank you for filling out the form" page.

You can then get the values people filled in from the web server access log.

How to switch between several network profiles on your laptop

Use the scheme option to cardctl to manage multiple network schemes on one laptop. The scheme is passed in as the first part of the device address in the PCMCIA wireless.opts script. Make two entries in wireless.opts:

    INFO="SSC WiFi Net"

    INFO="live.com network at Dana St. Roasting Co."

To switch between them, do

sudo cardctl scheme ssc


sudo cardctl scheme dana

For more info, see the PCMCIA HOWTO. You can change all the settings, including WEP key, mode and other options. For more information on free wireless access and coffee in Mountain View, California, see Dana Street: http://www.live.com/danastreet, a LIVE.COM Neighborhood Network.

Rob Flickenger explains how to set up shell scripts to switch schemes with less typing in his new book, Building Wireless Community Networks (O'Reilly, 2002).

Speeding up commands like "route" and "netstat"

If "route" takes a long time to run because you have no route to your nameserver, do "route -n" to skip the DNS lookup and use IP addresses only.

This works with "netstat", "ping" and "traceroute" too.

Very important topic: keeping your "fortune" file indexed

You can keep your fortune file indexed and up-to-date on multiple servers with make. Here's an example Makefile to handle common fortune-related tasks:

# List all the fortune files you maintain here.  (I just have them
# all in one big file)
FORTUNES = dmarti

# For every fortune file, the datfile is the same name but with .dat
# on the end

# Make a copy of the fortunes file to the zork.net  collection
# (http://zork.net/fortunes/)  Since it's the first target, this
# target and its dependencies will run if you just type "make"
tozork : $(DATFILES)
        scp $(FORTUNES) $(DATFILES) zork.net:/usr/local/etc/fortunes
        touch tozork

# This target makes each .dat file from the appropriate fortune
# file, if it has changed.
%.dat : %
        strfile $<

# Get rid of all the .dat files (not really needed, but it's traditional
# to have "make clean" do _something_)
clean :
        rm -f $(DATFILES)

# There is no file named "clean", but always build this target.
.PHONY : clean

For more information, see "man strfile" and "info make". Now that you know how to manage fortunes by editing only one file and typing make, why not put your favorite sayings on your web site as a fortune file others can also use? (The old fortunes that come with most distributions have come up way too often for us.)

Limiting the files "locate" shows

"locate" is a wonderful command for quickly finding files on your system. Unfortunately, sometimes it produces so many hits that it takes too long to find the forest among the trees. Distributions and programs often have lots of files, making locate seem useless. To refine your search, type:

loc ()   {
        locate "$1" | egrep -v 'bmp|html|whatever'

or put it in your .bashrc, and you won't receive any entries that contain

This page edited and maintained by the Editors of Linux Gazette Copyright © 2002
Published in issue 76 of Linux Gazette March 2002
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/

[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]