Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
systemctl poweroff failure
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
potuz
Guru
Guru


Joined: 30 Jan 2010
Posts: 378

PostPosted: Sun Jan 13, 2019 2:57 pm    Post subject: systemctl poweroff failure Reply with quote

Code:

# systemctl poweroff
Failed to power off system via logind: Unit systemd-poweroff.service has a bad unit file setting.
Failed to start poweroff.target: Unit systemd-poweroff.service has a bad unit file setting.
See system logs and 'systemctl status poweroff.target' for details.


Code:

#journalctl -r
systemd[1]: systemd-poweroff.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.


Adding
Code:

[Service]
ExecStart=/usr/bin/sleep 0


Solves the issue, but how did I get to have this issue to begin with?
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Sun Jan 13, 2019 3:53 pm    Post subject: Reply with quote

Quote:
Adding
Code:
[Service]
ExecStart=/usr/bin/sleep 0


To which file did you add that? To '/lib/systemd/system/systemd-poweroff.service'?

On my machine, '/lib/systemd/system/systemd-poweroff.service' was installed by sys-apps/systemd-239-r3. Below is the contents of the file:
Code:
#  SPDX-License-Identifier: LGPL-2.1+
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Power-Off
Documentation=man:systemd-halt.service(8)
DefaultDependencies=no
Requires=shutdown.target umount.target final.target
After=shutdown.target umount.target final.target

[Service]
Type=oneshot
ExecStart=/bin/systemctl --force poweroff
Back to top
View user's profile Send private message
potuz
Guru
Guru


Joined: 30 Jan 2010
Posts: 378

PostPosted: Sun Jan 13, 2019 4:31 pm    Post subject: Reply with quote

Interesting, my service unit file lacked the [Service] section. It was installed by systemd. Can't recall the version of the last update and I'm far from that box. But my laptop running systemd-239-r2 does have the same service file as yours. I am certain I did not change that file.
Back to top
View user's profile Send private message
potuz
Guru
Guru


Joined: 30 Jan 2010
Posts: 378

PostPosted: Mon Jan 14, 2019 12:21 pm    Post subject: Reply with quote

Just checked my desktop, it's systemd-240-r3. And the unit file is does not include the [Service] section

Code:

$ tar -x -f /usr/portage/distfiles/systemd-240.tar.gz systemd-240/units/systemd-poweroff.service
$ $ cat systemd-240/units/systemd-poweroff.service
#  SPDX-License-Identifier: LGPL-2.1+
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Power-Off
Documentation=man:systemd-halt.service(8)
DefaultDependencies=no
Requires=shutdown.target umount.target final.target
After=shutdown.target umount.target final.target
SuccessAction=poweroff-force


Haven't checked if systemd-240-patches-2.tar.gz include patches for this nor have I gone to figure out if this is a bug upstream or in the Gentoo distribution.

Opened https://bugs.gentoo.org/show_bug.cgi?id=675394
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Tue Jan 15, 2019 3:18 am    Post subject: Reply with quote

Here is the commit which removed the Service section. It doesn't look like a bug.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum