Bug 2092792

Summary: systemd emergency does not work as documented
Product: Red Hat Enterprise Linux 9 Reporter: Jan Pazdziora (Red Hat) <jpazdziora>
Component: systemdAssignee: David Tardon <dtardon>
Status: CLOSED MIGRATED QA Contact: Frantisek Sumsal <fsumsal>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: minl, msekleta, systemd-maint-list
Target Milestone: rcKeywords: MigratedToJIRA
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 11:52:31 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 Jan Pazdziora (Red Hat) 2022-06-02 09:18:56 UTC
Description of problem:

The https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/configuring_basic_system_settings/working-with-systemd-targets_configuring-basic-system-settings#proc_booting-to-emergency-mode_working-with-systemd-targets section says

 To change the current target and enter emergency mode:

 # systemctl emergency

However, this does not seem to work on RHEL 9.0.

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

systemd-250-6.el9_0.x86_64

How reproducible:

Deterministic.

Steps to Reproduce:
1. Have a virtual machine with RHEL 9 installation with just the @core group.
2. Connect to it using virsh console $domain and log in as root.
3. Run
   # systemctl emergency

Actual results:

[   86.459553] audit: type=1305 audit(1654160963.601:118): op=set audit_pid=0 old=562 auid=4294967295 ses=4294967295 subj=system_u:system_r:auditd_t:s0 res=1
[   86.460895] audit: type=1131 audit(1654160963.603:119): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=auditd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   86.463833] audit: type=1130 audit(1654160963.606:120): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dracut-shutdown comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   86.466083] audit: type=1131 audit(1654160963.608:121): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=firewalld comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   86.699911] audit: type=1131 audit(1654160963.842:122): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=rsyslog comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  111.446540] audit: type=1106 audit(1654160988.587:123): pid=747 uid=0 auid=0 ses=3 subj=system_u:system_r:local_login_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=? acct="root" exe="/usr/bin/login" hostname=localhost.localdomain addr=? terminal=/dev/ttyS0 res=failed'
[  111.452869] audit: type=1131 audit(1654160988.594:124): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=serial-getty@ttyS0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  111.462168] audit: type=1131 audit(1654160988.603:125): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-user-sessions comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  111.480012] audit: type=1131 audit(1654160988.621:126): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  111.487001] audit: type=1131 audit(1654160988.628:127): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dbus-broker comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  111.493977] audit: type=1334 audit(1654160988.632:128): prog-id=38 op=LOAD
[  111.494686] audit: type=1334 audit(1654160988.632:129): prog-id=39 op=LOAD
[  111.495402] audit: type=1334 audit(1654160988.632:130): prog-id=40 op=LOAD
[  111.496106] audit: type=1334 audit(1654160988.632:131): prog-id=27 op=UNLOAD
[  111.497006] audit: type=1334 audit(1654160988.632:132): prog-id=28 op=UNLOAD
[  121.527192] kauditd_printk_skb: 22 callbacks suppressed
[  121.527196] audit: type=1131 audit(1654160998.666:149): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  121.534680] audit: type=1104 audit(1654160998.674:150): pid=816 uid=0 auid=0 ses=5 subj=system_u:system_r:init_t:s0 msg='op=PAM:setcred grantors=? acct="root" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
[  121.535960] audit: type=1131 audit(1654160998.675:151): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=user@0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  121.542326] audit: type=1131 audit(1654160998.682:152): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=user-runtime-dir@0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'

[ ... and nothing else happens (I gave it for 15 minutes) ... ]

Expected results:

[   12.635263] audit: type=1305 audit(1654160209.518:142): op=set audit_pid=0 old=665 auid=4294967295 ses=4294967295 subj=system_u:system_r:auditd_t:s0 res=1
[   12.639820] audit: type=1131 audit(1654160209.523:143): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=auditd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   12.640753] systemd[1]: Stopping Journal Service...
[   12.641693] audit: type=1131 audit(1654160209.524:144): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-tmpfiles-setup comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   12.642248] systemd[1]: import-state.service: Succeeded.
[   12.644286] audit: type=1131 audit(1654160209.524:145): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-journal-flush comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   12.644968] systemd[1]: Stopped Import network configuration from initramfs.
[   12.647005] systemd[1]: Started Emergency Shell.
[   12.647555] systemd[1]: Reached target Emergency Mode.
[   12.647907] systemd[1]: Stopped target Local File Systems.
[   12.648289] systemd[1]: Stopped target Local File Systems (Pre).
[   12.648775] systemd[1]: systemd-tmpfiles-setup-dev.service: Succeeded.
[   12.648962] audit: type=1131 audit(1654160209.531:146): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=import-state comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   12.649497] systemd[1]: Stopped Create Static Device Nodes in /dev.
[   12.650557] audit: type=1130 audit(1654160209.531:147): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=emergency comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   12.651055] systemd[1]: systemd-sysusers.service: Succeeded.
[   12.652286] audit: type=1131 audit(1654160209.535:148): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-tmpfiles-setup-dev comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   12.654604] audit: type=1131 audit(1654160209.538:149): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-sysusers comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   12.655994] audit: type=1131 audit(1654160209.538:150): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=kmod-static-nodes comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   12.655996] audit: type=1131 audit(1654160209.538:151): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-remount-fs comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
You are in emergency mode. After logging in, type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default" or "exit"
to boot into default mode.
Give root password for maintenance
(or press Control-D to continue): 

Additional info:

The expected results output above is from RHEL 8.4, with the same VM setup.

Comment 1 David Tardon 2022-12-15 11:37:07 UTC
*** Bug 2153708 has been marked as a duplicate of this bug. ***

Comment 2 RHEL Program Management 2023-09-21 11:47:29 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 3 RHEL Program Management 2023-09-21 11:52:31 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.