At PrenHost, we often encounter unique system administration challenges when managing cPanel/WHM servers running on CloudLinux. Recently, we faced a common but frustrating issue: the removeacct
command was failing due to a broken CloudLinux prekillacct
hook.
The Problem
When attempting to remove a cPanel account, the process was denied by a CloudLinux hook:
/scripts/removeacct username
Failed to execute hook /usr/share/cloudlinux/hooks/cpanel/prekillacct
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/cloudlinux/hooks/listeners/wpos_user_dirs_hook.py'
The error indicated that a required listener (wpos_user_dirs_hook.py
) was missing or misconfigured. This is part of AccelerateWP integration, which uses CloudLinux’s hook system.
The Root Cause
The symlink /usr/share/cloudlinux/hooks/listeners/wpos_user_dirs_hook.py
pointed to a Python package inside CloudLinux’s virtual environment, but the file was either missing or the venv was out of sync. As a result, the hook script crashed, preventing account removal.
The Solution
After troubleshooting, we found the quickest and cleanest fix was to reinstall the required CloudLinux components:
yum reinstall accelerate-wp lve-utils
yum install accelerate-wp
These two commands:
- Reinstalled the AccelerateWP package, which restores missing hook listeners.
- Reinstalled lve-utils, ensuring CloudLinux utilities and dependencies were in sync.
After this, the missing file issue was resolved, and the prekillacct
hook functioned correctly.
Final Steps
- Confirm the listener exists:
ls -l /usr/share/cloudlinux/hooks/listeners/wpos_user_dirs_hook.py
- Verify that the hook imports cleanly:
python3 -c "import importlib.util; p='/usr/share/cloudlinux/hooks/listeners/wpos_user_dirs_hook.py'; s=importlib.util.spec_from_file_location('wpos', p); m=importlib.util.module_from_spec(s); s.loader.exec_module(m); print('OK')"
- Re-run the account removal process.
Key Takeaway
If you run into CloudLinux prekillacct hook errors while removing accounts in WHM/cPanel, the fastest fix is to simply reinstall accelerate-wp
and lve-utils
. This restores missing hook files and gets your account management back on track.
At PrenHost, we document these fixes not only for our internal sysadmins but also to help the broader hosting community save valuable troubleshooting time.