SLUG Pearls #3 For 18 Jun 2000

By Jeff Waugh

SLUG Logo
Check out the Sydney Linux User Group (http://www.slug.org.au/) !

Table Of Contents

Introduction

Phew - that was quick!

Due to the long weekend, SLUGgers had less time at work to spend posting to the mailing list. Thus, this week's SLUG Pearls is shorter than usual.

Announced this week:

1. More Apache, sed and grep

12 Jun 2000 (4 posts) Archive Link: "Virtual hosts on a dynamic IP"

People: Angus LeesJames Wilkinson

Continuing a thread from last week (http://www.slug.org.au/pearls-20000612.html#7) , Paul Robinson thanked Gus for his help with httpd.conf and mentioned that whilst working the script, he found that restarting Apache with kill -HUP didn't always work. Gus knew a better way of doing it:

the "cut -c"s make me nervous .. a new version of some tool will come out that adds a little whitespace and suddenly your script is off killing the wrong processes

try:

myip=`/sbin/ifconfig ppp0 | sed -n 's/^.* addr:\([0-9.]\+\) .*$/\1/p'` sed "/slug-pearls/s/@MYIP@/$myip/index.html" < httpd.conf.orig > httpd.conf
kill `ps -ax | grep '[/]usr/sbin/httpd' | cut -d' ' -f 1` /usr/sbin/httpd

(the square brackets on the grep regex is an amusing trick i once saw to avoid matching the grep process itself - better would be to use pidof(8) or similar)

James Wilkinson liked the sound of that, "Hey, thanks for this! Up 'til now I've been adding a '| grep -v grep' to do the same, which I've always hated ;)"

2. Superblocks & The Lost MP3s

13 Jun 2000 - 14 Jun 2000 (9 posts) Archive Link: "Argh! My drive no work"

People: Simon RumbleJill Rowling

Simon Rumble had an unfortunate problem with his "big mutha of a drive with stacks of mp3s and the like":

bash-2.04$ sudo e2fsck /dev/hdc3
e2fsck 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
Couldn't find ext2 superblock, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/hdc3

The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock:

e2fsck -b 8193 <device>

Doing what it suggested gave the same error.

DaZZa commented that when mkfs runs, it reports the position of the backup superblocks, but added, "Unfortunately, if you're anything like me, you don't bother writing them down/storing them anywhere, and you're stuffed."

Whilst she couldn't test these ideas at work, Jill Rowling remembered that mkfs -V <options used to create the drive> wouldn't actually write to the drive, but would return the same commands used to originally create it - and thus the superblock information.

Another possibility is mkfs -m /dev/hdc3 which is supposed to return the command line that was used to create the partition.

Please check with your local man page before trying these options, of course...

If you do find out what spare superblocks you have, maybe you could pick one of the higher numbered ones. Chances are if something trashed the disk by writing to the raw device, it only overwrote the first set of superblocks.

Of course if it was a huge MP3, then, maybe you have really lost it.

chesty offered the Filesystem HOWTO as a helpful read, and on hearing that Simon had read it, linked to some of the more relevant software directly (http://www.progsoc.uts.edu.au/lists/slug/2000/June/msg00641.html) .

3. Word into Wine

14 Jun 2000 (7 posts) Archive Link: "wine"

People: Angus Lees

Gus made his victory post:

figured i might try out the old wine torture test, just to see if i can get past the splash screen this time:

wine winword.exe

and goddamnit, it worked like a charm (or curse, or something)

http://www.cse.unsw.edu.au/~gusl/winword.jpg (warning: big image

i loaded up some old .doc's and everything.. it wouldn't let me print though for some reason (i didn't try too hard)

(so much for everyone needing a commercial windows emulator :)

There were some comments about the political nature of emulating Windows applications under Linux, including (Mum's bogeyman) scare stories about OS/2. Peter Rundle simply wanted to know whether Gus used a real Windows installation, and how he managed to get it going. Gus replied:

a very old (`96/97) win95 (b?) install that hasn't booted for a very long time:

-rwxr-xr-x 1 root root 52539 Oct 22 1997 bootlog.txt

i leave it lying around especially for wine and dosemu ;)

its a vanilla wine install from the debian (potato) package (version 0.0.20000109-3), with the Drive mappings changed to point to my locations.

the only real changes from that was using the native windows version of comdlg32/commdlg (since the wine ones have never really worked right), and deleting the enture DllPairs section (both following last weeks advice on wine weekly news). i have no idea whether these contributed at all - i didn't try with/without.

4. Mkfs it so!

14 Jun 2000 - 15 Jun 2000 (4 posts) Archive Link: "Formating a new Drive"

People: Peter McCarthyMichael Lake

Peter McCarthy installed a new hard drive, and was trying create and mount a new filesystem:

I have installed a new HDD setup as /dev/hdb

It is fdisk'ed with a Linux file system enabled. However I can't work out how to format the drive to make it ready for use. I tried fsck and it bailed on me (not suprising) as it is the File system checker. I tried mkfs -c /dev/hdb and it just keeps coming up with Usage: mkfs.minix [-c | -l filename] [-nXX] [-iXX] /dev/name blocks

But it looks ok to me !

DaZZa:

Asuming you've put only one partition on your new drive.

mkfs.ext2 /dev/hdb1

Michael Lake:

You just need to tell it what type of filesystem to make.

/sbin/mkfs -t ext2 /dev/hdb
/sbin/mkfs.ext2 /dev/hdb
   (v=verbose can be useful to show progress)
/sbin/mke2fs /dev/fd0

Either of the commands, mkfs, mkfs.ext2 or mke2fs, can be used. Do check the man pages for specific parameters.

5. Making a swap partition

14 Jun 2000 - 15 Jun 2000 (4 posts) Archive Link: "swap file creation"

People: Tony Cook

With a similar problem, Ben Donohue was unable to get his swap partition going. He had done the fdisk side of things, but needed to know more. DaZZa offered:

mkswap /dev/hdaX - replacing X with your partition number.

Edit /etc/fstab and add the correct line - it should look something like this

/dev/hdaX swap swap defaults 0 0

and Tony Cook explained how to put a swap partition to use without rebooting, "If you don't want to reboot to activate the swap space you can use the swapon command, "swapon -a" to activate all the swap partitions in /etc/fstab or "swapon device" to activate the swap on a particular device - see man swapon for details (priorities can be useful if you have more than one physical device, or if you're using swap files.)"

Ben had a couple of problems getting it to work, but soon found that fstab had two entries for the swap partition, thus giving him an error.

6. X-Message to Outlook Users

15 Jun 2000 (3 posts) Archive Link: "Using X-message in headers."

People:

Alleged "Mystery Man" Rodos reports:

I started putting in qwerky headers into my emails ('cause I can).

One that I did was "X-message : What did you think you would find here?". The weird thing is that Outlook treats this header as really special and shows it at the top of the message as an Informational thing.

See http://digit.rodos.net/outlook.jpg for an example of one.

A great way to annoy Outlook users!

 

 

 

 

 

 

Sharon And Joy
 

Kernel Traffic is grateful to be developed on a computer donated by Professor Greg Benson and Professor Allan Cruse in the Department of Computer Science at the University of San Francisco. This is the same department that invented FlashMob Computing. Kernel Traffic is hosted by the generous folks at kernel.org. All pages on this site are copyright their original authors, and distributed under the terms of the GNU General Public License version 2.0.