Bug 1467939 - Fatal error during installation after setting /var as a mountpoint
Fatal error during installation after setting /var as a mountpoint
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: systemd-maint
: Extras
Depends On:
  Show dependency treegraph
Reported: 2017-07-05 10:45 EDT by Michael Nguyen
Modified: 2017-07-10 11:04 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
/tmp/anaconda.log file (29.67 KB, text/plain)
2017-07-05 11:22 EDT, Michael Nguyen
no flags Details

  None (edit)
Description Michael Nguyen 2017-07-05 10:45:28 EDT
Description of problem:
Receiving a fatal error after setting up the disk to have /var in a separate partition.

Version-Release number of selected component (if applicable):
RHEL Atomic Host 7.4
Checksum: 8018f95c2f2f38a79e68f174dd5888b53769c0e4adcd89c87a802219091c9d0e

How reproducible:

Steps to Reproduce:
1.  Boot up 7.4 ISO to Anaconda installer
2.  Select US English language/keyboard.
3.  Select 'Installation Destination'
4.  Select 'I will configure partitioning' under 'Other storage options'
5.  Click Done
6.  Click 'Click here to create them automatically'
7.  Click + and add /var as a mountpoint with a valid capacity for your configuration.  I used 5GiB.
8.  Click Done and confirm the changes.
9.  Click on 'Begin Installation'

Actual results:
The following error occurred while installing.  This is a fatal error and installation will be aborted.

systemd-tmpfiles ['--create', '--boot', '--root=/mnt/sysimage/ostree/deploy/rhel-atomic-host/deploy/8018f95c2f2f38a79e68f174dd5888b53769c0e4adcd89c87a802219091c9d0e.0', '--prefix=/var/lib/rpm'] exited with code 1

Expected results:
Successful installation of Atomic Host

Additional info:
I am installing through libvirt using the 7.4 Installation ISO.
Comment 2 Michael Nguyen 2017-07-05 11:22 EDT
Created attachment 1294657 [details]
/tmp/anaconda.log file
Comment 4 Colin Walters 2017-07-05 18:09:20 EDT
I noticed while debugging this that the systemd-tmpfiles we have is sort of ignoring `--prefix`; I get a bunch of files created if I do `--prefix=/var/home`.  But, things do succeed if I entirely drop `--prefix`.

The systemd in e.g. F26 works correctly with this.
Comment 5 Colin Walters 2017-07-05 21:37:24 EDT
I also confirmed that the RHEL 7.3 systemd-tmpfiles honors --prefix correctly.
Comment 6 Colin Walters 2017-07-07 17:30:12 EDT
So this patch gets us past the bug:

diff --git a/pyanaconda/packaging/rpmostreepayload.py b/pyanaconda/packaging/rpmostreepayload.py
index da7650d3b..003f3a05f 100644
--- a/pyanaconda/packaging/rpmostreepayload.py
+++ b/pyanaconda/packaging/rpmostreepayload.py
@@ -300,8 +300,12 @@ class RPMOSTreePayload(ArchivePayload):
         # matching NSS configuration inside Anaconda, and we can't "chroot" to
         # get it because that would require mounting the API filesystems in the
         # target.
-        for varsubdir in ('home', 'roothome', 'lib/rpm', 'opt', 'srv',
-                          'usrlocal', 'mnt', 'media', 'spool/mail'):
+        # Note this version differs from Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1467939
+        rpmdblink = iutil.getSysroot() + '/var/lib/rpm'
+        iutil.mkdirChain(os.path.dirname(rpmdblink))
+        os.symlink('../../usr/share/rpm', rpmdblink)
+        for varsubdir in ('home', 'roothome', 'opt', 'srv',
+                          'usrlocal', 'mnt', 'media'):
                                        ["--create", "--boot", "--root=" + iutil.getSysroot(),
                                         "--prefix=/var/" + varsubdir])

But...it reveals other bugs in Anaconda here; this bug seems worse in RHEL:

The kickstart workaround isn't bad, but the UX if you go through the interactive path is awful since, well, you can't log in to fix it (without init=/bin/sh).

So big picture, I think this is going to need a round of fixes in Fedora and we should try 7.5.

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