Bug 1914571

Summary: grub-boot-success.service should not be started inside systemd-nspawn container
Product: [Fedora] Fedora Reporter: Gena Makhomed <makhomed>
Component: grub2Assignee: Javier Martinez Canillas <fmartine>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 33CC: fmartine, lkundrak, pjones
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: grub2-2.06-3.fc35 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-06 09:54:12 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 Gena Makhomed 2021-01-09 21:55:11 UTC
Description of problem:

grub-boot-success.service should not be started inside systemd-nspawn container

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

source: grub2-2.04-31.fc33.src.rpm
binary: grub2-tools-2.04-31.fc33.x86_64.rpm

How reproducible:

always

Steps to Reproduce:

1. Install Fedora Server 33

2. install systemd-container package:

dnf install systemd-container

3. create test container:

dnf --installroot=/var/lib/machines/test --releasever=33 install dnf systemd fedora-release openssh-clients openssh-server passwd vim mc

4. start test container:

machinectl start test

5. enter inside test container:

machinectl shell test

6. create user www inside container:

useradd www

7. set password for user www inside container:

passwd www

8. login to www via ssh inside container:

ssh www@localhost

9. wait two minutes

10. check systemctl status for user www:

systemctl --user

Actual results:

● grub-boot-success.service         loaded failed failed    Mark boot as successful
  grub-boot-success.timer           loaded active elapsed   Mark boot as successful after the user session has run 2 minutes

Host node journal fragment:

Jan 09 22:56:38 test sshd[8786]: pam_unix(sshd:session): session opened for user www(uid=1000) by (uid=0)
Jan 09 22:58:39 test systemd[8857]: Starting Mark boot as successful...
Jan 09 22:58:39 test systemd[8857]: grub-boot-success.service: Main process exited, code=exited, status=1/FAILURE
Jan 09 22:58:39 test systemd[8857]: grub-boot-success.service: Failed with result 'exit-code'.
Jan 09 22:58:39 test systemd[8857]: Failed to start Mark boot as successful.
Jan 09 22:58:39 test grub2-set-bootflag[10034]: Error canonicalizing /boot/grub2/grubenv filename: No such file or directory

Expected results:

grub-boot-success.timer should be disabled inside systemd-nspawn containers.

Additional info:

Patch to fix this bug:

# diff -u /usr/lib/systemd/user/grub-boot-success.timer.orig /usr/lib/systemd/user/grub-boot-success.timer
--- /usr/lib/systemd/user/grub-boot-success.timer.orig  2020-08-31 15:12:59.000000000 +0300
+++ /usr/lib/systemd/user/grub-boot-success.timer       2021-01-09 23:28:56.612000000 +0200
@@ -1,5 +1,6 @@
 [Unit]
 Description=Mark boot as successful after the user session has run 2 minutes
+ConditionVirtualization=!systemd-nspawn
 ConditionUser=!@system

 [Timer]

Comment 1 Gena Makhomed 2021-01-10 09:48:48 UTC
Updated patch to fix this bug:

# diff -u /usr/lib/systemd/user/grub-boot-success.timer.orig /usr/lib/systemd/user/grub-boot-success.timer
--- /usr/lib/systemd/user/grub-boot-success.timer.orig  2020-08-31 15:12:59.000000000 +0300
+++ /usr/lib/systemd/user/grub-boot-success.timer       2021-01-09 23:28:56.612000000 +0200
@@ -1,5 +1,6 @@
 [Unit]
 Description=Mark boot as successful after the user session has run 2 minutes
+ConditionVirtualization=!container
 ConditionUser=!@system

 [Timer]

Comment 2 Fedora Admin user for bugzilla script actions 2021-05-07 00:35:19 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 3 Fedora Update System 2021-07-06 09:49:52 UTC
FEDORA-2021-21ed0c951f has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2021-21ed0c951f

Comment 4 Fedora Update System 2021-07-06 09:54:12 UTC
FEDORA-2021-21ed0c951f has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.