Bug 796471

Summary: fedora 15 box will not shutdown -r after systemd update
Product: [Fedora] Fedora Reporter: Patrick <patrick>
Component: systemdAssignee: systemd-maint
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 15CC: johannbg, metherid, mschmidt, notting, plautrba, systemd-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-23 12:50:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Patrick 2012-02-22 23:44:19 UTC
Description of problem:

sudo shutdown -r +5 fails.  The message saying the system is going down in 5 minutes goes to all of the consoles, but the system does not reboot.  

/var/log/messages gets this message:
Feb 22 03:00:10 s4 systemd-shutdownd[7522]: Received message without credentials. Ignoring.

This message comes from systemd's routine read_packet() which contains:

        if ((n = recvmsg(fd, &msghdr, MSG_DONTWAIT)) <= 0) {
                if (n >= 0) {
                        log_error("Short read");
                        return -EIO;
                }

                if (errno == EAGAIN || errno == EINTR)
                        return 0;

                log_error("recvmsg(): %m");
                return -errno;
        }

        if (msghdr.msg_controllen < CMSG_LEN(sizeof(struct ucred)) ||
            control.cmsghdr.cmsg_level != SOL_SOCKET ||
            control.cmsghdr.cmsg_type != SCM_CREDENTIALS ||
            control.cmsghdr.cmsg_len != CMSG_LEN(sizeof(struct ucred))) {
                log_warning("Received message without credentials.
Ignoring.");
                return 0;
        }

If a socket has the 

SO_PASSCRED

option on, then a control message is supposed to always be set from
which you can pull out the uid and gid.  That's controlled by the kernel
which also got updated at the same time.

Right after this they check to see if the uid is 0 and if not refuse to
shutdown.

Doing a strace of pid 1 while this goes on yields:

open("/sys/fs/cgroup/systemd/system/systemd-shutdownd.service/tasks", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/sys/fs/cgroup/systemd/system/systemd-shutdownd.service", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
sendmsg(14, {msg_name(0)=NULL, msg_iov(2)=[{"l\4\1\1&\0\0\0\1\0\0\0o\0\0\0\1\1o\0\37\0\0\0/org/fre"..., 128}, {"!\0\0\0/system/systemd-shutdownd.se"..., 38}], msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 166

which doesn't look too helpful.



Version-Release number of selected component (if applicable):


How reproducible:

shutdown -r +5


Steps to Reproduce:
1. type sudo shutdown -r +5
2.
3.
  
Actual results:
No reboot

Expected results:
reboot

Additional info:

This started with after a yum update that updated systemd and the kernel:

Feb 12 05:09:27 s3 yum[14291]: Updated: systemd-units-26-16.fc15.x86_64
Feb 12 05:09:28 s3 yum[14291]: Updated: libcurl-7.21.3-13.fc15.x86_64
Feb 12 05:09:29 s3 yum[14291]: Updated: curl-7.21.3-13.fc15.x86_64
Feb 12 05:09:29 s3 yum[14291]: Updated: rpm-libs-4.9.1.2-4.fc15.x86_64
Feb 12 05:09:30 s3 yum[14291]: Updated: rpm-4.9.1.2-4.fc15.x86_64
Feb 12 05:09:31 s3 yum[14291]: Updated: rpm-build-libs-4.9.1.2-4.fc15.x86_64
Feb 12 05:09:31 s3 yum[14291]: Updated: rpm-python-4.9.1.2-4.fc15.x86_64
Feb 12 05:09:32 s3 yum[14291]: Updated: kernel-headers-2.6.42.3-2.fc15.x86_64
Feb 12 05:09:40 s3 yum[14291]: Installed: kernel-2.6.42.3-2.fc15.x86_64
Feb 12 05:09:42 s3 dbus-daemon: [system] Reloaded configuration
Feb 12 05:09:42 s3 dbus-daemon: [system] Reloaded configuration
Feb 12 05:09:43 s3 systemd[1]: Reexecuting.
Feb 12 05:09:44 s3 systemd[1]: systemd 26 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +SYSVINIT +LIBCRYPTSETUP; fedora)
Feb 12 05:09:44 s3 yum[14291]: Updated: systemd-26-16.fc15.x86_64
Feb 12 05:09:45 s3 yum[14291]: Updated: systemd-sysv-26-16.fc15.x86_64
Feb 12 05:09:50 s3 systemd[1]: Reloading.
Feb 12 05:10:45 s3 dbus-daemon: [system] Activating service name='org.freedesktop.PackageKit' (using servicehelper)
Feb 12 05:10:45 s3 dbus-daemon: [system] Successfully activated service 'org.freedesktop.PackageKit'
Feb 12 09:20:30 s3 dbus-daemon: [system] Activating service name='org.freedesktop.PackageKit' (using servicehelper)
Feb 12 09:20:30 s3 dbus-daemon: [system] Successfully activated service 'org.freedesktop.PackageKit'
Feb 12 12:46:23 s3 dbus-daemon: [system] Activating service name='org.freedesktop.PackageKit' (using servicehelper)
Feb 12 12:46:24 s3 dbus-daemon: [system] Successfully activated service 'org.freedesktop.PackageKit'
Feb 13 01:52:49 s3 dbus-daemon: [system] Activating service name='org.freedesktop.PackageKit' (using servicehelper)
Feb 13 01:52:49 s3 dbus-daemon: [system] Successfully activated service 'org.freedesktop.PackageKit'
Feb 13 03:00:01 s3 systemd-shutdownd[2733]: Received message without credentials. Ignoring.
Feb 13 03:15:32 s3 systemd[1]: Reexecuting.
Feb 13 03:15:32 s3 systemd[1]: systemd 26 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +SYSVINIT +LIBCRYPTSETUP; fedora)

Comment 1 Michal Schmidt 2012-02-23 12:50:22 UTC
It will work after reboot. It's an unfortunate transitional problem caused by SO_PASSCRED not being set when systemd is updated to systemd-26-16.fc15 from a previous F15 build. It would be set if systemd-shutdown.socket were restarted.
I'm marking this as a duplicate of the same problem in F16.

*** This bug has been marked as a duplicate of bug 795593 ***

Comment 2 Patrick 2012-02-23 14:14:19 UTC
Michal Schmidt commented on bug 795593:

This should work:
systemctl stop systemd-shutdown.service
systemctl restart systemd-shutdown.socket

In my case, systemd-shutdown.service was not running, so only the second line was needed, but it fixed it.  Yay!!!  See that bug for more information.