"Linux Gazette...making Linux just a little more fun!"


More 2¢ Tips!


Send Linux Tips and Tricks to [email protected]


Contents:


RE: Help Wanted - LaserJet 4L

Date: Mon, 2 Mar 1998 14:38:43 -0500
From: [email protected]

To: [email protected]
Re: font sizes + points, Linux Gazette #26 I had a similar problem with an old Deskjet under SunOS and was supplied with the following info by HP support Europe. It applies to DOS but should be applicable to any Un*x system as well These are printer instruction generation wizards URLs

I saw a posting in C.O.L.A. a few months back that someone has already done the tough work and has programmed some mostly-complete PCL 3+ 5 drivers for Linux If all else fails, HP DOS drivers exist that can customise point sizes + fonts and save them permanently to printer memory (5Si's do, i don't know about 4Ls) If you don't have a DOS partition maybe DOSEMU? Good Luck!
Shane McLaughlin


2c tip (StarOffice 4 / Ghostscript)

Date: Mon, 2 Mar 1998 18:48:51 -0500 (EST)
From: Fraser McCrossan, [email protected]

I've just started using the excellent Star Office 4.0 (free for personal use - go get it now!), but have noticed that when using Ghostscript to filter its print output on my non-Postscript printer, the results were not quite as they appeared on the screen.

I reasoned that this might be because the fonts supplied with SO didn't quite match those supplied with Ghostscript. However, the SO fonts are Type 1 Postscript fonts... which Ghostscript can use. To make Ghostscript use them, you need to link them to its home directory. For example, if your SO is installed in /home/fraser/Office40, change to the Ghostscript font (normally /usr/local/share/ghostscript/fonts) directory, and do the following:

 
ln -s /home/fraser/Office40/fonts/type1/*.pf[ab] .
mv Fontmap Fontmap.hide
For some reason, when I tried to add the new fonts to Fontmap in the same format as the existing fonts, GS would crash, hence hiding it. I'm not a GS guru... perhaps someone else can explain why. However, GS works just fine without Fontmap for me, although it probably takes longer to start up - and everything I print looks just like the screen.

--Fraser


RE: Linux and VAX 3400 and 3300

Date: Mon, 02 Mar 1998 20:34:55 -0500
From: RC Pavlicek, [email protected]

The March issue of the Gazette includes the following under 2 Cent Tips: <<I have just purchased a MicroVAX 3400 and 3300. I would like to put <<Linux on these two systems. Can you provide any help in this aspect.

<I believe those are MIPS 3000 boxes, try the Linux VAX Port Homepage at >http://ucnet.canberra.edu.au/~mikal/vaxlinux/home.html <and the Linux/MIPS project at http://lena.fnet.fr/

Anything with "VAX" in its name is just that -- a VAX. Digital made MIPS boxes once upon a time, but they never used the VAX/MicroVAX name. Most of Digital's MIPS boxes were sold under the DECstation or DECsystem name.

The pointer to the VAX/Linux effort is the best one I know about, but the whole VAX/Linux project was not even close to producing usable code last time I checked. NetBSD, if it works on these boxes, may be your best bet.

-- Russell C. Pavlicek
[speaking for himself, not for Digital Equipment Corporation]


xdm with pictures

Date: Thu, 05 Mar 1998 10:34:43 -0000 (GMT)
From: Caolan McNamara, [email protected]

Can I change the XDM login window/screen? I have a cool house logo so i want to use it in my own Home Network. And at my school they want to know to so. Is it possible. If yes, how? If no, WHY NOT? -- Jeroen Bulters, The netherlands
you could try xdm3d_xpm, which allows a picture in the xdm box, which is 3d with shadows and stuff,one version is at ftp://brain.sel.cam.ac.uk/users/mbm/xdm3d (probably the latest) theres another (older) at http://oak.ece.ul.ie/~griffini/software.html


Re: HELP-Installing Linux on a FAT32 Drive Date: Thu, 05 Mar 1998 11:35:42 -0000 (GMT)

From: Caolan McNamara, [email protected]

I'm interested in installing linux on a machine I built recently, but when I installed Win95(b), I idiotically opted to format the drive using FAT32, which in a 95-only environment is great, but Linux can't read it for greek. I've looked around for utilities to effectively un-FAT32 the drive, which I will then partition with Partition Magic to use the freespace as a native ext2 partition, etc., but am having little luck. Reformating is a disheartening prospect I would rather not face, but am fully prepared to do so if I don't find any help here. --nate daiger

Well partition magic 3 can repartition fat32 without hassle, and there exists a patch for linux kernel to understand fat32 at http://bmrc.berkeley.edu/people/chaffee/fat32.html which also lists a version of fips which also should understand fat32, to resize your drive.


Regarding "Easter Eggs" in Netscape etc.

Date: Thu, 5 Mar 1998 23:21:20 +0000 (GMT)
From: John Pelan, [email protected]

The on-going 2 cent tips about the hidden "Easter Eggs" in Netscape is interesting. However rather than continually listing them it might be more fruitful to learn how one can try to discover them for oneself.

One useful tool in particular, is the oft neglected 'strings' command. This will locate printable strings in an arbitrary file and display them. So one can do something like;

 
prompt% strings /usr/lib/netscape/netscape-navigator
which will reveal all the embedded strings in that binary. You might like to redirect the output to a file for analysis. As many of the strings will be rubbish (i.e. 'random' sequences of printable characters) one can always use grep, awk, Perl etc. to help filter in/out particular patterns.

In the case of Netscape, only a tiny set of the strings will correspond to "Easter Eggs" (not all of them will be immediately obvious either) and locating them is left as an exercise to the reader...


Re: Changing XDM windows

Date: Fri, 06 Mar 1998 12:16:02 +1200
From: Craige McWhirter, [email protected]

From: Jeroen Bulters, [email protected]
Can I change the XDM login window/screen? I have a cool house logo so i want to use it in my own Home Network. And at my school they want to know to so. Is it possible. If yes, how? If no, WHY NOT.

Try this web site below. It had everything I needed to customise my XDM login.
http://torment.ntr.net/xdm/


Nice xdm and Linux PPC Date: Fri, 06 Mar 1998 09:09:48 -0500

From: Serge Droz, [email protected]

just a quick comment on two letters in the Linux Gazette #26 (http://linuxgazette.net/issue26/lg_mail26.html)

  1. Changing XDM windows: Check out http://jovian.physics.uoguelph.ca/~droz/uni/xdm3d.html for a replacement (This version comes with pam support). This version runs fine on our Redhat systems (Intel & PPC).

  2. New direction: Linux is beeing ported to the PPC chip. See http://www.linuxppc.org for more info, downloads CD's T-shirts.... It actually runs quite stable on my PPC.
Cheers, Serge


Re: Help with Sound Card

Date: Fri, 6 Mar 1998 20:32:13 +0100 (MET)
From: Roland Smith, [email protected]

According to the Sound-HOWTO:
"MV Jaz16 and ESS688/1688 based cards generally work with the SoundBlaster driver"

To get a PnP card to work, you need to configure it first. There are two ways of doing that:

  1. boot into DOS, use the card's DOS-based initialization program, then do a warm boot to Linux

  2. compile sound support as a module, and use isapnp from the isapnptools package to initialize the card, after which you can insert the sound module.
The isapnptools package can be found at ftp://ftp.demon.co.uk/pub/unix/linux/utils

Regards, Roland


Modline for TV

Date: Sun, 8 Mar 1998 13:11:37 +0100 (MET)
From: [email protected]

I have shamelessly stolen this from USENET, because I feel this excellent information should appear within the Linux Gazette.

I hope the original author don't mind. :-)

From: Rob van der Putten
Date: Sun, 8 Mar 1998 00:14:15 +0100
Hopefully you won't need this, but if you ever want to display X on a big screen and a TV is the only big screen around you might want to use this.

A TV with a RGB SCART input is nothing more than a fixed sync monitor with a rather low picture quality. This means that you can make a TV compatible signal with a plain vanilla cheapo VGA card.

For the european 625 line (575 visable lines) TV standard a modeline looks like this: Modeline "736x575i" 14.16 736 760 824 904 575 580 585 625 interlace -hsync -vsync

Officially the horizontal resolution is 767 (4 / 3 * 575) pixels with a clock of 14.76 MHz. However, since the clock used is 14.16 MHz, I reduced the horizontal values proportional to 14.16 / 14.76 (and rounded them to the nearest multiple of 8).

If you want to make a 640x480 screen with a black border you can you use this line: Modeline "640x480i" 14.16 640 712 776 904 480 532 537 625 interlace -hsync -vsync

You can center it by altering the 2nd and 3rd horizontal and vertical values (this example shifts the picture to the left): Modeline "640x480i" 14.16 640 728 792 904 480 532 537 625 interlace -hsync -vsync

You can make a non interlaced signal with this modeline: Modeline "736x288" 14.16 736 760 824 904 288 290 292 312 -hsync -vsync

The VGA RGB signals are compatible with the scart bus, the sync signals are not. You have to create a composit sync signal of 0.3 ... 0.5 Vpp. The cirquit below acts both as a AND gate and a level translator. It doesn't need a power supply and can be mounted inside a VGA plug:
 

 -VS ------------------------+
                             |
                             |
                         |  /
       +-----+           |/
 -HS --+ 3k3 +-----*-----|     BC 548 B
       +-----+     |     |\
                   |     |  \|
                   |        -|     +-----+
                   |         *-----+ 68  +----- -CS 0.3 Vpp
                   |         |     +-----+
                  +++       +++
                  | |       | |
                  | |       | |
                  +++       +++
                   |         |
 GND --------------*---------*----------------- GND
                  1k2       820
You can use any general purpose low frequent low power NPN transistor instead of the BC 548 B
Regards, Rob


mpack 2 cent tip

Date: Mon, 9 Mar 1998 11:17:47 +0100 (MET)
From: J.I.vanHemert, [email protected]

I response to the 2 cent tip of Ivan Griffin, I am sending a two cent tip of my own.

Ivan send in a script that can be used to mail Micro$oft users. I would like to mention the package 'mpack', this program is very handy if you want to send out some mime-encoded mail. Furthermore the package also contains 'munpack' which does the obvious thing.

Mpack can be found on ftp.andrew.cmu.edu in the directory pub/mpack, in the archive mpack-1.5.tar.gz

Cheer, Jano


shutdown and root

Date: Mon, 9 Mar 1998 13:10:55 +0100
From: Guido Socher, [email protected]

I noticed that many people still login as root before they power down their system in order to run the command 'shutdown -h now'. This is really not necessary and it may cause problems if everybody working on a machine knows the root password.

Most Linux distributions are configured to reboot if ctrl-alt-delete is pressed, but this can be changed to run 'shutdown -h now'. Edit your /etc/inittab and change the line that starts with ca:

 
# Trap CTRL-ALT-DELETE
# original line would reboot:
#ca::ctrlaltdel:/sbin/shutdown -t3 -r now
# now halt the system after shutdown:
ca::ctrlaltdel:/sbin/shutdown -t3 -h now
#
Now you can just press crtl-alt-delete as normal user and your system comes down clean and halts.


Perl Script 2 cent tip (maybe even a nickel)

Date: Mon, 09 Mar 1998 18:37:20 -0500
From: Allan Peda, [email protected]

When I was putting my network card in my Linux box, I wanted to keep the soundblaster, but the addresses are not easy to read (for me) in hex. Even if there were in decimal, I figured a plot of the areas that appear open would be useful. So I hacked together a little perl script to do just that, Usage: addreses.pl addr.txt > outputfile.txt

Of course it goes to stdout without a redirected file. The input file is constructed with one line for each address:

 
base_address TAB upper_address TAB :Description
Here's a little perl script that I wrote to help me identify conflicting addreses:
 
# address.pl  v 0.1
# Allan Peda
# [email protected]
#
# How to use: Prepare a file based on the format of the sample at 
# the end of this script.
# This script will plot a servicable chart of the addresses in use,
# with the gaps plainly apparant.
#
$debug = 1;
$min_addr=0;
$max_addr=0;
for ($i=1; <:>; $i++) {
	/^(\w+)\s/; $$memory[$i]{base_addr}=$1;		# base address
	/^\w+\s+(\w+)\s/; $$memory[$i]{upper_addr}=$1;	# upper address
	/\:(.+)$/; $$memory[$i]{addr_descrip} = $1;	# description of address
	$ttl_num_addresses = $i;
	print "$i\t $$memory[$i]{base_addr} \t" if $debug;  
	print hex($$memory[$i]{base_addr}),"\t-->\t" if $debug;
	print " $$memory[$i]{upper_addr}\t" if $debug;  
	print hex($$memory[$i]{upper_addr}),"\t" if $debug;
	print "$$memory[$i]{addr_descrip}\n" if $debug;
	if (( hex($$memory[$i]{base_addr}) < hex($min_addr) ) || $i<=1){ 
		$min_addr = $$memory[$i]{base_addr};	
	}
	if (( hex($$memory[$i]{upper_addr}) > hex($max_addr) ) || $i<=1){ 
		$max_addr = $$memory[$i]{upper_addr};	
	}
}
print "\nTotal number of addreses used = $ttl_num_addresses" if $debug;
print "\nMinimimum address is: $min_addr" if $debug;
print "\nMaximimum address is: $max_addr\n" if $debug;
for ($addr = hex($min_addr); $addr <= hex($max_addr); $addr++) {
	printf "\n%4x -> ", $addr;
	for ($i=1; $i <= $ttl_num_addresses; $i++) {
		if (( hex($$memory[$i]{base_addr}) <= $addr ) and 
		(( hex($$memory[$i]{upper_addr}) >= $addr))){ 
		    print "*** "; 
		    if (( hex($$memory[$i]{base_addr}) == $addr )) {
			print "$$memory[$i]{addr_descrip}";
		    }
		} 
	}
}
# sample file address.txt follows:
__END__
0x1F0		0x1f8		:Hard disk drive
0x200		0x207		:Game I/O
0x278		0x27f		:Parallel Port 2 (LPT2)
0x2e8		0x2ef		:serial port, com4
0x300		0x31f		:Prototype / Network PCB
0x360		0x363		:PC Network (Low address)
0x368		0x36B		:PC Network (High address)
0x378		0x37f		:Parallel Port 1 (LPT1)
0x380		0x38f		:SDLC, Bisync
0x3a0		0x3bf		:MDA / prn adapter (hercules)
0x3c0		0x3cf		:EGA/VGA
0x3d0		0x3df		:CGA/MDA/MCGA
0x3e8		0x3ef		:Diskette controller
0x3fb		0x3ff		:serial port 1 - com 1
The input file looks like this (typically):
 
0x1F0		0x1f8		:Hard disk drive
0x200		0x207		:Game I/O
0x278		0x27f		:Parallel Port 2 (LPT2)
0x2e8		0x2ef		:serial port, com4
0x300		0x31f		:Prototype / Network PCB
0x360		0x363		:PC Network (Low address)
0x368		0x36B		:PC Network (High address)
0x378		0x37f		:Parallel Port 1 (LPT1)
0x380		0x38f		:SDLC, Bisync
0x3a0		0x3bf		:MDA / prn adapter (hercules)
0x3c0		0x3cf		:EGA/VGA
0x3d0		0x3df		:CGA/MDA/MCGA
0x3e8		0x3ef		:Diskette controller
0x3fb		0x3ff		:serial port 1 - com 1


RE: my dual pentium

Date: Mon, 09 Mar 1998 10:29:24 -0700
From: James Gilb, [email protected]

My guess is that the default Caldera kernel does not have multiple CPU's enabled. You will probably have to recompile your kernel to enable SMP. Some kernel versions (even the 2.0.xx) are less stable for SMP than others, unfortunately I can't give you any help on which version to choose. However, you may want to join the Linux-SMP mailing list, email [email protected] with the text 'subscribe linux-smp' to join the list. An archive is maintained at Linux HQ (http://www.linuxhq.com/lnxlists/linux-smp/), so you may want to look there first before you ask on the mailing list. The May 1997 Caldera newsletter has the following information (a little out of date):

Linux? When will SMP be fully supported?

The Linux 2.x kernel with full SMP support is currently in beta, and will most likely be included in the next stable release of the kernel. The Linux 2.0.25 and 2.0.29 kernels which ship in OpenLinux 1.0 and 1.1 products can reside and are tolerant of an SMP environment, but will not perform load balancing.

To enable SMP, the OpenLinux 1.2 FAQ (http://www.caldera.com/tech-ref/col-1.2/faq/faq-5.html) has the following suggestions:

5.4 How to enable SMP (multiple processor) support:
To enable SMP (multiple processor) support in OpenLinux, you must do three things:

  1. Go to "/usr/src/linux" and uncomment the "SMP = 1" line in the Makefile (to uncomment this line, remove the preceeding "#").
  2. Follow the instructions in Rebuilding the Linux Kernel for Caldera OpenLinux 1.2 (http://www.caldera.com/tech-ref/docs/COL12-Kernel-Rebuild.html) and during the 'make config' step be sure to enable "Real-time clock support". Then recompile your kernel using the remainder of the steps.
  3. Reboot your system.
Currently there is no method for monitoring how much of each processor is being used, but if you run the "top" utility you will most likely see processes that are using more than 100% of a processor; whatever is above the 100% mark is being done with the other processors. Also, to determine if both processors have been detected and are in use, you can cat the "/proc/cpuinfo" file for a report of what processors are recognized by Linux; if there's more than one listed, you are running with SMP support.

Some sources for information on SMP are:

http://www.caldera.com/LDP/HOWTO/Parallel-Processing-HOWTO-2.html
(or any other LDP site)
http://www.linux.org.uk/SMP/title.html
http://www.uruk.org/~erich/mps-linux-status.html
(These pages haven't been updated in a while)

If after reading the above information, you still have questions, you might email Caldera's technical support (assuming you purchased your distribution from them and registered it.) I have had good luck with their technical support, but read the FAQ's first.

BTW: I found most of the above information by going to Caldera's web page and typing SMP in the search box. Thanks Caldera for the web site.

James P. K. Gilb


RE: Changing XDM windows

Date: Mon, 09 Mar 1998 11:20:33 -0700
From: James Gilb, [email protected]

Jeroen, there a three ways that I know for sure to customize your login screen.

  1. Get XDM-photo from ftp://tsx-11.mit.edu/pub/linux/sources/usr.bin.X11/xdm-photo-1.1.tar.gz
  2. Use XBanner, which can do some really terrific things with you login screen. If you want a login screen that is the envy of you neighbors, you need XBanner. The URL for XBanner is: http://chaos.fullerton.edu/XBanner
  3. Use Xdm3d/XPM - from http://oak.ece.ul.ie/~griffini/software.html, get the sources and put your own XPM in, although the default penguin is pretty cool.
-- James Gilb


RE: HELP-Installing Linux on a FAT32 Drive

Date: Mon, 09 Mar 1998 11:24:56 -0700
From: James Gilb, [email protected]

Nate, there is a patch to allow FAT32 support in the Linux kernel so you can mount the OSR2 drives and even run a umsdos type installation. The web page for the patches is:
http://bmrc.berkeley.edu/people/chaffee/fat32.html

-- James Gilb


Re: Apache SSL extensions...

Date: Wed, 11 Mar 1998 02:45:06 -0800
From: G-man, [email protected]

I've put up a web page on how to setup apache-ssl Check out http://www.linuxrox.com/WebServer.html .. Also have examples of how the httpd.conf should look like to run secure and non-secure web server using apache-ssl..

Hope that helps..


Reply to locate tip (LG 26)

Date: Wed, 11 Mar 1998 19:37:47 -0500 (EST)
From: Brett Viren, [email protected]

About the problem of `locate' (2c tip #2 LG #26) showing files that normal users can't access: If this happens, it is not a bug with `locate' but rather with the Linux distribution (or the way locate and friends have been installed by hand). `Locate' should be allowed to print any and all matching file that are in the database it is pointed to. However, in the case of the database for general system, it is a security bug (IMO) if the database includes non-world-readable files. Here is were the problem lies.

Debian Linux handles this by running `updatedb' (the program which actually makes the `locate' data base) from /etc/cron.daily/find via:

 
	cd / && updatedb --localuser=nobody 2>/dev/null
This is also a tad easier than patching/recompiling. Anyways, there is my 2cents.

-Brett.


Re: Getting Linux to the public...

Date: Thu, 12 Mar 1998 17:19:59 -0500
From: Milton L. Hankins {64892}, [email protected]

(This is in response to the article posted in General Mail, Linux Gazette, Issue 26, March 1998.)

Although I can't speak for developers "that have Gobs of money for good video boards and [humongous] monitors," I can share a few things with you about my experiences with XFree86. I have run it successfully with on a 14 inch monitor, using the standard SVGA X server on a 486-75MHz with a Cirrus video card. It took quite a bit of fiddling, but I eventually figured out how to get it to run in 800x600 mode, and then in 1024x768 interlaced.

A lot of it was just meddling with the XFree86 configuration file directly, hoping that I wouldn't blow my monitor up. There are tools today (like Metro-X) that make this process a fair bit easier.

One thing you might not realize is that the XFree86 config (last I remember) sometimes chooses 640x480 mode on startup, when it actually supports more modes. Try pressing Ctrl-Alt-Keypad+ to change the resolution while running X.

Monitor size is another matter. I recall one application that liked to size itself bigger than my screen. There are a couple ways around this.

The first is the -geometry flag, available to most X applications. If you want to try it, the xterm, xeyes, and xbiff programs all support it. The most basic format is:

 
-geometry =<width>x<height>+<x>+<y>:
Replace <width> and <height> with the desired width and height of the window, respectively. Sometimes width and height refer to characters, and sometimes they refer to pixels. Your mileage may vary. <x> and <y> refer to the pixel coordinates of the new window's upper left corner. If you want, you can leave out the first half (default size) or the second half (default location). Sometimes you can leave off the equals sign, too.

Some examples: "-geometry 800x600+0+0" will place an 800x600 window in the upper left corner of the screen. "-geometry 400x300+200+150" will place a 400x300 window in the center of an 800x600 display.

You can write shell aliases to run these programs with a default size. A cleaner way is to put geometry specifications in your .Xresources file. Usually this is of the form <programName>*geometry: <width>x<height>+<x>+<y>

Here are some examples:

XEyes*geometry:                 +1060+40
plan*geometry:         +10+10
Netscape.Navigator.geometry: =336x425
Netscape.Mail.geometry: =300x400
Netscape.News.geometry: =300x400
Netscape.Composition.geometry: =350x350
You may also want to adjust the fonts for your program, especially if it doesn't support the -geometry flag nor X resource.

I, too, feel that Linux is not ready for the public because of its comparatively steeper learning curve. But it's gotten a lot better over the years, thanks to the Linux community. Keep up the good work, everyone!

Milton L. Hankins (no known relation to Greg)


My 2-cents on W95/Linux coexistence

Date: Tue, 17 Mar 1998 17:56:16 -0500
From: Carl Helmers, [email protected]

Re W95 and Linux: With hard disks crashing in price (hopefully not the heads), here is the strategy I used for this problem of getting W95 and Linux on the same machine at the end of 1997: On one of my personal desktop machines, I had excellent results using a product called "System Commander" -- this product has a Linux-savvy manual which explains all the details one needs. The machine in question is a generic Pentium-133 with 32mb memory, a 2GB EIDE drive and a S3 Virge based graphic card. After I got the machine in 1997 I added a removable 2GB EIDE drive in a DataPort drive frame/cartridge setup for testing various Linux versions, keeping the original W95 that came with the machine in the first drive.

Once I installed System Commander I set up the default boot choice on the P133 desktop machine to be (of course) Linux on the second hard drive, where I currently have X installed. I use this machine (running Emacs and a bunch of handy macros) to keep my update log while installing new Linices on my other machines (a Dell Latitude LM Laptop [P133 40mb] with an alternate 2GB hard drive for Linux, and a Cyrix 6X86-166 clone on the desktop next to the P133.

My first attempt at a W95/Linux combination was on that Cyrix clone -- whose W95 seems to have re-written the fundamental hard disk sector map of the second (but different model number, same capacity) Western Digital drive on which I installed Linux through getting a working X display -- before closing down and rebooting with LILO. After that disaster, I just said the heck with W95 and reformatted the 2GB hard disk as the primary Linux disk, with the second disk in its DataPort removable frame retained as an additional file storage region. In my 30 years of using computers since high school in 1966, I have developed the habit of always keeping a detailed log when doing anything I might want to reproduce -- such as installing a Linux release. That way, if I make a mistake I can try again, changing some critical detail or other. I started the habit with pencil and spiral paper notebooks. These days, I use a second computer system sitting on the same desktop running emacs under XFree86 with my custom macros to speed up entry -- but the principle is the same.

In the System Commander desktop machine, I set W95 as a second boot option, and the third option for booting from floppy using the Linux installation boot diskettes. I still useW95 [perish the thought] for one or two commercial Wintel programs I like which do not have a Linux work-alike, and to try out new software packages.

Carl Helmers


2-cent tips in LG 26: core dumps (Marty Leisner)

Date: Tue, 17 Mar 1998 19:45:48 +0100
From: Christoph L. Spiel, [email protected]

I was annoyed by "file", too. Under several other unices "file" can be used to identify a core dump. Marty's tip is just fine. You don't have to write any script or other stuff.

I used "gdb" to find out where a "core"-file came from. As a wrapper around it, I wrote "idcore". It has the advantage of displaying only relevant information, i.e., the name of the binary causing the core-dump. This way it can by used, e.g., in cron jobs to notify users. The verbosity of idcore is controlled with the

 
	--brief
and
 
	--long
options.

I'd like to paste some sample output here, but neither can I find a core dump on my machine, nor do I know a program that generates one. (This is not a devine linux-box, I have thrown out most instable binaries ;-)

Here comes "idcore":

 
#!/bin/sh

# name:      idcore  --  identify which binary caused a core dump
# author:    c.l.s. ([email protected])
# last rev.: 1998-01-22  11:14
# bash ver.: 1.14.7(1)
# $Id: lg_tips27.html,v 1.2 2002/10/09 22:24:23 lg Exp $

# display help message
# char* disp_help(void)
function disp_help
{
	echo "usage:"
	echo "	idcore [OPTION] [[COREDUMP] ...]"
	echo
	echo "	If COREDUMP is omitted the core file in the current"
	echo "	directory is used."
	echo
	echo "	-h, --help	display this help message"
	echo "  -v, --version	show version of idcore"
	echo "	-b, --brief	brief format, i.e. filename only"
	echo "	-l, --long	long format, with filename, signal, user,"
	echo "		        date, and backtrace"
}

# retrieve name binary that caused core dump via gdb
# char* get_name(const char* mode, const char* name)
function get_name
{
	case "$1" in
		brief)
			echo q | gdb --quiet --core="$2" 2>&1 | head -1 | \
			sed -ne "s/^.*\`\(.*\)'\.$/\1/p"
			;;
		standard)
			echo q | gdb --quiet --core="$2" 2>&1 | head -2
			;;
		long)
			dump=$(echo -e "where\nq" | \
				gdb --quiet --core="$2" 2>&1)
			echo "$dump" | head -2 | sed -ne '2,2s/\.$//p'
			ls -l "$2" | \
			awk '{ print "on", $6, $7, $8, "caused by", $3 }'
			echo
			echo "backtrace:"
			echo "$dump" | sed -ne '/^(gdb) /s/^(gdb) //p'
			;;
	esac				
}
#
# start of main
#
myname=$(basename "$0")		# name of shell-script
mode=standard			# normal mode of operation

case "$1" in
	-h | --help)
		disp_help
		exit 1
		;;
	-v | --version)
	        echo "version 0.1.0"
		exit 0
		;;
	-b | --brief)
		mode=brief
		shift
		;;
	-l | --long)
		mode=long
		shift
		;;
	-* | --*)
		echo "$myname: unknown option $1"
		exit 2
		;;
esac

if [ -z "$1" ]; then
	# no argument -> look at core in the current directory
	get_name "$mode" core
else
	# process all arguments
	for c; do
		# echo file we are processing
		if [ "$mode" != "brief" ]; then
			echo "$c: "
		fi
		get_name "$mode" "$c"
	done
fi
exit 0


Perl Script 2C Tip

Date: Mon, 16 Mar 1998 15:46:25 +0000
From: Mark Hood, [email protected]

After seeing the "Keeping Track of Tips" suggestion in your October issue, I thought it might be worth contributing this perl script which I use in a similar way. I have a user called 'info' and he has a .forward file consisting of the following line:

 
"| /home/info/mail2web"
In the user's public_html folder, I created a file called index.html:
 
<HTML><HEAD><TITLE>Information Archive</TITLE></HEAD>
<BODY>
<TABLE>
<TR><TH>Subject</TH><TH>Date</TH><TH>From</TH></TR>
<!-- Add after here -->
</TABLE>
</BODY>
</HTML>
This allows me to simply mail directly to this user, and the tip is instantly stored on the web page - no need for cron jobs or external C programs to split the mail up.

This file is provided for free use, feel free to distribute or alter it in any way. Note that there is no warranty - it works for me, but that's all I can say. In particular, I can't promise there are no security holes in it (it never calls 'exec', so it's unlikely a cracker can subvert it on your machine - and it's certainly no more dangerous than a shell script run by cron).

Enjoy! Mark Hood

 
----- Cut here and save as mail2web -----
#!/usr/local/bin/perl
#
# mail2web (C) 1998 Mark A. Hood ([email protected])
# 
# Takes a file (piped through it, eg. from a .forward file)
# And bungs it in a Web page.
# We have two html files:
# $index is the index file
# $stem  is the base name of the information files - the date & time
#       are appended to make it unique.
#
# The index file must exist and look like this (without the leading #
signs)
# The important bit is the  comment - this script
# uses that to know where to put the new data...
#
# <HTML><HEAD><TITLE>Information Archive</TITLE></HEAD>
# <BODY>
# <TABLE>
# <TR><TH>Subject</TH><TH>Date</TH><TH>From</TH></TR>
# <!-- Add after here -->
# </TABLE>
# </BODY>
# </HTML>

# Variables - change these to match your system

$index = "/home/info/public_html/index.html";
$stem  = "/home/info/public_html/";

# Nothing below this line should need changing

# Define the time and date

($sec,$min,$hour,$mday,$mon,$syear,$wday,$yday,$isdst) = localtime;

$year = 1900 + $syear;

# Add the time and date to the end of the filestem

$stem = sprintf ("%s%02d%02d%02d%02d%02d%02d.html", 
                $stem, $year, $mon, $mday, $hour, $min, $sec);

# Open the new file 

open ( OUTFILE, ">$stem") ;

# Write the HTML header
print OUTFILE "<HTML><HEAD><TITLE>\n";

$printing = 0;
$from     = "nobody";
$date     = "never";
$title    = "Untitled";

while ($line = <>) {
        if ($line =~ s/^From: (.*)$/$1/g) {             # Sender
                $from = $line;
        } elsif ($line =~ s/^Date: (.*)$/$1/g) {        # Date
                $date = $line;
        } elsif ($line =~ s/^Subject: (.*)$/$1/g) {     # Subject
                $title = $line;
                print OUTFILE $title;
                print OUTFILE "</TITLE><BODY><PRE>";
        } elsif ($line =~ /^$/ && $printing == 0) {     # End of headers
                $printing = 1;                          # Show the info.
                print OUTFILE "From: " . $from;
                print OUTFILE "Date: " . $date;
                print OUTFILE "Subject: " . $title . "\n";
        }
        $line  =~ s/\</\<\;/g;                        # Mask out
specials
        $line  =~ s/\>/\>\;/g;

        if ($printing) { 
                print OUTFILE $line;
        }

}

print OUTFILE "</PRE></BODY></HTML>";                   # Finish the
HTML

close OUTFILE;                                          # Close the file

$newfile = sprintf("%s.new", $index);                   # Backups 
$oldfile = sprintf("%s.old", $index);
open (  INFILE, "$index");

while ($line = <INFILE>) {
        if ($line =~ /^\<\!-- Add after here --\>/ ) {  # Our marker
                print OUTFILE "<TR><TD>";
                print OUTFILE "<A HREF=\"" . $stem . "\">";
                print OUTFILE $title . "</A></TD>";
                print OUTFILE "<TD>" . $date . "</TD>";
                print OUTFILE "<TD>" . $from . "</TD></TR>\n";
        }
        
        print OUTFILE $line;
}
rename ($index, $oldfile);                              # Backup the
current
rename ($newfile, $index);                              # Move the new
one
----- Cut here ----- Cut here ----- Cut here ----- Cut here ----- 


rxvt 0.02$ tip

Date: Sun, 15 Mar 1998 17:21:26 -0500 (EST)
From: John Eikenberry [MSAI], [email protected]

Recently I hacked together a little shell script for some friends of mine that I thought others might find of interest. It allows you to run rxvt with a random pixmap put in the background. The random pixmap is taken from a directory, thus no hard coding of pixmap names in the shell script.

Well, here it is... oh, this is using bash btw...

 
----start----
#!/bin/sh
run_rxvt ()
{
        shift $((RANDOM%$#))
        exec rxvt -pixmap ~/.pixmaps/$1
}
run_rxvt `ls ~/.pixmaps/`


Tiny patch to ifconfig

Date: Fri, 06 Feb 1998 23:12:02 -0600
From: John Corey, [email protected]

I've often wondered just how much data I've transmitted through my network. After a little research, I found that the ifconfig program just simply does not display this bit of information in it's results. So, I've fixed that problem.

To install, first get the sources from your favorite sunsite mirror. The file to look for is net-tools-1.432.tar.gz. I found it at ftp://ftp.cc.gatech.edu/pub/linux/distributions/slackware/source/n/tcpip/net-tools-1.432.tar.gz

Unpack those sources, apply the patch with patch < ifconfig.diff, and compile. I only modify the ifconfig program, so just simply backup your existing binary, then install the newly compiled one (assuming you already have this version of net-tools installed). Here is an example of the new output:

 
eth0      Link encap:Ethernet  HWaddr 00:40:F6:A4:8E:73
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:99773 errors:0 dropped:0 overruns:0 frame:0
          TX packets:91834 errors:0 dropped:0 overruns:0 carrier:0
coll:6
          RX bytes: 20752805 (19.7 Mb)  TX bytes: 27982763 (26.6 Mb)
          Interrupt:9 Base address:0x280
 
Content-Type: text/plain; charset=us-ascii; name="ifconfig.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="ifconfig.diff"

diff -c -r net-tools/ifconfig.c net-tools-patched/ifconfig.c
*** net-tools/ifconfig.c	Tue Sep 23 15:05:24 1997
--- net-tools-patched/ifconfig.c	Fri Feb  6 15:54:51 1998
***************
*** 190,195 ****
--- 190,196 ----
  static void
  ife_print(struct interface *ptr)
  {
+   unsigned long rx, tx, short_rx, short_tx;  char Rext[5], Text[5];
    struct aftype *ap;
    struct hwtype *hw;
    int hf;
***************
*** 352,357 ****
--- 353,372 ----
  	ptr->stats.tx_packets, ptr->stats.tx_errors,
  	ptr->stats.tx_dropped, dispname, ptr->stats.tx_fifo_errors,
  	ptr->stats.tx_carrier_errors, ptr->stats.collisions);
+ 
+ /* MyMod */
+   rx = ptr->stats.rx_bytes;  tx = ptr->stats.tx_bytes;
+   strcpy(Rext, "");  short_rx = rx * 10;  short_tx = tx * 10;
+   if (rx > 1048576) { short_rx /= 1048576;  strcpy(Rext, "Mb"); }
+   else if (rx > 1024) { short_rx /= 1024;  strcpy(Rext, "Kb"); }
+   if (tx > 1048576) { short_tx /= 1048576;  strcpy(Text, "Mb"); }
+   else if (tx > 1024) { short_tx /= 1024;  strcpy(Text, "Kb"); }
+ 
+   printf("          ");
+   printf(NLS_CATGETS(catfd, ifconfigSet, ifconfig_tx,
+ 	"RX bytes: %lu (%lu.%lu %s)  TX bytes: %lu (%lu.%lu %s)\n"),
+ 	rx, short_rx / 10, short_rx % 10, Rext, 
+ 	tx, short_tx / 10, short_tx % 10, Text);
  
    if (hf<255 && (ptr->map.irq || ptr->map.mem_start || ptr->map.dma || 
  		ptr->map.base_addr)) {


Re: Wanting HELP!

Date: Wed, 04 Mar 98 13:35:24 -0500
From: Bill R. Williams, [email protected] Status: RO

For anyone interested... IT'S FIXED! (*applause, cheering, etc.*) On Fri, 27 Feb 98 14:16:13 -0500, I (Bill R. Williams) wrote:

 
...[snip]...
In the process of getting a System installed I upgraded from the original CD-ROM install of (Intel) RedHat 4.2 to the new RedHat 5.0 CD-ROM. One of the significant items on this system is the mars-nwe Netware emulator. Under the RedHat 4.2 with mars-nwe 0.98pl8-1 the mars package ran fine, but logged copious errors about there being "too many connections -- increase the number in config.h". But it ran, and I *liked* the way it happily did Netware duties! (Especially the printer part.) The *new* RedHat 5.0 with mars-nwe 0.99pl2-1 offered some very desirable abilities, not the least of which is the move of some items (such as number of connections) to the run-time config file (/etc/nwserv.conf under RedHat, probably nw.ini on other distributions.) Now the bad news...
...[snip]...
This new package spawns out nwconn processes with an empty parenthesis as the last token instead of the USERID ('nwconn ... ()') until all connection slots are eaten, and then, of course, will not recognize any new attempts. Any users already logged into the nwserv(ice) are Ok.
...[snip]...
I have tried every combination of parameter twiddling in the run-time config file that can think of, but to no avail.
...[snip]...
Anyone who has solved this problem, please share the secret.
BTW: I had regularly pulled in updates to everything from RedHat errata. I was getting a bit gun shy about updating, because that's how I got into the mess. :-) I had previously tried the "..pl2-3.rpm" when it first appeared, but it died immediatly on startup so I went back to the "..pl2-1.rpm" build which, at least, would run in spite of all the problems I was having with it.

The breakthrough was inspired by a note I got when On Mon, 02 Mar 1998 12:24:37 +0100, Trond Eivind Glomsrd wrote: "Last: You have installed all items from the errata? The glibc updates fixes a lot of bugs, at least."

So I made one more trip to the RH errata repository, and got the absolute latest updates. There did happen to be a newer update of that glibc which Tron had mentioned.

I applied the glibc updates and installed the mars-nwe 0.99pl2-3, and this all seems to have fixed everything. Mars runs, and all the ugly hangups and problems appear to be gone! It's a thing of beauty.

For those keeping score, here are the package levels which are significant to running the mars-nwe on my RH 5.0 System:

 
    kernel-2.0.32-2
    mars-nwe-0.99pl2-3
    glibc-2.0.6-9 
It appears that the mixture of levels I had prior to this set just did not synch up, and I suspect the the fix must have been in the new glibc as Tron suggested it might be.

What a relief!

Bill R. Williams


Re: Help Wanted (usershell on console without logging in)

Date: Mon, 23 Mar 1998 15:26:17 -0500 (EST)
From: Kragen, [email protected]

Last month, there was a request by Todd Blake for some help:

I like most people am the only person to use my linux system at home. What I'd like to do is when my system is done booting to have me automatically login as my main user account(not as root though) on one virtual console(the first) and leave all other consoles and virtual consoles alone,

I thought this was a good idea, so I tried to do it. Eventually, I succeeded. The resulting software is at http://www.pobox.com/~kragen/sw/usershell.html. Mr. Blake reports that it is a good job.

Anyone else is welcome to it. I'll even help you if you have trouble with it :)

Kragen


2 cent tip followup -- X

Date: Tue, 24 Mar 1998 14:26:43 -0500
From: Vivek Khera, [email protected]

In the March issue, you have a tip on using X programs when you've run su to root. By far the easiest method is to simply

 
setenv XAUTHORITY ~khera/.Xauthority
for your own user name, of course... No need to run any other programs or cut and paste anything.

I have my machines configured so that when someone becomes root, if the file ~/.rootrc exists in their home directory, it is sourced as part of the root's .cshrc file. In there, I put the above setenv command. I've never had to think about it again (in nearly 5 years).

Hope this helps someone.

Vivek Khera, Ph.D.


locate patch

Date: 24 Mar 1998 11:57:20 -0000
From: Remco Wouts, [email protected]

In the Linux Gazette number 26 (march) there was mention of a patch for locate. The idea of the patch was to make it impossible to find out the names of files in directories that you do not have access to.

Unfortunately this patch does not solve the problem at all. So I would advise people not to use this patch, they could be lured into a false sense of privacy. What is the problem and what is wrong with the patch?

Locate allows you to find a file quickly. It does this by consulting a database of filenames. Of course this way of finding a file is much quicker then hunting for it in the file system. However, somebody has to make the database. This is done with the program updatdb, usually from a crontab every day or week. Updatdb can find all files that the user id, it is running as, has access to. So if updatedb is run with an id that has more access rights then the user who invokes the locate command, this user can find out the names of files that he/she otherwise could not find. The author of the locate patch solved the problem simply by changing the locate command. Just before sending the name of a file, it checks whether it exists and if so whether the invoking user has read access. However you don't need to use the locate command at all to read the file database. To make sure every user, who invokes locate, can read it it is stored world readable. The patch does not help at all to solve the privacy problem.

For the moment, if you are concerned about these privacy issues, you should not run 'updatedb' at all, and remove the existing database. Since locate & Co. are very handy utilities it is probably best to leave things as they are and make sure updatedb is run by user nobody from a crontab.

The next easiest solution would be to make the database created by updatedb readable by root only, and change locate to a setuid program which consults the database as root and checks for permissions. I will leave that as a challenge to the author of the patch.

Happy Linuxing.
-- Remco Wouts


locate subdirectories

Date: Thu, 26 Mar 1998 17:02:22 +0000 (GMT)
From: [email protected]

in a large directory of files it is sometimes hard to locate the subdirectories. to do this you can tag the directories with a '/' (using ls -F) and then grep these out...

 
ls -F |grep /$
or even better..
 
alias sub="ls -F |grep /$"
Padraig


Published in Linux Gazette Issue 27, April 1998


[ TABLE OF 
CONTENTS ] [ FRONT PAGE ]  Back  Next


This page maintained by the Editor of Linux Gazette, [email protected]
Copyright © 1998 Specialized Systems Consultants, Inc.