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.


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.