Bug 2131963

Summary: [spec] remote-cryptsetup.target is disabled in "guest" image
Product: Red Hat Enterprise Linux 8 Reporter: Marius Vollmer <mvollmer>
Component: systemdAssignee: Jan Macku <jamacku>
Status: CLOSED MIGRATED QA Contact: Frantisek Sumsal <fsumsal>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.4CC: dtardon, hartsjc, jamacku, systemd-maint-list
Target Milestone: rcKeywords: Bugfix, MigratedToJIRA, Reproducer, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-21 12:19:35 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 Marius Vollmer 2022-10-04 09:59:07 UTC
Description of problem:

The remote-cryptsetup.target systemd unit is disabled in a new installation that uses the "guest" image here:

http://download.devel.redhat.com/rhel-8/rel-eng/RHEL-8/latest-RHEL-8.4/compose/BaseOS/x86_64/images//rhel-guest-image-8.4-992.x86_64.qcow2

The unit is "preset: enabled", but its actual state is "disabled" when the image above is booted.

The same is true for all RHEL 8, RHEL 9, and Fedora images I have tried.  I think this was supposed to with in bug 1783263, but it is still broken for me.

The remote-cryptsetup.target unit is important for NBDE. When it is disabled, encrypted block devices with "_netdev" will not be processed at all during boot.

Version-Release number of selected component (if applicable):
systemd-udev-239-45.el8.x86_64

How reproducible:
Always

Steps to Reproduce:
1. curl -L -o image.qcow2 http://download.devel.redhat.com/rhel-8/rel-eng/RHEL-8/latest-RHEL-8.4/compose/BaseOS/x86_64/images//rhel-guest-image-8.4-992.x86_64.qcow2
2. curl -L -O https://github.com/cockpit-project/bots/raw/main/machine/cloud-init.iso
3. qemu-system-x86_64 -cpu host -enable-kvm -nographic -m 2048 -drive file=image.qcow2,if=virtio -snapshot -cdrom cloud-init.iso -net nic,model=virtio -net user,hostfwd=tcp::22001-:22
4. login as root, password "foobar"
5. systemctl status remote-cryptsetup.target

Actual results:
● 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)


Expected results:
● remote-cryptsetup.target - Remote Encrypted Volumes
   Loaded: loaded (/usr/lib/systemd/system/remote-cryptsetup.target; enabled; vendor preset: enabled)
   Active: active since Tue 2022-10-04 05:57:18 EDT; 1s ago
     Docs: man:systemd.special(7)

Oct 04 05:57:18 localhost systemd[1]: Reached target Remote Encrypted Volumes.


Additional info:

I think there is no reason why remote-cryptsetup.target should ever not be part of the boot.

Comment 1 Marius Vollmer 2022-10-04 10:01:10 UTC
This bugs exists in all versions of RHEL that I have tested.  Do I need to clone it explicitly?

Comment 2 David Tardon 2022-10-06 08:08:14 UTC
(In reply to Marius Vollmer from comment #0)
> Description of problem:
> 
> The remote-cryptsetup.target systemd unit is disabled in a new installation
> that uses the "guest" image here:
> 
> http://download.devel.redhat.com/rhel-8/rel-eng/RHEL-8/latest-RHEL-8.4/
> compose/BaseOS/x86_64/images//rhel-guest-image-8.4-992.x86_64.qcow2
> 
> The unit is "preset: enabled", but its actual state is "disabled" when the
> image above is booted.
> 
> The same is true for all RHEL 8, RHEL 9, and Fedora images I have tried.  I
> think this was supposed to with in bug 1783263, but it is still broken for
> me.

Well, apparently that bug hasn't really been fixed. And I see why. We run the preset-all on installation in %post of systemd package, which is too early (remote-cryptsetup.target is in systemd-udev, which itself depends on systemd, hence it will normally be installed after it). Either there's something else (anaconda?) that's supposed to run preset-all after installation (in which case it's pointless doing it in systemd's %post); or systemd should run it in %posttrans; or packages are supposed to run preset for every presettable unit they ship (in which case it's a bug that systemd-udev doesn't do it for remote-cryptsetup.target. And the preset-all in systemd's %post exists to fix presets for packages that've been installed _before_ systemd). We have to check what's the intent here to understand where this should be fixed.

> > I think there is no reason why remote-cryptsetup.target should ever not be
> part of the boot.

Apparently that's done for consistency with remote-fs.target.

Comment 3 Marius Vollmer 2022-10-07 07:44:04 UTC
(In reply to David Tardon from comment #2)

> Well, apparently that bug hasn't really been fixed.

Is there any test that would catch this?  This bug breaks our whole NBDE story, no?  Our documentation doesn't mention this either.  (It only talks about enabling clevis-luks-asspass.path, AFAICS, but not "_netdev" and remote-cryptsetup.target)  So how do people do NBDE?

Will fixing this in our packages fix systems that are upgraded from a buggy version to a fixed version?  Or will upgrading leave remote-cryptsetup.target disabled because presets are only applied during a fresh installation?

Comment 4 David Tardon 2022-10-10 12:46:13 UTC
(In reply to Marius Vollmer from comment #3)
> (In reply to David Tardon from comment #2)
> 
> > Well, apparently that bug hasn't really been fixed.
> 
> Is there any test that would catch this? 

If there were one, the issue would have been caught...

> This bug breaks our whole NBDE
> story, no?  Our documentation doesn't mention this either.  (It only talks
> about enabling clevis-luks-asspass.path, AFAICS, but not "_netdev" and
> remote-cryptsetup.target)  So how do people do NBDE?

I've no idea about NBDE, sorry.

> Will fixing this in our packages fix systems that are upgraded from a buggy
> version to a fixed version?  Or will upgrading leave
> remote-cryptsetup.target disabled because presets are only applied during a
> fresh installation?

I think enabling on upgrade from broken to fixed version could be handled by %trigger(post)un for the broken version. We already do this for a couple of systemd services in Fedora. (Provided triggers are available in RHEL-8's rpm. I don't remember when they were introduced.)

Comment 8 RHEL Program Management 2023-09-21 12:15:56 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 9 RHEL Program Management 2023-09-21 12:19:35 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.