Rebooting linux machine without disk access

This is a weird situation which I found myself in recently. One of the ubuntu servers were having issues and was unable to launch any process for unknown reason (kernel issue/disk or filesystem failure/etc). Puzzled, I tried to reboot the machine using shutdown and reboot, but the system did not allow me to. It also failed to run utilities such as ping, ifconfig, etc…

After some googling, here is the magic (“magic SysRq key”):

echo 1 >/proc/sys/kernel/sysrq
echo s > /proc/sysrq-trigger (optional, sync mounted filesystems)
echo u > /proc/sysrq-trigger (optional, remount filesystems as read-only)
echo b > /proc/sysrq-trigger

Aha! echo is a bash shell builtin command and does not have to be a new process. Reboot now!

Linux Magic System Request Key Hacks

Running statically linked Quassel core on 64-bit Ubuntu

Quassel is a cool IRC client and server. From its homepage:

Quassel IRC is a modern, cross-platform, distributed IRC client, meaning that one (or multiple) client(s) can attach to and detach from a central core — much like the popular combination of screen and a text-based IRC client such as WeeChat, but graphical.

One can choose to install quassel from the distro’s repo, or use the statically linked binary provided by the author. The advantages of the statically linked binary are: it does not require Qt or SSL to be installed, and is probably a newer version than what is in the repo.

The download provided is a 32-bit binary. To run it in 64-bit Ubuntu, we need to satisfy its dependencies:

apt-get install zlib1g:i386

Extract and run:

bunzip2 quasselcore-static-0.10.0.bz2

That’s it!

Blogs | Quassel IRC
Downloads | Quassel IRC

Set up Asus router network printing on Ubuntu

Certain routers like the Asus RT-N66U have built-in network print server capability, which is an under-appreciated feature IMHO. But the settings > add printer dialog in Ubuntu 14.04 left much to be desired when it could not add the printer running behind the Asus router.

As a workaround, run the following command to get a better add-printer facility:


Select Add.

Select Network Printer.

Select LPD/LPR Host or Printer.

Enter router IP (commonly in “Host”, and LPRServer in “Queue”, and select Forward.

Choose the driver that matches the printer to add it to the system. You can now print from other applications.


ASUSTeK Computer Inc.-Forum- How to setup network printer in Ubuntu 12.04


apt-get stuff

1. Add redundant repo

In /etc/apt/sources.list, add:

deb trusty main restricted universe multiverse
deb trusty-updates main restricted universe multiverse
deb trusty-backports main restricted universe multiverse


2. Set timeout

Create /etc/apt/apt.conf.d/99timeout, add:

Acquire::http::Timeout "10";


apt-get away!


apt – How to lower wait time for repository updates – Ask Ubuntu

ZFS with HP Smart Array P410i

As I was trying out zfs (on Ubuntu) on our HP server, I realised the RAID card that came with the server, HP Smart Array P410i, does not have a JBOD (Initiator-Target) mode. Now this is a First-world-problem – the card can support RAID 0, 1, 10, 5, 6, 50, 60, but not JBOD (?!).

Moving on, the next best thing is to configure every disk (we have 8 SSD) to be a 1-disk RAID 0 array to “simulate” a JBOD setup. Inside Ubuntu, there is now a 1-to-1 mapping of device to drive (sda – sdh), which is what is recommended by zfs.

Creating the zfs pool and setting some options:

zpool create tank sda sdb sdc sdd sde sdf sdg sdh
zfs set atime=off tank
zfs set sharesmb=on tank

But this is not the crux of this article. The problem is that random write performance is not as good as we expected out of zfs. The ideal setup would be to expose individual disks to zfs, but we could only expose the disks through the RAID card. After some tinkering, we found that the drive write cache was disabled, probably due to the fact that there is no battery unit on the RAID card.

To enable drive write cache:

hpacucli controller slot=0 modify drivewritecache=enable

IIRC there was some warnings, but I ignored them as what I want is a JBOD setup to hold non-mission critical data. A raidz pool can be setup if need be for redundancy, but at this point I lost myself looking at the 2x increase in write bandwidth. Next up, trying to saturate the pipe 😀

HP Management Component Pack for Ubuntu

We got a couple of HP ProLiant DL380 G7 servers, and this is what HP has to offer for being certified for Ubuntu: Management Component Pack (on its Software Delivery Repository).

And here’s how to set it up on Ubuntu 12.04 LTS.

Add the repo:

add-apt-repository 'deb precise/current non-free'

And the repo keys:

wget -qO - | sudo apt-key add -

Finally, get the list of packages from the repo and install whichever packages required (hpacucli to configure the disk array controller):

apt-get update
apt-get install hpacucli