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
reboot, but the system did not allow me to. It also failed to run utilities such as
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
echo is a bash shell builtin command and does not have to be a new process. Reboot now!
Linux Magic System Request Key Hacks
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:
Blogs | Quassel IRC
Downloads | Quassel IRC
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:
LPD/LPR Host or Printer.
Enter router IP (commonly
192.168.1.1) in “Host”, and
LPRServer in “Queue”, and select
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
1. Add redundant repo
In /etc/apt/sources.list, add:
deb http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
2. Set timeout
Create /etc/apt/apt.conf.d/99timeout, add:
apt – How to lower wait time for repository updates – Ask Ubuntu
Disclaimer: I am a noob at gdb.
To use intel syntax and display the current instruction:
(gdb) set disassembly-flavor intel
(gdb) display/i $pc
Next, setting a breakpoint where
0xdeadbeef is the address of
call fork instruction. Get gdb to follow fork child instead of parent, which is the default behaviour. Step over the fork to land in the child process:
(gdb) break *0xdeadbeef
(gdb) set follow-fork-mode child
Bonus, setting a rwx data breakpoint:
(gdb) awatch *0xbabecafe
Now I am not sure which is the greater evil, gdb or windbg…
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 😀
Needed to diff large (> 1GB) text files as part of a toolset, but DiffUtils provided by gnuwin32 is 32-bit only 😦 Of course I tried, but expectedly, it failed to diff the large files. Next solution: compile a native 64-bit version of diff. (Why is there no gnuwin64?) Anyway, I chose to compile on a x86_64 linux machine because I happen to have such a test machine around.
apt-get install mingw-w64
tar xJf diffutils-3.3.tar.xz
# get diffutils-3.3-mingw64.patch and place it here
patch -p1 -i diffutils-3.3-mingw64.patch
./configure --host=x86_64-w64-mingw32 --prefix=/tmp/diffutils-3.3-mingw64
make && make install
Now, the goods are in
diffutils-3.3-mingw64.patch can be found under Resources. I would have gladly pasted the file here if not for the non-printable character found in the original source. If anyone knows the settings for diff to generate pure printable patch file do drop a comment below, thanks!
Further interesting read: MinGW 64 how-to