Comment 3 for bug 1639222

Revision history for this message
Oliver Kurth (okurth-1) wrote :

Is there an update on this bug? We are hiting this issue frequently when testing open-vm-tools-desktop (version 2:10.1.10-2) with Ubuntu 17.10.

The root cause for this issue is escaping. run-vmblock\x2dfuse.mount is used in multiple places in the prerm, postrm and postinst scripts, and in most cases insufficiently escaped. Two backslashes are needed:

vmware@vmware-virtual-machine:~$ cat test.sh
#!/bin/sh

echo systemctl start run-vmblockx2dfuse.mount
systemctl start run-vmblockx2dfuse.mount

echo systemctl start run-vmblock\x2dfuse.mount
systemctl start run-vmblock\x2dfuse.mount

echo systemctl start run-vmblock\\x2dfuse.mount
systemctl start run-vmblock\\x2dfuse.mount

vmware@vmware-virtual-machine:~$ sudo ./test.sh
systemctl start run-vmblockx2dfuse.mount
Failed to start run-vmblockx2dfuse.mount: Unit run-vmblockx2dfuse.mount not found.
systemctl start run-vmblockx2dfuse.mount
Failed to start run-vmblockx2dfuse.mount: Unit run-vmblockx2dfuse.mount not found.
systemctl start run-vmblock\x2dfuse.mount
vmware@vmware-virtual-machine:~$

To elaborate on the previous comment why there is \x2d in the filename - this is a requirement for systemd. The mount point is /run/vmblock-fuse (with a plain '-'), but dashes in the mount file name will be converted to '/'. Hence we need to protect the dash by escaping it.

I am confused by the postinst script snippet copied in the bug description - it's not what I have - note that thee are only single backslashes:

#!/bin/sh
set -e

# load the fuse module just in case its missing
if ! lsmod | grep -qE '^fuse\s+'; then
    modprobe fuse || true
fi

# Automatically added by dh_systemd_enable/10.7.2ubuntu2
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask run-vmblock\x2dfuse.mount >/dev/null || true

# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled run-vmblock\x2dfuse.mount; then
        # Enables the unit on first installation, creates new
        # symlinks on upgrades if the unit file has changed.
        deb-systemd-helper enable run-vmblock\x2dfuse.mount >/dev/null || true
else
        # Update the statefile to add new symlinks (if any), which need to be
        # cleaned up on purge. Also remove old symlinks.
        deb-systemd-helper update-state run-vmblock\x2dfuse.mount >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installinit/10.7.2ubuntu2
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
        # In case this system is running systemd, we need to ensure that all
        # necessary tmpfiles (if any) are created before starting.
        if [ -d /run/systemd/system ] ; then
                systemd-tmpfiles --create /usr/lib/tmpfiles.d/open-vm-tools-desktop.conf >/dev/null || true
        fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/10.7.2ubuntu2
if [ -d /run/systemd/system ]; then
        systemctl --system daemon-reload >/dev/null || true
        deb-systemd-invoke start run-vmblock\x2dfuse.mount >/dev/null || true
fi
# End automatically added section