How to fix: “Error: /usr/sbin/lvectl destroy-and-recreate-all failed”

cagefsctl -M fails with error "Error: /usr/sbin/lvectl destroy-and-recreate-all failed"

Note: This may also be seen as error: “Ive_destroy: destroy operations are not allowed from LVE context” in kernel logs/on the hypervisor KVM.

I came across this error on a couple of new CloudLinux 8 servers running Plesk encountering users with newly imported/backup restored users from entering cagefs, with this error occurring when running cldiag --all

Check cagefs users can enter cagefs:
    FAILED: Command 'unset BASH_ENV; su '$user' -s /bin/bash -c 'echo -n "Logged in as: $(whoami) - $(id -u) "; [ "$(id -u)" == "10005" ] && ls /var/.cagefs'' returned non-zero exit status 1.; Output was: "su: cannot open session: Cannot make/remove an entry for the specified session"

CloudLinux’s documentation says it’s caused by a missing /var/.cagefs folder and said to run the following as sudo/root (make sure you do it):

mkdir -p /var/.cagefs
cagefsctl --force-update && cagefsctl -M

This however resulted in the following error:

cagefsctl --force-update && cagefsctl -M
Copying /var/www/cgi-bin/cgi_wrapper/cgi_wrapper to /usr/share/cagefs-skeleton/var/www/cgi-bin/cgi_wrapper/cgi_wrapper.orig.cagefs
Copying /usr/share/cagefs-plugins/plesk-cagefs/cgi_wrapper to /usr/share/cagefs-skeleton/var/www/cgi-bin/cgi_wrapper/cgi_wrapper
Copying /usr/share/cagefs-plugins/plesk-cagefs/cloudlinux_wrapper to /usr/share/cagefs-skeleton/var/www/cgi-bin/cgi_wrapper/cloudlinux_wrapper
Copying /usr/share/cagefs-plugins/plesk-cagefs/cloudlinux_wrapper to /var/www/cgi-bin/cgi_wrapper/cloudlinux_wrapper
Copying /usr/local/psa/bin/chrootsh to /usr/share/cagefs-skeleton/usr/local/psa/bin/chrootsh
Removed directory /usr/share/cagefs-skeleton/usr/libexec/dovecot
Updating users ...
Updating statuses of users ...
Error: /usr/sbin/lvectl destroy-and-recreate-all failed 

I logged into the server over SSH using a non-privileged user, and then elevate to root using su -, which meant that in order to fix this I needed to add my non-privileged user to the wheel group by running the following command as root, replacing $user with your username.

usermod -aG wheel $user

Then log out of SSH and log back in, and run the following:

sudo /usr/sbin/lvectl start
sudo cagefsctl -M
sudo reboot

Then, wait 30 seconds and log back in and run:

sudo cldiag --all

and you should get:

[...]
Check cagefs users can enter cagefs:

    OK: Several tested users really can enter cagefs

Check cagefs proxy commands configs are parsable:

    OK: Syntax looks fine. Files are parsable

Check cagefs virt.mp files syntax:

    OK: virt.mp files syntax is fine

Check MultiPHP system default php version:

    OK: MultiPHP system default PHP version is NOT alt-php. PHP Selector should work normally.

There are 0 errors found.
Exit mobile version