cpanel 11.38 virtfs

People that use cpanel, as their control panel of their servers, probably know about virtfs. In cpanel 11.38 virtfs got changed to improve security, and some other small changes. For those who don’t know what virtfs is:

VirtFS provides a jailed shell environment for the user, the good thing about this, is that the user can’t access data outside the users home directory.

Before cpanel 11.38 was released, the virtFS systems was only mounted if the user had jailed shell access, so hosts that didn’t allow users to use the shell, would never get the virtfs mountpoints.

After cpanel 11.38 was released, there was some changes to how virtfs works, both they increased the security (yay), but also when it’s mounted, sadly the system is bugged.

If a user have cron jobs defined, the virtfs mountpoints will get mounted, every single time the cron runs, this means that hosting providers that host a lot of magento sites, might see a lot of virtfs mounts if they run the commands df or mount

The whole problem is, that cpanel doesn’t unmount those virtfs drives after the cron is done executing, as well as the script:

/scripts/clear_orphaned_virtfs_mounts

Doesn’t work anymore, at least not as it should, because it often says, that there’s no mounts to be unmounted.

For now, until the bug is fixed, if you want to clean the virtfs mount points, you can run following command, which umounts the virtfs mountpoints if they’re not used. Keep in mind, that this is per user, so if you want to clean for all users, either enter the username manually into the line of code, or write some kind of script that loops over all users and execute the command:

/usr/local/cpanel/3rdparty/bin/perl -MCpanel::Filesys::Virtfs -e 'Cpanel::Filesys::Virtfs::clean_user_virtfs("user");'

Maybe it will get fixed in a later state, but for now I think there’s a huge backlog at cpanel with bugs, so it can take some time sadly.

But the above solution will work, if any want to create a script that loops over all users, please put it in the comments below, and I will add it to the post later on!