systemd invalid argument - debugging delayed hibernation service file
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I'm trying to implement the delayed hibernation unit. I'm on arch/antergos.
>>> systemctl enable suspend-to-hibernate.service
Failed to enable unit ...to-hibernate.service: Invalid argument
systemd-analyze verify ...hibernate.service
responds with an empty output.
I copied the unit file straight from the arch wiki and changed SLEEPLENGTH to 1 hour. How can I debug the issue? How can I make systemd issue more descriptive error messages?
suspend-to-hibernate.service
[Unit]
Description=Delayed hibernation trigger
Documentation=https://bbs.archlinux.org/viewtopic.php?pid=1420279#p1420279
Documentation=https://wiki.archlinux.org/index.php/Power_management
Conflicts=hibernate.target hybrid-sleep.target
Before=sleep.target
StopWhenUnneeded=true
[Service]
Type=oneshot
RemainAfterExit=yes
Environment="WAKEALARM=/sys/class/rtc/rtc0/wakealarm"
Environment="SLEEPLENGTH=+1hour"
ExecStart=-/usr/bin/sh -c 'echo -n "alarm set for "; date +%%s -d$SLEEPLENGTH | tee $WAKEALARM'
ExecStop=-/usr/bin/sh -c '
alarm=$(cat $WAKEALARM);
now=$(date +%%s);
if [ -z "$alarm" ] || [ "$now" -ge "$alarm" ]; then
echo "hibernate triggered";
systemctl hibernate;
else
echo "normal wakeup";
fi;
echo 0 > $WAKEALARM;
'
[Install]
WantedBy=sleep.target
systemd systemd-unit
add a comment |Â
up vote
1
down vote
favorite
I'm trying to implement the delayed hibernation unit. I'm on arch/antergos.
>>> systemctl enable suspend-to-hibernate.service
Failed to enable unit ...to-hibernate.service: Invalid argument
systemd-analyze verify ...hibernate.service
responds with an empty output.
I copied the unit file straight from the arch wiki and changed SLEEPLENGTH to 1 hour. How can I debug the issue? How can I make systemd issue more descriptive error messages?
suspend-to-hibernate.service
[Unit]
Description=Delayed hibernation trigger
Documentation=https://bbs.archlinux.org/viewtopic.php?pid=1420279#p1420279
Documentation=https://wiki.archlinux.org/index.php/Power_management
Conflicts=hibernate.target hybrid-sleep.target
Before=sleep.target
StopWhenUnneeded=true
[Service]
Type=oneshot
RemainAfterExit=yes
Environment="WAKEALARM=/sys/class/rtc/rtc0/wakealarm"
Environment="SLEEPLENGTH=+1hour"
ExecStart=-/usr/bin/sh -c 'echo -n "alarm set for "; date +%%s -d$SLEEPLENGTH | tee $WAKEALARM'
ExecStop=-/usr/bin/sh -c '
alarm=$(cat $WAKEALARM);
now=$(date +%%s);
if [ -z "$alarm" ] || [ "$now" -ge "$alarm" ]; then
echo "hibernate triggered";
systemctl hibernate;
else
echo "normal wakeup";
fi;
echo 0 > $WAKEALARM;
'
[Install]
WantedBy=sleep.target
systemd systemd-unit
Where issuspend-to-hibernate.service
, and have you runsystemctl daemon-reload
after creating/modifying that file?
â muru
Apr 2 at 4:03
suspend-to-hibernate.service
sits in a sub-folder of my home folder, from where I also run the commands. I was never able to enable it, so I haven't runsystemctl daemon-reload
â pandita
Apr 2 at 5:35
1
As given in the Arch wiki page, the file should be in/etc/systemd/system/
, and you have todaemon-reload
before enabling it (daemon-reload
gets systemd to recheck its directories for new or modified units, and only after than can you enable a new a service).
â muru
Apr 2 at 5:38
Thanks heaps, this worked. If you sum this up in an answer I'll accept it. I got to say that I find the error message super confusing.... it made me think that there is a syntax error in the file or something like this...
â pandita
Apr 2 at 8:41
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm trying to implement the delayed hibernation unit. I'm on arch/antergos.
>>> systemctl enable suspend-to-hibernate.service
Failed to enable unit ...to-hibernate.service: Invalid argument
systemd-analyze verify ...hibernate.service
responds with an empty output.
I copied the unit file straight from the arch wiki and changed SLEEPLENGTH to 1 hour. How can I debug the issue? How can I make systemd issue more descriptive error messages?
suspend-to-hibernate.service
[Unit]
Description=Delayed hibernation trigger
Documentation=https://bbs.archlinux.org/viewtopic.php?pid=1420279#p1420279
Documentation=https://wiki.archlinux.org/index.php/Power_management
Conflicts=hibernate.target hybrid-sleep.target
Before=sleep.target
StopWhenUnneeded=true
[Service]
Type=oneshot
RemainAfterExit=yes
Environment="WAKEALARM=/sys/class/rtc/rtc0/wakealarm"
Environment="SLEEPLENGTH=+1hour"
ExecStart=-/usr/bin/sh -c 'echo -n "alarm set for "; date +%%s -d$SLEEPLENGTH | tee $WAKEALARM'
ExecStop=-/usr/bin/sh -c '
alarm=$(cat $WAKEALARM);
now=$(date +%%s);
if [ -z "$alarm" ] || [ "$now" -ge "$alarm" ]; then
echo "hibernate triggered";
systemctl hibernate;
else
echo "normal wakeup";
fi;
echo 0 > $WAKEALARM;
'
[Install]
WantedBy=sleep.target
systemd systemd-unit
I'm trying to implement the delayed hibernation unit. I'm on arch/antergos.
>>> systemctl enable suspend-to-hibernate.service
Failed to enable unit ...to-hibernate.service: Invalid argument
systemd-analyze verify ...hibernate.service
responds with an empty output.
I copied the unit file straight from the arch wiki and changed SLEEPLENGTH to 1 hour. How can I debug the issue? How can I make systemd issue more descriptive error messages?
suspend-to-hibernate.service
[Unit]
Description=Delayed hibernation trigger
Documentation=https://bbs.archlinux.org/viewtopic.php?pid=1420279#p1420279
Documentation=https://wiki.archlinux.org/index.php/Power_management
Conflicts=hibernate.target hybrid-sleep.target
Before=sleep.target
StopWhenUnneeded=true
[Service]
Type=oneshot
RemainAfterExit=yes
Environment="WAKEALARM=/sys/class/rtc/rtc0/wakealarm"
Environment="SLEEPLENGTH=+1hour"
ExecStart=-/usr/bin/sh -c 'echo -n "alarm set for "; date +%%s -d$SLEEPLENGTH | tee $WAKEALARM'
ExecStop=-/usr/bin/sh -c '
alarm=$(cat $WAKEALARM);
now=$(date +%%s);
if [ -z "$alarm" ] || [ "$now" -ge "$alarm" ]; then
echo "hibernate triggered";
systemctl hibernate;
else
echo "normal wakeup";
fi;
echo 0 > $WAKEALARM;
'
[Install]
WantedBy=sleep.target
systemd systemd-unit
edited Apr 2 at 1:51
asked Apr 2 at 1:39
pandita
219418
219418
Where issuspend-to-hibernate.service
, and have you runsystemctl daemon-reload
after creating/modifying that file?
â muru
Apr 2 at 4:03
suspend-to-hibernate.service
sits in a sub-folder of my home folder, from where I also run the commands. I was never able to enable it, so I haven't runsystemctl daemon-reload
â pandita
Apr 2 at 5:35
1
As given in the Arch wiki page, the file should be in/etc/systemd/system/
, and you have todaemon-reload
before enabling it (daemon-reload
gets systemd to recheck its directories for new or modified units, and only after than can you enable a new a service).
â muru
Apr 2 at 5:38
Thanks heaps, this worked. If you sum this up in an answer I'll accept it. I got to say that I find the error message super confusing.... it made me think that there is a syntax error in the file or something like this...
â pandita
Apr 2 at 8:41
add a comment |Â
Where issuspend-to-hibernate.service
, and have you runsystemctl daemon-reload
after creating/modifying that file?
â muru
Apr 2 at 4:03
suspend-to-hibernate.service
sits in a sub-folder of my home folder, from where I also run the commands. I was never able to enable it, so I haven't runsystemctl daemon-reload
â pandita
Apr 2 at 5:35
1
As given in the Arch wiki page, the file should be in/etc/systemd/system/
, and you have todaemon-reload
before enabling it (daemon-reload
gets systemd to recheck its directories for new or modified units, and only after than can you enable a new a service).
â muru
Apr 2 at 5:38
Thanks heaps, this worked. If you sum this up in an answer I'll accept it. I got to say that I find the error message super confusing.... it made me think that there is a syntax error in the file or something like this...
â pandita
Apr 2 at 8:41
Where is
suspend-to-hibernate.service
, and have you run systemctl daemon-reload
after creating/modifying that file?â muru
Apr 2 at 4:03
Where is
suspend-to-hibernate.service
, and have you run systemctl daemon-reload
after creating/modifying that file?â muru
Apr 2 at 4:03
suspend-to-hibernate.service
sits in a sub-folder of my home folder, from where I also run the commands. I was never able to enable it, so I haven't run systemctl daemon-reload
â pandita
Apr 2 at 5:35
suspend-to-hibernate.service
sits in a sub-folder of my home folder, from where I also run the commands. I was never able to enable it, so I haven't run systemctl daemon-reload
â pandita
Apr 2 at 5:35
1
1
As given in the Arch wiki page, the file should be in
/etc/systemd/system/
, and you have to daemon-reload
before enabling it (daemon-reload
gets systemd to recheck its directories for new or modified units, and only after than can you enable a new a service).â muru
Apr 2 at 5:38
As given in the Arch wiki page, the file should be in
/etc/systemd/system/
, and you have to daemon-reload
before enabling it (daemon-reload
gets systemd to recheck its directories for new or modified units, and only after than can you enable a new a service).â muru
Apr 2 at 5:38
Thanks heaps, this worked. If you sum this up in an answer I'll accept it. I got to say that I find the error message super confusing.... it made me think that there is a syntax error in the file or something like this...
â pandita
Apr 2 at 8:41
Thanks heaps, this worked. If you sum this up in an answer I'll accept it. I got to say that I find the error message super confusing.... it made me think that there is a syntax error in the file or something like this...
â pandita
Apr 2 at 8:41
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
As given in the Arch wiki page, the file should be in /etc/systemd/system/
. There are several directories where systemd looks for unit files, and /etc/systemd/system/
is where a system administrator should place their service files. See man systemd.unit
.
After creating or a modifying a file in these directories, you have to run systemctl daemon-reload
, which gets systemd to recheck its directories for new or modified units. Only then can you enable or start a new service.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
As given in the Arch wiki page, the file should be in /etc/systemd/system/
. There are several directories where systemd looks for unit files, and /etc/systemd/system/
is where a system administrator should place their service files. See man systemd.unit
.
After creating or a modifying a file in these directories, you have to run systemctl daemon-reload
, which gets systemd to recheck its directories for new or modified units. Only then can you enable or start a new service.
add a comment |Â
up vote
2
down vote
accepted
As given in the Arch wiki page, the file should be in /etc/systemd/system/
. There are several directories where systemd looks for unit files, and /etc/systemd/system/
is where a system administrator should place their service files. See man systemd.unit
.
After creating or a modifying a file in these directories, you have to run systemctl daemon-reload
, which gets systemd to recheck its directories for new or modified units. Only then can you enable or start a new service.
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
As given in the Arch wiki page, the file should be in /etc/systemd/system/
. There are several directories where systemd looks for unit files, and /etc/systemd/system/
is where a system administrator should place their service files. See man systemd.unit
.
After creating or a modifying a file in these directories, you have to run systemctl daemon-reload
, which gets systemd to recheck its directories for new or modified units. Only then can you enable or start a new service.
As given in the Arch wiki page, the file should be in /etc/systemd/system/
. There are several directories where systemd looks for unit files, and /etc/systemd/system/
is where a system administrator should place their service files. See man systemd.unit
.
After creating or a modifying a file in these directories, you have to run systemctl daemon-reload
, which gets systemd to recheck its directories for new or modified units. Only then can you enable or start a new service.
answered Apr 2 at 8:45
muru
33.3k576141
33.3k576141
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f434943%2fsystemd-invalid-argument-debugging-delayed-hibernation-service-file%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Where is
suspend-to-hibernate.service
, and have you runsystemctl daemon-reload
after creating/modifying that file?â muru
Apr 2 at 4:03
suspend-to-hibernate.service
sits in a sub-folder of my home folder, from where I also run the commands. I was never able to enable it, so I haven't runsystemctl daemon-reload
â pandita
Apr 2 at 5:35
1
As given in the Arch wiki page, the file should be in
/etc/systemd/system/
, and you have todaemon-reload
before enabling it (daemon-reload
gets systemd to recheck its directories for new or modified units, and only after than can you enable a new a service).â muru
Apr 2 at 5:38
Thanks heaps, this worked. If you sum this up in an answer I'll accept it. I got to say that I find the error message super confusing.... it made me think that there is a syntax error in the file or something like this...
â pandita
Apr 2 at 8:41