Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 503082 - systemd fails to properly unmount disks on shutdown
Summary: systemd fails to properly unmount disks on shutdown
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo systemd Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-28 23:49 UTC by Jan Vesely
Modified: 2014-07-28 08:00 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info systemd (file_503082.txt,6.35 KB, text/plain)
2014-03-01 19:48 UTC, Jan Vesely
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Vesely 2014-02-28 23:49:14 UTC
Using reboot, shutdown -r, or clicking restart on the shutdown menu in gnome results in almost immediate reboot without unmounting the disks, resulting in fs corruption.

Reproducible: Always
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2014-03-01 15:04:31 UTC
1) Please post your `emerge --info sys-apps/systemd' output in a comment.
2) Please attach your syslog output from around the time you reboot the system.
Comment 2 Jan Vesely 2014-03-01 19:48:18 UTC
Created attachment 371518 [details]
emerge --info systemd

Here are last few lines around the restart:
eb 28 19:25:57 [kernel] wlan0: associated
Feb 28 19:25:57 [NetworkManager] <info> (wlan0): supplicant interface state: associating -> completed
Feb 28 19:25:57 [NetworkManager] <info> (wlan0): roamed from BSSID 06:27:22:E9:43:C0 (LAWN) to 06:27:22:BD:44:5B (LAWN)
Feb 28 19:25:58 [kernel] bzr-notify[2454]: segfault at 7fff11b48f88 ip 00007fc8462d1cd8 sp 00007fff11b48f90 error 6 in libc-2.17.so[7fc846288000+1a0000]
Feb 28 19:26:03 [colord] device removed: xrandr-LVDS1
Feb 28 19:26:03 [colord] Profile removed: icc-881a7624e9a74aad0319408038496d62
Feb 28 19:26:03 [NetworkManager] <info> caught signal 15, shutting down normally.
Feb 28 19:26:03 [kernel] wlan0: deauthenticating from 06:27:22:bd:44:5b by local choice (reason=3)
Feb 28 19:26:03 [NetworkManager] <info> (eth0): device state change: unavailable -> unmanaged (reason 'removed') [20 10 36]
Feb 28 19:26:03 [NetworkManager] <info> (eth0): cleaning up...
Feb 28 19:26:03 [kernel] brcmsmac bcma0:0: brcmsmac: brcms_ops_bss_info_changed: disassociated
Feb 28 19:26:03 [kernel] brcmsmac bcma0:0: brcms_ops_bss_info_changed: arp filtering: 1 addresses (implement)
Feb 28 19:26:03 [kernel] brcmsmac bcma0:0: brcms_ops_bss_info_changed: qos enabled: false (implement)
Feb 28 19:26:03 [kernel] cfg80211: Calling CRDA to update world regulatory domain
Feb 28 19:31:27 [kernel] Initializing cgroup subsys cpu
Feb 28 19:31:27 [kernel] Linux version 3.13.5-gentoo (orome@manwe) (gcc version 4.7.3 (Gentoo 4.7.3-r1 p1.4, pie-0.5.5) ) #2 SMP PREEMPT Fri Feb 28 17:28:05 EST 2014
Feb 28 19:31:27 [kernel] Command line: BOOT_IMAGE=/boot/vmlinuz-3.13.5-gentoo root=/dev/sda3 ro quiet splash i915.i915_enable_fbc=1 i915.lvds_downclock=1 init=/usr/lib/systemd/systemd drm.rnodes=1


I restarted the machine just after booting, so there's some wifi raming stuff. The 5 min difference between the last and the first entry is because I booted liveusb and xfs_check/repaired the disk

Note that shutdown works OK.
Comment 3 Jan Vesely 2014-03-25 13:27:11 UTC
I have been avoiding reboots as much as I can, but I hit this yesterday even with shutdown.

THe steps to reproduce are always the same:
1) compile new kernel
2) grub2-mkconfig -o /boot/grub2.cfg
3) reboot (or shutdown)

4) grub fails to read grub2.conf, kernel fails to boot (image truncated),
when booting from liveusb xfs_check complains that I should flush the log by mounting the drive first. sometimes additional xfs_repair is necessary.

not sure if this is might caused by fs/kernel (3.13.x, but I have seen this on earlier revisions), or my hw lying about data written.
Comment 4 Mike Gilbert gentoo-dev 2014-03-25 14:25:19 UTC
Can you reboot from a virtual terminal and see if you can catch any messages before it reboots?

Also, in the interim, I would recommend running the "sync" command before rebooting to flush the filesystem buffers to disk.
Comment 5 Mike Gilbert gentoo-dev 2014-03-25 14:25:45 UTC
Also, can you try rebooting by using the "systemctl reboot" command?
Comment 6 Jan Vesely 2014-03-26 17:33:10 UTC
(In reply to Mike Gilbert from comment #5)
> Also, can you try rebooting by using the "systemctl reboot" command?

I have tested several things. My root partition is now in unfixable state (still works, but xfs_repair will not find a root block with correct checksum/magic).

The incorrect shutdown usually manifests by a loud and distinct 'click' sound from the machine hdd (kinda scary).

I tried halt and reboot from win7, openrc, and systemd:
win7 shuts down and restart without the 'click' sound
openrc shuts down cleanly, but restarts with a click.
systemd, both shutdown and restart give me the click sound.

I could not really see any messages. After unmerging plymouth and siabling gdm (working from a vt). both 'systemctl shutdown' and 'systemctl halt' print "Storage is finalized" among the last messages.

note that 'systemctl halt' does not shutdown my machine, it just prints 'system halted'. After pressing the power button for some time it still clicks, indicating that disk has not been turned off.

It looks a bit messy right now, I'll try to recreate my root partition, and rerun the tests with xfs_check instead of click as an indicator. So far it looks like the issue might be outside of systemd.
Comment 7 Jan Vesely 2014-03-26 19:03:08 UTC
Turns out more recent xfsprogs could fix my root partition. I ran few more tests, and I'm pretty confident that this is a kernel issue not a systemd one.

I downgraded back to 3.12.z and I no longer hear the annoying clicks. Also there is no more disc corruption reported after restart or shutdown.

just an info, I have a weird combination of having swap file on an encrypted home partition. I have seen these messages during shutdown sequence:
[  OK  ] Failed unmounting /home
...
...
Unmouting /home
All filesystems unmounted
All swaps deactivated

thanks for you help. I have renamed the bug to say this is kernel's fault
Comment 8 Jan Vesely 2014-04-01 02:22:11 UTC
(In reply to Jan Vesely from comment #7)
> Turns out more recent xfsprogs could fix my root partition. I ran few more
> tests, and I'm pretty confident that this is a kernel issue not a systemd
> one.
> 
> I downgraded back to 3.12.z and I no longer hear the annoying clicks. Also
> there is no more disc corruption reported after restart or shutdown.
> 
scratch that. I just reproduced using 3.12.15 (and .14).
I can reproduce this using 3.1{2,3,4} kernels, although my partition might just be FUBAR at this point
Comment 9 Jan Vesely 2014-05-19 01:12:42 UTC
I disabled reboot in kernel and this is what I saw as the last screen:

Stopped target Encrypted Volumes
Stopping Cryptography Setup for pc-home
Stopped target Swap
Deactivating swap /home/swap...
Stopped target Local File Systems
Unmouting /tmp...
Unmouting /var/tmp/portage...
Stopped target Encrypted Volumes
Stopping Cryptography Setup for pc-home
Deactivating swap /home/swap...
Stopped target Local File Systems
Unmouting /tmp...
Unmouting /var/tmp/portage...
Deactivated swap /home/swap.
Unmouting /home...
Failed unmouting /home.
Stopping File System Check on /dev/mapper/pc-home
Stopped File System Check on /dev/mapper/pc-home
Deactivated swap /home/swap.
Unmouting /home...
Failed unmouting /home.
Stopping File System Check on /dev/mapper/pc-home...
Stopped File System Check on /dev/mapper/pc-home.
Unmouted /var/tmp/portage.
Unmouted /var/tmp/portage.
Unmouted /tmp.
Stopped Target Local File Systems (Pre).
Stopping Remount Root and Kernel File Systems...
Stopped Remount Root and Kernel File Systems.
Reached Target Shutdown.
Unmouted /tmp.
Stopped Target Local File Systems (Pre).
Stopping Remount Root and Kernel Files Systems...
Stopped Remount Root and Kernel Files Systems.
Reached target Shutdown.
reboot: Restarting system

I don't know why several things were shut down multiple times.
"Failed unmouting /home" seems to be the problem, although the corruption is on the root disk too.
I tried turning off swap (swapoff -a) before reboot but unmouting /home still fails.
/home is encrypted
/tmp and /var/tmp/portage are tmpfs
Comment 10 Jan Vesely 2014-07-27 19:37:58 UTC
I no longer see the unmount problem with systemd-215-r3.

the annoying clicking sound is a separate kernel issue caused by a536877 "x86: Make Dell Latitude E6420 use reboot=pci". Commenting out those lines make the system reboot in the same way as windows does. Wonder why it didn't show up on 3.12 (the commit was introduced in 3.0)
Comment 11 Pacho Ramos gentoo-dev 2014-07-28 08:00:00 UTC
Thanks for testing and feedback