Pages

2014-12-28

Dual booting Debian Jessie and Windows 8.1 on Dell Vostro 3800

This post is about a peculiar problem with the UEFI firmware that ships with the Dell Vostro 3800 (or maybe just some of its variants). This problem shows up when you try to dual boot GNU/Linux along side a Windows 8.1 (maybe even 8.0). If you are never gonna dual-boot into Windows, this post is not for you. This post assumes that you understand UEFI to some extent and are familiar with the tools. This is NOT a step-by-step instruction set. If you screw up, its your own problem.

Symptoms and constraints (all of these must hold true):
  1. You should be using GPT.
  2. You should be doing native UEFI boot.
  3. Secure boot should be disabled.
  4. After installing Debian GNU/Linux (Debian Jessie, in my case) along side the pre-installed Windows, on the FIRST boot, you should get the Grub boot-menu.
  5. From that boot-menu, if you choose "Debian GNU/Linux", your fresh installation should boot fine without issues.
  6. When you reboot, and choose Windows from the Grub boot-menu, Windows should boot fine without issues.
  7. When you reboot from Windows, you do not get the Grub boot-menu anymore. The computer boots into Windows by default. Basically, the first time you boot into Windows after installing GNU/Linux, your Grub is gone.
  8. At this point, boot into rescue mode using the Debian installer CD/USB/*. Choose your root partition, etc, and get to a shell. At the shell, do "efibootmgr --verbose":
    1. There should be an entry for "Windows Boot Manager"
    2. There should be an entry for "debian". But this entry will not have a "HD path" after the "Vendor" part (compare with the "Windows Boot Manager" entry).
  9. Delete the invalid "debian" entry.
  10. Add a valid entry for Debian.
  11. Reboot, hold F2 and get into the "firmware setup" (AKA BIOS setup). Go to the "Boot" options. The setup screen will not list any operating systems on your 'hard-drive'.
  12. If you continue to boot, the computer will boot into Windows.
  13. If you reboot into Debian installer's rescue mode and check the NVRAM using "efibootmgr --verbose", you see that problem in (8) has returned.
Now the explanation : The UEFI firmware on the mother-board is buggy. When there is more than one boot entry in the NVRAM, it gets confused.
  1. Before you installed Debian, "Windows Boot Manager" was the only entry, and the setup-firmware would have shown you that.
  2. Then when you installed Debian, 'grub-install' would have removed all NVRAM entries, and configured itself as the ONLY boot-manager because it knows how to load everyone else. So, the setup-firmware would have shown you "debian".
  3. When you boot-up Windows for the first time from Grub, Window's boot-manager got annoyed to see that it was not there in the NVRAM and adds itself there. It also sets itself as the default. Now, at this point both "Windows Boot Manager" and "debian" are listed in the NVRAM. But the "debian"entry got munged somehow (Not sure whose fault it is, the firmware or Windows).
  4. When you setup a valid entry for "debian" the UEFI-firmware did not understand it and therefore resorted to booting the default boot-manager in "\EFI\Boot\boot64.efi", which in turn loads the "Windows boot manager" in "EFI\Microsoft\Boot\". And, in the process the "debian" entry got munged again.
  5. In [1], there is a suggestion to install rEFInd for a similar problem. However, that will not work either. Coz, when windows loads up, if there is no "Windows boot manager" entry in the NVRAM, it'll install it. So, at any point there has to be two valid boot entries in the NVRAM. And, the UEFI firmware is having a problem with that.
The fix: Tell windows that Grub's boot-manager is its boot-manager. You can do this using:
bcdedit /set {bootmgr} path \EFI\debian\grubx64.efi
Once you do that, "Windows Boot Manager" (which gets chain-loaded from Grub) will ensure that the Grub's UEFI file is listed as the boot-manager in the NVRAM. So, you'll get the Grub boot-menu always :)

2014-12-07

Respect the fcking distance

Last year, I was euphoric when I crossed that finish line at "The Wipro Chennai Marathon 2013". I had no expectations when I started. The whole 'full marathon' subscription itself being a mistake, I was just glad that I could crawl to the other side in one piece. I also made a conscious note that I'll be in better shape next year.

This year (at  TWCM14), the goal was to finish fairly comfortably. To be able to walk normally after crossing the finish line. I did not have any timing expectations. However, in the end, I felt completely defeated and broken. Inspite of all the buildup up to the run, the cramps returned with a vengeance, like clockwork, at 32k. The last 10k was an ordeal of getting my legs to listen to the brain. Yes, I was hydrated. Yes, I was well-fed on the right stuff. Did the icing, the spraying, the stretching. Nothing helped. The take-away is:
  1. Respect the fcking distance.
  2. "If you could do 30k comfortably, you could do 42k" is utter bullshit. If you want to do 42k comfortably, you should be able to do 50k comfortably on a training run.
  3. And again, respect the fcking distance.
So, forwarding the same "comfortable finish" goal to the next one.
 

2014-04-30

I cannot digest "model driven engineering". Sorry.

Lately, I am being told that "Model driven engineering" is the future in Automotive (and also various other Industrial automation fields). That, it is the standard (apparently) to which most of the industry has already moved. Basically means, "goodbye y'all embedded programmers".

While I clearly see the potential theoretical benefits, I cannot oversee the fundamental flaws in the approach. Every single tool vendor out there, who provides an end-to-end solution, ensures that you are locked in firmly and deeply. This lock-in starts from software and goes all the way to the hardware.  Simply put: You cannot model with one tool, generate code with another, and use commodity hardware to verify/test the model with the actual hardware. Heck, you cannot even version control any of this with a tool of your choice. You'll have to go back to folders named "version-1", "version-2", etc.

None of these tools come cheap BTW (~50 Lakh INR to get the whole chain to work, apparently). That creates a huge entry barrier in terms of sheer capital investment. That automatically puts the target industries out of reach for most start-ups. The main driving force (as I understand) seems to be "testability". The industry does have many fancy terms to call the different facets of this (verifiability, traceability, ..), however. Its all the same old story anyways.

While the rest of the software industry has dealt with this quite well (we even got JavaScript testable, duh!), these particular domains are looming in darkness (or so it seems). Maybe I am wrong. Maybe my sources of information are wrong. But this does bring me to an important decision point. If this is how it has to be.. then I have choices to make. The knowledge that I can walk away (like its not my fight to fight), does feel gratifying. But I am not going to ignore that the problem does exist.

The need of the hour, IMHO, is a community that can break this market up so that there is fair participation and true innovation from all ends. I am talking ~10 man-years of development work. Sorry, its not my fight. My bread and butter is a work-in-progress (literally).

2014-03-01

running shoes

"Running shoes" are not the easiest to pick. You got to look through the options, do the research, find the right one, flirt with it to see how it responds, then take it out on the roads, until it finally blends in and it becomes "THE" shoe. It is like getting married. The random idiot who flicked my last pair, obviously wont see all that love that had gone into it. With the shoe gone, I was forced into the searching-flirting-dating-marrying cycle once more.

The ordeal of dealing with "over enthusiastic" salesmen should not be under-estimated. From "stability" to "bounce" to "support", the salesman will throw "vendor taught jargon" all over you. You know it well, that no matter what the price, what the jargon, what the technology, the shoe will eventually fall apart after 1000Km. If this is the 5th pair of shoes you are picking, you obviously have learnt it the hard way that, it does not fcking matter. Your opinion could vary depending on the type of snob you are. For me, the only things that matter are:
  1. Price
  2. Minimum heel to toe drop
  3. Roomy toe-box
  4. Durability
 (4) is THE most important. Because, I really dont have the patience to go through another round of the searching-flirting-dating-marrying cycle.

Armed with a decent bit of research on the models that fit my criteria, I hit every showroom of every vendor in Madras. Realisation dawned pretty quickly: "Big vendor shoes aint cheap. The base price is ~4K INR. At that base price, you get something that feels straight out of a plastic compression molding machine". And none of them fit my requirements (2) and (3). So, in spite of coughing up a lot of money, I should still compromise.

I am not in terms with the idea of buying clothing/apparel/shoes online. Given the situation, I decided to give it a shot anyway. Saw a well reviewed shoe on a discount sale on Flipkart. Before I could think twice, made the jump. At ~2.8K INR, the "Merrell Mix Master 2" fit my requirements (1), (2) and (3) perfectly. (4) should be figured over time.

Its been ~80Km.. the shoe is good :)

2013-10-19

.. small joys ..

"All of today's code compiled. A fair chunk of them test-case covered. Yay.."

Here doggie.. here's a dram of whisky for you. Good boy. :P

2013-09-19

On how they killed my watch

Early on, I figured I need a watch that "Just Works (TM)". The search took me to my first "Timex Ironman Triathlon" digital watch. And, work it did. A beautiful piece of art, it is. It bore the rain, the sweat and the shower. It bore the drops and crashes. It bore it all. Until one day, three years later, the battery drained out and I had to change it at a service center. The next day, the watch died after a dip in the bay of bengal.

The service man had not fit the back cover properly after replacing the battery.

After the swearing, yelling and crying, I went over and got myself another "Timex Ironman Triathlon". Which ended with the same fate two years later. So, I went for it again the third time. This time it lasted 5 years and died because of the same reason.

Yes, my next watch is also going to be the same "Timex Ironman Trialthlon". But this time, I am gonna buy the necessary tools to fix the battery myself. I am fed of unskilled idiots ruining my happiness.

2013-09-17

Freescale Codewarrior MCU 10.2 on Debian Jessie (amd64)

These are largely notes to self. So, dont sweat. Go elsewhere for entertainment.

Freescale Codewarrior MCU 10.2 requires a 32bit environment to work. So, you need to first set that up.
$dpkg --add-architecture i386
$apt-get update
$apt-get install gcc-multilib g++-multilib
$apt-get install libexpat1:i386
$apt-get install libxt6:i386
$apt-get install libswt-gtk-3-jni:i386
$apt-get install libswt-gtk-3-java:i386
$apt-get install gnome-themes-standard:i386
Codewarrior looks for "libexpat.so.0", so we need to create a link for it.
$ln -s /lib/i386-linux-gnu/libexpat.so.1.6.0 /lib/i386-linux-gnu/libexpat.so.0
Run the installer as root and install the IDE into /opt/Freescale. After the installer is done, replace the contents of "/etc/udev/rules.d/25-pemicro.rules" with:
SUBSYSTEM!="usb", ACTION!="add", GOTO="kcontrol_rules_end"

ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="0035", GROUP="plugdev", MODE="0664"
ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="0042", GROUP="plugdev", MODE="0664"
ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="0058", GROUP="plugdev", MODE="0664"
ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="005E", GROUP="plugdev", MODE="0664"
ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="005F", GROUP="plugdev", MODE="0664"
ATTRS{idVendor}=="1357", ATTRS{idProduct}=="0001", GROUP="plugdev", MODE="0664"
ATTRS{idVendor}=="1357", ATTRS{idProduct}=="0503", GROUP="plugdev", MODE="0664"
ATTRS{idVendor}=="1357", ATTRS{idProduct}=="0504", GROUP="plugdev", MODE="0664"

LABEL="kcontrol_rules_end
The above rules are required to make your USB-multilink programmer work. Your 'user' should be part of the 'plugdev' group. Launch "/opt/Freescale/eclipse/cwide" and all should be well :)

References:
  1. http://mcuoneclipse.com/2012/03/06/mcu10-2-on-ubuntu-12-04-64bit/
  2. https://community.freescale.com/thread/311460

2013-08-10

"Poverty IS a state of mind"

Lately, Mr. Rahul Gandhi, the heir apparent, (apparently) stated: "Poverty is just a state of mind. It does not mean the scarcity of food, money or material things. If one possesses self-confidence, then one can overcome poverty". And, the whole of India (online/offline/in-the-restroom) blew up into a state of anger calling it a "mockery of the poor". But no one really thought about it twice. No one really did.

Yes, I am looking at this from my shoes. And, I think it fits the argument. If you take a casual stroll through the streets of Madras, you are bound to bump into atleast 10 beggars (taking an optimistic count). You can easily classify them into:
  1. Old people
  2. Differently abled people
  3. Children
  4. Homeless able bodied young people
The distribution of the "under poverty line" people in the above categorisation is (honestly) unknown. For the sake of argument, lets assume there is an equal distribution. That means, 25% of the "under poverty line" people are "homeless able bodied young people". Now, what do these people want/desire/expect in their lives? A car? A fridge? A house of their own? A fancy gadget? A fancy lifestyle? Top of the line fashion clothing? NO. They want three meals a day, clothing enough to clothe, a shelter enough to shelter.

A day of "construction labour" fetches 350 INR a day. And, Madras has enough construction happening, that you have a job for the next 10 years. Walk into the closest "Amma's mess" (government subsidised food joint) and you get three meals for less than 30 INR a day. Throw another 50 INR on public transport travel and such. And, another 20 INR for sundry expenses. You still save 250 INR a day. For 5 days a week, and 4 weeks a month, you get to 5000 INR a month as savings. Figure the rest.

Yes there are exceptions to the rule. But, how many are the exceptions? The exceptions are hardly 5% of that 25%. If that 25% were productive, imagine where the rest would be? YES, "poverty is a state of mind". One can sit there on their asses hoping for the world to save them, or move it and save their own. Its their choice. Its their state of mind. So please, for hells sake stop your dramatic emotionalism and move on. Period.

Edit 1: The "construction labour" is just one of the many examples. There are so many other such.

2013-02-17

Resolutions

It IS quite late in the year to take resolutions. But well, whats the fun in riding with the herd (like resolutions are any fun at all.. bah).
  1. Stop searching for an alternate to GNU Emacs to write C++ code. Inspite of the zillion times cc-mode fails with template code, it still does the job in a much lesser painful way.
  2. Stop trying to migrate to clang (for atleast the forseeable future (6 months?)) from g++. Deal with the complicated template errors. Just deal with it. Its fine. The c++11 sweet-spot is too good to lose.
Now, what was I drinking?