When installing Virtualmin, the install script may stop with the following error:

/tmp directory is mounted noexec. Installation cannot continue.

Virtualmin /tmp NoExec

The error is caused by the noexec option been set for the /tmp mount point as a way of security protection against unauthorized access. With noexec flag, you cannot run or execute binaries and executable that are on the partition. Normally, noexec option is normally set in /etc/fstab configuration file, while one can also mount a filesystem manually with noexec option.

Resolution

To fix the issue so that Virtualmin can be installed, just make the /tmp executable. To do so, type the following commands:

mount -o remount,exec /tmp

Then, restart the Virtualmin installation.

After installation, you can apply noexec flag onto /tmp again with:

mount -o remount,noexec /tmp

Process above required that you have root privileges. If you don’t, you can modify the Virtualmin install.sh script to bypass the noexec check and assign a new temporary directory for Virtualmin which execution is allowed.

Firstly, disable the noexec by commenting the corresponding code.

Search:

TMPNOEXEC=`grep /tmp /etc/mtab | grep noexec`
if [ "$TMPNOEXEC" != "" ]; then
        echo "/tmp directory is mounted noexec.  Installation cannot continue."
        exit 1
fi

Replace with:

#TMPNOEXEC=`grep /tmp /etc/mtab | grep noexec`
#if [ "$TMPNOEXEC" != "" ]; then
#        echo "/tmp directory is mounted noexec.  Installation cannot continue."
#        exit 1
#fi

Then, set a temporary temp directory

Search:

if [ "$TMPDIR" = "" ]; then
        TMPDIR=/tmp
fi

Replace with (enter a valid path for /your-preferred-tmp-directory, e.g. /temp or /home/tmp):

if [ "$TMPDIR" = "" ]; then
        TMPDIR=/your-preferred-tmp-directory
fi

Save the install.sh and run the Virtual installation.