Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-119795

Httpd cannot start on bootc image mode with a dedicated /var

Linking RHIVOS CVEs to...Migration: Automation ...RHELPRIO AssignedTeam ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • rhel-10.2
    • rhel-9.6
    • httpd
    • None
    • rhel-stacks-web-servers
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • All
    • None

      What were you trying to do that didn't work?

      httpd does not work out-of-the-box on bootc image mode when there is a dedicated /var (or /var/log). /var/log/httpd being not present, the service fails at startup. The issue is likely the same on RHEL 10. Feel free to move this bug to the `rhel-bootc-container` component if needed.

      What is the impact of this issue to you?

      Evaluation of the product.

      Please provide the package NVR for which the bug is seen:

      httpd-2.4.62-4.el9_6.4.x86_64

      How reproducible is this bug?:

      Always

      Steps to reproduce

      • Use a Containerfile that installs `httpd`
      FROM registry.redhat.io/rhel9/rhel-bootc:latest
      RUN dnf update -y && dnf -y install httpd && dnf clean all
      RUN systemctl enable --now httpd
      RUN bootc container lint 
      • Deploy it with a kickstart using `ostreecontainer` on a system with a dedicated /var (and optionally /var/log)
      • Start the httpd service and observe the errors.

      Expected results

      httpd is up and running with image mode.

      Actual results

      ### httpd unit logs
      Oct 08 10:13:51 localhost.localdomain httpd[3008]: (2)No such file or directory: AH02291: Cannot access directory '/etc/httpd/logs/' for main error log
      Oct 08 10:13:51 localhost.localdomain httpd[3008]: AH00014: Configuration check failed
      Oct 08 10:13:51 localhost.localdomain systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
      
      # ls -l /etc/httpd/logs /var/log/httpd
      ls: cannot access '/var/log/httpd': No such file or directory
      lrwxrwxrwx. 1 root root 19 Oct  7 14:27 /etc/httpd/logs -> ../../var/log/httpd
      

      Suggested workaround

      Create the missing directories using systemd-tmpfiles.d if they don't already exist.
      NOTE: this list might be non-exhaustive.

      # mkdir -p overlay/usr/local/lib/tmpfiles.d
      # cat << EOF > overlay/usr/local/lib/tmpfiles.d/bootc-extra.conf 
      d /var/www    0755    root    root    -    -
      Z /var/www    -    -    -    -    -
      d /var/www/cgi-bin    0755    root    root    -    -
      Z /var/www/cgi-bin    -    -    -    -    -
      d /var/www/html    0755    root    root    -    -
      Z /var/www/html    -    -    -    -    -
      D /var/lib/httpd    0700    apache    apache    -    -
      Z /var/lib/httpd    -    -    -    -    -
      d /var/log/httpd    0700    root    root    -    -
      Z /var/log/httpd    -    -    -    -    -
      EOF
      

      And then append the following line to your Containerfile:

      COPY overlay/ /

              luhliari@redhat.com Lubos Uhliarik
              rhn-support-cbesson Christophe Besson
              Lubos Uhliarik Lubos Uhliarik
              Branislav Náter Branislav Náter
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: