After using Linux Mint with Cinnamon for a long time I am now back with Ubuntu with GNOME (reluctantly, I may add).

One thing I have noticed is there does not seem to be an option in the settings to change your preferred terminal emulator.
Continue reading

(This guide applies to any Debian/Ubuntu based distribution)

For some reason (complexity perhaps) it is not possible to configure full-disk encryption and LVM from the graphical installer in the desktop edition. It is possible to select full-disk encryption but this only creates one filesystem (root).

I want to use LVM to allow me to have more than one filesystem without having to enter more than one password during boot-up. It is not impossible to install Ubuntu desktop (or Linux Mint as in this guide) with encryption and LVM but it does require a little more work.

Continue reading

I’ve been running KVM for quite a while on my lab server. It’s been running without issue but with the release of vSphere/ESXi 6.0 I felt it was time to move back to VMware.

I wanted to preserve the virtual machines already running so I set out to move these to ESXi. I ran into some issues which I’m not sure is a generic problem or specific to ESXi 6.0 but I’ll describe what I have done.

In order to convert the existing disk images to VMware’s vmdk format you should you use the program qemu-img from the package qemu-utils (in Ubuntu).

The process is straight-forward

  • $ sudo qemu-img convert -p -i DiskImage.img -O vmdk DiskImage.vmdk
  • Transfer disk image to ESXi (using scp (enable ssh in ESXi)) or NFS (as I did)
  • Create new virtual machine with custom options and add the converted disk
  • Boot

Unfortunate this did not work as expected, when booting the converted images, the Linux instances inside all crashed during boot with this error message (or something similar)

lib6.so: unsupported version 0 of verneed record

It turns out, two steps were missing; after transfering the converted disk image to ESXi, do this from the ESXi cli (via SSH)

# vmkfstools -i /vmfs/volumes/nfs1/DiskImage.vmdk -d thin /vmfs/volumes/datastore1/MyServer/DiskImage.vmdk

-d is the output format which can be zeroedthick, eagerzeroedthick or thin.

Now open the newly created vmdk file in vi and change the line ddb.adapterType from ide to lsilogic.

After doing this, add the image(s) to a newly created VM and boot.

(This was done in Ubuntu and will work with any Linux variant with qemu-img. If you want to do this in Windows, StarWinds V2V converter is said to be able to do the job)

As mentioned in my previous post i synchronize my wallpaper folder between my desktop computers.

While the are various ways of setting a random desktop background (XFCE – which I use – has this built in), I’ve had to conclude it’s just easier from the command line.

In XFCE it is not possible to do this from cron it seems, so I made a script which is run at start-up:

#!/bin/bash

IFS='
'

DIR="$HOME/etc/wallpaper"



while true
 do
        PIC=$(ls $DIR/*.* | shuf -n1)
        # Uncomment based on desktop environment
    # XFCE:
    #/usr/bin/xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s ${PIC}
    #/usr/bin/xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-style -s 5
    # GNOME2
    #gconftool-2 --type=string --set /desktop/gnome/background/picture_filename ${PIC}
    #gconftool-2 --type=string --set /desktop/gnome/background/picture_options zoom
    # GNOME/Unity/Cinnamon
    #gsettings set org.gnome.desktop.background picture-uri file://${PIC}
    #gsettings set org.gnome.desktop.background picture-options zoom
    # Generic - uses feh
    #feh --bg-fill ${PIC}
        sleep 120
done

In order to make the script run at start-up, create the file $HOME/.config/autostart/wallpaper.desktop

[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Rotate bg
Comment=
Exec=/home/alj/bin/setwallpaper.sh
StartupNotify=false
Terminal=false
Hidden=false

If you are not using a desktop environment like GNOME or XFCE, add the script to .xsession.

If you have the need to wake up machines on your local LAN from the outside, there are a few steps you need to take to get it working with OpenWRT (12.09)

  1. Select an unused IP address (which you are certain will never, ever be used). I will be using 192.168.1.254 in the following
  2. Log into OpenWRT and go to System → Startup → Local Startup (the text input at the bottom of the page) and add this line above exit 0:
    ip neigh add 192.168.1.254 lladdr ff:ff:ff:ff:ff:ff nud permanent dev br-lan
  3. Save (or Submit depending on the theme used)
  4. Go to System → Software and verify the package ip is installed. If not, do so.
  5. Go to Network → Firewall → Port forwards and add a new rule like this:
    forward(select custom to enter the internal IP address).
  6. Save and apply
  7. Reboot the router

That’s it. Now wake on lan should work from the WAN (Internet) as well.

This is what it looks like in the WoL Wake On Lan Wan Android app:

wake-on-wan

(via)

I’ve started to use copy.com instead of services like Dropbox, SpiderOak and similar.

Why? Because it’s fast (unlike Dropbox), it’s simple (unlike SpiderOak) and it’s able to run on all major platforms (Windows, OSX, Android, iOS and Linux, both graphical and console. Both are native Linux application).

This article explains how to install the agent on Linux – more specifically how to run the console agent on a Ubuntu-derived distribution.

Continue reading

I have recently moved my hosting to a couple of VPSes at ChicagoVPS and wanted to use IPv6 (via tunnelbroker.net)

ChicagoVPS uses OpenVZ which presents a couple of problems

$ ifconfig sit0
sit0: error fetching interface information: Device not found
$ sudo modprobe ipv6
FATAL: Module ipv6 not found.

It turns out, this is a fairly common problem though OpenVZ is supposed to support IPv6. Luckily, someone made a small userland program (tb-tun, which “tunnels” IPv6 tunnels through a TUN/TAP device.

First, it requires tun/tap device support to be enabled in the VPS, this is done in the control panel under settings

Control panel

Note! – Changing this setting will reboot your VPS without warning!

Next, make sure the build-essential package is installed (it’s included in the Ubuntu template at ChicagoVPS)

$ sudo apt-get install build-essential

Now, download and install the tb-tun program

$ mkdir tb-tun
$ cd tb-tun
$ wget https://tb-tun.googlecode.com/files/tb-tun_r18.tar.gz
$ tar zxvf tb-tun_r18.tar.gz
$ gcc tb_userspace.c -l pthread -o tb_userspace
$ sudo mv tb_userspace /usr/local/sbin

Before, continuing I recommend looking up the following information:

Server IPv4 Address - This is the IPv4 address of the Tunnelbroker gateway
Client IPv4 Address - This is the IPv4 address of your server
Client IPv6 Address - This is the IPv6 address of your server (for the tunnel end-point)
Routed /64 - This is your network

Next, you need to ensure your iptables configuration allows incoming encapsulated IPv6 traffic (protocol 41). Since ufw is a PITA to get to work on OpenVZ, I’m using iptables-persistant, which simply means adding one line to /etc/iptables-persistent/rules.v4

# IPv6 tunnel
-A INPUT -p 41 -s <Server IPv4 Address> -j ACCEPT

You also need to secure your server on IPv6, /etc/iptables-persistent/rules.v6

*filter
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# Allow ping
-A INPUT -p ipv6-icmp -j ACCEPT
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
-A INPUT -j DROP
-A FORWARD -j DROP
COMMIT

Apply the new rules

$ sudo service iptables-persistent reload

Finally, you are ready to set up your tunnel in /etc/network/interfaces

auto tb
iface tb inet6 manual
        pre-up  setsid /usr/local/sbin/tb_userspace tb <Server IPv4 address> <Client IPv4 address> sit > /dev/null &
        up      ifconfig tb up
        post-up ifconfig tb inet6 add <Client IPv6 address>/64
        post-up ifconfig tb inet6 add <Routed /64>:1/64
        post-up ifconfig tb mtu 1480
        post-up route -A inet6 add ::/0 dev tb
        post-up netstat -rn6 | grep -q venet0 && route -A inet6 del ::/0 dev venet0
        down    ifconfig tb down
        post-down       route -A inet6 del ::/0 dev tb
        post-down       killall tb_userspace

In my setup it looks like this:

auto tb
iface tb inet6 manual
        pre-up  setsid /usr/local/sbin/tb_userspace tb 209.51.181.2 192.210.137.214 sit > /dev/null &
        up      ifconfig tb up
        post-up ifconfig tb inet6 add 2001:470:1f10:74b::2/64
        post-up ifconfig tb inet6 add 2001:470:1f11:74b::1:1/64
        post-up ifconfig tb mtu 1480
        post-up route -A inet6 add ::/0 dev tb
        post-up netstat -rn6 | grep -q venet0 && route -A inet6 del ::/0 dev venet0
        down    ifconfig tb down
        post-down       route -A inet6 del ::/0 dev tb
        post-down       killall tb_userspace

Now, I just have one question

Y U NO

(Actually I know, and understand, why. It’s still annoying though)

As always with a new Ubuntu release comes the problem of getting Cisco’s VPN client to install (and no, using vpnc instead is not really an option since the VPN concentrator doesn’t play nice and drops the connection from time to time)

The problem this time is the kernel version of Ubuntu 11.10 – The new 3.0 series kernel.

I’ve made a patch which will make the kernel module compile and install on the 3.0 kernel.

If you have the vanilla Linux client, you still need the patches hereIf the installation/compile fails, make sure you have installed all relevant patches as will as the packages needed to install (ia32-libs build-essential linux-headers-`uname -r`).

At some point Veritas has release the Cluster Manager (Java Console) for Linux. Of course, Linux means Red Hat (and other RPM based flavours). Luckily it isn’t too hard making it work on Ubuntu (and friends).

First, get the software – This requires a SymAccount. And no, I will not send you the software

Now, prepare your Ubuntu box

$ sudo apt-get install alien fakeroot

And finally convert and install the package

$ fakeroot alien -c VCS_Cluster_Manager_Java_Console_5.1_for_Linux.rpm
$ sudo dpkg -i vrtscscm_5.1.00.20-1_all.deb

Now, from a terminal or otherwise (ALT-F2 in various Ubuntus) run

$ /opt/VRTSvcs/bin/hagui

Or create a desktop entry for the Cluster Manager to put it in the menu

Create the file ~/.local/share/applications/hagui.desktop

[Desktop Entry]
Version=1.0
Name=Veritas Cluster Manager
GenericName=Veritas Cluster Manager
Comment=Manage Veritas clusters
Exec=/opt/VRTSvcs/bin/hagui
Terminal=false
Icon=ClusterManager
Type=Application
Categories=System

Copy ClusterManager.png to ~/.icons

The fix itself is the same as for Python 2.5 – only the line numbers have changed.

Open the file /usr/lib/python2.7/locale.py and find the line containing en_gb (line 921) and add these lines (this works for Danish locales):

    'en_dk':                                'en_DK.ISO8859-1',
    'en_dk.iso88591':                       'en_DK.ISO8859-1',
    '[email protected]':                           'en_DK.ISO8859-15',

In order to avoid this change getting overwritten by packages updates, I use dpkg-divert:

$ sudo dpkg-divert --add --rename --divert /usr/lib/python2.7/locale.py.real /usr/lib/python2.7/locale.py
$ sudo cp /usr/lib/python2.7/locale.py.real /usr/lib/python2.7/locale.py

If you wish to remove the diversion (if the package is fixed to support you locale at some point) simply run

$ sudo dpkg-divert --rename --remove /usr/lib/python2.7/locale.py