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


More 2¢ Tips!


Send Linux Tips and Tricks to [email protected]


Contents:


Linux kernel 2.1.102(3) error - patch!

Date: Sat, 23 May 1998 16:20:07 +0000
From: Yaroslav Rosomakho, [email protected]

Hello. I have found that make menuconfig and lowlevel sound drivers won't work in 2.1.102 & 2.1.103 (latest kernels). I have written a patch:
http://yaroslav.hypermart.net/linux

tell people about it!

Yaroslav Rosomakho.


Tip for using Windows 95 buttons in X

Date: Wed, 29 Apr 1998 20:18:00 +0200 (MET DST)
From: Andreas Ehliar, [email protected]

I am sure that I am not the only one using a keyboard with Windows 95 buttons. Most people I know tend to ignore them, since they are not very useful in Windows 95, and even less so in Linux. But they are supported in the Linux kernel. That is, they do generate key codes which applications could use, if they only know what to look for.

So, how do I get X to use the offending buttons? In the following example, I will show how I configured X and fvwm2 to allow me to move a window by pressing the left Windows 95 button, and the left mouse button anywhere in the window. I can also resize the window by pressing the left Windows 95 button and the right mousebutton anywhere in the window. This greatly simplifies things for me, since I don't have to locate the titlebar, or a border of the window to move it. So, how did I accomplish this? First, I created a file named .Xmodmap in my home directory with the following two lines:

keycode 115 = Hyper_L
add mod4 = Hyper_L
This will map the left Windows 95 button to Hyper_L, and map Hyper_L to mod4.

I added the following line to .xsession to actually load the modified keymap:

 
xmodmap $HOME/.Xmodmap
Note that .xsession is usually executed if you use xdm to log on. If this is not the case, you need to find the relevant file on your computer system. Some likely candidates are .xinitrc, or .Xclients, however, YMMV.

To actually use mod4 I modified my .fvwm2rc by adding the following lines:

 
# I have bound my left win95 button to mod4, and by holding down it
# I can move and resize my window without bothering to find a border or
# titlebar
Mouse 1 W       4       Move
Mouse 3 W       4       Resize
What these lines does is to specify that if you press the left mouse button (1) in a window (W) while pressing mod4 (4) you will move the window. (Move) If you want to know more about these lines, you should study the fvwm2 man page.

So, read in your .Xmodmap, restart fvwm2, and enjoy the added functionality. Now all that is left is to replace that Windows logo with a penguin :)

Final notes:

* This is only an example, you will probably need to modify some paths to suit your system.

* It is also possible that you already have a button bound to mod4. In that case, you should probably think twice before binding another button to it.

* If you don't use fvwm2 as your window manager,you should read the documentation that comes with your window manager to figure out how to do the above mentioned configuration.

* If you want to bind the other two window 95 buttons, the scan codes for them are 116 respectively 117. This sort of information is by the way available using the xev program.

Andreas Ehliar


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

Date: Thu, 30 Apr 1998 09:38:03 -0700
From: Rick Bronson, [email protected]

I've read, with interest, the good ideas people have submitted about setting up Linux to be more stand alone. I've worked on this issue on and off for some time now and would like to share my ideas.

I've often thought that there needs to be a Linux distribution that has an automatic startup as the default. One of the reasons that MSDOS (as bad as it was) was popular was because it wasn't burdened with "security" items like logging in. Most of us that use Linux at home don't need to waist time logging in every day. If we had a distribution of Linux that booted up into X we would have a lot more users.

My goals are as follows (all done automatically from power up):

1. From power up, automatically login.

2. Bring up X Windows.

3. If I haven't been connected to my ISP (via PPP) in the last 4 hours then connect.

3.1 Start up Netscape, get mail from my ISP (via cron), and check it every minute.

3.2 If I haven't read USENET news today then fire up newsreader and automatically to thru and apply kill files to all articles and leave newsreader just showing what's left.

3.3 (I admit, this one is weird) Telnet into my local library and check to see if I have overdue books.

For the purposes of this 2 cent tip, I'm going to cover #1 & #2. (NOTE: replace every occurrence of "username" with your real login name).

1. Add this to the bottom of your /etc/inittab (for Debian), unless you have an rc.local file

 
rc:12345:wait:/etc/init.d/rc.local
1a (if you don't have an rc.local file) Make an /etc/init.d/rc.local file with this in it:
 
#!/bin/bash
echo "Auto login of user username"
cd /home/username
su - username
Set permissions of rc.local to:
 
  -rwxr-xr-x   1 root     root           96 Jun 29  1997 rc.local
By doing:
 
chmod 755 rc.local
1b (if you have an rc.local file) Add this to the bottom of your rc.local
 
echo "Auto login of user username"
cd /home/username
su - username
2. Add the following to the bottom of your ~/.bash_profile:
 
if [ "`tty`" = "/dev/console"  -o "`tty`" = "/dev/tty0" ]
then
  startx
fi
That's it! This has been tested under Slackware (a long time ago) and under Debian, recently. Please give me any feedback.

Thanks, Rick Bronson


IBM Lan Adapter for Ethernet

Date: Fri, 01 May 1998 00:23:21 +0000
From: Brian Hall, [email protected]

I believe this is the same card I have. I have two on my home LAN, one in my Linux box and the other in a Win95 box. In Linux, use the ne2000 compatible network driver, found under "Other ISA" network cards in the kernel configuration. To configure the card itself, you will need to run a DOS program. The setup program is contained in an archive called "ETILAN.EXE".


Easy Access to Removable Media

Date: Fri, 1 May 1998 10:30:52 +0100 (BST)
From: Karsten Ballueder, [email protected]

Here's a little tip that makes life much easier. I always found it annoying to manually mount and unmount floppies, CD-ROMs or my ZIP drive, so eventually I decided to use the amd automounter for that.

The configuration is somehow tricky, but once it's set up, it works like a charm.

For amd to work, you need to create a mountmap /etc/amd.direct= . Mine looks like this:

 
zip type:=3Dprogram;fs:=3D"/.amd/myhost/zip";mount:=3D"/bin/mount mount=
-tvfat -o user,rw,conv=3Dbinary,nosuid,uid=3D502,gid=3D100,umask=3D0000=
,quiet
/dev/sda4 ${fs} ";unmount:=3D"/bin/umount umount ${fs}"

cdrom type:=3Dprogram;fs:=3D"/.amd/myhost/cdrom";mount:=3D"/bin/mount m= ount -tiso9660 -o user,ro,conv=3Dbinary,nosuid,uid=3D502,gid=3D100,umask=3D0= 000 /dev/cdrom ${fs} ";unmount:=3D"/bin/umount umount ${fs}"
A type:=3Dprogram;fs:=3D"/.amd/myhost/A";mount:=3D"/bin/mount mount -tv= fat -o user,rw,conv=3Dbinary,nosuid,uid=3D502,gid=3D100,umask=3D0000,qu= iet /dev/fd0 ${fs} ";unmount:=3D"/bin/umount umount ${fs}"
Where you will need to replace "myhost" with your machine's hostname. Like this it will automount the ZIPdrive, a CD-ROM and the first floppy in a set of directories created under /.amd .

To start amd, you will usually use something like a script /sbin/init.d/amd, which should contain a line like:
/usr/sbin/amd -l syslog -c 30 -w 30 -x all -a /.amd -- /tmpmnt /etc/amd= .direct &=20

This will start amd and give it a 30 second timeout for unmounting directories. You also need to create a directory called /tmpmnt where you can access the devices. For easy access, I have create symbolic links /zip, /A and /cdrom pointing to /tmpmnt/zip, /tmpmnt/A and /tmpmnt/cdrom.

Now, when you try to access any of these directories, amd will automatically mount the device with the options specified in /etc/amd.direct. Once you no longer access it, it will get unmounted after 30 seconds.

Oh, if it doesn't unmount your device, you can use thefuser /dir command to check which of your processes uses it.

Karsten Ballueder


Re: bpp 16 Question

Date: Sun, 3 May 1998 14:07:55 +0200 (MET DST)
From: Roland Smith, [email protected]

To: [email protected]
You asked in the Linux Gazette #28:

Hi, I'm tired of starting my X-session with 'startx -- -bpp 16' to get 16 biplanes instead of the default 8. How do I get xdm to run with 16 bpp? If I use it now, it starts X with 8bpp on my Red Hat 5 installation.
Assuming you're using the XFree86 server:

Edit your XF86Config file.

Hope this helps.

Roland


Re: finite elements programs for Linux

Date: Sun, 3 May 1998 14:07:55 +0200 (MET DST)
From: Roland Smith, [email protected]

To: [email protected]
In response to your query in the Linux Gazette #28:

I started talking to the ones buying it and my arguments stopped, when they said that one reason for using NT was that they should be running finite elements programs on them and that the frontier for those programs was now on the Windows platform. I don't know anything about that, so I am looking for info; should I accept their arguments or is it that he just does not know what can be gotten for Linux? Commercial Finite Element Method (FEM) programs are also in the searchlight!
FEM has traditionally a UNIX domain. Most FE programs run on commercial unices. I only know of one free program for Linux: felt. You can find it at http://www-cse.ucsd.edu/users/atkinson/FElt/felt.html

Hope this helps.

Roland


Re: How to enable swapping

Date: Sun, 3 May 1998 13:51:21 +0200 (MET DST)
From: Roland Smith, [email protected]

To: [email protected]
In the Linux Gazette you wrote:

My machine, which is a Pentium Pro with 64MB memory, reports no swap space being used. In procinfo, it always report 0K swap space. I did a fdisk on /dev/hda and verified that a 64MB partition of type Linux swap (83) is actually there. So why is the swap never being used ?
Swapping needs to be started. This can be done with the `swapon' command.

Normally there should be something like `/sbin/swapon -a' in the system initialization scripts. On my Slackware system it is in /etc/rc.d/rc.S.

For this to work, you need to define the swap partition in /etc/fstab. Something like (on my box):

 
/dev/hda7    swap         swap    defaults   1   2
Hope this helps.

Regards, Roland Re: cd rom


Re: Slackware

Date: Sun, 3 May 1998 14:30:59 +0200 (MET DST)
From: Roland Smith, [email protected]
To: [email protected]

In the Linux Gazette #28 you asked:

Hello.I have the Linux Slackware 2.0.30 Walnut Creek.I installed it on a Pentium 200 MMX with a 24x CD-ROM. During the installation I had to write "ramdisk hdd=cdrom" for reading the CD-ROM, but after the installation Linux doesn't see the CD-ROM. I have an atapi CD-ROM, and when I tried to compile my kernel another time, I saw that atapi is the default !!! So I don't understand where is the problem . What can I do ?
To use your CD-ROM, you must "mount" it, i.e. add it to your file-system.

You will have to make sure that the iso9660 filesystem is supported in the kernel.

Mounting is most conveniently done by first adding an entry into your /etc/fstab file like this:

 
/dev/hdb     /mnt/cdrom   iso9660 ro,user,noauto,unhide 1 2
(Assuming your CD-ROM player is /dev/hdb) Create the directory /mnt/cdrom before mounting the CD! Put a CD-ROM in the drive and issue the command `mount /mnt/cdrom' to mount the CD.

You will have to unmount the CD (`umount /mnt/cdrom') before you can open the drive!

Hope this helps.

Roland


May 2Cent Tips--about:mozilla

Date: Wed, 6 May 1998 10:28:44 -0700 (PDT)
From: David Mc Anulty, [email protected]

The tip of going to about:mozilla is incorrect. You do not have to click on Netscape's logo to get the new animation. The act of visiting about:mozilla does this.

It lasts until Netscape is restarted. So if you like him, set about:mozilla as your home page.

Dave


Re: Rebooting without logging in as root, 2c tips

Date: Wed, 06 May 1998 09:25:13 +0200
From: Hartmut Niemann, [email protected]

An alternative I used once on a system that did *not* have enabled was to provide a special login that *just* did a shutdown. There is such a line in my /etc/passwd now that I didn't put there, so I guess it's from Red Hat two years ago.
I had this shutdown login too. Normally it needs rood rights, i.e. UID 0. But then I found out that su shutdown does not execute the login shell, i.e. the shutdown script. So everybody can become 'shutdown', which is basically 'root' with a different startup shell. Bad if this 'shell' doesn't get executed ...

For some time I have had 'shutdown' just SUID root, and now I'm back to Ctrl-Alt-Del performing a shutdown -h. (And then press Ctrl-Alt-Del again for a reboot.)

Hartmut.


Re: Running an ATAPI ZIP drive

Date: 05 May 1998 20:26:26 -0500
From: Omegaman, [email protected]

Steve Beach gives some interesting remarks and good advice for setting up an ATAPI ZIP drive. In it he says: First, the kernel:

Do _not_ use the "IDE FLOPPY" option (officially the name is CONFIG_BLK_DEV_IDEFLOPPY ). This will work perfectly for reading and writing, but it will not work for ejecting.
I recently bought a system with one of these units PRE-installed. I purchased a copy of Debian 1.3.1 on CD and was surprised to find "IDE Floppy" support compiled into the stock kernel. So, like Steve, I added necessary entries to my /etc/fstab to mount my ZIPs and away I went.

However, I do not have the problem he's had with ejecting my ZIP disks. On the front of my drive is a status light that also functions as the eject button. It works fine. I surmise that Steve's problem is that he has no such button and requires a software-only eject method.

One note of warning: I once ejected a standard floppy by pressing the drive's eject button when it was mounted causing a system panic and forced reboot. I don't know if the eject button on the ZIP is disabled in the same way as the eject button on a CDROM when it is mounted. I have no intention of finding out.

Omegaman


Re: enabling swap space

Date: Tue, 05 May 1998 04:44:22 -0300
From: Diego Rodrigo, [email protected]

On issue # 28, Kevin Ng wrote :

My machine, which is a Pentium Pro with 64MB memory, reports no swap space being used. n procinfo, it always report 0K swap space. I did a fdisk on /dev/hda and verified that a 64MB partition of type Linux swap (83) is actually there. So why is the swap never being used ?
Tagging a partition with type 83 (Linux swap) is not enough. You kave to prepare it for swap with mkswap (see manual page) . Type:
 
        mkswap /dev/hdxx
where hdxx is your swap partition. After that, you have to append a line in /etc/fstab saying this:
 
        /dev/hdxx       none            swap
where /dev/hdxx is your swap partition, none is the mount point, and swap is the type of file system.

With these changes, the next time you reboot, your swap space will be added to your system. The command that actually adds your swap space to the system is swapon (see man page, section 8), which is called from an init script at boot time. OK, I agree, Linux shouldn't be rebooted, (only when recompiling the kernel), so you can just type:

 
        swapon -a
and you'll have your swap space.

Diego Rodrigo - ARGENTINA


Re: problems using menus in X

Date: Thu, 7 May 1998 11:45:01 -0500 (CDT) From: Michael Hammel, [email protected]

To: [email protected]

I'm having a problem with my menus in X. I can access all menus (by mouse), but the items of those menus which are WITHIN a "X-box" are not selectable, somehow. The menus I'm talking about are menus like the 'vt fonts', 'main options' and 'vt options' in the Xterm. Or the 'file' and 'page' menu of Ghostscript. If anyone has a suggestion on why I can select the menu but not menu item, please send me a mail. I'm using Debian 1.3.
Check your NumLock key. It should probably be turned off for applications written in strict Xlib or Athena widgets, which appears to be the case with the applications you mention. Its not a strict rule, but many people had problems with my XPostitPlus program, caused by the use of the number keypad with applications like XCalc.

Michael J. Hammel, The Graphics Muse


Music Typesetters

Date: Tue, 12 May 1998 12:13:50 -0400 (EDT)
From: Robert Tennent, [email protected]

Although I appreciated Bob van der Poel's review of MUP in LG28, there are some good free music notation systems that weren't even mentioned. First, a very good site to check out is the Lilypond home page at

http://www.cs.ruu.nl/people/hanwen/lilypond/out-www/index.html

This describes Lilypond (which is still under development) but also has links to many other music packages.

One of these, musixtex, is IMHO the best free system available. It certainly isn't beta, but it is being extended and improved constantly. The input language is plain TeX, but there are some good pre-processors available (PMX, MPP, M-Tx, SceX, ABC2MTeX). The output quality is professional. Several arrangements I've set using musixtex have been published directly from my postscript files. Check out

http://www.gmd.de/Misc/Music

for links, downloads, documentation, examples, etc.

Bob Tennent


BASH hostname completion: comment on tip in May '98 issue

Date: Tue, 12 May 1998 08:58:18 -0500
From: Justin Dossey, [email protected]

The script John Taylor sent had a nice idea to it, but I must admit I didn't read it; Bash completes host names by a builtin function.

Just as you would use to complete a filename, you can use ESC, @ to complete a hostname (if it is in /etc/hosts) and CTRL-X, @ to list all possible hostname completions based on /etc/hosts.


Re: xdm and depth

Date: Tue, 12 May 1998 11:32:26 +0100 (IST)
From: Caolan McNamara, [email protected]

From: Denny �berg, [email protected]
Hi, I'm tired of starting my X-session with 'startx -- -bpp 16' to get 16 biplanes instead of the default 8. How do I get xdm to run with 16 bpp? If I use it now, it starts X with 8bpp on my Red Hat 5 installation.
under redhat in the file /etc/X11/xdm/Xservers

there's a line

 
:0 local /usr/X11R6/bin/X
change this to
 
:0 local /usr/X11R6/bin/X -bpp 16D
and ta-da, thats it.

Caolan McNamara


Re: Shutdown and Root

Date: Mon, 11 May 1998 13:42:44 +0200
From: Aaron Digulla, [email protected]

Another note to the 2cents Tip "Re: Shutdown and Root":

I have a shutdown user, too, and this is what he looks like:

In /etc/passwd:

 
    shutdown:x:6:0:shutdown:/home/shutdown:/bin/sh
You'll probably have to adjust the user-id (here: 6).

Then you create a home-dir which just contains this script as .profile:

 
------------------------ .profile ---------------------------------------
#!/bin/sh
trap "" SIGKILL SIGINT SIGQUIT

PATH=/bin

# List all users which are still logged on
/usr/bin/finger

echo
echo "Really shut down (y/N) ?"

read answer

# Every answer except "y" is no
if [ "x$answer" != xy ]; then
	answer=n
fi

if [ $answer = y ]; then
	echo 'The system will now shut down. You can turn the power'
	echo 'off when the message "System halted" appears'
	/bin/sleep 5
	./halt
else
	echo 'Abgebrochen...'
	/bin/sleep 1
fi
------------------------ .profile ---------------------------------------
Now just copy /sbin/halt to /home/shutdown/ and make it executable for this user (chown shutdown halt and chmod 700 halt).

Aaron "Optimizer" Digulla


Printing with Linux

Date: Sat, 09 May 1998 18:50:06 +1000
From: Mitch Davis, [email protected] To: [email protected]

I've just bought a HP DeskJet 722C printer, but I couldn't get it to work. I asked around and everyone has answered that Linux does not support it - is it a Windows-only printer? If so, is it possible to write a driver for it? or does anyone know of where I can get my hands on the driver (if it's already been written, of course).
In an effort to reduce the production cost of their low-end printers, HP has removed as much of the electronics from the printer as possible, and put the burden of turning commands into dots on the printer driver in the computer. Somewhat euphuistically, this is called the Printing Performance Architecture, a kind of less-is-more concept which I'm sure is big in the HP marketing Dept.

All is not lost however. There's a guy who reverse-engineered the protocol, and has written a driver. You can find his page here:

http://www.rpi.edu/~normat/technical/ppa/

(I have not tried it, nor have I corresponded with him).

I hope this helps you.

Mitch.
(I don't work for HP. Well Ok, I do, but further away from the bit that makes printers than you'd ever believe. I speak as an outsider)


RE: finite elements programs for Linux

Date: Fri, 22 May 1998 09:39:29 -0700
From: "James Gilb (p27451)", [email protected]
To: [email protected]

At the department where I am sitting they are planning to buy a PC-bar, and they intend to put NT on the machines. I would benefit from them putting Linux on them, since I could then use them for simulations overnight. ... I don't know anything about that, so I am looking for info; should I accept their arguments or is it that he just does not know what can be gotten for Linux? Commercial Finite Element Method (FEM) programs are also in the searchlight!
There a some really neat FEM codes out there that are free or semi-free. Check out the Scientific Applications for Linux (SAL) page, sponsored by Kachina Tech at http:// SAL.KachinaTech.COM/

Next, go to the INTERNET FINITE ELEMENT RESOURCES page at:

http://www.engr.usask.ca/~macphed/finite/fe_resources/

and check out the section on Public Domain FE Programs (I think FElt is way cool). Also, there may be some commercial vendors that support Linux as well, you should probably ask your vendors. I found Northwest Numerics and Modeling on the above page which sells a product called Zebulon on Linux. Also, some related software is also available on Linux, e.g. PV-WAVE (graphics), MATLAB, Mathematica, Maple.

Finally, do a search of Linux and FEM software on your favorite search engine. (linux + FEM + software gave me 1085 hits on www.hotbot.com).

As a postscript, the future of FEM doesn't depend on the OS it is used on. The real work is done in numerical code that never touches the OS, indeed an OS call in the middle of the deepest loops would cause a severe slowdown of the program. Some of the interfaces that you use for input, pre-processing and post-processing may be moving to NT, but there are still substantial packages available on the big iron. In any event, the current IA32 line from Intel is not a leader in double-precision floating point work, the current crop of workstations will blow it away in most floating point benchmarks. This is improving with the emphasis on multi-media, but the new chips will be very expensive within the near term (USD $2000-$4000 until at least 2000).

If you have any more questions, please email me.

James Gilb, [email protected]


RE: How to enable swapping

Date: Thu, 21 May 1998 15:49:17 -0700
From: "James Gilb (p27451)", [email protected]
To: [email protected], [email protected]

My machine, which is a Pentium Pro with 64MB memory, reports no swap space being used. In procinfo, it always report 0K swap space. I did a fdisk on /dev/hda and verified that a 64MB partition of type Linux swap (83) is actually there. So why is the swap never being used ?
First, make sure the partition has been turned into a swap partition by doing an mkswap on it. Then just do swapon /dev/hda? where ? is the partition number of the swap partition. Now, if you put an entry for the swap partition in /etc/fstab and run swapon -a in your boot scripts (pretty early on), then swap will be automagically enabled whenever you boot.

James Gilb


Cuckoo Clock

Date: Sun, 24 May 1998 23:48:02 +0200
From: Jjacobsen, [email protected]

My wife's grandpa has a pretty switzer-cuckoo-clock (kuckucksuhr..). Well, I love to hear the little bird singing every hour. That's why I wrote this little script...

 
#!/bin/sh
#cockoo.sh
time=`date +%I`
count=0
until [ "$count" -eq "$time" ]
  do
   play /usr/share/sounds/au/cuckoo.au
   count=$[$count+1]
  done
Then, I edited the crontab file using crontab -e:
 
00 * * * * /bin/cuckoo.sh
and well, it's really funny... Using my script and cron, your Linux box will become a great switzer-kuckucks-uhr ;)

Joerg Jacobsen, Schweinfurt, Germany


Published in Linux Gazette Issue 29, June 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.