Updates from MD1032 Toggle Comment Threads | Keyboard Shortcuts

  • MD1032 4:31 pm on May 14, 2012 Permalink  

    Script to convert a SYMPA mail archive to mbox format (sympa2mbox) 

    Export the mail archive using the SYMPA web interface, extract the zipfile and run the following script over the mail directory. You need to have “formail” installed.

    # This scripts takes a sympa email archive and converts it into a
    # single mbox file
    function die()
    	echo "$1"
    # ensure arguments are passed
    [ -z "$path" ] && die "Pass archive directory as first argument."
    [ -z "$dest" ] && die "Pass destination mbox file name as second argument."
    # sanity checking
    [ ! -d "$path" ] && die "Can't find '$path'"
    touch "$dest" || die "Can't write to '$dest'"
    # we rely on directories being name in alpha order oldest -> newest 
    for dir in $(ls "$path"); do
    	if [ -d "$path/$dir" ]; then
    		echo -n "Working on $path/$dir..."
    		files=$(ls "$path/$dir" | sort -n)
    		for file in $files; do
    			formail -ds < $path/$dir/$file >> $dest
    		echo "done"
  • MD1032 3:40 pm on May 4, 2012 Permalink  

    Remove failing VMs in OpenStack 

    Occasionally OpenStack VMs fail to spawn or fail to terminate and cannot be removed from the VM list. Deleting the VM using the command line or web interface has no effect, they are stuck in the “spawning” or “deleting” state. To get rid of these zombie entries I remove them from the database using the following bash script (pass the machine UUID as parameter):

    mysql -uroot -ppassword << EOF
    use nova;
    DELETE a FROM nova.security_group_instance_association AS a INNER JOIN nova.instances AS b ON a.instance_id=b.id where b.uuid='$1';
    DELETE FROM nova.instance_info_caches WHERE instance_id='$1';
    DELETE FROM nova.instances WHERE uuid='$1';

    • jhalter 3:16 pm on May 13, 2012 Permalink

      Thanks, this saved me a lot of time!

    • askstack 6:41 am on May 16, 2012 Permalink

      thanks! I spend at least 4 hours on this problem.

    • davidpc 12:39 am on May 23, 2012 Permalink

      thanks for sharing!

    • love_essex 1:05 pm on October 25, 2012 Permalink

      thanks a lot

    • jeff 2:13 pm on October 26, 2012 Permalink

      thank you!

    • Max 11:10 pm on November 8, 2012 Permalink

      Thank you very much! Helped a lot

  • MD1032 6:20 pm on March 31, 2012 Permalink  

    Force library refresh on Nook Simple Touch 

    If you have rooted a Nook Simple Touch e.g. using http://forum.xda-developers.com/showthread.php?t=1343143, you may want to run some scripts to download some books directly onto your device. The problem is that these books you saved to /media or /sdcard only show up in the library after you reboot the Nook.

    To force a library refresh, create a script containing the line

    busybox killall vold

    of course you need to have busybox installed through Google Play and you have to run this script with root permissions.

  • MD1032 2:34 pm on March 20, 2012 Permalink  

    RAID5 array of 6 SSDs Performance Evaluation 

    I’ve got six Crucial m4 SSDs with 256GB in a RAID5 array, resulting in 1.2TB useable disk space.The SSDs are connected via SATA3 to a Gigabyte 990FX UD7 board. I’m running 64bit Ubuntu 11.10 server.

    The following two articles offer some good ideas on performance tuning the SSD RAID:

    The chuck size on /dev/md127 is 512k, which is the default in Ubuntu and suits the 512k erase block size of the Crucial m4 disks. I’ve decided to partition the disks with “gdisk”, using a GPT. The partition starts at sector 2048 to align with the SSD chunk size. The filesystem is ext4, using 4k block size and 128 blocks stride, which again matches the 512k EBS. There is no need to pass any special options to mkfs.ext4, it was all autodetected.

    I’m using the following optimizations in /etc/rc.local:

    md=`ls -l /dev/disk/by-id/md-uuid-f70a5a71:577d6424:8ca4b9cf:265a61a3 | 
    awk '{ print $NF }' | sed -e 's/[/\.]//g'`
    echo 32768 >  /sys/block/$md/md/stripe_cache_size
    blockdev --setra 4096 /dev/$md
    for s in $SSD
      NODE=`ls -l $s | awk '{ print $NF }' | sed -e 's/[/\.]//g'`
      echo noop > /sys/block/$NODE/queue/scheduler

    Make sure /etc/rc.local is run by bash, not sh. The block device scheduler for the SSDs is set to “noop”, since there is no seek time on the SSD.

    Here are some benchmarks:

    root@localhost:/mnt/ssd# dd of=file.bin if=/dev/zero bs=1G count=10
    10+0 records in
    10+0 records out
    10737418240 bytes (11 GB) copied, 20.4972 s, 524 MB/s
    root@localhost:/mnt/ssd# dd if=file.bin of=/dev/null
    20971520+0 records in
    20971520+0 records out
    10737418240 bytes (11 GB) copied, 16.53 s, 650 MB/s

    650MB/s read speed is not too bad!

    Probably add GRUB_CMDLINE_LINUX_DEFAULT=”bootdegraded=true” to /etc/default/grub to allow the array to boot in degraded state.

    Note that there is no TRIM support for software raid5 yet (only levels 0,1,10 as of Linux 3.3), but support for levels 4,5,6 is in the making. Until then, a regular wipe of all SSDs may allow for steady performance.

  • MD1032 5:56 pm on November 21, 2011 Permalink  

    How I built my custom Mac 

    Here’s a list of the parts:

    Intel Core i7 2600K $335.00
    Corsair Vengeance CMZ16GX3M4A1600C9B 16GB (4x4GB) DDR3 $149.00
    Antec Sonata IV with 620W $187.00
    Crucial M4 SSD 256GB $439.00
    LG CH12LS28 12X BD-R Blu-ray DVD Combo Drive $69.00
    Arctic Cooling Freezer 13 Pro CO CPU Cooler $59.00
    Gigabyte GA-Z68MX-UD2H-B3 Motherboard $165.00

    First I had to update the BIOS to F12 and configure a few settings:

    • enable HPET in 64bit mode
    • Set all SATA controllers to AHCI
    • give 64MB of memory to the integrated graphics
    • turn off the SATA RAID BIOS
    I then prepared a UniBeast stick on my other Mac, according to the instructions here. I followed the guide but could not get to the Lion installer. After fiddling around with a few parameters I realised that passing PCIRootUID=1 on the UniBeast loader did the trick. After partitioning and formatting the SSD I was able to install Lion and boot it through the USB stick.
    I then installed Multibeast with the DSDT for my mainboard. After rebooting Lion got stuck on the white apple screen. To go ahead I passed GraphicsEnabler=false to the boot loader and got into Lion at a low resolution. System Info reports that the machine is a Mac Pro, and that was the problem since the Mac Pro doesn’t have an Intel HD 3000 graphics card. So I ran Multibeast again and installed the Mac Mini System Definition. I had to add it to my /Extra/org.chameleon.Boot.plist:


    < ?xml version="1.0" encoding="UTF-8"?>
    < !DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
            <key>Legacy Logo</key>

    After a reboot I got it running in full resolution. What was still missing is the USB3 driver and the Lnx2Mac RTL81xx driver from MultiBeast, which installed with no problems. Everything is working now, even the sound and the USB Bluetooth stick. It’s a rock stable system overclocked to 4GHz and I have never seen a faster Mac. And it is silent, too. CPU core temperature never goes over 60 degrees, even overclocked & under full load.

  • MD1032 6:21 pm on November 11, 2011 Permalink  

    Mounting Drobo b800i on Linux using iSCSI 

    iSCSI support in the new Drobo is a really neat feature. Here’s how to mount the Drobo as a block device in Linux:

    • install some hard disks and connect the Drobo via USB cable to a Windows or Mac computer
    • open the Drobo Dashboard and create a volume. I recommend to set it to 16TB size, no matter how many disks you actually have installed. This allows you to grow the filesystem later when you add more disks.
    • give the Drobo a static IP address on the iSCSI1 interface and connect it via Ethernet cable to your Linux machine (directly or using a gigabit switch)
    • unplug the USB cable
    • in Linux you need to install the iSCSI daemon. On Ubuntu just become root and run apt-get install open-iscsi
    • make sure your Ethernet card is configured to be on the same network as the Drobo
    • run iscsiadm -m discovery  --type sendtargets --portal where the IP address is your Drobo iSCSI1 IP address
    • you should now see your volumes listed, like,0 iqn.2005-06.com.drobo:b800i.tdb1119b0269.id1
    • connect to your id1 volume by running iscsiadm -m node --targetname iqn.2005-06.com.drobo:b800i.tdb1119b0269.id1 --portal --login
    • run dmesg | tail to see whether the block device was detected by the Linux kernel
    • run parted /dev/sdb to partition your device. Use mklabel to create a GUID partition table (GPT). Then use mkpart to create a partition. Drobo apparently does not support ext4, but ext3 works fine for me.
    • the block device will appear to be of size 16TB. However your actual useable space depends on the number and size of the disks you are using and the amount of redundancy you selected. Make sure that the partition you create is smaller than the actually available space. You can calculate the capacity of your Drobo here. Leave the rest of the 16TB disk as free space.
    • exit parted and format the disk using mkfs.ext3 /dev/sdb1
    • mount /dev/sdb1 and enjoy blazing fast storage
    • for automatic iSCSI target login on boot, run iscsiadm -m node -T iqn.2005-06.com.drobo:b800i.tdb1119b0269.id1 -p --op update -n node.startup -v automatic
    • If the target login fails, it helped me once to disconnect the USB cable
    • If the Drobo volume should mount on boot, add an entry to the /etc/fstab with options auto,_netdev
    • Keith Bradnam 1:50 pm on September 13, 2012 Permalink

      Is everything still working with you b800i? Can I ask how far apart your Drobo and server are, i.e. are they on the same local network or separated by various networks?

    • Christoph 3:59 pm on September 14, 2012 Permalink

      Yes it’s working on a local network, haven’t tested it across subnets

  • MD1032 4:59 pm on October 15, 2011 Permalink  

    XBMC & Lirc & Ubuntu 11.10 oneiric 

    After upgrading to Ubuntu 11.10, my MCE remote stopped working in XBMC. Since XBMC did not get an update (it’s coming from a separate PPA), I assume the LIRC button naming for the “mceusb” driver has changed in the new lirc package. It doesn’t match the “mceusb” section in XBMC’s Lircmap.xml anymore.

    What I had to do to get my MCE remote working again in XBMC was to create a new file ~/.xbmc/userdata/Lircmap.xml and insert the remote button codes that I gathered from running “irw” and pressing the buttons. Make sure that the “lirc” package is installed and choose the “Windows Media Center Remote” when it asks you for the type of remote you have.

    This is mostly the default mapping, with a few customisations for my personal preferences. Note that this is for the “mceusb” driver, if you use a different driver, you have to change the “<remote device=”mceusb”>” line and gather the correct codes from “irw”.

    	<remote device="mceusb">

    The above file maps the buttons on the remote to XBMC button names. If also want to change the mapping of XBMC buttons to XBMC functions, you need to create another file, e.g. ~/.xbmc/userdata/keymaps/remote.xml . I like to use the “play” button to display a context menu on the selection screens and codec statistics during playback. The following file overrides the default XBMC mapping to enable this:

    • Logan 4:18 am on October 16, 2011 Permalink

      Thanks for posting that. It’s just what I needed. I’d narrowed it down to lirc but had no idea how to revert back to an old version or fix this one. Appreciate folks like you who post helpful things for the benefit of others.

    • dash 9:56 am on October 16, 2011 Permalink

      Thanks a lot !, that’s exactly what I needed to make my remote work again with XBMC .

    • Richard 6:44 am on October 21, 2011 Permalink

      Thanks a lot! That worked for me!
      Just made a minimal install of Ubuntu 11.10 with XBMC Nightly and the only thing that didn’t work until now was my mce remote.

      Keep posting stuff like this….. kept my out of the dark cold late nights searching the web 😉

    • Roberto 2:17 am on October 22, 2011 Permalink

      Thanks. This works for everything lirc. From Rhythmbox to mplayer and pulseaudio.

    • Vincent 9:29 pm on October 24, 2011 Permalink

      Thanks too, Works perfectly now on 11.10

    • fr0sty 1:44 am on November 18, 2011 Permalink

      This fixed it for me, but now i seem to have double keypresses in XBMC. IRW gives me double keypresses, for example when going through the menu in XBMC it moves 2 options instead of 1

    • Mark Anderson 2:19 am on November 28, 2011 Permalink

      Thank you so much!!! I thought I broke my lirc with 11.10 update, only to find it did the exact same thing with a fresh install. With these instructions, I had my HTPC working in no time.

    • Elliot Nathanson 7:25 am on January 9, 2012 Permalink

      Yes – thank you! Lirc also broke with my 11.10 update.

    • Daniel D 8:47 am on April 21, 2012 Permalink

      I have a Rosewill RRC-126 and i wasn’t sure how to map it fully in XBMC thank you so much all buttons work how i want now!

  • MD1032 11:32 am on September 23, 2011 Permalink  

    Openfire & Ubuntu & more than 1000 XMPP users 

    Openfire on Ubuntu may get into a state where it doesn’t accept incoming connections anymore. The process is still there, the log files do not give any hints, but new XMPP clients just hang at the connection attempt.

    The reason for this behaviour may be a limit on a user’s maximum number of file descriptors. On Ubuntu, it defaults to 1024 (check with ulimit -n). To lift this limit, edit /etc/security/limits.conf and add the lines:

    root		soft	nofile		100000
    root        	hard    nofile          100000

    to raise the limit to 100K file descriptors and restart openfire. Since you are running the openfire init script as root, the limits need to be applied to root. Even though the process is started as user openfire, the ulimit from the parent process (run as root) seems to get inherited.

    Update: This does not work when openfire is started at boot through an init.d script. The limits.conf is only applied by a PAM module at login. Modify the init script to include “ulimit -n 100000”. This does not need limits.conf since the init scripts are run as root.

  • MD1032 10:57 pm on September 17, 2011 Permalink  

    XBMC and Radeon: scrambled desktop on exit 

    When quitting XBMC or when switching from full screen to windowed mode, the desktop becomes scrambled and unusable. This happens on Ubuntu 11.04 with the fglrx drivers for Radeon cards. The fix is to turn off  the “tear-free” feature in the Catalyst control panel.

  • MD1032 6:43 pm on August 25, 2011 Permalink  

    Display all installed Ubuntu packages sorted by size 

    dpkg-query -W -f'${Package}\t${Installed-Size}\t${Status}\n' |\
    awk '/installed$/ { print $2 "\t" $1 }' |sort -n
Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc