Bug 1366575 - Reboot from emergency.target hangs when rootfs is on LUKS
Summary: Reboot from emergency.target hangs when rootfs is on LUKS
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 26
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1370133
TreeView+ depends on / blocked
 
Reported: 2016-08-12 11:21 UTC by Michal Sekletar
Modified: 2017-03-16 08:25 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
: 1370133 (view as bug list)
Environment:
Last Closed: 2017-03-16 08:25:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Michal Sekletar 2016-08-12 11:21:12 UTC
Description of problem:
When rootfs is on LUKS we need to deactivate LUKS device during shutdown. To do that we call systemd-cryptsetup detach on the particular device. systemd-cryptsetup will then call crypt_deactivate function from libcryptsetup. This function then deactivates device, but when libcryptsetup notices that udev daemon is still running it executes the code path that uses udev cookies (synchronization mechanism implemented by libdevicemapper based on udev). To figure out whether udev is running it uses udev_queue_get_udev_is_active function from libudev. However this function only checks for presence of udev control AF_UNIX socket. Because system is in emergency mode, udev is not running  anymore and corresponding socket unit was also already stopped. Note that systemd by default doesn't unlink AF_UNIX sockets from the filesystem when socket unit is stopped. udev_queue_get_udev_is_active then returns true because /run/udev/control AF_UNIX socket is still present, but udevd is actually not running. That will then cause hang in libcryptsetup. 

Version-Release number of selected component (if applicable):
systemd-231-3.fc26

How reproducible:
always

Steps to Reproduce:
1. install system with encrypted /
2. systemctl isolate emergency.target
3. sulogin
4. reboot

Actual results:
Reboot hangs

Expected results:
Reboot completes in a timely fashion

Additional info:
https://github.com/systemd/systemd/issues/2477

Comment 1 Fedora End Of Life 2017-02-28 10:05:26 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 2 Michal Sekletar 2017-03-16 08:25:32 UTC
This was fixed while ago by,

https://github.com/systemd/systemd/pull/4039/commits/a2de10775194edec51b1e88d20a380724a3dc716

Above commit is included in systemd-v233 (F26 and rawhide).


Note You need to log in before you can comment on or make changes to this bug.