+
Skip to content

ansible.posix.mount cannot unmount directories mounted with --rbind and --make-rslave options for chroot environment #644

Open
@tedheadster

Description

@tedheadster
SUMMARY

You cannot unmount a directory using ansible.posix.mount with "state: unmounted" that has been mounted this way:

mount --rbind /dev /mnt/dev
mount --make-rslave /mnt/dev

However, performing "/usr/bin/umount -R /mnt/dev" works fine.

Setting "opts: -R" does not work either.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible.posix.mount

ANSIBLE VERSION
ansible [core 2.14.18]
  config file = /root/ansible-install-gentoo/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Sep 14 2024, 03:00:30) [GCC 12.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True


COLLECTION VERSION
# /usr/lib/python3/dist-packages/ansible_collections
Collection    Version
------------- -------
ansible.posix 1.5.4

CONFIGURATION
CALLBACKS_ENABLED(/root/ansible-install-gentoo/ansible.cfg) = ['profile_tasks']
CONFIG_FILE() = /root/ansible-install-gentoo/ansible.cfg
DEFAULT_HOST_LIST(/root/ansible-install-gentoo/ansible.cfg) = ['/root/ansible-install-gentoo/inventory']
OS / ENVIRONMENT

Raspberry Pi OS
Linux raspberrypi 6.6.51+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 GNU/Linux

STEPS TO REPRODUCE

From the command line

mkdir -p /mnt
mount --rbind /sys /mnt/sys
mount --make-rslave /mnt/sys

    - name: "Unmount /mnt/sys"
      ansible.posix.mount:
        path: "/mnt/sys"
        opts: "-R"
        state: unmounted
EXPECTED RESULTS

It should successfully unmount the volume, recursively if necessary.

ACTUAL RESULTS

The mount fails to unmount, likely because of being mounted with --rbind and --make-rslave

TASK [Unmount /mnt/sys] ****************************************************************************************************
Friday 30 May 2025  17:39:15 +0000 (0:00:00.022)       0:00:00.022 ************
fatal: [/mnt -> /]: FAILED! => {"changed": false, "msg": "Error unmounting /mnt/sys: umount: /mnt/sys: target is busy.\n"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载