You are not logged in.
[Unit]
Description=Disable wake up from usb devices
[Service]
Type=oneshot
ExecStart=/usr/bin/echo disabled > /sys/bus/pci/devices/0000:00:1a.0/power/wakeup ; /usr/bin/echo disabled > /sys/bus/pci/devices/0000:00:1d.0/power/wakeup
[Install]
WantedBy=multi-user.target
Last edited by fluxboxer (2018-02-22 16:10:14)
Offline
Some context would be nice. You should tell us what the symptoms are: how do you use it, what do you expect it to do, what does it actually do?
However, in this case, there is at least one obvious error: the ExecStart line is not parsed by a shell, so '>' is meaningless and ';' does not split commands.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Sorry about the brevity.
Well, I've been trying to disable waking the computer by keyboard and mouse as they're vulnerable to my cats' paws.
I can manually just do it by
sudo bash -c 'echo disabled > /sys/bus/pci/devices/0000:00:1a.0/power/wakeup && echo disabled > /sys/bus/pci/devices/0000:00:1d.0/power/wakeup'but it's not retained after a reboot. So I want to automate it. I've managed (very very easily) to do it by just this (f)crontab
@reboot echo disabled > /sys/bus/pci/devices/0000:00:1a.0/power/wakeup && echo disabled > /sys/bus/pci/devices/0000:00:1d.0/power/wakeupYet I prefer to do it with the default system resources of Arch (systemd), if possible.
My service doesn't work. When running manually by
/etc/systemd/system/buttonwakeup.serviceI get
bash: /etc/systemd/system/buttonwakeup.service: Permission deniedLast edited by fluxboxer (2018-02-22 14:35:16)
Offline
If that's the command you want to run, that's the command that should be in the ExecStart line:
ExecStart=/usr/bin/bash -c 'echo disabled > /sys/bus/pci/devices/0000:00:1a.0/power/wakeup && echo disabled > /sys/bus/pci/devices/0000:00:1d.0/power/wakeup'However there's likely a better way:
https://wiki.archlinux.org/index.php/Sy … rary_files
Last edited by Trilby (2018-02-22 14:39:20)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I've already tried your suggestion without success. Will look at your link now.
Offline
What does "without success" mean? What's in the journal? What is the status of the service? My first suggestion is ugly as hell (there is likely a much slimer sysctl command that would be better) but it should most definitely work if the service is started at the appropriate time.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
using tmpfiles on files in /sys has been an issue, it's a race condition since there's no dependency checks that the files exist before tmpfiles is run. You're better of with a udev rule for this.
Offline
@Trilby
The "status" has always reported "success" (erroneously). I'll re-enable the service, reboot and look into journal.
On the other hand, I feel it's foolish to fight with systemd, while there's a very easy solution with cron.
Offline
It's very possible you have the same race condition problem with the .service file that I mentioned with tmpfiles. Again, udev rule.
Offline
Thank you.
By the way, the journalctls:
Feb 21 04:01:53 evo systemd[1]: Starting Disable wake up from usb devices...
Feb 21 04:01:53 evo echo[338]: disabled > /sys/bus/pci/devices/0000:00:1a.0/power/wakeup && /usr/bin/echo disabled > /sys/bus/pci/devices/0000:00:1d.0/power/wakeup
Feb 21 04:01:53 evo systemd[1]: Started Disable wake up from usb devices.Offline
There's no way that's from the ExecStart that Trilby gave you.
Offline
No, it's from a previous trial; I'll retry bash -c.
Offline
Well, I'm embarrassed; it works. I'm (almost) sure that I've tried it before along with some other things. Sorry for the noise. Thank you.
Offline
It's not noise. And Scimmia is right - a udev rule would be much cleaner. Mine was an ugly hack primarily only to highlight why your initial attempt didn't work (because ExecStart lines are not parsed by a shell).
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thank you.
Offline