Bug 1783263

Summary: [spec] remote-cryptsetup.target is not enabled by default
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: systemdAssignee: Jan Macku <jamacku>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: dtardon, jamacku, ltcgcw, mgandhi, msekleta, scorreia, systemd-maint-list
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-239-48.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:54:49 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 Renaud Métrich 2019-12-13 13:24:56 UTC
Description of problem:

remote-cryptsetup.target is not enabled by default even though it should be.

/usr/lib/systemd/system-preset/90-systemd.preset lists this unit:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
enable remote-cryptsetup.target
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# systemctl status remote-cryptsetup.target 
● remote-cryptsetup.target - Remote Encrypted Volumes
   Loaded: loaded (/usr/lib/systemd/system/remote-cryptsetup.target; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd.special(7)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


But our RPM doesn't enable it:

systemd.spec:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
 721         systemctl preset --quiet \
 722                 remote-fs.target \
 723                 getty@.service \
 724                 serial-getty@.service \
 725                 console-getty.service \
 726                 debug-shell.service \
 727                 systemd-resolved.service \
 728                 >/dev/null || :
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

This makes decryption of remote volumes not automatic (the user must unlock the volume manually by executing the corresponding systemd-cryptsetup@luks... service).


Version-Release number of selected component (if applicable):

systemd-239-18.el8.x86_64


How reproducible:

Always


Steps to Reproduce:
1. Install a system with 1 luks device for some non-root volume, e.g. "/data" mount point backed on encrypted /dev/vda3
2. Boot regularly, passphrase is requested (OK)
3. Add _netdev to /etc/crypttab and /etc/fstab to simulate a remote volume and reboot

Actual results:

Passphrase is not asked for, systemd-cryptsetup@luks... is not executed.
Additionally:
- Boot hangs forever waiting for device to come up because x-systemd.device-timeout=0 in /etc/fstab

Comment 1 David Tardon 2020-07-20 10:36:46 UTC
We should use "systemctl preset-all" like Fedora does. Relevant change to systemd.spec: https://src.fedoraproject.org/rpms/systemd/c/8510cadb34504578fbefad8d57df3e256d9ca394

Comment 3 George C. Wilson 2021-05-25 22:31:59 UTC
I also ran into this issue while trying to integrate a network-based key management service with cryptsetup, passed the _netdev option in the /etc/crypttab line for the device, and didn't get the expected result.  remote-cryptsetup.target should be enabled by default IMO.

Comment 8 errata-xmlrpc 2021-11-09 19:54:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (systemd bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4469