This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2019905 - If selinux labels are not restored, the autorelabel is not enough in RHEL8.4 and recovered system does not boot
Summary: If selinux labels are not restored, the autorelabel is not enough in RHEL8.4 ...
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: rear
Version: 8.4
Hardware: All
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Pavel Cahyna
QA Contact: CS System Management SST QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-03 15:37 UTC by Welterlen Benoit
Modified: 2024-01-20 04:25 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-09-21 23:39:49 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 2021835 1 medium CLOSED .autorelabel does not work anymore in RHEL8.4 if a file required by systemd is unlabelled (/etc/localtime) 2023-06-13 08:14:49 UTC
Red Hat Issue Tracker   RHEL-6961 0 None Migrated None 2023-09-21 23:39:43 UTC
Red Hat Issue Tracker RHELPLAN-101718 0 None None None 2021-11-04 09:11:24 UTC
Red Hat Knowledge Base (Solution) 6364351 0 None None None 2021-11-03 15:46:24 UTC

Internal Links: 2021835

Description Welterlen Benoit 2021-11-03 15:37:24 UTC
Description of problem:
- When restoring a system with selinux enabled, but where the backup does not restore the label, the system is not bootable because autorelabel will happen to late, systemd already fails with:
---
Failed to create timezone change event source: Permission denied
---

because in RHEL 8.4, systemd is not able to read unlabelled files anymore.

- This case can happen with different backup tools:
- rsync with remote filesystem not able to manage extended attributes
- TSM as customer, because labels for link are no saved, thus /etc/localtime will be unlabelled an systemd will fail.

Version-Release number of selected component (if applicable):
- rear-2.4-18.el8.x86_64
- systemd-239-45.el8_4.1.x86_64
- selinux-policy-targeted-3.14.3-67.el8.noarch
- policycoreutils-2.9-14.el8.x86_64

How reproducible:
- always

Steps to Reproduce:
1. run rear backup on a target that does not support extended attributs
2. recover the system
3. on reboot, the system fails

Actual results:
- recover is complete, but system does not boot and autorelabel can't be applied

Expected results:
- recover completes, and system directly bootable


Additional info:
- I wrote a KCS to workaround the issue with a first boot with enforcing=0 on kernel command line
- I will also open a BZ against selinux because autorelabel is starting to late, systemd failed already.

Comment 1 Pavel Cahyna 2021-11-04 09:08:23 UTC
Hello Benoit, I suppose that the issue does not happen with usual tar (NETFS), because I have not observed this in tests? With BACKUP=RSYNC, the issue does not occur either if the backup destination supports the appropriate extended attributes, or does it?

Comment 2 Welterlen Benoit 2021-11-04 09:34:34 UTC
Hello Pavel,

Thanks for your answer.
Yes, the issue is only seen when labels are not restored correctly (especially /etc/localtime). In this case, the .autorelabel is useless because it can't be applied, systemd is already dead.
 
The solution is to boot with enforcing=0, but this seems complex, because it's a temporary option only for the first boot. I don't know if this is easily feasible (EFI can configure next entry, but legacy ...)

Anyway, the relabel function should be fixed also.

Thank you !

Benoit

Comment 3 Pavel Cahyna 2021-11-04 09:40:17 UTC
Yes, but I am curious if you know under which conditions this does or does not happen, because I thought that ReaR in general relies on relabeling, not restoration of labels - but apparently I was wrong. If you don't know, no problem, I will investigate.

Comment 4 Welterlen Benoit 2021-11-04 09:46:14 UTC
The root cause is that autorelabel can't be reliable anymore in RHEL8.4 because systemd is not able to access unlabelled files any more, and fails before the relabel if /etc/localtime is not labelled for example !

I opened this BZ against rear because I saw the issue with it, and wondering if the workaround can be automatically applied by rear, or at least a warning before the reboot:
if at the end of the process, /etc/localtime is not labelled and selinux in enforcing, WARNING to run the first boot with enforcing=0 to allow the relabel.

But I will also open a BZ against selinux to improve the autorelabel process.

Thank you !

Comment 5 Welterlen Benoit 2021-11-12 08:11:47 UTC
Hello,

I opened a BZ against selinux, and it seems not possible to start autorelabel earlier: https://bugzilla.redhat.com/show_bug.cgi?id=2021835

The specific answer for rear will be to restore the labels before the first reboot:

  # setfiles -c /mnt/local/etc/selinux/target/policy/policy.32 -r /mnt/local/ /mnt/local/etc/selinux/targeted/contexts/files/file_contexts /mnt/local

Thank you !

Benoit

Comment 14 RHEL Program Management 2023-09-21 23:35:58 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 15 RHEL Program Management 2023-09-21 23:39:49 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.

Comment 16 Red Hat Bugzilla 2024-01-20 04:25:13 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


Note You need to log in before you can comment on or make changes to this bug.