Cannot add an iptables rule inside a container - "FATAL: Could not load /lib/modules/2.6.32-042stabXXX.X/modules.dep: No such file or directory"

Refers to:

  • Plesk 11.0 for Linux
  • Plesk 12.0 for Linux

Created:

2016-11-16 12:49:54 UTC

Modified:

2017-01-28 00:32:11 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Cannot add an iptables rule inside a container - "FATAL: Could not load /lib/modules/2.6.32-042stabXXX.X/modules.dep: No such file or directory"

Symptoms

Upon trying to add a firewall rule inside a container a similar error is observed:

# iptables -A OUTPUT -p tcp -m multiport --port 80,443 -m state --state NEW -j LOG --log-level debug --log-prefix "OutputHHTP"
FATAL: Could not load /lib/modules/2.6.32-042stab093.4/modules.dep: No such file or directory

Cause

Necessary "/lib/modules/*" directory inside the container is missing.It should contain the directory named after presently loaded vzkernel:

Healthy container should look like this:

# vzctl exec 101 ls /lib/modules/
2.6.32-042stab088.4
2.6.32-042stab090.4
2.6.32-042stab092.3
2.6.32-042stab093.4

While in the affected container may look like this:

# vzctl exec 101 ls /lib/modules/
2.6.32-279.el6.x86_64
2.6.32-431.29.2.el6.x86_64

Resolution

  1. Make sure there is a " /etc/init.d/modules_dep " file inside the container:

    # vzctl enter 101
    entered into Container 101
    CT-101-bash-4.1# ls -la /etc/init.d/modules_dep
    -rwxr-xr-x 1 root root 1128 Sep 18 09:53 /etc/init.d/modules_dep
    CT-101-bash-4.1#
  2. If this file is missing, copy it from a healthy neighbor container of the same OS version and same architecture.

  3. Assign proper permissions:

    CT-101-bash-4.1# chmod 0755 /etc/init.d/modules_dep
  4. Re-create `"/lib/modules/2.6.32-042stabXXX.X/" directory:

    CT-101-bash-4.1# /etc/init.d/modules_dep reload
Have more questions? Submit a request
Please sign in to leave a comment.