Bug 1097938

Summary: Systemd fails to umount/ & luksClose crypted iSCSI mounts on shutdown
Product: [Fedora] Fedora Reporter: Robert Sigler <rsigler>
Component: iscsi-initiator-utilsAssignee: Chris Leech <cleech>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: agrover, cleech, hdegoede, johannbg, lnykryn, msekleta, plautrba, rsigler, s, systemd-maint, vpavlin, zbyszek
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: 2015-06-30 01:35:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Robert Sigler 2014-05-14 22:16:41 UTC
Description of problem:
With luks crypted iSCSI file systems mounted, the system fails to cleanly shutdown.

Version-Release number of selected component (if applicable):
Fedora release 20 (Heisenbug)
systemd-208-16.fc20.x86_64 (currently installed)

How reproducible:
Every time


Steps to Reproduce:
1. Attach an crypted iSCSI target to an initiator client.
2. Decrypt the SCSI disk (cryptsetup luksOpen ...).
3. Mount the decrypted disk.
4. Shut down the system (halt, reboot, etc)

Actual results:
Events are executed out of order. From logs:

**** first, iSCSI shutdown (this needs to happen third)****

May 14 17:55:43 home iscsiadm[19189]: Logging out of session [sid: 1, target: iqn.2003-01.org.linux-iscsi.storage.x8664:sn.7007b0b470ea, portal: 192.168.1.203,3260]
May 14 17:55:43 home iscsiadm[19189]: Logging out of session [sid: 2, target: iqn.2003-01.org.linux-iscsi.storage.x8664:sn.7faa6e66c2b6, portal: 192.168.1.203,3260]
May 14 17:55:43 home iscsiadm[19189]: Logout of [sid: 1, target: iqn.2003-01.org.linux-iscsi.storage.x8664:sn.7007b0b470ea, portal: 192.168.1.203,3260] successful.
May 14 17:55:43 home iscsiadm[19189]: Logout of [sid: 2, target: iqn.2003-01.org.linux-iscsi.storage.x8664:sn.7faa6e66c2b6, portal: 192.168.1.203,3260] successful.
May 14 17:55:43 home systemd[1]: Stopped Login and scanning of iSCSI devices.
May 14 17:55:43 home systemd[1]: Stopping Open-iSCSI...
May 14 17:55:43 home iscsid[929]: Connection1:0 to [target: iqn.2003-01.org.linux-iscsi.storage.x8664:sn.7007b0b470ea, portal: 192.168.1.203,3260] through [iface: default] is shutdown.
May 14 17:55:43 home iscsid[929]: Connection2:0 to [target: iqn.2003-01.org.linux-iscsi.storage.x8664:sn.7faa6e66c2b6, portal: 192.168.1.203,3260] through [iface: default] is shutdown.
May 14 17:55:43 home iscsid[929]: iscsid shutting down.
May 14 17:55:43 home systemd[1]: Stopped Open-iSCSI.
May 14 17:55:43 home systemd[1]: Stopping Open-iSCSI iscsid Socket.
May 14 17:55:43 home systemd[1]: Closed Open-iSCSI iscsid Socket.
May 14 17:55:43 home systemd[1]: Stopping System Initialization.
May 14 17:55:43 home systemd[1]: Stopped target System Initialization.


**** Second, crypt shut down (this needs to happen second) ****

May 14 17:55:43 home systemd[1]: Stopping Encrypted Volumes.
May 14 17:55:43 home systemd[1]: Stopped target Encrypted Volumes.


**** Third, then file system umounts (this needs to happen first) ****

May 14 17:55:43 home systemd[1]: Stopping Local File Systems.
May 14 17:55:43 home systemd[1]: Stopped target Local File Systems.
May 14 17:55:43 home systemd[1]: Unmounting /home/rsigler/Downloads...  ### iSCSI 
May 14 17:55:43 home systemd[1]: Unmounting /mnt/storage...             ### iSCSI 
May 14 17:55:43 home systemd[1]: Unmounting /mnt/restore...
May 14 17:55:43 home systemd[1]: Unmounting /mnt/f20Restore...          ### iSCSI
May 14 17:55:44 home systemd[1]: Unmounting /var...
May 14 17:55:44 home systemd[1]: Unmounting /boot/efi...
May 14 17:55:44 home systemd[1]: Unmounting Temporary Directory...
May 14 17:55:44 home systemd[1]: Stopping Configure read-only root support...
May 14 17:55:44 home systemd[1]: Stopped Configure read-only root support.

Expected results:
1. umount
2. luksClose
3. iSCSI logout

Additional info:

Comment 1 Lennart Poettering 2014-06-17 22:16:57 UTC
I figure there's currently no way to fix this properly since iscsi cannot be configured to be shutdown only after all LUKS partitions are also removed.

To make this work I have now added a new passive target unit "cryptsetup-pre.target". It is implicitly ordered before all LUKS parrtitions, and since in systemd the shutdown order of two units is always the reverse start-up order, this means that on shutdown the LUKS devices are disassembled first, and everything that orders itself before "cryptsetup-pre.target" hence second.

This is currently in systemd git only, will soon hit rawhide.

To make use of this iscsi needs to be updated to do:

Before=cryptsetup-pre.target remotefs-pre.target
Wants=cryptsetup-pre.target remotefs-pre.target

It needs to be an early-boot service for this, i.e. have DefaultDependencies=no.

Anyway, these are changes necessary in iscsi, hence reassigning.

Again, all rawhide work only.

Comment 2 Zbigniew Jędrzejewski-Szmek 2014-06-18 18:52:44 UTC
I think this target is harmless enough to be introduced in F20. In principle someone could have created their own target like that, but let's ignore this remote possibility.

Comment 3 Fedora Update System 2014-06-19 13:19:46 UTC
systemd-208-18.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/systemd-208-18.fc20

Comment 4 Fedora Update System 2014-06-19 22:56:32 UTC
Package systemd-208-18.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-208-18.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-7512/systemd-208-18.fc20
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2014-06-22 23:55:55 UTC
Package systemd-208-19.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-208-19.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-7512/systemd-208-19.fc20
then log in and leave karma (feedback).

Comment 6 Fedora End Of Life 2015-05-29 11:50:59 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Fedora End Of Life 2015-06-30 01:35:43 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.