Kartones Blog

Be the change you wanna see in this world

UEFI, NVMe and being stubborn

This weekend I wanted to install Linux on my new work laptop (a Dell XPS 13 9350, just in case someone else runs into similar issues). As in the past I had some issues with UEFI booting and Ubuntu (versions 12 & 14), the first thing I did was to go to the BIOS and proceed to unenforce secure boot and enable legacy boot (the classic BIOS), tried to install Unbutu 15.10 from a USBdrive... and it was broke trying to install GRUB after the install itself.

An initial research about the failure trying to setup the bootloader at /dev/nvme0p1 (instead of the classic /dev/sda1) taught me about NVM Express controllers (aka NVME). I thought that maybe updating gparted to 0.24 (which supports MVNE) would be solved. To do that I:

  1. Booted Ubuntu 15.10 from the USB
  2. Installed this package
  3. sudo apt-get install gparted
  4. Create the partitions from gparted and when installing just use them (wiping the data but not recreating anything)

It didn't worked out :( I could see the hard disk partitions but install would still fail at the bootloader (final) step.

Next I tried to just reinstall GRUB bootloader (using Boot-Repair), with some retries recompiling GRUB and even updating the partition Linux kernel to latest one to be sure... without luck. Bootloader was installed but couldn't boot the OS.

Two afternoons later I decided to do one last attempt before giving up: As the laptop's boot menu allows me to run the USBdrive Ubuntu install using UEFI (instead of "legacy boot"), I just tried running it to see what would do... And it worked!

If I had just RTFM about ubuntu UEFI support I would have seen that now it works and that Ubuntu 15.10 can somehow manage NVME partitions at install time (despite having an old version of gparted...). Anyway, I learned about some recent developments in "BIOS" and HDD firmwares so not all was wasted time & effort.

Also it is interesting to see how Intel seems to be leading in this evolutionary changes by presenting specifications and opening them to others so they become standards.

Note: A the time of this writing, everything works fine in the XPS 9350 model with the mentioned Ubuntu 15.10 except the wifi, which seems to be a "too new" Broadcom model and doesn't even gets detected, so I'm stuck for the time being with having to rely on an external USB wifi donge.

Does the term adultescent even make sense (regarding videogames)?

My grandfather spent a lot of hours every week playing cards while drinking beers at the bar downstairs of his home. Every time we went to visit my grandparents we would get him first.

My father spent hours every weekly watching movies and TV series from the sofa. I knew how to do the vulcan salute before knowing how to tie my shoelaces because he was always watching some Star Trek episode, and nobody could beat me at a movie names hangman (until early 2000s) because he was a film critic so we watched lots of movies together.

At the time of writing this post I'm 34 and I do still play videogames whenever I have time, usually some late nights or at weekends.

Did my grandfather was less adult for playing cards? No, because it was considered ok in the society.

Did my father was "still an adolescent" because of keeping watching TV & films past his mid-20s? Neither.

So why it feels strange to be an adult and "still play videogames"? What I think is that they are a relatively young and new entertainment compared with other forms of entertainment. If videogames were a century old instead of having appeared at the 70s, they would be so deeply integrated in our daily lives and culture they wouldn't be seen as for adolescents.

After all, I now see a lot of "adults" playing games on their phones every day, so why playing a videogame instead of for example watching a movie is different?

I focused on just videogames regarding "adultescents" because at other topics I do think is an appropiate term (or at least I'm not in a position to judge it). I just dislike how it's applied here.

Random rant because of this spanish article.

Fixing Windows Update service registration missing or corrupt

The other day I wanted to give some use to my old development laptop to watch movies at the living room (instead of using the gaming PC, now at another room). I opted for a fresh format and installing Windows 7, to either get the upgrade to Windows 10 or staying with a decent OS (I got really tired of Windows 8/8.1). But few things in life are easy, so after installing the OS, some drivers and running Windows Update once, it installed Windows 7 Service Pack 1... and after a reboot, the "check for updates" would never end (I left it ~4 hours the first time).

As usual, I searched for possible problems. Basic official Microsoft troubleshooting just pointed me to a tool, so I tried that Microsoft FixIt utility. It did nothing.

I kept refining searches until I found something more specific: Windows Update components might get stuck, corrupted, call-it-whatever-you-want. So I tried that Windows Update Diagnostic utility. First run said it fixed a few things except two of them.

Searching for one of the remaining issues I was told to download the System Update Readines Tool for Windows 7, a 550MB (!) pack of something that looked individual patches. No problem, download, run, wait, restart and running the WU diagnostic utility I got to just one reamining unfixed issue: "Service registration is missing or corrupt".

Now, hunting for how to fix the service registration I wasted probably more time than with everything else, as there is no official answer, lots of KB and Microsoft forums questions without official answers, and lots of procedures that seems to work sometimes. This is what I did to fix the issue:

  1. Run multiple times the diagnostic utility (not joking). Eventually it will fix the error.
  2. On an Administrator-elevated Command-Prompt, type:
  3. net stop wuauserv
    wuauclt /detectnow

  4. Leave the PC on and connected to internet for 1-2 hours until Windows Update catches up. It might look as if doing nothing, but if you check the task manager, I had one core at 100% use, and svchost.exe was eating +1GB running among others the "wuauserv" executable. It will gather all your installed updates, all available ones and start downloading them (at least a first pack of mandatory ones).

When it finishes, checking for updates again will yield almost 200 new Updates between mandatory and optional. You probably will need to restart multiple times as some of them are exclusive regarding sequential install, but with patiente you will be able to leave the PC fully up to date.

I know and understand operating system updates are not easy to deliver, but maybe instead of trying to sneak me Bing or Silverlight "updates", the effort could be put into improving the diagnostic tools (so they work properly and the first time) or at least in the KB providing an easily reachable official solution.

Now, I should decide if to try to force the Windows 10 upgrade or not, as I've had enough unexpected installs and updates for a while...

Setting up a Ubuntu VirtualBox Virtual Machine

I've been using for more than one year and a half an Ubuntu 12 VM for daily development. I know we now live in an era of Vagrants and containers, but I haven't had good experiences with the former, and having Windows host OS containers with Linux guests are not possible. Also, with a proper configuration & decent CPU, assigning one or two cores and a few GB of RAM to a VM makes for a wonderful development environment (which you can backup, rollback and duplicate easily).

So, I decided that might be interesting to write down my findings and some quick optimizations anybody can apply to get a faster guest Linux VM.

I have tested this VMs both with Windows hosts (Windows 8, 8.1 and 10) and Ubuntu 15, with a 4th gen i7 and a 5th gen i5 (both mobile CPUs), 8 GB of host RAM and SSD HDDs.

Basic configuration

  • Always use the latest VirtualBox version: For example 5.0 has speed improvements and USB 3.0 support, but in general it is nice to keep updating them as Linux kernels get new releases quickly and I wouldn't trust an old "Virtualbox Guest Additions" build.
  • Assign 1 or 2 CPUs to the VM: My rule is up to half the physical ones, but if you are going to "mono-task" a lot, maybe one is enough. For background processes, jobs and similar tasks 2 assigned processors work better.
  • There's no need to change the chipset setting. I found some posts telling people to change from PIIX3 to ICH9. Most are about old generations of CPUs and I noticed no increase in performance changing it so went back to the "safe and proven" setting.
  • 2 to 3 GB of RAM are usually more than enough: I run 2 Node.js apps, PostgreSQL, Ruby on Rails, Resque jobs, Sublime text, PGAdmin... all of them usually under 2GB of used RAM. Just keep an eye for swap usage, swapping is the devil.
  • Enable all the System tab options that you can: Nested paging, PAE/NX... all of them are good, and you can even try setting them on and if something breaks just turn them off again. Shared /bi-directional clipboard is great but I don't know why comes off by default.
  • Linux Acceleration is still crappy with VirtualBox: Forget about 3D acceleration, and if you prefer speed to fancy animations, disable also 2D acceleration and see more tweaks below. You will get pixelated zoom effects when switching applications but the OS performs faster overall. This also allows to setup 18 or 24MB of RAM without problems.
  • Check the "Solid-State Drive" option in the Storage section when the Host HDD is an SSD: This also should be an automatic check but... anyway do it because not only I/O will be faster you'll also increase the lifespan of your SSD drive.
  • Port forwarding is dead easy between VMs: I had to comunicate two VMs recently, and found that each VM can communicate with the outside just calling the default route ( by default) and a given port, and then forwarding that port to another VM's IP (e.g. calls which gets forwarded to
  • Shared folders are so great: Windows with Samba can read and write Linux folders, so don't be afraid to use them.

Ubuntu tweaks

  • Toolset for many of this tweaks: CompizConfig Settings Manager, Ubuntu Tweak, MyUnity. Depending on the Ubuntu version some might not be available.
  • Disabling fancy effects, fadings and animations, and for those animations you cannot remove, just set them as fast as possible. You can even fully disable VSync waits to squeeze some FPS if your hardware is not great.
  • If you have a good resolution setup, disabling font antialiasing also speeds up. And at the bare minimum you can disable it from the window titles.
  • Disabling background (just place a plain solid color) and sounds. I directly disable sound at the VM.
  • Missing a right click context menu "open in Terminal" option? Try this:

    sudo apt-get install nautilus-open-terminal
    nautilus -q

  • Remove all unwanted software: Upon install, Ubuntu each day feels more like Windows, full of OpenOffice applications, viewers, crappy games and other stuff you probably will never use. Do yourself a favor and spend 20 minutes checking all installed packages and removing the unused ones.
  • Ubuntu Tweak has a nice feature call "Janitor". It allows you to clean unused packages and dependencies and, most importantly, remove old kernel versions and old cached packages. Each time I use it I regain around 1GB of space and delete hundreds of files.
  • Linux filesystem uses a "journal" to write changes in a way there is no data loss. You can change it to be faster at the expense of less reilability in case of errors (I haven't had any issue yet):
    sudo tune2fs -O has_journal -o journal_data_writeback /dev/sda1
  • Another option I haven't yet explored is creating a RAMDisk, should be noticeably faster and as now we're going towards 16GB can be interesting if your VM does a lot of I/O.


  • Disable Super key/Win key: Quite annoying and a problem if both the Host and Guest OS are Linux as one steals the keypress from the other. Afterwards I for example have it mapped to switching the keyboard layout.
  • To remove undesired autoboot applications, you can check the boot list at /etc/xdg/autostart
  • Sometimes (for example disabling Bluetooth) the Unity control panel just "stops working". Ubuntu dependencies seem to uninstall it, but bringing it back is easy: sudo apt-get install unity-control-center
  • If with a Windows Host the Guest Linux runs extremely slow, this SuperUser.com instructions might help. In my specific case I was missing the proper Host Intel chipset drivers and VirtualBox was really slow.

Bonus: Security

  • Encrypting the Home folder: After install, as at setup time you can do it. Careful as it will eat twice the HDD space (it decryps the home folder upon login, creating a copy) and hurts I/O.
  • Or activating a /Private home encrypted subfolder: My favourite, way less taxing on I/O but with some symbolic links you can have a safe but comfortable folder structure.
  • And how to disable encryption, just in case you change your mind or wish to change from /Home folder to /Private subfolder one

Code and style checks for Ruby at Sublime Text

I use lately Sublime Text a lot, both at work and at home, where it's curious that even for languages that I have better tools available and installed (C#/ASP.NET, Powershell...) I usually use Sublime too instead (because is faster and I don't need to compile nor debug). Also, at work my colleages have activated Hound to get GitHub comment floodings coding style violations and, as you get one comment per broken rule, some pull requests become really hard to code review.

So, in order to prevent hound bites (and learn in a more confortable way what rules I should follow), I checked and fought a bit with Sublime plugins to setup the same rules that Hound uses for Ruby code (Rubocop gem) and have them inside my IDE. If you want to have realtime coding style checks inside Sublime 3, you need this:

Just take into account to leave the Rubocop rules file named as .rubocop.yml at the project's base folder, because SublimeLinter-Rubocop doesn't allows to specify another name/path. Also restart the IDE after installing everything.

It is fun that at 2005 we had nice aggregated CI reports that you could also concatenate and send via a single email (or check online at your CI server) but at 2015 receiving literally 50 emails after creating a pull request seems good by a continuous integration tool maker... ¯_(ツ)_/¯

Previous entries