24 September, 2012

Linux and the Samsung Series 9 NP900X3C

So I bought a new laptop, a Samsung series 9: the 13" NP900X3C (review on the Verge). Quite a nice piece of hardware. It is thin, light and has very decent battery life. For all Linux users who decided to buy this really nice piece of hardware or are still deciding, you can find below tips and tricks on getting the most out of it.

Update 22 March 2014: I've finally gotten around to update this post, after finally fixing the last major annoyance after a hint by +Rui Seabra. With the tip below you can get this laptop to reliably recognize the power plug and the screen being closed. Yay!

Also, there is a new generation out (Ativ 9) which honestly does not impress me. It is heavier, has a insanely high resolution screen so its battery life is barely improved and the CPU is slightly slower though the GPU is more powerful. The touch screen makes it thicker. If Samsung would put a Intel Haswell in the NP900X3C chassis combined with 8 or 16GB of ram, they would have improved their top model. Now - it has its plusses and minusses. Too bad.

Last update, Dec 2014: X3C still humming fine here with latest Linux (openSUSE 13.2, KDE's Plasma 5.x). If you're in the market for this or a similar laptop, the X3C can now be had for as little as USD 800 if you look around a bit. And there is a worthy successor: the NP900X3G. This laptop is nearly the same, but features the newer Intel Haswell CPU bringing longer battery life, 8GB ram, 256GB SSD, Core i7 4500U and full-HD screen. Otherwise, same weight (1.13kg), great aluminum body and so on. Not cheap, as usual with the series 9 - USD 1450 is the cheapest I've found it for, but the X3C has shown to be worth every dime and I think this'll be worth it, too. Too bad Samsung is pulling out of this market as they've been the only one producing laptops at or above the quality levels of Apple's (Macbook Air) devices.

The Specs of the NP900x3c

You don't exactly select this laptop on performance for the money. But just looking at specifications leads to buying ugly, fragile, heavy pieces of plastic with 20 minutes battery life. This laptop is the opposite.
  • Intel Core i5-3317U CPU 1.7 ghz (turbo to 2.4), 3MB cache and 17watt TDP
  • Intel HD Graphics 4000, 3W stereo speakers and 1.3MP webcam
  • 13.3" 1600x900 PLS super bright (400nits) screen
  • 4GB of ram (soldered on board) and replacable 128 GB Sandisk SSD
  • WLAN (Inel 6235, 2x2 a/b/g/n) and Bluetooth 4.0. Lan with included dongle
  • SD/SDHC/SDXC/MMC cart reader, 1x USB 2 and 1x USB 3 (powered when off)
  • VGA and microHDMI (both need separately sold dongle)
  • 80 keys backlit keyboard and all-button multi-touch touchpad
  • 44 WH battery (rated for 9 hours but count on max 7)
  • Made of aluminum. Weight 2.55 lb or 1.16 KG.

About how it looks and feels: it is as nice as they say in every review. The design makes it (imho) the best looking ultrabook on the market and it feels super solid. The matte screen is the best I've ever seen (awesome looking angles & brightness) and it's perfectly silent due to the overkill of 2 fans (that are off most of the time anyway, surprisingly, even under load).


To save you some research, here a comparison to two laptops with similar specs:
  • Compared to the ASUS Zenbook Prime it feels more solid (I've touched both) and has less Q&A issues (according to online complainers). It also has a ~14% lower weight and better touchpad but slightly worse keyboard according to reviews. The keyboard of the S9 is fine for me - shallow but I have no issues with it. The touchpad is indeed excellent, noticeably better under Linux than under Windows however. Battery life is claimed to be better on the Samsung, too. You do of course pay about 300 bucks more for about the same specs as the Prime...
  • Compared to the Sony Vaio Z - I haven't touched that one but it's certainly less solid (it is made of "carbon fiber"--I've had a "carbon fiber" Vaio Z before and I'd just call it plastic) and has less battery life. Then again, the Z is what you want if you want no compromise in performance vs portability - as in, a Quad core cpu in a Ultrabook chassis. The Samsung has way less crunch power. Also, you can get the Vaio with 8 and possibly even 16GB of ram. So go Vaio if you don't move that often and are OK with a slightly more flimsy device and higher price and/or need the processing power.

The Linux support of the S9 is OK - not perfect, but OK. (Update March 2014: actually, near flawless, but not yet out-of-the-box in most Linux distributions) Getting the most out of it - see below! By the way, I strongly suggest to update the Bios to the latest version first before installing Linux.

Power usage

Let's start with power. As you probably bought this laptop for its portability (I know I did), let me give some info on battery life.

What to expect

I haven't done a full run-down test or anything and I usually use the battery life extender (max 80% charge power) but at the time of writing (sept 2012) the best you can get out of this laptop is about 6 hours of typing work with wifi/BT off, low screen brightness and battery life extender off. And that is provided you enabled silent performance mode, run laptop_mode and have enabled the power saving tips from the powertop tool (install it!!!). At that point, powertop reports 8-10 watt power usage. I have seen it go down as far as 6 but haven't figured out how to keep it there. As the laptop is supposed to do 7 hours under windows (and considering the 6 watt I've seen), there is surely room for improvement and I expect newer Linux versions/distributions to do better.

EDIT: after updating to kernel 3.6-RC6 (from here) I discovered power usage is down significantly. Varying between 6.2 and 7.2 watt, this might bring an additional hour of battery life to this laptop under Linux.

On more modest settings, you'll get more like 4 to max 5 hours - that's with wifi on, screen on a reasonable brightness and battery life extender on (so battery life -20%).

EDIT2: in 2014, you can really expect 5-6 hours, up to 7 if you're not taxing it much.

How to get longer battery life

As I said: install powertop. It can even tell you what's drawing how much energy (although this seems not too reliable). Powertop can enable a bunch of power saving options which must be configurable somewhere else too but I haven't figured that out for each. Start it, go to the right-most page and use the 'enter' key to enable them. They seem to stick mostly across reboots but not all of them do so use it whenever you need the battery life. Make sure especially to enable powersaving on the USB channels, one has the webcam which alone can draw 2-3 watts according to powertop.

Second, use the 'silent' performance_level. Set it by echo-ing 'silent' to '/sys/devices/platform/samsung/performance_level'. See more below. In my experience, the laptop is plenty responsive with the CPU speed capped at 800 mhz - as long as you do nothing too fancy.

Third - as you probably won't use it (much), disable the LAN port. Also uses quite some power according to powertop (although I doubt it's accuracy in this, it won't hurt). You can do this in the Bios of the system.

Fourth, enable power saving for the video card by going to Boot Loader in YaST, edit the boot loader options and add this after"Optional Command Line Kernel Parameter" (or editing grub(2) by hand if you're on a less easy distro):
    i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1
See phoronix for more info on these. I took out acpi_backlight=vendor as it consistently doesn't work for me.

While you're editing boot parameters, you might want to enable zswap (compressed swap). On a 4GB ram laptop, this is, well, helpful. Add zswap.enabled=1 if you want it. Note that it only works from Linux 3.11 onwards and probably only well from kernel 3.13 up.

Linux support: what works

So what works and doesn't? In short, putting in an USB stick and booting from it, then installing openSUSE - works like a charm. You might have difficulty having it boot from a stick - look in the BIOS. Disable "Fast BIOS Mode" under the "Advanced" tab and it should work. Re-enable it later for faster booting! Now, on to the specifics.


Works perfect, better under Linux than under Windows. See under 'tips' for some config ideas.


to ram: no problems. Very occasionally it hangs the mouse - use Fn-F5 twice to disable and re-enable the touchpad and you should be good. If it still doesn't work, I have had to disable Fast Booting in the BIOS to get it back. After that turning it on again was no problem. Tja, computers.
to disk: works but kernel mentions it's "Dazed and confused, but trying to continue". Apparently "NMI received for unknown reason 2c on CPU 0" and the kernel wonders if "you have a strange power saving mode enabled?". Suspend to disk is pointless anyway as this thing almost boots faster than it resumes from suspend to disk (with a bit of optimization using systemd-analyze, openSUSE goes in 8 sec from grub to desktop, a bit more work and you'll get to ~5sec and I think even less is doable if you really work at it).

wifi, bluetooth

Both work great, no problems. The Fn key to disable wifi doesn't work out of the box.

screen, sound, multimedia buttons

Volume and screen brightness buttons work fine, touchpad disable button works. Keyboard brightness buttons don't work, neither does the wlan button (light in button does turn on/off depending on state of wlan, however). See below on fixing that.

Webcam, microphone, sound

All worked flawless for me. Skype and Google Hangouts work without issues.

HDMI, VGA, Network

All flawless. I'd recommend to disable the network port to save power, however...

'special' stuff you have to configure

The laptop has a few interesting extra features. I'll go over them and how to use them.

Fn keys

Go to this Red Hat bugzilla page to get a number of changes to udev which will allow your function keys to work. Probably not gonna be a problem with any modern Linux distribution 2-3 months from now (sept 2012). A reboot is the best way to get things working after the changes.

EDIT 14 Oct 2012: note that on openSUSE and possibly other distributions you can find the udev rules in /lib/udev/keymaps instead of /usr/lib/udev/keymaps. Also, note that updates can overwrite your changes in the two control files and you might have to re-apply them every now and then.

EDIT 22 March 2014: note that on modern distro's this has moved to /usr/lib/udev/hwdb.d/60-keyboard.hwdb and requires a different fix. My distro (openSUSE 13.1) does not yet have the latest version of that file. You can get the latest here, just overwrite the file. Then execute as root: udevadm hwdb --update. Now reboot and the keys should work properly. By the end of the year I think this will be in most Linux distro's

Below I have a number of tips with scripts and such to get the keys to work. You'll need some scripts and set some permissions and then bind actions to the keys. In a Plasma Desktop, KHotkeys can take care of that for you. To make it easy I created a khotkeys file here which you can just import. Do this by:
      start systemsettings
      go to 'Shortcuts and gestures'
      click 'edit' and choose 'import' ('edit' is found in the middle bottom of the 'custom shortcuts')
      Pick the file you can download above.
      Modify the paths in the shortcuts, they're set on my home directory!

keyboard backlight

enable zswap (comapressed swap)
Check if the keys work out of the box. They might depending on the release of your distribution. If not, follow these tips.

The keyboard backlight can be adjusted by echo'ing a number between 0 (off) and 8 (max) to a special file like this (all on one line):
    echo 8 > /sys/devices/platform/samsung/leds/samsung::kbd_backlight/brightness
You need to be root to do that or use sudo. To ensure you can do this as normal user, add the following to /etc/rc.d/boot.local (on openSUSE) or another place that gets executed at boot on your distro:
    # make it possible to change brightness chmod 0664 /sys/devices/platform/samsung/leds/samsung::kbd_backlight/brightness chgrp users /sys/devices/platform/samsung/leds/samsung::kbd_backlight/brightness
(note that my blog might put things on a new line which shouldn't be. The chmod 0664 /sysblabla is one line, so is chgrp!)

Of course, you now want to assign the brightnes keys (Fn F9 and Fn F10) to these actions. The easiest way is to go to the KDE systemsettings and open 'Shortcuts and Gestures'. Then follow these steps (or import the khotkeys file I created instead):
      Create a new global shortcut (on the bottom: edit > new > global shortcut > command/URL) and call it 'backlight off'
      As trigger, assign the Fn-F9 key
      As Action, add this (all on one line):
        echo 0 > /sys/devices/platform/samsung/leds/samsung::kbd_backlight/brightness; kdialog --title 'keyboard backlight' --passivepopup 'off' 1
create a second global shortcut, call it backlight on, and give it this Action:
    echo 8 > /sys/devices/platform/samsung/leds/samsung::kbd_backlight/brightness; kdialog --title 'keyboard backlight' --passivepopup 'on' 1
    The keys should now work.

performance mode

The S9 has a nice feature in the 'performance mode' which does work under Linux but has to be triggered specially. I made a script you can bind to the ventilator key to make it work just like under windows.
There are two performance modes on the S9: 'silent' and 'normal'. Silent forces the CPU to 800 mhz max, keeping the fans always off and power usage down to about 8-9 watt), normal is - well, normal... I've seen the CPU go up to 2.4 ghz in 'normal' mode. For my use (text writing, browsing, email, occasional video or music), silent is perfect and I like the fact the laptop stays cold and quiet so I have that almost always on.

triggering it
You can change the performance mode by echo'ing 'normal' or 'silent' to /sys/devices/platform/samsung/performance_level. If you want to be able to do that as user, add the following to /etc/rc.d/boot.local to set the permissions open for the group 'users':
    # make it possible to change performance level chmod 0664 /sys/devices/platform/samsung/performance_level chgrp users /sys/devices/platform/samsung/performance_level echo silent > /sys/devices/platform/samsung/performance_level # set silent (800 mhz) performance as default

If you want the fan (Fn F11) button to take care of it for you, download the file here and follow the instructions in it.

Rf Kill

You can trigger turning off wifi and BT with files also in /sys/devices/platform/samsung under rfkill. The names of the files do change sometimes. Also for this I made a script, which you'll have to allow to be run at root. All instructions are in the file. Get it here.

Battery life extender

The laptop has a function called 'battery life extender'. It's a limit the bios puts on the battery on how full it can charge: no more than 80% if the battery life extender is on. This will increase the life expectancy of the battery significantly. You can enable and disable it in the bios but also from Linux and Windows. I have turned it on and rarely change it.

I didn't bother writing a script for this as I don't change this often: you can enable and disable the battery life extender by echoing either 1 (on) or 0 (off) to battery_live_extender in the already-familiar /sys/devices/platform/samsung folder. A quick command line to remember (you have to be root to do this):

    "echo 1 > /sys/devices/platform/samsung/battery_live_extender" to turn it on and "echo 0 > /sys/devices/platform/samsung/battery_live_extender" to turn it off

I use it when I expect to need my battery life to be maximal, like on intercontinental flights or when traveling to a conference. At home I almost never use the extra ~hour of battery life this gives.

Linux support: what doesn't work

The things which don't work ATM are:
  • recognizing if the system is on battery power or not. this is messy ATM. Usually, after a suspend cycle, it correctly shows the status. I'm guessing a kernel newer than the 3.5 I run now will solve this at some point, or maybe a new udev. It is annoying because it prevents laptop mode (battery saving mode) from automatically kicking in. In my use case it's not a big deal as it's usually charging in the house and when I take it somewhere it sleeps while traveling... Here is the bug on the kernel bugzilla
  • recognizing if the laptop lid is closed. Same story there - I guess a newer kernel version will solve it. For now, the system won't go to sleep or anything if you close the lid - you have to assign a key for sleep. I assigned the power key to sleep by going modifying the button events handling in System Settings -> Power Management. Not a BIG deal, I actually often close the lid while thinking (Yes, I do it, though infrequently) to save power...

And there now is a fix! I was made aware of it by +Rui Seabra, points for him. I am fairly certain the fix will make it into a kernel soon and to your distributions later, but for now you can put in a little work by hand and have it work too. Follow these steps:
  • Get this c file and compile it into a binary. Instructions are in the file, but to help you: gcc -o samsung_fix_ec_events samsung_fix_ec_events.c will do the trick. Yes, you need gcc. zypper in gcc will work on openSUSE. Thanks to Juan Manuel Cabo for creating this!
  • Now copy the resulting binary to /usr/local/bin/samsung_fix_ec_events
  • Download this file and copy it into /home/jospoortvliet/Dropbox/Public and make it executable: chmod +x /home/jospoortvliet/Dropbox/Public/samsung_fix_ec_events
Now, whenever you suspend or come back from suspend, the samsung_fix_ec_events file gets executed, cleaning up the bits that were blocking ACPI.

Tips to get the most out of the S9

A few minor tips to make things nicer on this laptop...


The laptop has a bunch of partitions and I could give all kind of tips about which to keep and all that - but I just cleaned everything up and installed Linux only so I have nothing to say.

Fast booting

If you'd like to make the laptop boot faster, install systemd-analyze, a tool which can show you what services delayed the bootup procedure most. It works best with the 'plot' function which generates a SVG of the bootup process:
    systemd-analyze plot > test.svg
Then view test.svg with a browser or so and see what seems to be blocking progress and try to fix it. In the pic in my blog (from my desktop, btw) it seems it takes a long time to go on line and the system waits with executing the login until it has connected. See this and this for some on how to do this.


Go through the options in Synaptiks or whatever your distro or desktop ships as touchpad tool - a must. First of all, make sure it switches off the touchpad on keyboard activity (I've set it to 0.75 seconds which works without annoying me but I think that this setting is VERY personal) and you should enable the horizontal and vertical scrolling with two fingers under Touchpad Configuration. I have also enabled "continue edge scrolling automatically", which feels very natural if you're trying to scroll quickly.

Under tapping, as Plasma Workspaces are single-click everywhere (by default...) I've enabled "make single taps faster and double taps slower". And I use one finger for left mouse, two for right and three for middle-click (can't live without middle-click-paste in Linux). But you can also use the corners. I don't like the automated dragging - sometimes I DO a double-tab to e.g. maximize a window and it often starts dragging. The dragging with this touchpad works very well, almost perfect: just click (until you get a audible and sensory CLICK) on the bottom-left of the touchpad, then move with your other finger. Works quite OK although it sometimes gets annoying when you drag and have to lift your finger to keep going - sometimes things snap back.

Filesystems and such on a SSD

There are lots of SSD tips and tricks on the net. Most of these are not needed these days as the Linux schedulers are just fine with SSD's and other settings are done with laptop-mode-tools or are standard in openSUSE 12.2. But for the curious: I use btrfs and I have the following options after "default," in my fstab "noatime,compress=lzo,ssd,discard".

Also, I would put /tmp on a tmpfs. Probably not needed on a 2014 distribution but not (yet) standard in older distro's. Do this by modifying /etc/fstab and adding the following line:
    tmpfs /tmp tmpfs defaults 0 0

That's it

If you've got a NP900X[Something], have fun with it and let me know if this was useful!