Saturday, 27 September 2014

Ubuntu stops at Grub menu

I had this annoying issue with my Ubuntu server. Every time it rebooted, quite often because of a power failure, it wouldn't boot properly. I needed to go the storage room where I have it and connect a laptop with a serial cable. Well, I got an UPS to at least stop this from happening inadvertently but I decided to fix the issue once and for all when I need to reboot it for other reasons. And it turns out that since 12.04 LTS there has been a very simple solution. Just adding the following to /etc/default/grub fixes this issue:

The problem is that if the system goes down without proper shutdown, default behaviour is to stop in the Grub menu. This is pretty ridiculous for servers.

As it happens I managed to buy the only UPS (from APC) without remote access, so I can't set the system to shutdown in case of power failure. But the UPS should be able to keep the system running for at least 30 minutes, easily, and our power failures are not that long. Think there has been one that long once and that was because our mains was cut by some workers.

Thursday, 18 September 2014

Emacs evil mode

I decided to have a look at Emacs evil mode (the Vi mode for Emacs). Vim is not really suitable as an IDE. It's an editor and anything else tends to be a bit of a hack. Debugger is one such issue, it's not very convenient to use gdb inside Vim. As an added bonus I can use Lisp instead of Vimscript to write scripts.

But I like Vim's editing better than Emacs's endless control-meta-this-and-that approach. It's faster and more convenient. I might try Emacs without Evil mode at some point, I'm a pragmatist after all but at least this way I don't have to learn the entire Emacs editing thingy just to get started. I'm familiar with M-x, C-x C-f, C-x C-f and the like which should suffice for now.

Installing was almost like a breeze. Had I figured out Ubuntu 12.04 uses emacs23 instead of emacs24 which all the help I can google points to I would have had an easier time. But here's how I got started:

sudo add-apt-repository ppa:cassou/emacssudo apt-get updatesudo apt-get install emacs24git clone ~/.emacs.d/undo-treegit clone git:// ~/.emacs.d/evil

Then I added the following to .emacs:
(add-to-list 'load-path "~/.emacs.d/evil")  (require 'evil)  (evil-mode 1)
(load-theme 'wombat)

Last line loads the wombat colour scheme. I use wombat256 in Vim.

Now I just need to figure out how to get the same functionality as my favourite Vim plugins have. For instance, CtrlP. Someone suggested ido mode, but I can't seem to get it to do recursive search. In CtrlP you don't have to know where a file is to find it.