How to set low power warning at 30%

Continuing the discussion from Power Manager for Zorin:

Hello @Aravisian , I would like to set up the low power warning at 30% instead of the default 10% of battery. The steps you describe here look good. Could you detail these steps for me who is a beginner at Linux command lines? I don’t even know how to open te UPower.conf file. I have the Core version of Zorin installed. Many thanks and best regards, Cedric

Cedric, I do not know about you, but when I moved from Windows to Linux, I rarely ever used the DOS Cmd Prompt on Windows. That thing was scary and I never really knew how to effectively manage it.
On Linux, however, using the terminal began to feel like the first time Luke Skywalker picked up his first Light Saber. It looks so simple and basic at a glance, but then you feel the furious power of it and the control back in your hands instead of leaving your fate to the Aether...

The beauty of it is that you have a GUI approach you can use or the terminal. It is true that the terminal is faster, easier, more controlled and better protected from making mistakes. But the GUI method is still good to use when starting out too, to help the brain familiarize itself with the hierarchy of the Linux System and to help visualize what you are doing. I will try to help, if I can, by integrating Both Methods in this reply.

First, let's start by opening the UPower.conf file and to do that, we need to know where it is. You can use the locate command in terminal to do this. In terminal, enter

locate UPower.conf

So simple- yet there is that power right at your finger tips. Try doing that on Winders. That is the "locate" command which is followed by the name of the file or directory you are looking for in terminal. In this case, it shows /etc/UPower/UPower.conf
Let's switch to GUI File Manager to take a look. If you are using Core- then you are probably using Gnome File Manger which used to be called "Nautlius". In terminal, that name remains the same. To open a GUI Application with Root Privileges, you need to use the pkexec qualifier first:
In terminal enter

pkexec nautilus

Enter your root password and a new instance of Nautilus with elevated privileges will open. In the left Sidebar, you should see a treeview with Starred - Home - Desktop - Documents.... At the bottom of the tree is "Other Locations" or "File System." Click on that and then you will see the option "Computer"
(At this point - I must interrupt myself. Nautilus is not always User Friendly and this is not how I would have made it. I use Nemo or Thunar File Manager on my machines and nautilus just sits in the background being lonely. On either of the other two file managers- I just hit the Up Arrow Key on the Toolbar to navigate Upward into Root. It helps visualize it better. Nautilus's method makes it look like Root is on a separate computer or partition or something. But all you are doing is moving upward along the path.)
Selecting "Computer" brings you to the directory "/" - This is the topmost part of your file path. Root.
Starting at /, if you want to follow the path to your Downloads folder, you would double click 'home', then the directory that is named your user name, then the directory named Downloads- You can see the structure of the path.
Starting at /, you can see bin, boot, cdrom, dev... etc...
The path above is /etc/UPower/ so double click the etc directory to open it. Now, type on your keyboard the letters u and p and the content view screen will change, showing all contents that start with up... The first being UPower. Double click to open. There is the file you want. You can double click this to open it in Gedit and modify the file and save as you would any file.
But let's switch back to the terminal to test out the Mightiness:
In terminal, enter your SuperUser DO command followed by your Terminal Text Editor application name (which is Nano. You can also use VIM if you prefer it). That is followed by the directory path to the file to open.

sudo nano /etc/UPower/UPower.conf

In the terminal, you should see a warning that only the system vendor should modify this file but remember that you are a rebel and do not take orders from the Imperial Guard.
Use the Arrow Keys on your keyboard to navigate. Hit Down arrow key to these lines that DO NOT have a #hashtag in front:
PercentageLow=10
PercentageCritical=3
PercentageAction=2
Use your right arrow key to move the cursor between the 1 and the 0 and backspace the 1 out of existence, then type a 3
PercentageLow=30
Down arrow once, the right arrow over to change the 3 into a 9 and then down arrown once and left arrow once to change the 2 into a 6.
hit control key plus x key to exit
ctrl+x
It will ask Save Modified Buffer?Type a y key ; It will then say File name to write and shows the Existing File Name so all you need to do is accept that by hitting the enter key once.
The terminal will revert to normal.
Now restart the UPower system using the superuser DO command with the SystemControl command:

sudo systemctl restart upower

Reboot and Test.
You can see how very fast and straightforward the Terminal Method is. It's a Powerful Little Puppy. You can see how to find files and modify them either by using a GUI method or using the terminal, allowing you to visualize and easily conceptualize the entire system.
So hopefully this will help you with all sorts of modifying in the future. ALWAYS check for Typos. Typos can really mess you up.

All that said... I Have No Idea if this will help you get an earlier warning or not. It should work, but I have never actually performed it on my own computer to verify it.
I guess you will find out if your battery dies without warning. :smiley:
But the steps you follow in taking control of your system will benefit you in all areas of using a Linux OS. Because you have yoU Power!
Heh heh heh... heh... ....
sigh...

1 Like

Many thanks! Very detailed, I like it! I was able to modify UPower.conf with the following but unfortunatley the battery warning did not pop up at 30%. Neither did it pop up at 10% unlike before my change. Edit: ignore what I wrote. It works perfectly now! Probably the system restart solved it.
PercentageLow=30
PercentageCritical=6
PercentageAction=4

Short side note: I used the Terminal method. GUI method did not work. error message:
`

> Unable to init server: Could not connect: Connection refused

`

(nautilus:3207): Gtk-WARNING **:
1 Like

Permissions issue. Were you Root?
IF you were, this makes me wonder whether Root had ownership.

I don’t know if I was Root. I followed your steps:
typed pkexec nautilus
then a window prompts to enter password. I enter my Zorin session password.
I get the error message

At least your immediate issue is resolved.
I am curious though- Is it repeatable?
What file manager do you use by default? Do you always get a connection refused error in terminal when you open a file manager with pkexec?

I don’t know what file manager I use. Never changed anything about that in the Zorin Core settings.
I tried pkexec firefox and get: Error: no DISPLAY environment variable specified
Don’t know if it helps
when typing pkexec nautilus I also get cannot open display:

In terminal, you may try

xhost +SI:localuser:root

Reboot, then test pkexec nautlius and see if you get either of those errors.

I just worry that not fixing this now may haunt you later...
You can also install the ability to Open as administrator on Right Click Menu:

sudo apt install nautilus-admin

Before I try, can you have a look at this. they have the same Unable to init server: Could not connect: Connection refused

and I understand xhost +SI:localuser:root works only until the next system reboot.

That thread has this link- which looks worth a shot:

I did not know this. Thanks for clearing that up.

Thanks, I’m going to dig into this tomorrow. Where does this bug come from in your opinion? If it does not concern everyone who installs the Zorin OS Core, then I suppose it is the combination of Zorin and my hardware that triggers it? Also, I see it’s not a Zorin specific problem so maybe the fix has to be done up-stream, because Zorin is forking from other Linux projects I guess. Just assuming
Edit: I wondered if the Flatseal application that I had installed was causing the trouble but after uninstall and reboot, still error with pkexec nautilus
Edit2: I don’t understand much of it but is there anything intereseting for me here maybe? https://askubuntu.com/questions/287845/how-to-configure-pkexec#332847
Edit3: I followed the link: it did not do a lot…

cedric@cedric-HP:~$ sudo rm /var/lib/apt/lists/lock
[sudo] password for cedric:         
cedric@cedric-HP:~$ sudo rm /var/lib/dpkg/lock
cedric@cedric-HP:~$ sudo rm /var/lib/dpkg/lock-frontend
cedric@cedric-HP:~$ sudo dpkg --configure -a
cedric@cedric-HP:~$ sudo apt clean
cedric@cedric-HP:~$ sudo apt update --fix-missing
Ign:1 http://repo.vivaldi.com/stable/deb stable InRelease
Hit:2 http://repo.vivaldi.com/stable/deb stable Release
Ign:3 https://repo.vivaldi.com/archive/deb stable InRelease
Hit:4 https://repo.vivaldi.com/archive/deb stable Release
Hit:7 http://fr.archive.ubuntu.com/ubuntu bionic InRelease
Hit:8 http://fr.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:9 http://fr.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:10 https://packages.zorinos.com/stable bionic InRelease
Hit:11 http://ppa.launchpad.net/zorinos/apps/ubuntu bionic InRelease           
Hit:12 http://ppa.launchpad.net/zorinos/drivers/ubuntu bionic InRelease        
Hit:13 http://ppa.launchpad.net/zorinos/patches/ubuntu bionic InRelease
Hit:14 http://ppa.launchpad.net/zorinos/stable/ubuntu bionic InRelease         
Hit:15 https://packages.zorinos.com/patches bionic InRelease              
Hit:16 https://packages.zorinos.com/apps bionic InRelease
Hit:17 https://packages.zorinos.com/drivers bionic InRelease
Get:18 http://security.ubuntu.com/ubuntu bionic-security InRelease [88,7 kB]
Fetched 88,7 kB in 10s (8 700 B/s)    
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
cedric@cedric-HP:~$ sudo apt install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
cedric@cedric-HP:~$ sudo dpkg --configure -a
cedric@cedric-HP:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
cedric@cedric-HP:~$ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
cedric@cedric-HP:~$ sudo reboot