Thursday, June 29, 2017

HP and Windows - A Jealous Affair

I bought my HP laptop 3.5 years ago. It came pre-installed with Windows 8. As a primary Linux user, I installed Ubuntu with a intention of dual-booting with using Ubuntu primarily. However, HP always showed only Windows in the bootup, and by default it goes into Windows - never letting me sign in. Boot-repair-disk helped me fix this issue. Nevertheless, every time Windows upgraded, it broke the fix, and made the computer go into Windows by default. I tried to stop Windows upgrade after fixing this several times using Boot-repair-disk, as I got fed up with this. However, Windows upgrade worked on its own for "critical system/security updates". I was unable to turn these off. Guess what? These automated updates broke my boot as usual, leaving Windows the only option. 

It was not even possible to change the boot to Ubuntu, or to bring the menu at start up. By that time, I got to know that this was a bug (or a feature?) from HP that Windows was hard-coded. I also did not have this issue in my other new laptop. Why I did not completely uninstall Windows? Sometimes I need it: printer, a few wifi configurations, and some docx, pptx files sent by others - these are the reasons behind my occasional usage of Windows. But every time I go to WIndows, it breaks my grub, leaving it as the only option to log in to.

By this time, Boot-repair-disk stopped working. However, I have an earlier version stored in my pen drive, which luckily works well. So I assume that a later "fix" in Boot-repair-disk broke it. Even efibootmgr did not work as expected. All I was able to do was to change the option for the next boot. Not forever! Eventually, I had to follow this work-around to get this running.

First, find your current status:
$ sudo efibootmgr
[sudo] password for pradeeban:
BootCurrent: 0002
Timeout: 0 seconds
BootOrder: 0003,3003,0000,0002,0004,2001,2002,2003
Boot0000* rEFInd Boot Manager
Boot0002* ubuntu
Boot0003* Windows Boot Manager
Boot0004* ubuntu
Boot0005* EFI USB Device (General UDisk)
Boot2001* USB Drive (UEFI)
Boot2002* Internal CD/DVD ROM Drive (UEFI)
Boot3000* Internal Hard Disk or Solid State Disk
Boot3001* Internal Hard Disk or Solid State Disk
Boot3003* Internal Hard Disk or Solid State Disk

Now, ideally you should be able to do the below:
$ sudo efibootmgr -o 0002,0004,3003,0000,2001,2002,0003
BootCurrent: 0002
Timeout: 0 seconds
BootOrder: 0002,0004,3003,0000,2001,2002,0003
Boot0000* rEFInd Boot Manager
Boot0002* ubuntu
Boot0003* Windows Boot Manager
Boot0004* ubuntu
Boot0005* EFI USB Device (General UDisk)
Boot2001* USB Drive (UEFI)
Boot2002* Internal CD/DVD ROM Drive (UEFI)
Boot3000* Internal Hard Disk or Solid State Disk
Boot3001* Internal Hard Disk or Solid State Disk
Boot3003* Internal Hard Disk or Solid State Disk

But, unfortunately, it was not working as expected. Rather, I had to follow a work-around of changing the boot order just for the next boot:
$ sudo efibootmgr -n 0002

Now add this below line to /etc/rc.local to repeat this same action every time Ubuntu loads:
sudo efibootmgr -n 0002

After this work-around, the grub loads successfully, and I can choose Ubuntu (among the many other options) easily as before. I did not log in to Windows after this fix. I am sure Windows will find a way to easily break this work-around once I log in to it.

Currently this work around makes sure that every time I log in to Ubuntu, Ubuntu sets the next boot to be Ubuntu/grub option. However, if I log in using the Windows entry in the grub, this bit won't be set. So the next time, it will log in to Windows directly, and thus breaking this cycle. However, when that happens, I just need to use Esc -> F9 sequence to just log in to Ubuntu once. After that, Ubuntu will be back as long as I keep using only it. In other words, Ubuntu boot will be fine as long as I do not log in to Windows.

You do not see Ubuntu upgrades breaking my Windows boot. Windows is such a jealous affair.

Saturday, June 3, 2017

When a search giant abandons your country

Google "sri lanka news"
I am not sure what is going wrong. Is my country, Sri Lanka, just cricket, or is it something wrong with Google? When the entire country is suffering due to floods and land slides leaving up to 1/20 of the country's population affected, Google search on "Sri Lanka news" just returns news on Sri Lanka cricket.

I am not sure whether this is done systematically through some hidden involvement. It annoys me a lot. Are we really addicted to Cricket that much? Seriously? We have bigger problems and more important news at the moment. How can I trust the Internet, when the most popular search engine returns irrelevant news?

Please note that I used the private mode. So my results are not affected by my past views. So you cannot give the excuse that my search results are based on my previous clicks. If I want to read about Sri Lanka in cricket, I would search for "sri lanka cricket" instead. When I search for news, I want real news. Not stories of a certain sports or gossips about actors. This is not a one-time event. I tested Google several times for Sri Lanka news over the past years. It always disappointed me with cricket news. News is something that affects the people. At least they are the news that should pop up as the top stories. Google fails Sri Lanka miserably here.

On the other hand, duckduckgo, a newer search engine performs better, returning more relevant real news on Sri Lanka for the same search. Probably we all should switch to duckduckgo as our search engine.
duckduckgo "sri lanka news"