Powered by
Movable Type 3.38 mod_perl/2

 July 2007 Archives

2007, July 01 (Sun)

 iPod EU volume fix

As most of you are probably aware, there is a slight defect with European and French iPod maximum volumes. (You could also say a cap or limit.)

Fixing however is simple:

The following instructions apply to 3G, 4G, mini, color iPods.

Copy the iPod firmware to your disk:

dd if=/dev/sda of=ipod_fw count=1536

Apply some magic:

perl -Mbytes -p -i -e's"(?<=\x08\x00\x9F\xE5\x38\x01\x90\xE5)(.)(.)"$2$1"s' ipod_fw

Send it back to the iPod:

dd if=ipod_fw of=/dev/sda

Gracefully have it reload the firmware:

eject /dev/sda

Enjoy!

To undo, just repeat once more.

(You have to send your regards to nusse for this, he made me write it down.)


2007, July 10 (Tue)

Netzwelt titanic-magazin.de liferea/snownews scraping

A small Ruby snippet to have a full-content feed for titanic-magazin.de:


#!/usr/bin/ruby
require 'net/http'
require 'rexml/document'
require 'iconv'

def get_item url
        item = Net::HTTP.get_response(URI.parse(url)).body
        item.scan(/<td class="tt_news-bodytext">(.*?)<\/td>/m)[0][0]
end

feed = REXML::Document.new($stdin.readlines.join)

feed.elements.each('rss/channel/item') do |element|
        element.elements['description'].text = Iconv.new('UTF-8', 'ISO-8859-1').iconv(get_item(element.elements['link'].text))
end

feed.write($stdout, 0)

A little bit slow as all items are fetched and there is no caching (yet).


2007, July 11 (Wed)

Linux Thinkpad S3 after s2disk wakeup workaround

There is a problem with recent kernels (I think to recall 2.6.20 as the first to tail) and Thinkpads wakeup behaviour.

Please read the following problem description twice as many people seem to misunderstand my problem:

After the first (successfully) suspend to disk using swsusp from the vanilla kernel waking up from suspend to ram using the LID button fails. Waking up by pressing the Powerbutton still works.

Even /proc/acpi/wakeup tells LID is enabled for wakeup:

$ cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
LID       S3    *enabled
SLPB      S3    *enabled
(...)

It actually is not. There is a small workaround; just disable and reenable LID as wakeup source:

echo LID >/proc/acpi/wakeup
echo LID >/proc/acpi/wakeup

And maybe find out why swsusp fiddels with these values. After rebooting wakeup works out of the box

Edit(2007-07-16): Does not work reliable.


2007, July 12 (Thu)

Linux How to make gnome-power-manager (hal) respond to thinkpad-acpi hotkey events

thinkpad-acpi (known as ibm-acpi up to Linux 2.6.22) can generate ACPI events (loading with hotkey=enable) for several Fn-Fx combinations, including Fn-F4, which is already supported by ACPI. However, the generated events differ from the usual events.

button/sleep SLPB 00000080 00000002

ibm/hotkey HKEY 00000080 00001004

Using gnome-power-manager and hal on etch this makes suspending using Fn-F4 impossible, because the hal does not recognize the events. The fix is quite simple; build and install hal from lenny:

apt-get source -t lenny hal
apt-get build-dep hal
cd  hal-<version>/

Now you have to alter debian/rules: add ---enable-acpi-ibm to the configure target and build the package using:

fakeroot dpkg-buildpackage -uc -us

After installing the new packages and their depencies (hal-info from lenny) the new hald will send Sleep events when pressing Fn-F4 and Hibernate Fn-F4, which makes gnome-power-manager to initiate a suspend to disk cycle.


2007, July 16 (Mon)

 Liferea/Snownews extension for pro-linux

Liferea/Snownews-extension to get a full-content feed for the german linux-news-website pro-linux:

#!/usr/bin/ruby
require 'net/http'
require 'rexml/document'
require 'iconv'

def get_item url
    item = Net::HTTP.get_response(URI.parse(url)).body
    '<font size="+1"><b>' + item.scan(/<font size="\+1"><b>(.*)$/)[1][0]
end

feed = REXML::Document.new($stdin.readlines.join)

feed.elements.each('rss/channel/item') do |element|
    element.elements['description'].text = Iconv.new('UTF-8', 'ISO-8859-1').iconv(get_item(element.elements['link'].text))
end

feed.write($stdout, 0)


2007, July 17 (Tue)

Linux via: framebuffer cursor/ gray bar near upper left corner

Since recently switching from the open source to the binary VIA Xserver, I always had an annoying gray bar near the upper left corner of my screen. It would go away by switching to a text mode framebuffer and back to X though.

One hack would have certainly been to automate that switching after X has started, but it turns out that this gray bar is actually a shadow of the text mode cursor… guess proper initialisation isn’t VIA’s strength or something?

So instead, I added the following line to my /etc/init.d/entrance script:

@@ -43,6 +43,7 @@ case "$1" in
                export PATH=`pam_getenv -l PATH`
        fi
        set -e
+       /usr/bin/setterm -cursor off>/dev/tty9
        $DAEMON
         fi
        echo "."

This turns off the text mode cursor. Seems to be working fine so far.


2007, July 22 (Sun)

Linux You don't exist, go away!

If you are trying to use SSH inside a debian-installer session, you might run into some problems...

  • With the installer from lenny, ssh will complain about a missing libz.so.1.

    I couldn't find this file anywhere on the media, it is missing.

    You need a libz.so.1 from somewhere, so copy it to a USB stick or something.

  • Using the installer from sid, tring to ssh anywhere might result in the message "You don't exist, go away!"

    If you get this message, make sure to install libnss. (I only had to do this using the newt "install", not with installgui.)

Linux debian-installer: loop-aes fails with "not supported by kernel"

When installing from something involving an ISO image, d-i will load the wrong loop module and later on setting up loop-aes will fail.

After generating enough randomness, you will receive the message "An error has occured while configuring encrypted volumes", and the syslog shows

partman-crypto: ioctl: LOOP_SET_STATUS: Invalid argument, requested cipher or key length (256 bits) not supported by kernel.

To fix this problem, first proceed to the partitioner and select encryption with loop-aes. That will make d-i unpack the necessary files to lib/modules/*/updates

Now switch to a console and modprobe -v -r loop (this is a rmmod replacement.)

You will probably need to umount the cd image first: umount /cdrom
(Now try again: modprobe -v -r loop)
Then cd to lib/modules/*/updates and insmod ./loop-aes.ko
(this will load the right loop module for use with loop-AES!)
You might want to remount your cdrom:
mount /hd-media/*.iso /cdrom -o loop
(Alternatively, you can Esc out a few times in d-i and select the autodetection from the main menu again.)

Now you should succeed in setting up loop-aes.

(This problem should be fixed in one of the next debian-installer versions.)

Linux crypto-root on loop-AES (partly) using debian-installer

First of all, crypto needs to be done using newt ("install", not installgui). This is a known limitation of debian-installer and documented somewhere on the d-i website.

Secondly, when installing from something involving an iso image, d-i will load the wrong loop module. If that is your case, please make sure to read loop-aes "not supported by kernel"?.

Unfortunately, the debian-installer doesn't want to let you encrypt your root with loop-aes even if you have an unencryped /boot

Once you have arrived at the partman-crypto screen and set up your crypto devices, the next thing you need to do is patch debian-installer to not bitch about having / on loop-aes.
This can be done by modifying a file in /lib/partman/check.d/ and removing the check (thanks to fjp@#debian-boot for the pointer.)

If, after generating enough randomness, d-i fails with "An error has occured while configuring encrypted volumes", check the article "loop-aes 'not supported by kernel'".

Otherwise, the install should now go through fine.

Finally you'll want to chroot into your new system, and come up with some loop-aes initramfs hooks so that your system will be bootable.

You can use those in the loop-aes-utils debian package source as a starting point:

apt-get source loop-aes-utils
tar xzvf *.tar.gz
cd util*
gunzip < ../*.diff.gz | patch -p1
grep -R debian initramfs

and execute the commented lines.

However, they are broken, so fix the bugs in these scripts!

You will also want to add a feature to these scripts so that it reads your key from a removable media.

Remember: the "key" in your encryption is your keyfile. The passphrase is just an additional blocker, but if your keyfile gets in the wrong hands, your security is more than halved!
This means that you absolutely don't want to keep the keyfile in the initrd (where it would be stored in plaintext).

Lastly you will probably want to regenerate your initrd so that the system becomes bootable:

mount proc proc -t proc
update-initramfs -k $(ls lib/modules) -u
umount proc

Confirm reboot in the debian-installer

Enjoy

Continue reading “crypto-root on loop-AES (partly) using debian-installer” »