Setting savedefault option for grub in Ubuntu 13.04

Technical, Technology

Thank to kstevens.

You need to have both of these lines in /etc/default/grub:


Then run sudo update-grub.

Check the entries in /boot/grub/grub.cfg and they should look something like:

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
        insmod ext2
        set root='(hd0,5)'
        search --no-floppy --fs-uuid --set c23bb931-2d60-4f48-9086-c8dbdc7fdca6
        linux   /boot/vmlinuz-2.6.32-22-generic root=UUID=c23bb931-2d60-4f48-9086-c8dbdc7fdca6 ro splash vga=786  quiet splash
        initrd  /boot/initrd.img-2.6.32-22-generic

The most important line to note is savedefault.  It indicates that this menu entry will save itself as the default when selected.  Verify that this line appears under each menu entry.

Un-revoke certificate in OpenVPN

Technical, Technology

First of all, “un-revoking” is not an official term. And in PKI practice, a certificate should never be un-revoked.

However, there are cases that things get wrong and you do not want to complicate things by creating new certs.  You may consider this method.

  1. cd <whatever directory your openvpn configs are in, e.g. /etc/openvpn>/easy-rsa/keys
  2. Backup the files crl.pem and index.txt.
  3. There should be an index.txt, with certificate IDs in it. The ones starting with “V” are valid, and ones with “R” are revoked. You can edit that file, and fix the first char to “V”, and delete the third column (the revocation date). If you have more then one certificate, you should see the pattern (sequential number comes in the third column now, etc).
  4. Delete crl.pem
  5. cd ..
  6. . ./vars
  7. openssl ca -gencrl -out "crl.pem" -config "$KEY_CONFIG"
  8. You should find a new crl.pem generated in the current directory. Copy this file to the sub-folder keys.  Done!

Quick Recipe – restoring a corrupted SVN master repo with the slave repo

Technical, Technology

With svnsync, you could set up a replica of your SVN repository.  Apart from load balancing, the slave repo is also a backup of your master repo.

When in times you’d like to recover the master (we call it the original master) from the slave, you could follow these steps:

  1. Ensure no one is committing to SVN.
  2. Trigger svnsync in all SVN slaves.
  3. Stop the master’s SVN service.
  4. Duplicate your slave repo.  We call the duplicate the new repo.
  5. Change the UUID of the new repo to that of the original master.
    svnlook uuid <path to master repo> # Gives the master's UUID
    svnadmin setuuid <path to new repo> <master's UUID>
    svnlook uuid <path to new repo> # Check if it is set correctly
  6. In physical file system, backup and move away the original master.  Move and rename the new repo to exactly that of the path of the original master.
  7. Remove the hook for the slave (in my case, the file <repo>/hooks/pre-revprop-change).
  8. Add back the hook for the master (in my case, the file <repo>/hooks/post-commit).
  9. Restart the SVN service.


  1. Section “svnsync Bookkeeping” of svnbook
  2. Managing Repository UUIDs

Install hddtemp in CentOS – to check harddisk temperature in Linux

Technical, Technology

Assuming you are now logged in as root.

  1. Add repository
  2. yum update
  3. yum install hddtemp

Use Sun Java plugin in Firefox for Ubuntu 12.04

Technical, Technology
  1. Download and expand a JRE or JDK using root account.  Record the path, e.g. /usr/lib/jvm/jdk1.6.0_23 (we call it <java path>).
  2. sudo update-alternatives --install "/usr/bin/java" "java" "<java path>/bin/java" 1
  3. mkdir -v ~/.mozilla/plugins (skip this if the directory already exists)
  4. cd ~/.mozilla/plugins
  5. ln -s <java path>/jre/lib/amd64/