Librem 14 Failed to charge SOLVED

My Librem 14 was failing to charge with PureOS. I switched out the power cord that goes into the provided transformer with a spare Australian cord I had laying around. The transformer says it supports 50Hz and 240v supply so that shouldn’t be a problem.

The solution was;
sudo apt install librem-ec-acpi-dkms
cat /sys/class/power_supply/BAT0/charge_control_start_threshold
outputs 0. This is the problem as the laptop will only start charging when it is completely dead.
echo 90 | sudo tee /sys/class/power_supply/BAT0/charge_control_start_threshold
90 can be any value between 0 and 100. Your laptop should start to charge!

Edit: if cat does not output a number or you get an error (no such file or directory, or permission denied) check the directory and file exists. If not, update CoreBoot.

All the battery settings are found in /sys/class/power_supply/BAT0/

p.s. There’s chat on L14-battery-constant-discharge-charge-in-qubes and I didn’t want to derail the conversation.
p.p.s. Got to love everything on Linux is a file.

Edit: changed nano to tee as its a nice solution.


Once you install librem-ec-acpi-dkms you may need to reboot your laptop.

If you don’t have charge_control_start_threshold or charge_control_end_threshold in the /sys/class/power_supply/BAT0 directory, you need to update CoreBoot.


As my advisor in college once said about certain math proofs, “The best form of elegance is simplicity.”


Thank you again for all your help @dean my laptop is charging at 100% now.

1 Like

Hey i’m still having issues with the charging every time I try to update the file i get this error.

Error writing lock file /sys/class/power_supply/BAT0/.charge_control_start_threshold.swp: Permission denied

Ive even tried to run it as Root. I’m a complete linux novice so im most likely doing something wrong. Do you or anyone else have any tips?

I got the same thing, I will PM you

Did you use the terminal to edit it? It’s root-level, so it has to be prefaced with sudo (i.e. “superuser do”).

sudo nano followed by the file path /sys/class/…and so on.

sudo raises the privilege, nano is the name of the text editor (unless you have a different text editor installed, in which case you use the name of that one instead).

1 Like

What is your firmware version?
I am on 17.1 PureBoot and on Qubes and I can not see /sys/class/…/charge_control_start_threshold.
I also cannot see it on PureOS-10 live version.
Nicoles solution is actually a driver and not a firmware update. That is why I wonder that updating the firmware helped.
On my PureOS harddrive install I also had to install Nicoles Driver before I could get the files.

1 Like

First of all the dot before charge_control_… must be left out.
Second you will probably have to do sudo chmod 666 on the file and then sudo vi the file.

1 Like

That’s the vim antifeature - the .swp file in the same directory in which is the file being edited. Not all directories are writable, but files in them might. And this is the case with /sys filesystem.

Try updating the file this way, as root:
echo 90 > /sys/class/power_supply/BAT0/charge_control_start_threshold

(or any other number then 90, to your liking).

@Dwaff I tried that technique (echo >) with sudo but it wouldn’t work. That’s why I wrote it using nano.

sudo su then echo 90 >sys/... would work.
sudo echo 90 >sys/... is not working, because first shell tries to open /sys/… (as regular user) and only then would execute the sudo. Since regular users can’t write to files in /sys, the shell get’s permission denied error, and does not even try to execute the sudo.

Any output redirections (the bits with a > sign) are not part of the command, but instruction for the shell, where output should go. So unless the shell itself runs as root, output redirections will not be able to write to restricted locations where only root can write.

sudo nano is admittedly simpler than sudo su; echo; exit (one command vs three).

1 Like

Users could also do ‘sudo bash -c “echo 90 > /sys/…”’


Or, a bit more elegantly, echo 90 | sudo tee /sys/class/...


Seems everyone has fixes this, so just wanted to share instructions I received from Purism Support…

please install the librem-ec-acpi-dkms package:

sudo apt install librem-ec-acpi-dkms

Then restart and check what the charging thresholds values with the following commands:

cat /sys/class/power_supply/BAT0/charge_control_start_threshold

cat /sys/class/power_supply/BAT0/charge_control_end_threshold

If the value for /sys/class/power_supply/BAT0/charge_control_end_threshold is 0

Then run:

echo ‘40’ | sudo tee -a /sys/class/power_supply/BAT0/charge_control_start_threshold

echo ‘95’ | sudo tee -a /sys/class/power_supply/BAT0/charge_control_end_threshold

All seems to be working fine for me now. I will be curious if he next software update overwrites any of these changes. I’m new to all this, so not sure how it is handled.


Also I have noticed that first you have to update charge_control_end_threshold i.e. 95 only then you will be able to set charge_control_start_threshold 90.

1 Like

Hi Dean, I updated the coreboot and when I went to update threshold, I got permission denied in the terminal.

FYI - Newbie to linux.

Hi Dean, I don’t have the threshold files in my file directory to change. I updated my PureBoot, but when I tried to update Coreboot I got a warning saying that I would lose all of my Pureboot settings. If I choose to update Coreboot, does this mean I lose the functionality of the Librem Key, or can I still be using PureBoot after that? Updating only PureBoot has not given me the missing file.

Make sure you follow the sudo tee ... hackery in the post above by @Bass20 : Librem 14 Failed to charge SOLVED

I’m on Linux Mint 20.1 Cinnamon, I’m attempting to run sudo apt install librem-ec-acpi-dkms but I’m getting Unable to locate package librem-ec-acpi-dkms. Can someone point me to where I can add the librem-ec-acpi-dkms repository to my machine to be able to download it?

1 Like