Fix the font rendering of Calibri

If you see very bad artifacts when displaying small sizes of the Calibri font in Linux (which you are not allowed to use because it comes with a MS Windows only license) you should disable their embedded bitmap variants in $HOME/.fonts.conf:

<match target=”font” >
     <edit name=”embeddedbitmap” mode=”assign”>

2ct and a cookie if someone sends me the snippet to only apply this to the Calibri font :-).

Thanks to for the hint!


Thinkpad yoga immediately wakes up after suspend

After switching to Kernel 4.0 my lovely Yoga wouldn’t go to sleep anymore (Debian unstable). Actually it went to sleep (ACPI s3 state) but again woke up immediately after. The problem seems to be the USB driver and could be solved via a

echo “XHC” > /proc/acpi/wakeup

Using Sachesi with Debian

In order to update my BlackBerry Q5 I wanted to use the handy Sachesi program to install all the .bar files. It proved to be more complicated than I thought.

Problem is that Sachesi does in fact use a USB connection to communicate with the BB10 device but not via some serial protocol but instead IP. Therefor the device registers itself as a USB network device and acts as a dhcp server providing the computer with a link local IPv4 in a /30 network. And here lies the problem. Sachesi doesn’t recognize your BB if there are other Network connections going.

Long story short, I disconnected LAN and Wireless, put usb0 as

iface usb0 inet manual

into /etc/network/interfaces, restarted the network-manager service and run dhclient manually

sudo dhclient -v -d usb0

Make sure that Tethering and USB mass storage are off and the device is set to Windows Mode instead of Auto or Mac.

Sometimes it does work with WiFi enabled, but I have to stick with manual dhclient.

Update 2:
If you get random crashes with Sachesi and XFCE just disable the xfwm4 compositor while using it.

Very hot online resize of a filesystem on a lvm volume in a vmware vm

The case:
Virtual machine with a Linux (a bit dated red hat distribution). There are 2 partition, one for /boot and second one for lvm. On the lv we have two lvs for root and swap (whoever came up with this…).

root (“/”) became muuuuuch, much to small and we have to get more space, fast. Called the VM admin, got more space in the vm. Usually you would now restart, boot into a LiveCD, resize everything, restart and everything’s fine. This wasn’t an option. So let’s see how we can do this while staying online:

#### rescan the disks to possibly detect new devices
echo "- - -" > /sys/class/scsi_host/host0/scan

#### rescan the disks to detect the changed size
echo '1' &gt; /sys/class/scsi_disk/0\:0\:0\:0//device/rescan

#### add a 3rd partition and change type to Linux LVM (IMPORTANT!!)
fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1044 8281507+ 8e Linux LVM

Command (m for help): n
Command action
e extended
p primary partition (1-4)
Partition number (1-4): 3
First cylinder (1045-2088, default 1045):
Using default value 1045
Last cylinder or +size or +sizeM or +sizeK (1045-2088, default 2088): Using default value 2088

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sda: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1044 8281507+ 8e Linux LVM /dev/sda3 1045 2088 8385930 8e Linux LVM

Command (m for help): w

#### detect new 3rd partition
partprobe -s
/dev/sda: msdos partitions 1 2 3

#### create new pv on it
pvcreate /dev/sda3
Physical volume &quot;/dev/sda3&quot; successfully created

#### extend volume group by the new pv
vgextend VolGroup00 /dev/sda3
Volume group &quot;VolGroup00&quot; successfully extended

#### extend lv
lvextend -l+100%FREE /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 11.97 GB

#### finally: extend filesystem
resize2fs /dev/VolGroup00/LogVol00

Yeah, that’s about it. You might ask why didn’t I extended /dev/sda2 into the free space — partprobe couldn’t discover the change and I would had to restart the system in order to go on. And final remark: Don’t try this at home without first testing on a clone of the production system :-)

Some Links about RAID and filesystems

Online resize a Linux RAID

Today we want to swap the 2 hard disks in a RAID 1 array for 2 bigger ones. Let’s avoid downtime and try to do this online.

I found a HowTo here:

And basics about RAID on Linux here:

These are the steps:

  1. Do the Backup
  2. Hotplug one of the 2 new disks (make sure that your SATA-Controller is in AHCI mode…….
  3. Partition it in a convenient way
  4. Add it to the RAID1 (as a 3rd disk)
  5. Go out, jump around on a slackline, play some badminton, throw a frisbee, go climbing…
  6. Remove one of the 2 old disks from the RAID and the computer
  7. Add the 2nd one of the new disks
  8. Wait again
  9. Throw out the remaining old disk (don’t forget to remove it from the RAID before
  10. Grow the RAID Device
  11. Grow the filesystem
  12. Make sure your computer can still boot afterwards – especially if you messed around with the /boot partition

Okay. Let’s look at some steps a bit closer:

Adding a third partition to a RAID1:

mdadm /dev/md0 --grow -n3
mdadm /dev/md0 --manage --add /dev/sdc3
watch cat /proc/mdstats

Slacking of

Removing the 1st one of the old disks

mdadm /dev/md0 --manage -f /dev/sdb3 -r /dev/sdb3

Add the 2nd new one, remove the 2nd old one, change RAID back to 2 drives

mdadm /dev/md0 --manage --add /dev/sdb3
watch cat /proc/mdstats
mdadm /dev/md0 --manage -f /dev/sda3 -r /dev/sda3
mdadm /dev/md0 --grow -n2

Grow MD and ReiserFS

mdadm --grow /dev/md0 -z max
resize_reiserfs /dev/md0
watch cat /proc/mdstat

The first step again takes quite a long time because of the resync of md0. Nevertheless I ran the resize_reiserfs command directly afterwards und it worked fine.

Tell Debian to look after your Grub and initramfs

As we use Debian Squeeze and use grub (“grub-pc”) I did the following

cp /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf_back
/usr/share/mdadm/mkconf > /etc/mdadm/mdadm.conf
dpkg-reconfigure grub-pc
dpkg-reconfigure grub-pc
dpkg-reconfigure initramfs-tools

I had to do the first 2 steps because the UID of the RAID did change (why?). 3rd and 4th step are the same but grub didn’t want to install itself into the new boot sectors in the first place because I also changed the /boot partition to now be a RAID1 on its own (and not to reside on one hd only). It can’t do any harm, so I propose it here as well. 5th is necessary because the mdadm.conf was changed.

In case you – like me – forgot the very last step, you are presented Debians initrams busybox rescue prompt. Here I did

mdadm /dev/md0 --assemble /dev/sda3 /dev/sdb3
...wait some time... (why that?)
mdadm -r /dev/md0 (why?)
mount -t reiserfs /dev/md0 /root

Now normal boot process jumped in.

And that’s it. It wouldn’t had been easier if we had used LVM on top of the RAID1 as we didn’t add disks but had to replace them. You don’t necessarily have to deal with 3 disks at a time but degrade the array before. But as I was dealing with old disks I didn’t have much trust in any of them.