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

Kickstart %post Mount Command Fails with "Mount Point Busy" in RHEL 9.5 and above

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

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-9.7
    • anaconda
    • None
    • Yes
    • Moderate
    • rhel-anaconda
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • x86_64
    • None

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

      Attempting to mount the installation media (e.g., /dev/sr0 or by label) during the `%post` (chroot) section of a Kickstart installation fails. While this was fully functional in RHEL 9.4, it now consistently fails in RHEL 9.5 and above.

      For example,

      %post --log=/root/ks-post.log
      
      mkdir /test
      
      # Using device name sr0 fails
      mount -v /dev/sr0 /test
      
      # Using device label RHEL-9-5-0-BaseOS-x86_64 fails
      # mount -v /dev/disk/by-label/RHEL-9-5-0-BaseOS-x86_64 /test
      
      %end
      

      We see the error in the kickstart post log file.

      # cat /root/ks-post.log
      mount: /test: /dev/sr0 already mounted or mount point busy.
      

      Workaround

      For the workaround we need to mount this device outside of chroot using the `%post --nochroot` option to mount this device and then use the `%post` to perform actual operation. The `umount` command work inside `%post` later on as seen below

      %post --nochroot --log=/mnt/sysimage/root/ks-post-nochroot.log
      
      # 1. Mount the device. The path on the final system (/mnt)
      # must be prefixed with the chroot target path (/mnt/sysroot).
      mount -v /dev/sr0 /mnt/sysroot/mnt
      
      %end
      
      %post --log=/root/ks-post.log
      
      <your post script commands here>
      
      # 2. Unmount the device from the installed system's mount point.
      umount -v /mnt
      
      %end
      

      What is the impact of this issue to you?

      This breaks existing kickstart scripts which is used to copy additional data, configuration files, or custom RPMs from the local media to the target system . We need to use Kickstart scripts with `%post --nochroot` blocks for the same tasks from RHEL 9.5 to RHEL 9.7

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

      Anaconda in RHEL 9.5, 9.6 and 9.7 ISO.

      How reproducible is this bug?:

      100% reproducible on RHEL 9.5, 9.6 and 9.7.

      Steps to reproduce

      1.  Perform a Kickstart installation of RHEL 9.5.
      2.  Include the following block in the Kickstart file:
        %post --log=/root/ks-post.log
        mkdir /test
        mount -v /dev/sr0 /test
        %end
        
      1.  After installation, review `/root/ks-post.log`

      Expected results

      The device should be mounted successfully to /test within the chroot environment.

      Actual results

      The mount command fails with the following `error: mount: /test: /dev/sr0 already mounted or mount point busy`.

              anaconda-maint-list anaconda-maint-list
              rhn-support-amepatil Ameya Patil
              anaconda-maint-list anaconda-maint-list
              Release Test Team Release Test Team
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: