Archive for the 'Debian' Category

LightScribe on Debian - burn your cd/dvd labels!

I have started doing some photography for other people, so decided I should really put some effort into how I present the photos. I thought about buying an inkjet for printing labels, but they weren’t all that cheap and from my experience with inkets in the past the ink dries out and is rather expensive to replace.

I also had problems finding inkets that could print direct to cd from linux… Then BlueMonki suggested a LightScribe drive. LightScribe is a technology where you put the disk in the burner upside down and it etches a label onto it. Of course you need a new drive and specific media, but the drives are available for £20 and media is less than 30p each, which is more expensive than a normal dvd+r but not a problem for occasional use.

Continue reading ‘LightScribe on Debian - burn your cd/dvd labels!’

Codename of next Debian release - squeeze

Debian has announced the codename of the next release to follow Lenny. Continuing the scheme of naming releases after toy story characters, the next release will be called squeeze after the three-eyed space alien. Official announcement

PIC Microchip programming under debian

A while ago I bought a PICkit2 programmer, including 16f690 PIC. I installed piklab and sdcc (in Debian repositories) and got it working pretty easily. I did play with the programmer that came with it (mplab, windows only), which upgraded my firmware. piklab cannot use the new firmware, so if you need to get an old firmware, then try the old firmware downloads page

There is quite a difference in programming between mplab and piklab. Although there is support for a large number of chips in piklab, they are not supported as well as mplab. The big problem is that in mplab most special bits (i.e. each bit for an output port, one per pin) have a defined name so you can set them on or off individually. Piklab on the other hand has support for only a few of these, so if you want to turn on a pin, you have to set a value on the whole port (byte). Saying that, I prefer the piklab editor as it seems to do a better job with syntax highlighting etc.

Below is some code examples to help you get started if you are finding the learning curve steep

Continue reading ‘PIC Microchip programming under debian’

iPod Classic with Amarok on Linux

When I first bought my iPod classic, Amarok hadn’t yet got support for the new SHA1 hashing that was being done in the song db. Then it was only in cvs, and while I remember compiling from source I don’t think I ever got round to running that code.

Of course I found out the hard way that Amarok didn’t have support for my iPod, and nearly bricked the thing. Thankfully a windows box and iTunes could reset it.

I now have it working, however it took a little fiddling. If you are trying to get it working, you absolutely must read http://amarok.kde.org/wiki/Media_Device:IPod before starting, especially #My_iPod_does_not_show_any_music, as this explains how to set up the magic ID number. Unfortunately earlier pages didn’t say whether to add the 0x in from of the ID, and I remember having lots of difficulty just with libgpod and gtkpod. While I am mentioning it, the versions you need for an iPod Classic are: Amarok 1.4.8 and libgpod 0.6.0

So you have them installed, and you want to get Amarok managing your iPod - Well, I plugged it in, amarok detected it popped up a window asking if it should mount it as an iPod. I said yes, copied some songs, ejected it and BANG! - My iPod wouldnt show any songs.

It seems that the data uploaded by iTunes isn’t the same as by Amarok, and the iPod doesnt like that. Deleting the contents of the iPod_Control folder from the iPod seemed to make Amarok and the iPod happy. Of course Amarok needed to recreate some folder structure, but it asked nicely. Also, if you do this, don’t forget you have to recreate your SysInfo file again before Amarok uploads any songs.

Anyway, I now have an iPod that I can upload to with Linux (which is a hell of a lot faster than iTunes - iTunes took about 30 hours to copy ~30G of music, Amarok took about 3 hours), podcasts work and even some cover art has been copied.

If you have any problems, you can reboot the iPod by holding the Menu and select button down together for a few seconds. If the songs list comes up blank, then you have something wrong and Amarok didnt write the hash correctlty - check the SysInfo file, delete all music from the iPod in Amarok, and copy a few test tracks, disconnect and check if you have it right.

You can also use the Smart Playlists to sync to the iPod - Favourite tracks, Newest tracks and All Collection are good ones to use. Of course you can create your own custom smart playlists too.

Best of all, Amarok is properly multi-threaded so I can copy my entire music collection to my iPod, while playing music and Amarok and writing blog posts - on windows syncing an iPod used to make the system struggle, and iTunes became rather unresponsive…

software raid1 and lvm on debian etch

Background

I have a fileserver box, which currently has 2×200GB disks in lvm to give me a 400GB virtual disk. This arrangement gets good use of space, but if one disk has a failure, then the whole filesystem is trashed and cannot be recovered.

The solution is to start using raid. Before I go on, raid is not a backup solution. It cannot protect you from accidentally deleting all your files, and will not protect you from a virus or malicious user or hacker. Raid just reduces the damage if a disk happens to fail (which knowing my luck, is sometime soon).

The final solution I want is 2×500GB disks in raid1 (mirrored) with lvm on top to split into my partitions. This way I could add another pair of disks in raid, add them to the lvm and not have to worry about which partitions get new space, as lvm will allow me to expand any parition onto the new space, and have a partition across multiple disks.

Why not raid5? Raid 5 is great for getting space, as you have n+1 disks, and get the space of n disks out of it as one is the redundant disk. The problem with raid5 is it is limited to the smallest disk in the raid. So 2 500GB disks and one 200GB disk will only give 400GB as each disk can only be used up to 200GB. Raid5 is great if all your disks are the same size, but if I want to add disks, and not have to replace all 3+ disks, then with raid1 I just have to buy disks in pairs. My pc has 4 ide slots and 2 sata slots, so raid1 should be fine (disks are getting quite bit these days).

So the plan is to add 2 500GB disks. put them in raid1 with a partition for /boot (which cant be in lvm) and the rest becomes part of a lvm group, with my / and /home partitions in there (and /tmp, swap)

How I did it

Continue reading ’software raid1 and lvm on debian etch’

OpenSSL expoit

I am sure you have all ready about the OpenSSL exploit that was recently found in Debian:
http://lists.debian.org/debian-security-announce/2008/msg00152.html

It is worth noting that the exploit affects any keys that were built on a debian box after sarge (so etch, lenny, current sid). This also means that any box that has those keys as an authentication method is vulnerable too:

http://blog.drinsama.de/erich/en/linux/2008051401-consequences-of-sslssh-weakness.html

Because any of those boxes could already be compromised, if you are paranoid you should be careful about logging in with passwords to them too - basically if you are paranoid then you can’t really trust anything (so business as normal for paranoid people)

In order to fix your keys, you should probably do the following (thanks to Hugo Mills)

on all boxes you own

  • Install the patch
  • Delete the following files if the host keys are likely to be vulnerable:
    • /etc/ssh/ssh_host_dsa_key*
    • /etc/ssh/ssh_host_rsa_key*
  • Generate new host keys:
    • sudo dpkg-reconfigure -plow openssh-server
  • Restart the ssh daemon

And on all boxes you have access to via keys

  • Delete the following files:
    • ~/.ssh/authorized_keys
    • ~/.ssh/id_*
  • Generate new personal keys:
    • ssh-keygen -t rsa -b 4096