...making Linux just a little more fun!

<-- prev | next -->

More 2 Cent Tips!

See also: The Answer Gang's Knowledge Base and the LG Search Engine


Backporting packages.

Sun, 22 Feb 2004 02:09:05 +0000 (GMT)
Thomas Adam (The LG Weekend Mechanic)

Some of you will have expressed questions like: "When will XYZ be in stable" or "is there a backport for such and such". You can in fact backport packages yourself. For such cases, the following procedure works:

(note: I maintain a number of backported debs, and this routine works)...

1. Add a deb-src line for sid to your sources.list. Typically:

deb-src http://www.mirror.ac.uk/sites/ftp.debian.org/debian/ unstable main

2. Run:

apt-get update

3.

apt-get build-dep <package> && apt-get -b source <package>

(where: <package> refers to the package name in question). What this will do is install the build dependencies for the given package, and then will build the package.

4. All that is left then is to do:

dpkg -i ./deb_files.deb


Pushing files to multiple hosts

Mon, 2 Feb 2004 10:20:58 -0500
Ben Okopnik (LG Technical Editor)

When I teach a class, I often need to push one or more files to my students' systems. Previously, I would write a "for-do-done" loop and use "scp" to get the files across, laboriously logging in and exiting out of each system every time I wanted to do a transfer - painfully clunky.

Then I did some searching on the Net and found "sshtool" by "noconflic". Written in Expect, it allows multiple host logins and copying. However, it did not have a "no password" mode (i.e., logging in when ".ssh/authorized_keys" contains your key) and read the list of hosts from a list defined within the program. I've modified it to read an external file called "pushlist" and added a "no password" mode; this last, of course, requires that you first push a "~/.ssh/authorized_keys" to the host list.

See attached sshtool.expect.txt

First, create your "pushlist", possibly from an "/etc/hosts" on one of the local machines. It should contain all your target hosts, one line per host. Next, create your ".ssh/authorized_keys" in the directory where you keep "sshtool" by copying your public keys into it:

ben@Fenrir:~/sshtool$ mkdir .ssh; cat ~/ssh/*pub > .ssh/authorized_keys

Then, push it out to your hosts (NOTE: this replaces the remote hosts' "authorized_keys" files!):

# Log in as user "student" and send the local file
ben@Fenrir:~/sshtool$ ./sshtool -c .ssh/authorized_keys student

After this, I can upload any file or list of files to the entire pushlist simply by typing

ben@Fenrir:~/sshtool$ ./sshtool -C <file[s]> student

I can also execute a command on all the systems via the "-U" option.

Note: I'm not an Expect programmer; otherwise, "sshtool" would accept a "local:remote" syntax so files wouldn't need to be in identical locations. It would also allow you to specify per-host usernames in the push list (not an option I need, but something to make it more flexible.) Anyone adding these features - please send me a copy. :)


compression speed

Tue, 3 Feb 2004 10:48:08 -0500
Ben Okopnik (LG Technical Editor)

Based on something I saw on the "swsusp" list, I've done a bit of experimentation with "lzf" compression. It's not any more effective, size-wise, than some of the common compression utilities - in fact, it's less so in many cases. What it is, however, is fast.

Results for compressing my 45MB "Sent_mail" box:

rar         0m46.314s
bzip2       0m29.840s
arj         0m7.396s
zip         0m7.008s
gzip        0m6.756s
compress    0m3.094s
lzf         0m0.997s

File sizes:

47668763     Sent_mail
35446476     Sent_mail.lzf
32227703     Sent_mail.Z
25119004     Sent_mail.arj
24836842     Sent_mail.zip
24836720     Sent_mail.gz
23355061     Sent_mail.bz2
22877972     Sent_mail.rar

For applications where speed matters more than size, "lzf" is clearly a win. For size where speed is not an issue, it's "rar" (which matches the results of my previous, much broader testing with many file types and scenarios.)


2.6.2 kernel woes: Will not find root fs

Thu, 5 Feb 2004 16:14:18 -0500
dann (dann from thelinuxlink.net)

I have been compiling and recompiling the 2.6.1 and 2.6.2 kernels the past three days trying to find a configuration that will work for me. I have performed many kernel compiles in the past and never had this problem occur on my machine which is currently running 2.4.24.

This is the error I get when I boot into the 2.6.1 or 2 kernel:

VFS:  Cannot open root device "302" or hda2
Please append a correct "root=" boot option
Kernel Panic:  VFS:  Unable to mount root fs on hda2
[Thomas] Believe it or not I had this and it was related to a ramdisk issue. Try adding:
append="ramdisk_size=5120"
to /etc/lilo.conf
and then:
/sbin/lilo -v
Reboot and pray.

Now I have done some searching around google and saw that other people have had this problem. I have implemented a number of suggestions they were given but nothing has been fruitful. This is what I have tried:

Verified the following are compiled in (which they are):

CONFIG_IDE=y
CONFIG_BLK_DEV_IDE=y
CONFIG_BLK_DEV_IDE=y
CONFIG_BLK_DEV_IDEDISK=y  (I have tried both IDE and IDEDISK separately
also)
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y

I have removed support for Advanced Partitions.

Should have no effect -- I support advanced partitions all the time in my kernels so I can mount other-OS drives in my lab station. -- Heather

I have toggled between DEVFS support (initially I said no, but enabling does not seem to make a difference anyway).

By the time devfs really causes pain you're in userland already - you didn't get that far. Didn't I hear a rumor they're deprecating it? -- Heather

I verified my settings in /etc/lilo.conf were correct. I even tried passing the root=/dev/hda2 parameter to the kernel at boot.

Nothing has worked.

I have tried to see if there are any error messages during the boot but where I would suspect there being an error message, it scrolls by way too fast. Nothing gets logged at this point either.

As I said, I have been running 2.4.24 for a bit now having patched that from 2.4.9 along the way. My distro is slackware-current which reports to have support for the 2.6.x series kernels.

Any further suggestions would be much obliged.

Thanks for your time.

[dann] I fell pray to the post to TAG curse again, which usually has me finding the answer within a few hours of emailing TAG.
I had replaced a failing drive about 6 months back with a used drive I picked up along the way. This drive had EZ-Bios installed in the boot sector. Initially I was concerned with this but when I had no problems with running linux after I transferred over my partitions, I put it out of mind a bit too far.
I compiled a 2.6.2 kernel enabling everything possible under the IDE device drivers into the kernel. This slowed down the boot process enough for me to see this line:
/dev/ide/host0/bus0/target0/lun0 p1[EZD]
Sure enough, I knew EZBios was going to come back and bite me one day. I guess EZBios was somehow preventing the kernel from seeing the drive properly.
After removing EZBios the 2.6.2 kernel booted without a complaint.
Thanks for the suggestions, I appreciate your time and effort.
[Ben] Surely that would be "The TAG blessing" rather than "curse", Dann? :) All you do is write to TAG and shortly thereafter get your answer. What could be better?

That is true. Perhaps I should take advantage of that blessing more often and post sooner. Maybe the luck will work the other way. Instead of three days of trial and error, post on day one and the answer will appear.

[Ben] (Yes, we managed to enlist the Universe and The Gods of Fate and Time in helping us. We thought the negotiations would be tough, but, you know, Gods are intelligent beings and therefore use Linux. It was a shoe-in.)

Well heap some more offerings on the pyre. I'm going in for another round of video capture and editing soon!


Live Linux CDs

Wed, 18 Feb 2004 19:45:58 +0000 (GMT)
Thomas Adam, Raj Shekhar, Ben Okopnik (The LG Answer Gang)

Hi all,

Someone on my LUG found a really useful site[1] that has a list of all the Live Linux CDs that are available. Not just Knoppix you know!

-- Thomas Adam

[1] http://www.frozentech.com/content/livecd.php

[Raj] A lot of effort is going to create the regional language flavor of Linux. Linux + Live CDs has provided a fertile ground for internalization of software and demoing the capabilities of Linux to the people.
For example, one of my friends demoed a Bengali version of Knoppix (Ankur Bangla Linux) in the LinuxAsia 2004 held in Delhi, India. It was a great hit. People watched open mouthed as he typed away happily on gedit to produce a small Bengali poem.
[Ben] Oh, excellent! This is sorta the "dark area" of computers - generally solved by "simply" learning English. Not that I mind the world moving toward a common language, but the exclusion field and the entry requirements are keeping the computer culture very small compared to what it could be.
I'm really looking forward to the day when someone invents an input method that is multilingual, portable, and at least as fast as a keyboard (they'll be billionaires overnight.) I've heard of various "fist keyboards" like the Twiddler and OrbiTouch, but... we're not quite there yet.


script for finding ssh-agent at login

Mon, 2 Feb 2004 14:02:38 +0100
Karl-Heinz Herrmann, Ramon van Alteren (The LG Answer Gang)

Hi,

I ran into an annoying problem with ssh-agents. If you don't start one on the very first login screen from which you start X you can't access the agent from any xterm started from the window-manager. Starting new ones is no good idea if one is already running. This script will look for a running ssh-agent and set the environment variables so it can be contacted. If none is running it will start one. As on ssh-login with enabled "AGENT Forwarding" the environment variables will be set and the remote ssh-agent (where you are connecting from) one will be used.

See attached sshssearch-old.bash.txt

unfortunately there has been a change in "interface" of "ssh-add -l" -- before it was giving exit code 0 for "agent is there, with or without keys" and 1 for "no agent".

Now it's finegrained to: 0 for "agent with keys" , 1 for "agent without keys" and 2 for "no agent".

See attached sshssearch-new.bash.txt

of course you have to "source" the script to set the local environment variables:

source sshsearch.sh or . sshsearch.sh

to make it automatic call it from .profile (or .bashrc).

Ben (or whoever feels its to clunky): feel free to make it into a one-liner :-)

K.-H.

[Ramon] I'm familiar with the problem and found a small tool to deal with it. It was written by Daniel Robbins.
Here's the relevant part of the manpage:

...............

NAME
keychain - a program designed to keep ssh-agent processes alive across
multiple logins.

DESCRIPTION
Keychain is an OpenSSH key manager, typically run from ~/.bash_profile.
When run, it will make sure ssh-agent is running; if not, it will start
ssh-agent. It  will  redirect ssh-agent's output to
~/.keychain/[hostname]-sh, so that cron jobs that need to use ssh-
agent keys can simply source this file and make the necessary passwordless ssh
connections. In  addition,  when  keychain runs, it will check with ssh-agent
and make sure that the ssh RSA/DSA keys that you specified on the keychain
command line have actually been added to ssh-agent. If not, you are prompted
for the appropriate passphrases so that they can be added by keychain.

...............

Although it creates a security risk, (don't leave any consoles open unattended, all your keys are cached) I've found it extremely pleasant to work with.
Here's the link:
http://www.gentoo.org/proj/en/keychain.xml
Can't beat homegrown scripts though :) It's too much fun to make 'm.
Hope it's useful


Xine problem

Fri, 06 Feb 2004 11:33:02 +0530
Aditya Godbole (aditya_godbole from infy.com)

I am using RH8 linux and successfully installed xine for video play. Video cds(.dat format) are functioning well with xine. But I cannot play the video files (in .dat format) copied to hard disk.

Hi, Rename the files from .dat to .mpg or .mpeg. Works for me.

Regards,
Aditya Godbole.


Even the laws of nature cannot produce the right results unless
the initial conditions are entered correctly.

Prof. Yash Pal
(Techfest 2004)


Floppies on CD - the ultimate collection

09 Feb 2004 20:20:38 -0500
Suramya Tomar (suramya from suramya.com)

Hi,

This is a cool tip. For people who are too lazy to do all the work (like me) they can download a program called the Ultimate Boot CD which allows you to run floppy-based diagnostic tools from CDROM drives.

For information on the CD and the tools included with it visit: http://www.ultimatebootcd.com. You can download it from the above site or from my mirror at: http://mirror.suramya.com.

The site also has instructions on how to customize the CD for your specific needs.

Hope you all find it as useful as I do.

- Suramya


Local Eth/Internet PPP can work together

Sat, 21 Feb 2004 20:57:17 -0500
Jack Sprat (trashcan from chilitech.com)

On RedHat/Fedora, if only the subnet your computer is part of needs to be accessed over the LAN card, I believe this simple trick will work. If not, it is easy to undo.

On set up of the network, simply do not enter an IP for the gateway. If this is already configured then shut down your network (/etc/rc.d/init/.d/network stop) and remove the "GATEWAY" line from /etc/sysconfig/network-scripts/ifcfg-eth0. Restart your network and the "route" command should show no default gateway, but also a route via eth0 to the subnet your computer is on. Something like : 192.168.0.0 * 255.255.255.0 U 0 0 0 eth0

kppp should then happily create a default route to ppp0 when executed.

Ron H.

No need to shut it down, just do:
route del default gw <IP_ADDR>
You'll need to be root to do it. -- Thomas Adam


Sometimes it's not the website

Fri, 5 Dec 2003 10:31:03 -0800
Mike Orr (Linux Gazette Editor)
Question by Raj Shekhar (rajshekhar3007 from yahoo.co.in)

I'm still not seeing it there. The entries are alphabetical and go from "Firebird Modern" directly to "Lush", and I can't find "LittleFirebird" on the page anywhere.

after some poking around... -- Heather

This is really strange. I checked again and I can see LittleFirebird theme. I asked other people to check it and they could not find it either.

No idea why this is happening. I am on broadband connection. My ISP (Sify broadband) has put a LAN in the neighbourhood and we connect through a proxy server. Do you think this could be an issue with the cache ? (The other people I asked to check were not part of the ISP's LAN)

[Mike] Either your ISP is not updating the page properly, or your browser isn't. I assume you've done shift-reload, restarted the browser, or tried a different browser. Sometimes the browser cache can be subtle and stubborn, although I've had less problems with that since I stopped using Netscape 4. If your ISP has a malfunctioning proxy server, I guess there's nothing you can do except tell them to fix it.


Securing a dial in?

Fri, 13 Jun 2003 10:45:13 -0400
John Karns (The LG Answer Gang)
Question by George Morgan (George_Morgan from sra.com)

Hello answer guy,

I need to be able to secure an external modem that has been connect to a Solaris box to protect against unauthorized calls.. What I mean is that I want to be able to allow people to connect to the box based purely on the phone number they are calling from. Is there a way on the modem to only allow certain calls to go through while rejecting all other calls?

Thanks,

George

[John Karns] See the "mgetty" open source pkg (http://www.google.com/linux for it). It offers this capability, provided that your modem line has caller id. The pkg includes pretty good documentation as well as good example cfg files.


Full r/w to NTFS from Linux

Sat, 06 Dec 2003 00:19:18 -0800
James Sparenberg (james from opencountry.org)

Thought Linux Gazette might like this one. A project called Captive has taken a wine like approach and combined some features from ReactOS.... Microsoft Windows ntfs.sys driver and actually getting full r/w this way.

http://www.jankratochvil.net/project/captive

Is the URL.

James


re: Renaming Ethernet Devices

Thu, 26 Jun 2003 14:36:55 -0700
Ryan White (ryanw from niuhi.com)
In response to 2 Cent Tip #14 in issue 64 (http://linuxgazette.net/issue64/lg_tips64.html#tips/14) which itself claims to refer back to February 2000 (issue 50). Must be a y2k bug, though, because I couldn't find the more ancient reference myself. The fact is, this hasn't changed any, the tip is just as valid as ever, and more useful now that more people might use multiple ethernet cards to run their house LANs. Enjoy. -- Heather

After reading your post I found this. I figured it would help someone.

http://www.scyld.com/expert/multicard.html


Anonymous batch FTP -> SFTP

Sat, 20 Dec 2003 14:19:58 +0100
Carol Meertens (c.meertens from geog.uu.nl)

Until recently we had a remote machine doing a nightly FTP-job over anonymous FTP to a local machine. Both machines have ssh2 installed, so we started using sftp instead. Here's how we did it:

On local machine:

  1. create a normal user sftp
  2. mkdir /home/sftp/.ssh/

On remote machine:

  1. su <user-who's-doing-the-nightly-jobs>
  2. ssh-keygen -t dsa
  3. give ~/.ssh/id_dsa.pub to admin of local machine

On local machine:

save contents of retrieved id_dsa.pub into /home/sftp/.ssh/authorized_keys

On remote machine:

sftp sftp@local_machine

That's it. To make the sftp-account more restricted, we use scponly (http://www.sublimation.org/scponly).


- close that audio stream

25 Jun 2003 10:02:48 -0400
Allan Peda (pedaa from rockefeller.edu)

Third times a charm :-)

Last night I left my zinf (streaming audio) player running. I felt bad because doing so wasted bandwidth playing music to a muted amplifier in an empty room. Here is my bash solution, a la run-mozilla.sh

[allan@array14 workarea]$ cat ~/bin/run-zinf.sh
#!/bin/sh

# June 25, 2003
# Kills zinf after HR_LIMIT

AUDIO_STREAMER="/opt/bin/zinf"
HR_LIMIT=8

$AUDIO_STREAMER $@ &
echo "killall ${AUDIO_STREAMER}"| at now +${HR_LIMIT} hours

[allan@array14 workarea]$
As a general note, just want to remind folks ... do send in your answers and tips of all sorts! In case you're wondering to where -- that's [email protected]. They don't always get published in the month we receive them, but we do collect them and mix them up a bit. And sometimes we find strays -- this one had been sent to the editors, not to the normal tips-and-tag mailbox. -- Heather


X is Smarter Now

Sat, 7 Jun 2003 15:41:24 -0500
Chris Gianakopoulos (The LG Answer Gang)

Hello Gang,

I have a NEC MultiSync 77F monitor and a Matrox Millenium II video card. When running the SuSE configuration program Sax, X configuration occurs sort of automatically.

All parameters were correct except the modelines associated with my monitor. I say this because the horizontal centering was incorrect when running X.

I tried modelines generated via the XFree 3.3.6 version of xf86config, and incorporated the modelines generated from that tool. Those modelines were proper and usable for XFree86 4.3.0.

As I read on, I saw that X is smart enough to figure out the appropriate timing without modelines. Thus, I deleted all of the generated modelines, and now the Modes section looks like this.

Section "Modes"
  Identifier   "Modes[0]"
EndSection

The file that I edited is:

/etc/X11/XF86Config

I hope that this helps other SuSE 8.2 users.

[Heather] The flip side of this clue is just as important; if you're on a more modern setup that doesn't generate modelines because the internally generated ones will do, but you don't like them and feel they can be improved, then all the old tuning tricks will still work, as will modelines found on the net that match your monitor more perfectly.

This page edited and maintained by the Editors of Linux Gazette
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/

 

Copyright © 2004, . Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 100 of Linux Gazette, March 2004

<-- prev | next -->
Tux