Archive

Archive for June, 2009

Working with lzma tarballs

June 28th, 2009 No comments

The Lempel-Ziv-Markov chain algorithm is a (at least in the Linux-world) relatively new compression method. It features a very high compression ratio that is generally much higher than bzip21. Unfortunately there a quite a few different implementations. So creating and extracting lzma archives on different Linux distrubutions will vary.

While the latest Fedora comes with GNU tar 1.22, which has a built-in flag for lzma compression, CentOS still uses GNU tar 1.15.1; So you will have to pipe your tarball manually to the lzma binary. Here is an example:

On Fedora 11, creating an lzma compressed tarball is rather simple:

tar cfv backup.tar.lzma a/dir --lzma

Just like decompressing it

tar xfv backup.tar.lzma --lzma

You may want to skip the verbose flag v in a script.

On CentOS 5.3 you first have to pull lzma from a 3rd party repository like RPMFusion

yum install lzma

before you can create you archive with:

tar cv a/dir | lzma -c -z > backup.tar.lzma

For decompression, just pipe the hole file into lzma -d and un-tar the output:

cat backup.tar.lzma | lzma -d | tar xv

Again: You may want to skip the verbose flag v in a script.



[1] http://www.linuxjournal.com/node/8051/print


Categories: Uncategorized Tags: , ,

Convert filenames from iso-8859-1 to utf-8

June 28th, 2009 No comments

Just as you can convert entire files from one charset to another, you can convert the filenames. For example:

convmv -f iso-8859-15 -t utf-8 -r .

would recursively convert all files in the current directory from iso-8859-1 charset into utf-8. Well, not exactly. To finally rename the files you need the --notest flag. Otherwise convmv will perform a dry run without any changes.

Categories: Uncategorized Tags: ,

Convert files from iso-8859-1 to utf-8

June 26th, 2009 No comments

How to convert iso-8859-1 charset files into utf-8? Simple:

iconv --from-code=ISO-8859-1 --to-code=UTF-8 oldfile > newfile

Of course, your values for --from-code and --to-code may vary. For a list of available encodings use iconv --list

Categories: Uncategorized Tags: ,

Running a script on shutdown

June 21st, 2009 No comments

It’s rather easy to run a command or a script on boot without going through the full Sys V style init stuff. /etc/rc.local is executed after the init scripts on boot, but unlike BSD, Linux doesn’t have a rc.shutdown.

So how can we execute a command on shutdown? Usually, /etc/init.d/halt is used for shutting down, which calls /sbin/halt.local (if it exists). So we simply add our commands to /sbin/halt.local:

# echo "YOUR_COMMAND" >> /sbin/halt.local

Note that if the file does not exist, you have to add a shebang (e.g. #!/bin/sh) and make it executable (chmod +x /sbin/halt.local)

Categories: Uncategorized Tags: ,

Unlocking a luks volume with a USB key

June 16th, 2009 5 comments

A luks encrypted disk partition is great. The only thing that can bug you from time to time is that you have to specify the key before you can use it. Or maybe, if you try to mount the volume with /etc/fstab, you’ll be prompted for the password during boot.

Wouldn’t it be great, if you could use a real key to unlock your encrypted volume? Not a keyfile, but a physically existent key like the ones you use to unlock your front door?!

Well, it’s not actually a key, but these LaCie USB Flash Drives come very close:

LaCie iamaKey USB Flash Drives

This article will show you, how to generate a random key for your luks encrypted volume, hide it on any USB flash drive and use udev to unlock and mount your luks volume whenever you plug this flash drive into a USB port

Read more…

Categories: Uncategorized Tags: , ,

Using udevadm to gather information about specific device

June 15th, 2009 3 comments

Usually, udevadm requires the sysfs device path of the device in question. But you can also ask udevadm which device path belongs to a certain device node. This gets really helpful if you combine these two queries.

Example: You want to get a list of attributes for a specific device. You do not know the complete device path; all you know is the device node /dev/sdb:

# udevadm info -a -p  $(udevadm info -q path -n /dev/sdb)

A nice document describing how to use this information to write udev rules can be found on http://www.reactivated.net/writing_udev_rules.html.

Categories: Uncategorized Tags:

Disabling GDM greeter sound on Fedora 11 [Update]

June 14th, 2009 4 comments

Due to a bug in GDM there currently is now way of preventing GDM from playing a sound when you login to your Fedora 11 box. This is especially annoying on notebooks, e.g. when you’re sitting in a meeting or in a (quiet) public place like a library.

The only workaround (a bit dirty, granted) is to delete or rename the sound file:

# cd /usr/share/sounds/freedesktop/stereo/
# mv bell.ogg bell.ogg-bak

Enjoy reclaimed silence!

Update: There is a workaround in bugzilla that gets by without deleting or renaming any files.

Categories: Uncategorized Tags: ,

GDM AutoLogin

June 10th, 2009 No comments

To login a certain user automatically at boot time, you have to change the daemon-section of your /etc/gdm/custom.conf:

[daemon]
TimedLoginEnable=true
TimedLogin=you
TimedLoginDelay=0 

With ‘TimedLogin’ being a valid, non-root user and ‘TimedLoginDelay’ being the login delay in seconds.

An overview of available configuration variables can be found on live.gnome.org

Categories: Uncategorized Tags: ,