Need help debugging shutdown issues

Nikolaus Rath Nikolaus at rath.org
Thu Nov 6 06:39:50 GMT 2014


Nikolaus Rath <Nikolaus-BTH8mxji4b0 at public.gmane.org> writes:
> On 11/05/2014 02:51 AM, Michael Biebl wrote:
>> Am 05.11.2014 um 03:35 schrieb Nikolaus Rath:
>>> Hello,
>>>
>>> I'm using testing with systemd as pid 1, and my system does not shut
>>> down (or reboot) properly.
>>>
>>> That's a lot better than not booting properly, but I'd nevertheless like
>>> to fix it :-).
>>>
>>> I tried following the instructions at
>>> http://freedesktop.org/wiki/Software/systemd/Debugging/#index2h1 and
>>> found that
>>>
>>> sync && reboot -f
>>> sync && poweroff -f
>>>
>>> work just fine. When rebooting or powering off with systemctl, however,
>>> the system is still active after 10 minutes of waiting.
>>>
>>>
>>> I then proceeded to add
>>>
>>> systemd.log_level=debug systemd.log_target=kmsg log_buf_len=1M
>>> enforcing=0
>>>
>>> to the kernel command line and created the
>>> /usr/lib/systemd/system-shutdown/debug.sh file. I noticed that the
>>> system-shutdown directory did not exist - does that mean this method is
>>> not applicable in Debian?
>>>
>>> In any case, I did not get the /shutdown-log.txt file after trying to
>>> shutdown, so I activated the debug shell instead.
>>>
>>> On the debug shell, I ran
>>>
>>> systemctl reboot &
>>> sleep 120
>>> dmesg > dmesg.txt
>>> systemctl status > systemctl-status.txt
>>> systemctl list-units > systemctl-units.txt
>>> systemctl list-jobs > systemctl-jobs.txt
>>>
>>> This gave me a huge amount of information (included below), but I don't
>>> really know what to do with it. For example, is it a problem if
>>> samba.service has status "stop running"? Or is the problem with
>> 
>> This is most likely a samba bug and a duplicate of [1].
>> I assume, you're not running samba 2:4.1.13+dfsg-2, which is supposed to
>> fix that issue.
>> Could you upgrade to that version and test again?
>
> I'm at 2:4.1.13+dfsg-2 now, problem is still the same unfortunately.


Ok, this probably sounds weird, but I confirmed it several times:

- when I run "systemctl reboot/poweroff" on a console, it works
- when I run "systemctl reboot/poweroff" on an X11 terminal, it
  hangs

Additionally, when running "systemctl reboot" from X11 the system
becomes unusable after a fraction of a second - the screen goes blank
and I can't switch to a text console anymore either. I have tried to
issue the command and then quickly switch, but this did not work either.

When I'm running "systemctl reboot" from a console, the system stays
usable. I can see the status messages, switch to other consoles and use
the debug shell. But this doesn't help much, because the system shuts
down just fine.


I have tried to start the following script in the debug shell *prior* to
executing "systemctl reboot" in X11:

#!/bin/sh
exec > shutdown.log
while true; do
  echo
  echo
  date
  systemctl list-jobs
  systemctl status
  sync
  sleep 10
done

The last entry in shutdown.log is then:

Wed Nov  5 22:28:29 PST 2014
JOB UNIT                                                           TYPE  STATE  
775 reboot.target                                                  start waiting
776 systemd-reboot.service                                         start waiting
777 shutdown.target                                                start waiting
782 local-fs.target                                                stop  waiting
783 systemd-remount-fs.service                                     stop  waiting
838 networking.service                                             stop  running
841 systemd-random-seed.service                                    stop  waiting
853 system-systemd\x2dcryptsetup.slice                             stop  waiting
858 systemd-tmpfiles-setup-dev.service                             stop  waiting
862 lvm2-monitor.service                                           stop  waiting
881 local-fs-pre.target                                            stop  waiting
892 umount.target                                                  start waiting
907 systemd-cryptsetup at vg0\x2dnikratio_crypt.service               stop  running
908 dev-mapper-vg0\x2dnikratio_crypt.device                        stop  waiting
909 dev-disk-by\x2duuid-...\x2d4ab6\x2db67a\x2d5d21f14f7a38.device stop  running
910 dev-disk-by\x2did-dm...9b86897\x2dvg0\x2dnikratio_crypt.device stop  running
911 dev-disk-by\x2did-dm\x2dname\x2dvg0\x2dnikratio_crypt.device   stop  running
912 dev-dm\x2d6.device                                             stop  running
913 sys-devices-virtual-block-dm\x2d6.device                       stop  running
914 home-nikratio.mount                                            stop  waiting
921 boot.mount                                                     stop  waiting
922 mnt-windata.mount                                              stop  waiting
923 tmp.mount                                                      stop  waiting
924 run-user-1000.mount                                            stop  waiting
925 final.target                                                   start waiting

25 jobs listed.
* vostro
    State: stopping
     Jobs: 25 queued
   Failed: 1 units
    Since: Wed 2014-11-05 22:24:10 PST; 4min 18s ago
   CGroup: /
           |-1 /sbin/init splash
           `-system.slice
             |-mnt-windata.mount
             | `-699 /sbin/mount.ntfs /dev/sdc2 /mnt/windata -n -o ro,relatime,big_writes,uid=1000,dmask=022,fmask=133,norecover,windows_names,compression
             |-system-systemd\x2dcryptsetup.slice
             | `-systemd-cryptsetup at vg0\x2dnikratio_crypt.service
             |   `-control
             |     `-3412 /lib/systemd/systemd-cryptsetup detach vg0-nikratio_crypt
             |-networking.service
             | `-control
             |   |-3416 /bin/sh -e /etc/init.d/networking stop
             |   |-3427 ifdown -a --exclude=lo
             |   |-3463 /bin/sh -c dhclient -v -r -pf /run/dhclient.br0.pid -lf /var/lib/dhcp/dhclient.br0.leases br0
             |   `-3464 dhclient -v -r -pf /run/dhclient.br0.pid -lf /var/lib/dhcp/dhclient.br0.leases br0
             |-systemd-journald.service
             | `-376 /lib/systemd/systemd-journald
             |-plymouth-reboot.service
             | `-3161 @sbin/plymouthd --mode=shutdown --attach-to-session
             |-systemd-udevd.service
             | |- 388 /lib/systemd/systemd-udevd
             | |-3430 /lib/systemd/systemd-udevd
             | |-3431 /lib/systemd/systemd-udevd
             | `-3432 /lib/systemd/systemd-udevd
             `-debug-shell.service
               |-3018 /bin/bash
               |-3119 /bin/sh ./systemd-debug.sh
               `-3471 systemctl status


I am, however, not sure if at this point the shutdown was truly blocked,
or if the shutdown continued, but the log file could not be written
anymore (e.g. because / was mounted read-only). Is there a way to tell?


Any suggestion would be much appreciated.


Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«




More information about the Pkg-systemd-maintainers mailing list