I bought my Framework 13 (AMD 7040) in December 2024. I’m using Ubuntu 24.04 at the moment. The Linux experience has been good but there are a few problems, one of which is the keyboard back-light. I’m able to adjust it using the usual shortcut fn + space, but it doesn’t persist. Every time I close the laptop lid (put it in stand-by) and open it again, the keyboard back-light goes back to its default setting, which is on, at its lowest brightness level. I just want to permanently turn it off. Does anyone else have the same problem? Can anyone help? Thank you!
I wouldn’t call it a problem but I observed the same. Linux Mint 22.2, so also Ubuntu 24.04. When I have a moment I’ll see if I can find out why this happens. Could maybe be fixed with a simple systemd service.
Quick little update: the service already is supposed to save and restore the settings for backlight, so it’s a bug. Gotta go hunting.
Yeah, so journalctl shows
Starting systemd-backlight@leds:chromeos::kbd_backlight.service
Finished systemd-backlight@leds:chromeos::kbd_backlight.service
but no log entry that shows a restored value. Nothing else touches the backlight.
So I think the hardware resets the backlight on resume and no service bothers to restore the saved value. I think this calls for a little systemd service, as I suspected. Anybody have a better solution, please chime in.
I will be back.
That was straightforward. I don’t know how comfortable you are with the console - if you need help I am sure the community will provide.
It turns out that systemd DOES save the backlight state, but only on shutdown and startup. Weird. So we’ll use the same location to make the backlight value persistent for sleep / resume.
The name of the file where I store the value may differ for you. Just do an ls of the directory.
Ok. We create 2 new services, one for saving.
- Create a file named ‘/etc/systemd/system/kbd-backlight-save.service’. (you need sudo for this, the file has to belong to root.
Change permissions to make it executable (sudo chmod 751 kbd-backlight-save.service) and put the following into it:
[Unit]
Description=Save keyboard backlight brightness to systemd state file before suspend
Before=sleep.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c ‘cat /sys/class/leds/chromeos::kbd_backlight/brightness > /var/lib/systemd/backlight/platform-cros-keyboard-leds.5.auto:leds:chromeos::kbd_backlight’
[Install]
WantedBy=sleep.target
- One for restoring. Do the same as in 1) but name the file ‘kbd-backlight-restore.service’. Put the following into that file:
[Unit]
Description=Restore keyboard backlight brightness after resume from systemd state file
After=suspend.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c ‘cat /var/lib/systemd/backlight/platform-cros-keyboard-leds.5.auto:leds:chromeos::kbd_backlight > /sys/class/leds/chromeos::kbd_backlight/brightness || true’
[Install]
WantedBy=suspend.target
execute
sudo systemctl daemon-reload
sudo systemctl enable kbd-backlight-save.service
sudo systemctl enable kbd-backlight-restore.service
That’s it. Works on my system.
If the above suggestion works for you, then you can ignore the following.
Take a look at keylightd.
Unfortunately, keylighted is not maintained and needs a minor patch to build it. I use keylightd so that I can have the keyboard backlight turn off after a delay and also turn off the power button led after the same delay. I believe you can set it up to persistently shut off the keyboard/power button backlight as well.
After applying the patch mentioned above, keylightd builds and functions fine for me with ubuntu 24.04.
I recall that there may be other keyboard backlight solutions for framework - perhaps better maintained. Try searching around if you would like more options.
OMG thank you so much. I didn’t know that the back-light status is saved between restarts. Upon learning that from you, I just turned off the back-light, turned my machine off and back on again, and now it remains off even after sleep/wake. It actually serves me fine now. I will try your fix at some point though. I wonder whether it’s just a Framework issue or actually a bug in Ubuntu 24.04 or Debian. I mean, I wonder if it’s worth raising it as a bug in their repos.
Anyway, thank you so much! You really didn’t have to.
You are very welcome. I learned something in the process.
It is absolutely a Ubuntu / Debian problem. There is nothing Framework can do apart from using their clout to push for a better implementation. Their hardware works as intended, or my solution would not work.
I am glad that I could rid your life of a tiny little annoyance!
(Probably should mark this as solved now)
Ehh… I think that’s only an option when a post is located in community-support. Could either move it there, or just put [solved] in the thread title.
How do you figure? I don’t believe any other distro (or upstream systemd for that matter) will restore backlight after suspend resume.
If the backlight is getting reset shouldn’t it be an EC problem? A really good data point would to be to read from sysfs the backlight value before suspend and after. Does it match? If it does match but the backlight is physically on after I would say it’s an EC bug. If it doesn’t match but at least matches physically then I believe we need to track down what is changing it. Is it the kernel driver? Or is it userspace somewhere?
I said it is a Ubuntu ‘problem’ because Ubuntu (or Debian) is configured to save and restore backlight setttings on boot / reboot. This works as intended.
Look at the service
/usr/lib/systemd/system/systemd-backlight@.service
and check out the man page for it.
The problem was that this is not done on suspend / resume, which would be more useful. Instead, resume reverts to the setting stored during the last shutdown.
My point is that doesn’t make it an Ubuntu or Debian problem. It’s a generic systemd unit. Neither Debian or Ubuntu change it.
I happen to have a Dell laptop in front of me that keeps the backlight status across a suspend/resume in Linux. That’s why I’m questioning if this is an EC problem.