Permission denined while moving a file to /usr/lib/systemd/system

I’ve been trying to install supergfx on my Laptop to try fix my awful battery life and I was following Files · main · asus-linux / supergfxctl · GitLab to install it.

When I tried to run “sudo systemctl enable supergfxd.service --now” it said “Failed to enable unit: Unit file supergfxd.service does not exist.” so I downloaded the supergfxd.service file seperately and tried to move it to /usr/lib/systemd/system but I was prompted with “Error opening file “/usr/lib/systemd/system/supergfxd.service”: Permission denied”.

Anyone got a way to bypass this issue so I can my install? Help would be much appreciated.

Normally you will put your local changes into /etc/systemd/system not /usr/…
But in both cases root will own the files. Is it simple as you need to use sudo or be root?

I think it goes as far as just needing sudo or be in root to move this file so I can carry on installing supergfx. Is there a terminal command that would enable me to do this?

Simply add ‘sudo’ before the mv or cp command in the terminal. That is the way the system is designed and the intended use of sudo. The file manager does not have that capability.

1 Like

I’m trying to learn the cd commands right now but I’m kinda stuck. I’ve made my way to the directory I want to move the file to but got no idea where to go from there:

[boni@fedora ~]$ sudo su
[sudo] password for boni:
[root@fedora boni]# cd /root/
[root@fedora ~]# cd /usr/lib/systemd/system
[root@fedora system]# pwd
[root@fedora system]#

In workshops using specialized linux software, many students ran into similar difficulties. In the workshops, we started spending the first two afternoons in a 2-week program introducing use of the linux command line with Linux Command. Another good introduction is Apple Command Line Primer:

Shell scripts are a fundamental part of the OS X programming environment. As a ubiquitous feature of UNIX and UNIX-like operating systems, they represent a way of writing certain types of command-line tools in a way that works on a fairly broad spectrum of computing platforms.

All linux distributions share a common core of command-line tools, so you may prefer documents available from other distributions in languages other than English. There are a few excellent on-line tutorials, but also many with dangerous omissions and mistakes.

I was able to transfer the file after some hard thinking but I’m still stuck with the same issue of running “sudo systemctl enable supergfxd.service --now” and getting “Failed to enable unit: Unit file supergfxd.service does not exist.”.

I think I just got a whole separate issue on my hands, maybe supergfxt is only for asus laptops while I have a HP Envy 13. I’m just trying to get the ability to switch my dGPU on or off to improve battery life.

HP Community discussion of Envy poor battery life may help.

After transferring the file, run:

sudo systemctl daemon-reload

I use this to get a root prompt from sudo:

$ sudo -i