You are not logged in.
Hello!
I have an god awful Asus Zephyrus G14 'ThePain' Notebook with an additional 6800S dGPU.
The aim is to have the notebook running poer saving and making the hardware longlived, by not having the dGPU run all the time when it's not needed.
For doing so I have to use supergfxctl to switch the notebook to 'Hybrid' mode and then 'manually' disable the dPGU, because when using the 'Integrated' mode that's meant to run only using the iGPU, this trash notebook freezes all the time (Btw: It's a Linux problem, but finding a solution to this sadly is impossible for me)
So, for disabling the dGPU I use the follwing command:
'echo 1 > /sys/devices/platform/asus-nb-wmi/dgpu_disable'
For making it easier available and to also automatically applying this at boot, I created a systemd-unit file, as you can see here:
GNU nano 8.4 disabledGPU.service
[Unit]
Description=Disables dGPU when the service is enabled[Service]
ExecStart=echo 1 > /sys/devices/platform/asus-nb-wmi/dgpu_disable
ExecStop=echo 0 > /sys/devices/platform/asus-nb-wmi/dgpu_disable[Install]
WantedBy=multi-user.target
I enabled the service and manually started it. From systemctl status the services starts and rtuns the command without an error - but the content '/sys/devices/platform/asus-nb-wmi/dgpu_disable' does not change, no matter if I start or stop the service:
sudo systemctl status disabledGPU.service
Warning: The unit file, source configuration file or drop-ins of disabledGPU.service changed on disk. Run 'systemctl daemon-reload' to reload units.
○ disabledGPU.service - Disables dGPU when the service is enabled
Loaded: loaded (/etc/systemd/system/disabledGPU.service; enabled; preset: disabled)
Active: inactive (dead) since Sun 2025-06-01 14:06:27 CEST; 2min 43s ago
Duration: 29ms
Invocation: c9cf7f9d7045417db1eeb1932306a202
Process: 63145 ExecStart=echo 1 > /sys/devices/platform/asus-nb-wmi/dgpu_disable (code=exited, status=0/SUCCESS)
Process: 63146 ExecStop=echo 0 > /sys/devices/platform/asus-nb-wmi/dgpu_disable (code=exited, status=0/SUCCESS)
Main PID: 63145 (code=exited, status=0/SUCCESS)
Mem peak: 1.7M
CPU: 11msJun 01 14:06:26 work systemd[1]: Started Disables dGPU when the service is enabled.
Jun 01 14:06:26 work echo[63145]: 1 > /sys/devices/platform/asus-nb-wmi/dgpu_disable
Jun 01 14:06:26 work echo[63146]: 0 > /sys/devices/platform/asus-nb-wmi/dgpu_disable
Jun 01 14:06:27 work systemd[1]: disabledGPU.service: Deactivated successfully.
Can someone please tell me what's wrong here?`:)
Last edited by Elmario (2025-06-01 13:58:59)
Offline
'>' is a redirect interpreted by the shell. You don't have a shell here.
Offline
OK, I have the "echo part" working like this:
GNU nano 8.4 disabledGPU.service
[Unit]
Description=Disables dGPU when the service is enabled
[Service]
ExecStart=bash -c "echo 1 > /sys/devices/platform/asus-nb-wmi/dgpu_disable"
ExecStop=bash -c "echo 0 > /sys/devices/platform/asus-nb-wmi/dgpu_disable"
[Install]
WantedBy=multi-user.target
Thanks for your help.
Now there's another issue with the unit: It always executes both commands (ExecStart and ExecStop) at once, so the result always 0 . That's not how I thought it would be working ..
Last edited by Elmario (2025-06-01 13:51:04)
Offline
simplest would probably be to use bash -c 'command'. Then you can use all features of bash, including the redirect.'
The next thing you're going to run into, though, is that the command executes, finishes, and the service stops. You will need to sleep or something.
Last edited by Scimmia (2025-06-01 13:52:39)
Offline
Hello, sorry. I have the bad habit in editing my posts countless times - I just found the "bash -c" workaround, too, thank you!
Now the next issue is, that everytime I start the service, actually both commands are run: ExecStart and ExecStop. Shouldn't ExecStop just run when I stop the service?
Edit:
I found the solution to this:
[Unit]
Description=Disables dGPU when the service is enabled[Service]
Type=oneshot
ExecStart=bash -c "echo 1 > /sys/devices/platform/asus-nb-wmi/dgpu_disable"
RemainAfterExit=true
ExecStop=bash -c "echo 0 > /sys/devices/platform/asus-nb-wmi/dgpu_disable"
I also had to remove the target from the service-unit and create an additional timer instead, because otherwise the command would be executed too early in theboot process and in advance got overriden by something else:
GNU nano 8.4 /etc/systemd/system/disabledGPU.timer
[Timer]
OnBootSec=1min[Install]
WantedBy=graphical.target
Also it's needed to disable the service itself, but enable the timer.
Thank you very much!
Last edited by Elmario (2025-06-01 14:21:35)
Offline
And I edited in that while you were replying, too.
Offline
He he
Last edited by Elmario (2025-06-01 14:26:49)
Offline