How I managed to fix EFI booting on my archlinux laptop after changing Motherboard

My less than a year old, Thinkpad x230 just got back from repairs – a dead motherboard. Thinkpads maybe tough but not tough enough for “The Mehul Test” :-P, this is the 2nd Thinkpad that’s suffered the same fate in my hands.

That’s the backstory, now getting back to the problem at hand. So, I got the motherboard changed, for free as it’s within warranty. The Lenovo repaircenter called and said they can’t boot Windows off the hard disk. I told them to hold back as it has Linux and would require some BIOS change. Fiddled around with BIOS settings, upgraded the BIOS to the latest version, still no go. Tried booting from the USB drive which I installed arch from, it showed blank screen. After fiddling around and browsing forums and trying IRC channel in vain, I decided to try the UEFI Shell. Thus, I went to the archlinux wiki and read up on it.

So, the bcfg command is the way to go. At first, I blindly copy pasted it from the wiki page and failed a couple of times. 

bcfg boot add 3 fs0:\EFI\refind\refind_x64.efi "rEFInd"

The above did add a boot entry which took me to the USB drive boot menu only. After a couple of minutes, it struck me that there were fs0 and fs1 among the entries when UEFI shell was launched. fs1 is what pointed to the my SSD drive. So, I went ahead and typed

bcfg boot add 3 fs1:\EFI\arch-grub\grubx64.efi "rEFInd"

And voila! That worked. Just before that, I typed


and then did ls to see the contents. I could see that the contents were what was on the SSD in EFI partition and then gave the bcfg command.

This UEFI is super duper confusing. And I must admit, I barely understand it. I just managed to solve this issue by bruteforcing everything I could lay my eye upon. Unfortunately, it wasn’t documented anywhere nor could I find it via Google search. Hope this blog post helps someone who gets stuck with similar issue.


Hi Readers,
I have shifted my wordpress blog to a hosted space. I would not be posting any further updates on this blog. Please update your bookmarks to point to my new blog at .
If you want to check my non-tech blog, you can view it on

Access VirtualBox Guest Network From Outside

I have been looking for a way to enabling network inside virtualbox so that I can access it from anywhere thus being able to run various services inside virtual environment, trying out anything without any worries.

Here’s a simple how-to borrowed from archlinux wiki

Install bridge utils for creating bridge and uml_utilities for creating a tun device

pacman -S bridge-utils uml_utilities

Open the file /etc/udev/rules.d/60-vboxdrv.rules and add the following line to it

KERNEL==”tun”, OWNER=”root”, GROUP=”vboxusers”, MODE=”0660″

Then type the following command to load the tun module

modprobe tun

Now, let’s setup a bridge device to bridge network from your physical network interface to the virtual one

  • Create a bridge interface

brctl addbr br0

  • Set your interface in promiscous mode so it can accept packets from any interface

ifconfig <interface name> promisc

  • Now, bridge the bridge interface with the real network interface

brctl addif br0 <interface name>

  • Now set the bridge interface to acquire IP address as your physical network interface would. eg if eth0 is your network interface and it acquires IP via DHCP then

dhclient br0

  • And finally add virtualbox host interface

VBoxAddIF vbox0 <VirtualBox user> br0

Now start VirtualBox and go to network settings. Select network interface as ‘host networking’ and interface device as ‘vbox0’.

Now you need to give an unused IP address in your IP range of the internet gateway. If you cannot provide that due to some reason then what you can do is create a virtual interface say eth0:0 then bind bridge network to that interface and setup NATing to pass packets between virtualbox and external network.

Some nifty fun with Linux and PDF files

Let me narrate 3 nice experiences with pdf on Linux while at work

1) Merging multiple PDF files

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOUTPUTFILE=filename.pdf file1.pdf file2.pdf……..fileN.pdf

2) Convert ps to pdf

ps2pdf file.pdf

3) Compressing PDF files.

4) Convert images to PDF

convert image1.jpg image2.gif image3.tiff…… filename.pdf

Viewing MS Word files on Command Line

I had to urgently view a MS Word file but I didn’t have a word processor on my system to view it in, KWord2 beta wasn’t able to support MS Word files. And I couldn’t find any small word processor or the one that wouldn’t being a gnome and a half in with itself. So, I decided to explore the CLI way.

I came across this nice article on how to view MS Word files on CLI. One of those softwares which I tried out is antiword, as it seemed most suitable to my purpose. A nifty utility to download and use while takes it’s sweet couple of hours.

Another nice thing is that it can be used when you don’t have X running or if you’re connecting via SSH.

Viewing the file in antiword is as simple as typing

antiword filename.doc

Though it has a few options to format stuff via parameters, I don’t need them. But, they can be quite useful for some purposes.

Pipe the document through a pager and nicely sit and enjoy reading your MS Word document over Command Line Interface.

My thoughts on the software – simple, easy to use and makes life easy when all you want is to view simple text from a MS Word document. What I miss the most in the software is the ability to open odt files 😦

2 Minutes To Your Own Planet

Heh! Please don’t mistake me for one of those LHC guys. No, I am not talking about planets as in heavenly bodies which reflect lights from the stars but have give out no light on their own. I am talking about planet as in a feed aggregator.

Firstly, planet is a web based feed aggregator software developed in python. Planet was originally developed for GNOME and Debian. It can parse RSS, Atom and RDF feeds.

So, let’s get started up.

First step is to download planet software from here or checkout the latest stable bzr version from here.

Then untar the file if you downloaded the tarball.

tar -xpvf planet-xx.tar.bz2

Now untar the planet tarball and install the planet files eg.

tar -xpvf ~/planet-2.0.tar.bz2

cd ~/planet-2.0


./ install

Now we need to configure the config.ini file in fancy directory to get started quickly. If you wanto take your time

vim examples/fancy/config.ini

Look at the file, it’s nicely commented you should have no problem at all in configuring it to your tastes, believe me. It’s too easy.

I set my output directory as

output_dir = /var/www/localhost/htdocs/planet

cp -R examples/output/* /var/www/localhost/htdocs/planet

This will place all the output files in the planet and the second command will copy the images folder and css file to the DocumentRoot so your page renders well.

Now to generate the output

./ examples/fancy/config.ini

Now you can install the and to /usr/bin using so that you can run it via cron

./ config && ./ install

crontab -e

0 * * * *   /usr/bin/ /home/user/planet-2.0/examples/fancy/config.ini

Now open up your web browser and point to localhost/planet. Of course you need a web server running on localhost to try this out.

To show your image, put it in /var/www/localhost/htdocs/planet/images

Happy journey. Enjoy the feeds on your own planet!

Using tor and privoxy in linux

No how-to from my side this time around. But a nice link I followed to setup tor and privoxy on my machine. It’s really easy to follow and straightforward.–privoxy-for-anonymous-searching.html

Probably I will write a how-to on customising privoxy to block ads, unwanted url’s, redirect machines on the network to use tor and privoxy using firewall rules.

Installing MaraDNS

Today on ##linux-india at people were discussing about DNS and the recent DNS security issue and it’s implications and solutions. So, I decided to try out the test for my ISP’s nameservers, the default nameservers that I use. The test can be found on Kaminsky’s Website.

The test confirmed that my ISP’s nameservers aren’t patched, so I decided to finally configure my dnsmasq finally and again use local DNS servers. But, the dnsmasq configuration is too lengthy and complicated for this purpose. It’s a great software if you want to have a lot of function like tftp boot, dhcp and such. But, in my case I just need a caching DNS server so decided it was either bind which I always use or try maradns, as suggested by someone on the channel.

Since, I have gone with bind in the past I decided to go with maradns, which I heard is easy to configure and is supposedly as secure as djbdns. So maradns it was. I downloaded the latest release from their download page as no binaries are available in arch repos.

So, let’s start with the process, now that you’ve downloaded the binary. This will work, only for linux. Please check the README files and documentation for further details and different platforms.

First untar the downloaded file, in my case the tar.bz2 file

tar xjvf maradns-

cd maradns-

Then run



Now, your binaries have been created and you’re ready to test out the DNS server

Note:-You need to be root henceforth

mv server/maradns /usr/local/sbin

mv tools/duende /usr/local/sbin

mkdir /etc/maradns

touch /etc/mararc

Now open the /etc/mararc file in your favourite text editor and add the following

ipv4_bind_addresses = “”
chroot_dir = “/etc/maradns”
recursive_acl = “”

Now start maradns


Then test it

dig @

If it returns a reply, you’re good to go 🙂 If not, post the errors I will be glad to help out.

Now, try running it in daemon mode

killall maradns

/usr/local/sbin/duedne /usr/local/sbin/maradns

If all is fine till here then we can proceed to actually install maradns.

First cd to the maradns directory, where the source is place then run

make install

Now, we need to add /usr/local/sbin and /usr/local/bin to our PATH variable

add the following to your bashrc

export PATH=$PATH:/usr/local/sbin/:/usr/local/bin

That’s it, you’re done! Your server is ready to run.

TODO :- Find init scripts for starting it at boot time. My distro is arch. If anyone can supply me one I will be thankful.

PS :-

If you want the server to listen to multiple IP’s add them in a comma separated list inside the quotes for ipv4_bind_addresses. Check

Lots of nice stuff can be found at

Hurray! Got my webcam working on linux

I was sitting at night browsing some friend’s blogs and adding RSS feeds to Akregator, after my new found fondness for KDE 4(more on that in a later post). Then Gaurish Sharma asked how to get webcam and fingerprint scanner to work on linux. I didn’t really have much clue but asked him to dig around with /var/log/dmesg and /var/log/messages to get more info on the webcam to start with. While he was looking around, I decided to dig up my own webcam from the closet.

I connected the webcam to the PC just to see a bunch of errors being spewed out by /var/log/messages. Then I installed gspcav1 kernel module and loaded it

pacman -S gspcav1

modprobe gspca

Still, no go. I still got errors on reconnecting the webcam. Then, I peeked around the Arch Linux wiki and found some other drivers that may be needed by device. Then ran


It showed up a microdia webcam but still /var/log/messages spewed out errors. Then I went for verbose option of lsusb to see if there’s anything worthwhile.

Here’s the lsusb -v output for those interested

Still nothing. 😦

Then I decided to remove bluetooth from the other port and insert the webcam there. And voila! there it works. The webcam was detected, no errors this time and the required device was created.

Now, to test if it works or not. I tried kopete but alas! it doesn’t support all the webcams and mine is in one of those unsupported ones. I started looking at other apps which support more webcams. I started with cheese and ekiga but both looked to install evolution-data-server, why would I want that? Then I installed skype

pacman -S skype

Then add the user to video group and execute

chown :video /dev/video0

Now, logout and log back in for group settings to take effect. Then I ran skype.

Hurray! My webcam worked! Though the picture was hardly visible, I would place the blame on the webcam rather since it hasn’t been used in years now and it has always been throwing out grainy pictures since the beginning.