Use your ssh-agent for cron scripts with keychain

Here's a great IBM howto explaining how to use your ssh-agent for cron scripts with keychain.

Related: Copy your public SSH-Key to another Computer.

Resumable, fast and efficient hard disk data recovery dd_rhelp

dd_rhelp is a script that uses dd_rescue, but includes a log file and parameters to automatically read all the good blocks first and skip the bad ones. And it automatically resumes where you left off when it's interruped.

Grub Error Codes

If you want to know what the grub error codes mean, look here:

1 : Filename must be either an absolute filename or blocklist
This error is returned if a file name is requested which doesn't fit the syntax/rules listed in the Filesystem.
2 : Bad file or directory type
This error is returned if a file requested is not a regular file, but something like a symbolic link, directory, or FIFO.
3 : Bad or corrupt data while decompressing file
This error is returned if the run-length decompression code gets an internal error. This is usually from a corrupt file.
4 : Bad or incompatible header in compressed file
This error is returned if the file header for a supposedly compressed file is bad.
5 : Partition table invalid or corrupt
This error is returned if the sanity checks on the integrity of the partition table fail. This is a bad sign.
6 : Mismatched or corrupt version of stage1/stage2
This error is returned if the install command points to incompatible or corrupt versions of the stage1 or stage2. It can't detect corruption in general, but this is a sanity check on the version numbers, which should be correct.
7 : Loading below 1MB is not supported
This error is returned if the lowest address in a kernel is below the 1MB boundary. The Linux zImage format is a special case and can be handled since it has a fixed loading address and maximum size.
8 : Kernel must be loaded before booting
This error is returned if GRUB is told to execute the boot sequence without having a kernel to start.
9 : Unknown boot failure
This error is returned if the boot attempt did not succeed for reasons which are unknown.
10 : Unsupported Multiboot features requested
This error is returned when the Multiboot features word in the Multiboot header requires a feature that is not recognized. The point of this is that the kernel requires special handling which GRUB is probably unable to provide.
11 : Unrecognized device string
This error is returned if a device string was expected, and the string encountered didn't fit the syntax/rules listed in the Filesystem.
12 : Invalid device requested
This error is returned if a device string is recognizable but does not fall under the other device errors.
13 : Invalid or unsupported executable format
This error is returned if the kernel image being loaded is not recognized as Multiboot or one of the supported native formats (Linux zImage or bzImage, FreeBSD, or NetBSD).
14 : Filesystem compatibility error, cannot read whole file
Some of the filesystem reading code in GRUB has limits on the length of the files it can read. This error is returned when the user runs into such a limit.
15 : File not found
This error is returned if the specified file name cannot be found, but everything else (like the disk/partition info) is OK.
16 : Inconsistent filesystem structure
This error is returned by the filesystem code to denote an internal error caused by the sanity checks of the filesystem structure on disk not matching what it expects. This is usually caused by a corrupt filesystem or bugs in the code handling it in GRUB.
17 : Cannot mount selected partition
This error is returned if the partition requested exists, but the filesystem type cannot be recognized by GRUB.
18 : Selected cylinder exceeds maximum supported by BIOS
This error is returned when a read is attempted at a linear block address beyond the end of the BIOS translated area. This generally happens if your disk is larger than the BIOS can handle (512MB for (E)IDE disks on older machines or larger than 8GB in general).
19 : Linux kernel must be loaded before initrd
This error is returned if the initrd command is used before loading a Linux kernel.
20 : Multiboot kernel must be loaded before modules
This error is returned if the module load command is used before loading a Multiboot kernel. It only makes sense in this case anyway, as GRUB has no idea how to communicate the presence of such modules to a non-Multiboot-aware kernel.
21 : Selected disk does not exist
This error is returned if the device part of a device- or full file name refers to a disk or BIOS device that is not present or not recognized by the BIOS in the system.
22 : No such partition
This error is returned if a partition is requested in the device part of a device- or full file name which isn't on the selected disk.
23 : Error while parsing number
This error is returned if GRUB was expecting to read a number and encountered bad data.
24 : Attempt to access block outside partition
This error is returned if a linear block address is outside of the disk partition. This generally happens because of a corrupt filesystem on the disk or a bug in the code handling it in GRUB (it's a great debugging tool).
25 : Disk read error
This error is returned if there is a disk read error when trying to probe or read data from a particular disk.
26 : Too many symbolic links
This error is returned if the link count is beyond the maximum (currently 5), possibly the symbolic links are looped.
27 : Unrecognized command
This error is returned if an unrecognized command is entered on the command-line or in a boot sequence section of a configuration file and that entry is selected.
28 : Selected item cannot fit into memory
This error is returned if a kernel, module, or raw file load command is either trying to load its data such that it won't fit into memory or it is simply too big.
29 : Disk write error
This error is returned if there is a disk write error when trying to write to a particular disk. This would generally only occur during an install of set active partition command.
30 : Invalid argument
This error is returned if an argument specified to a command is invalid.
31 : File is not sector aligned
This error may occur only when you access a ReiserFS partition by block-lists (e.g. the command install). In this case, you should mount the partition with the `-o notail' option.
32 : Must be authenticated
This error is returned if you try to run a locked entry. You should enter a correct password before running such an entry.
33 : Serial device not configured
This error is returned if you try to change your terminal to a serial one before initializing any serial device.
34 : No spare sectors on the disk
This error is returned if a disk doesn't have enough spare space. This happens when you try to embed Stage 1.5 into the unused sectors after the MBR, but the first partition starts right after the MBR or they are used by EZ-BIOS.

Ext3 Partition Optimized for RAID5

Check the output of mdadm. It tells you the block size in chunks, which you will need.
mke2fs -j -E stride=64,stripe-width=320 -L LABEL /dev/md0

In my example the chunks size is 64k. I use 6 disks, out of which 5 carry data, so the stripe-width is chunks*5=320. See man mke2fs for more.

I always add this for even more speed:
tune2fs -o journal_data_writeback -O dir_index /dev/md0

Refresh the Partition Table

sudo blockdev --rereadpt /dev/sda

First make sure nothing is mounted from the disk (here /dev/sda).

Fast interlaced AVCHD (PAL) conversion with Mencoder-SVN

Thanks to a Urkki, I've found out that mencoder-SVN nowadays supports AVCHD transcoding pretty well now. So I'll publish my current (quite easy) script for converting AVCHD into 720p Mpeg4.

First get a current svn version of mplayer and compile and install it:
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd mplayer
CFLAGS= ./configure && make && sudo make install

Then you can use this command:
mencoder 00001.MTS -o 1.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=10000:threads=2:ilme:ildct -lavdopts threads=2 -vf scale=1280:720:1 -fps 50

Notes
- I need fps 50 because mplayer doesn't yet detect the fps automatically in my files.
- I've used two threads to speed things up on multi-core systems: threads= should be the number of cores your cpu has.
- I have interlaced content and preserve the interlacing: scale=...:1, ilme:ildct.

Copy your SSH Public Key to Another Machine with One Simple Command

ssh-copy-id user@host

KDE 4.2 - Fresh, Hot, Pretty, Efficient - A Release to Enjoy

I've seen quite few real reviews of KDE 4.2 so far. Let me show you a screen shot and begin with my summary: It's a great release.

Plasmoids
The core, no actually every part of the KDE4 desktop consists of plasmoids, little applets comprising parts of the desktop: The menu, the panel, the clock, desktop applets such as wheather and disk space, network and CPU usage displays, news overviews and many more are already included.


After some problems with achieving the high goals of a flexible interface the developers have by now achieved much. You can put the plamoids anywhere on your screens. I have two displays and really enjoy being able to setup each display with its corresponding plasmoids. I really enjoy the prettier new taskbar and the new style. You can now move plasmoids from the panel to the desktop and back, but that's not easy yet.

Platforms
I don't know about the OS X port, but my girl friend is already enjoying the Windows port of KDE including great applications such as Parley in a native Windows build. And they work more or less flawlessly. I think the sounds support was not perfect, but everything else works nicely and the installer is pretty simple to handle while remaining flexible. (It's not easy enough yet that she could install it herself, though.)

Stability
As it's a .0 release, you will definitely be able to crash plasma. Probably during the tryouts for setting up your plasmoids. I recommend quitting and restarting plasma after you've got your basic configuration done with kquitapp plasma && plasma &. Then continue with the fine tuning.

Upgrade
KDE used 4.2 my previous(4.1.4) configuration successfully. Even my applets were still there at the same place. That's a nice thing and I think between 4.0 and 4.1 it didn't work well for me.

Bugs
The screen flickering problem disappeared for me. In KDE 4.1 my second screen kept going blank for about 1,5 seconds about every 10 seconds. I had to work around that bug by starting kde manually. That's solved now. I get one flicker during that startup of KDE but that's it.

Polish
There will of course be some polish in the 4.2.x releases. Some plasmoids are still buggy and can crash plasma. The weather applet crashed plasma if it didn't find the city I was searching for e.g. Sometimes removing an applet can crash plasma. But there are more practical plasmoids and they work better than in 4.1. The rss reader lets you scroll through with your mouse wheel, a memory usage applet is still missing.

Efficiency
You can see how efficient the plasma approach and implementation is when suspending your computer and then resuming it. The clock will take up to a minute to be set to the current time. That's because it gets the time only once a minute - when a new minute starts. That saves CPU usage in between and shows how much thought the programmers put into an efficient implementation. Even my desktop full of plasmoids uses only very little resources of my system. It doesn't slow you down. It even works nicely over NX (remote desktop). When idling, plasma creates about 1 wake per second in powertop on my system.

Porting Chrome back to KDE

Greg just had a great idea. Port the browser (Chrome) based on the browser (safari) that is based on the browser of KDE(konqueror) back to KDE again. Chrome coming home to KDE again would be a great thing. A native, fast browser that can really compete.

I think the code has been improved a lot since the beginning and as KDE is already running on Windows, OS X and Linux, it's an idea that Google probably could have followed from the beginning.

IMHO Google should the very least do everything to help the KDE community to achieve that port, as without them and KHTML they would never have come this far as quickly.