Linux Laptop Experiment PT: 1

I recently purchased a razer blade stealth laptop as my dev machine after my macbook pro 2013 had finally given up the ghost and compiled its last program. The allure of a linux laptop and native docker/container access has long been tempting to make the switch but for one reason or another it always seemed to be plagued with hurdles. The allure of the macbook and macos has always been that at the end of the day simple things like hibernate or suspending when the lid is closed "just work".

I would say that the series of hurdles to being productive on a linux laptop in 2019 are still present but I think this was the year they started becoming alot more minor.

Currently the razer blade stealth (late 2019) is on sale for black friday for 1,200.00 USD, normally I have shied away from razer computers but the 2019 razer blade stealth seems to be a turning point in their design philosophy and overall is a much more mature machine than the previous generations.

Important to note is that I avoided any of the configurations with the dedicated GPU, for me a 13" notebook should be "fast enough" and have good battery life, something that just is not possible once you add a GPU into the mix. This model does come with the new Intel Iris+ graphics chip which has so far impressed me with its performance.

The first thing I did was replace the SSD with a 1TB samsung 970 pro m.2 drive which if you have a torque screw driver on hand is a peice of cake and took around 12 minutes. I believe the HD and RAM in this unit are both up-gradable which is nice. So far the 16gb of ram included with the machine has proved snappy enough for me. With the new beefy drive installed I setup my dual boot system with,

  1. Windows 10 Pro
  2. Ubuntu 19.10 (I am probably going to regret not going with an LTS release in the long run but I wanted a newer revision of the linux kernal for some issue's I ran into later related to sleep/hibernate)

I ended up choosing ubuntu for its driver support but fedora 31 was a really close second and I think would have won out had I not had a strange issue with the laptop not going fully into sleep mode that I did not experience with Ubuntu 19.10 I may go back and investigate at a later time what I can do to fix this issue as closing my laptop to hop into a meeting or two only to re-open the lid to a mostly drained battery ceased being fun after the first handful of times.

Biggest Initial Issues

  1. suspend loop when the lid is closed
  2. wifi does not connect to some networks
  3. battery life is pretty awful

Suspend Loop

Suspend loop was a bit annoying to pin down but I now have it fixed https://github.com/rolandguelle/razer-blade-stealth-linux/blob/master/ubuntu-19-04.md this github repo had some pretty good solutions for various issues but not all of them apply to 19.10 for various reasons the main one here was the solid fix for the suspend loop, it appears that when the lid is open the proper signals are not sent to wake the computer up.

sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="button.lid_init_state=open" 

and then run
sudo update-grub

An odd note I had alot of weird issues when I made a 19.10 bootable drive with rufus initially I switched to the Etcher media writer and had far less issues I will be honest and say I dont fully understand why that would be mechanically.

next up was the wifi issues this one is a bit of a weird one but luckily the fix was pretty straight forward.

Wifi Issues

echo "options iwlwifi 11n_disable=1" | sudo tee /etc/modprobe.d/iwlwifi.conf

and then reboot your machine and it will work fine, why you have to do this has to do with the initial settings for the intel wireless drivers in ubuntu having a narrow range of settings and bands. There is probably a reason for this but ive yet to find any official statement as to why it was disabled and its working great after the switch.

Getting the most out of your battery life

there are pretty much 3 solutions for battery life improvements on linux

  1. powertop
  2. tlp
  3. cpufreq
Powertop

On the razer blade stealth the powertop auto tune would cause my laptop to suspend but never resume or have the monitor turn off but not truely sleep so I would later come back to a dead laptop despite not using it this was probably an issue with the default settings and my lack of expertise with the tool I will say its definetly work installing but not using its tune settings atleast for this machine

sudo apt install powertop

TLP

tlp on the otherhand gave me and immediate boost to battery life going from about 5 hours on a clean install to about 7:30 when coding/browsing the web and listing to music which is not going to set the world on fire but was solid enough for me.

sudo apt install tlp tlp-rwd -y
sudo tlp start

Another small powersave/performance slider that worked pretty well for me
sudo apt install indicator-cpufreq -y

CPUFREQ

https://extensions.gnome.org/extension/1082/cpufreq/

CPU freq is the 800 lb gorrilla of power management tools and is not super intuitive to use but it can let you do some really cool stuff for power saving measure's such as scaling down the number of cores in use when on battery and turning of frequency boosting allowing me to get close to 9 hours battery life browsing the web in my testing however the experience was pretty abysmal and slow. I am going to play around with this one some more and see if i can get a profile that extends battery life but is more enjoyable and usable.

Conclusion

So that about wraps up the things I needed to do to get the laptop working as it should out of the box.

In a few months ill do a pt 2 where I go into the apps i prefer and revisit the battery life issue as well as give a deciding rating to whether such a setup would keep me from going back to a macbook pro as a programmer.

I have to say that so far im impressed, the last 3 years have seen a pretty massive leap for linux and it maturing into a decent desktop enviroment, there are rough area's such as trying to find a decent calendar app that syncs with gmail calendars or various codec issues for DRM'd video services.