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 1285805 - The rhel7.2 docker image sets systemd target to graphical.target
Summary: The rhel7.2 docker image sets systemd target to graphical.target
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rhel-server-container
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Frantisek Kluknavsky
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
: 1286665 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-26 14:03 UTC by Jan Pazdziora (Red Hat)
Modified: 2015-12-08 14:04 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1286787 1286812 (view as bug list)
Environment:
Last Closed: 2015-12-08 14:04:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2015:2575 0 normal SHIPPED_LIVE Red Hat Enterprise Linux 7.2.1 Container Image Update 2016-01-18 17:46:09 UTC

Description Jan Pazdziora (Red Hat) 2015-11-26 14:03:56 UTC
Description of problem:

With minimal container running systemd, error

Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.

is shown. It seems the default target is now graphical.target, not multi-user.target.

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

registry.access.redhat.com/rhel7.2   latest              6883d5422f4e

How reproducible:

Deterministic.

Steps to Reproduce:
1. docker run --name systemd -t -v /sys/fs/cgroup:/sys/fs/cgroup:ro -e container=docker rhel7.2 /usr/sbin/init
2. In another terminal docker exec -ti systemd systemctl get-default

Actual results:

graphical.target

Expected results:

multi-user.target

Additional info:

docker run --name systemd -t -v /sys/fs/cgroup:/sys/fs/cgroup:ro -e container=docker rhel7.1 /usr/sbin/init provides expected result, thus marking as regression. The dependencies for graphical.target do not seem to be there on the image, plus I'd argue graphical is not the generally expected target for containers.

Comment 1 Jan Pazdziora (Red Hat) 2015-11-26 14:18:22 UTC
Upon closer examination,

  # docker run --name systemd -t rhel7.2 ls -la /etc/systemd/system/default.target
  systemd
  lrwxrwxrwx. 1 root root 37 Nov 10 09:47 /etc/systemd/system/default.target -> /lib/systemd/system/multi-user.target

shows that the image contains the correct target.

However, systemd during initialization says 
Detected architecture x86-64.

Running with unpopulated /etc.

Welcome to Red Hat Enterprise Linux Server 7.2 (Maipo)!

Set hostname to <d9faac847dca>.
Initializing machine ID from random generator.
Populated /etc with preset unit settings.
Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.

which seems to be caused

                empty_etc = access("/etc/machine-id", F_OK) < 0;
                if (empty_etc)
                        log_info("Running with unpopulated /etc.");

and later

                if (empty_etc) {
                        r = unit_file_preset_all(UNIT_FILE_SYSTEM, false, NULL, UNIT_FILE_PRESET_FULL, false, NULL, 0);

So it looks like the problem is caused by machine-id not being populated.

This is with docker-1.8.2-8.el7.x86_64 in case the problem is in the docker itself.

Comment 2 Jan Pazdziora (Red Hat) 2015-11-26 14:22:22 UTC
Upgrading to docker-1.9.1-4.el7.x86_64 did not help.

Comment 3 Jan Pazdziora (Red Hat) 2015-11-26 14:26:12 UTC
Listing the environment variables of the /usr/sbin/init process (as seen on the host) does not show container_uuid to be set.

Comment 4 Frantisek Kluknavsky 2015-11-27 15:31:54 UTC
Leaving a valid /etc/machine-id in the image would break a lot of things. We can try to work around this by leaving an empty /etc/machine-id in the container, hopefully breaking not so many things.

Comment 6 Jan Pazdziora (Red Hat) 2015-11-27 16:15:06 UTC
(In reply to Frantisek Kluknavsky from comment #4)
> Leaving a valid /etc/machine-id in the image would break a lot of things. We
> can try to work around this by leaving an empty /etc/machine-id in the
> container, hopefully breaking not so many things.

I don't think that's the right fix.

IMHO the goal should be for /etc/machine-id to be populated by docker via the container_uuid mechanism which I believe was in place in the past.

Comment 7 Frantisek Kluknavsky 2015-11-30 19:14:49 UTC
I guess I can not do anything about it in the image, bug against docker filed: https://bugzilla.redhat.com/show_bug.cgi?id=1286787 (and https://bugzilla.redhat.com/show_bug.cgi?id=1286812)

Comment 8 Frantisek Kluknavsky 2015-12-01 12:35:47 UTC
*** Bug 1286665 has been marked as a duplicate of this bug. ***

Comment 10 Martin Jenner 2015-12-07 17:11:51 UTC
# docker run --name systemd -t -v /sys/fs/cgroup:/sys/fs/cgroup:ro -e container=docker registry.access.stage.redhat.com/rhel7.2:7.2-38 /usr/sbin/init


In another terminal 

# docker exec -ti systemd systemctl get-default
multi-user.target

Comment 12 errata-xmlrpc 2015-12-08 14:04:25 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, 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://rhn.redhat.com/errata/RHEA-2015-2575.html


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