May 26, 2019

Technical Note: Dell XPS 9370 dynamic brightness control

Recently while using Windows Pro 10, I notice that my XPS 9370 adapts its screen brightness according to contents displayed on it. When I view websites with bright color theme, XPS 9370 screen will display the website's content with its maximum brightness. However, when I view websites using dark color theme, my dell laptop screen will automatically lower its brightness accordingly.

This adaptation is good because lowering display brightness helps reduce power consumption, as well as make our eyes comfortable. However, my Dell laptop often reacts too much to minor changes of contents' brightness. A huge recognizable brightness often happens even when there are minor changes to color themes. The problem turns worse when brightness incurs latency. I switch between windows of multiple applications often enough to find the brightness adaption and its latency annoying. I decided to turn off this feature.

It turns out to be quite difficult to find a place to turn off this feature. At first, I thought it was a Windows feature, so naturally I went to Windows display settings to look for it. But to my surprises, there are no corresponding option to adjust / change "automatically brightness adaption". A quick look at power settings failed to find out corresponding option. Somebody on the internet suggests looking at Intel Graphics Settings. I checked it out but find nothing there. I desperately thought that it was a hardware defect and I cannot do anything with it.

Luckily, I was wrong this time. A google for "Dell XPS 9370 brightness" leaded me to Dell Support. Someone was annoyed like me and bothered to open a dell support ticket. It seems that dynamic brightness control is a feature and it can be turn off in BIOS settings. I immediately restarted my computer, [F2] to go to BIOS settings, went to Power, and disabled this feature. Annoying display brightness adaption disappeared.

It's intriguing to find out that this feature only manifests in Windows Pro. My dual boot Ubuntu 19.04 shows no problem. This proves that sometimes a lag in hardware supports of OS is good for end users :-)

May 14, 2019

Technical Memo: DynamicUser in systemd

Recently, I received a really interesting question from my customer. He found out in his file system two files (directories), which belong to an user that not in /etc/passwd. Specifically in Ubuntu Linux 18.04, these 2 files are

/var/lib/private/systemd
/var/lib/private/systemd/timesync

These two files belong to a user named systemd-timesync with UID/GID in 62583 and this user does not belong to /etc/passwd.

Traditionally, a Linux user does not always need to be in /etc/passwd because it can come from many remote sources, for example
  • LDAP
  • NIS / NIS+ server
  • Windows Domain Controller Server
  • ...
All current users, both from /etc/passwd and remote sources, can be queried by getent command [1]

$ getent passwd

Unfortunately, Our systemd-timesync user does not appear in getent list

A quick Google points to an article [2], written by systemd developer - Lennart Poettering, explaining about DynamicUser feature. It turns out that DynamicUser was introduced from systemd version 235. My client's environment is running Ubuntu 18.04 with systemd version 237, so his system supports DynamicUser feature.

DynamicUser feature tries to solve the problem of user scatters in Linux system. Modern Linux systems have multiple system users, whose usage is to run system processes, and a less number of human users. The point is some processes when being removed from the system does not remove its system users properly, leaving the system with floating users. Worse, files created by system processes is leaved with old users' UID/GID. The UID/GID user added after that have total control over these files, which lessen system securities. DynamicUser solves this issue by allowing process to define a system user that only exist during run time. When a process with DynamicUser ends, the dynamic user gets removed automatically. We can enable this feature by adding DynamicUser = True to your systemd's service files and systemd will setup everything for you.

In Ubuntu 18.04, systemd-timesyncd uses this feature so my client can see files with systemd-timesync user that does not belong to /etc/passwd. Unfortunately at the time of this post, this feature seems buggy so Ubuntu developers decided to turn it off in later release. In Ubuntu 19.04 (Disco Dingo) and later, systemd-timesyncd will not use DynamicUser. So we expect to see systemd-timesync user appears in /etc/passwd again.

References
  1. https://askubuntu.com/questions/504971/is-it-possible-for-users-not-to-be-in-passwd
  2. http://0pointer.net/blog/dynamic-users-with-systemd.html