You are not logged in.
Hello all! I've a little problem that I hope someone can help me with.
A have a fresh Arch Install fully upgraded on a Dell Inpiron 15R SE 7520. In this setup, my root partition uses bcache (from kernel 3.10.3-1, not from the AUR package) for SSD caching. On top of bcache I use LUKS and finally on top of all that, btfs.
The setup boots, runs and works, but there is a problem: it won't shutdown.
When I try to shutdown with "halt" or "shutdown -h now" I get:
Detaching DM devices.
Detaching DM 253:0.
Could not detach DM /dev/dm-0: Device or resource busy
Cannot finalize remaining file systems and devices, giving up.
...
[ 1309.417073] mei_me 0000:00:16.0: stop
[ 1341.773926] ata3.00: exception Emask 0x0 SErr 0x0 action 0x6 frozen
[ 1341.773978] ata3.00: cmd a0/00:00:00:08:00/00:00:00:00:00/a0 tag 0 pio 16392 in
[ 1341.773978] res 40/00:03:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1341.774038] ata3.00: status: { DRDY }
[ 1341.811061] ata3: COMRESET failed (errno=-16)
[ 1341.848244] ata3: COMRESET failed (errno=-16)
[ 1341.924857] ata3: COMRESET failed (errno=-16)
[ 1341.943453] ata3: COMRESET failed (errno=-16)
[ 1341.943498] ata3: reset failed, giving up
After that it just stays there, complaining from time to time that "poweroff:857" is blocked for more than 120 seconds and never shutdown if i don't hold the power button.
I'm using the shutdown hook on mkinitcpio. To debug the issue I put "/bin/ash" on /run/initramfs/shutdown and dropped into a shell. In the shell I can't "umount" or "crypsetup luksClose" the root partition, all of them accusing "Device or resource busy", even though lsof says there is nothing using it.
It does not appear to cause any form of file system corruption. I noticed that btrfs identifies the partition as a ssd and automatically mounts with that option, even tough only the cache is ssd. I thought maybe that is the problem, but couldn't find an option to disable btrfs from doing this automagically.
Any help is appreciated.
Offline
all of them accusing "Device or resource busy", even though lsof says there is nothing using it.
Might be a kernel bug. Perhaps dirty pages on the cache device prevent the backing device from being unmounted.
I noticed that btrfs identifies the partition as a ssd and automatically mounts with that option, even tough only the cache is ssd. I thought maybe that is the problem, but couldn't find an option to disable btrfs from doing this automagically.
You should be able to invert the option by passing 'nossd', but this definitely shouldn't be related to the problem.
Offline
Thanks for the answer. I'll open a bug report.
Offline
I found a workaround. Running:
# echo 0 > /sys/block/bcache0/bcache/writeback_running
before umounting solves the issue (forgot to say I was using bcache in writeback mode).
This makes sense: the disk was being used for writing back. But I shouldn't have to disable it manually. The documentation says this option is for benchmarking only.
Anyway, I could make a patch for the shutdown hook. But I'm not sure where to submit it and whether that's the preferred solution.
Offline
Hi Bolche,
I am also facing the exact same problem, where exactly did you add the last line?
I tried adding it in /usr/lib/initcpio/hooks/shutdown and the recreating the image, it didnot work.
Can you please help?
Thanks,
Shanmu.
Offline
You should edit the file /usr/lib/initcpio/shutdown (outside of the "hooks" directory)
On my system I changed this:
...
[ -e "$part" ] && disassemble "${part%%/*}"
done
for bc in */bcache/writeback_running; do
echo 0 > $bc
done
case $1 in
poweroff|shutdown|halt)
...
Comment your setup on bug #36323.
Offline
Hi,
I have edited and it did not work.
I added some print statements and they never got printed as well.
I have the shutdown hook in my mkinitcpio.conf and have regenerated the init image after this change.
Is there something that needs to be done to make this code run during shutdown?
I tried poweroff, reboot and shutdown to no avail.
Thanks,
Shanmu.
Offline
Try to put /bin/ash somewhere in /run/initramfs/shutdown. This will drop you on a shell when shutdown. If this does not happens, then systemd is hanging and it's a different bug.
Offline
From the bug comment, I take that it didn't solve. What happens?
Offline
I donot have a /run/initramfs/shutdown, I am not sure if the mkinitcpio is including the shutdown hook?
Offline