0

I'm trying to install Kubernetes cluster using Kubespray. I get this error during script run time:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.2.0/modules.builtin'

I use for control plane and work node Ubuntu 22.04.

Do you know how I can fix this issue?

I use this OS: https://src.openvz.org/projects/OVZT/repos/ubuntu-22.04-x86_64-ez/browse

  • Crossposted: https://askubuntu.com/questions/1458004/no-such-file-or-directory-lib-modules-5-2-0-modules-builtin and https://superuser.com/questions/1772223/no-such-file-or-directory-lib-modules-5-2-0-modules-builtin – Thomas Ward Mar 06 '23 at 16:33

1 Answers1

0

Okay. i had the same error.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-01] (item=ip_vs) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs", "params": "", "state": "present"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-02] (item=ip_vs) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs", "params": "", "state": "present"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-03] (item=ip_vs) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs", "params": "", "state": "present"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-01] (item=ip_vs_rr) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs_rr", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs_rr", "params": "", "state": "present"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-03] (item=ip_vs_rr) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs_rr", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs_rr", "params": "", "state": "present"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-02] (item=ip_vs_rr) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs_rr", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs_rr", "params": "", "state": "present"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-01] (item=ip_vs_wrr) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs_wrr", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs_wrr", "params": "", "state": "present"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-03] (item=ip_vs_wrr) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs_wrr", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs_wrr", "params": "", "state": "present"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-02] (item=ip_vs_wrr) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs_wrr", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs_wrr", "params": "", "state": "present"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-01] (item=ip_vs_sh) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs_sh", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs_sh", "params": "", "state": "present"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-03] (item=ip_vs_sh) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs_sh", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs_sh", "params": "", "state": "present"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'
failed: [nl-k8-02] (item=ip_vs_sh) => {"ansible_loop_var": "item", "changed": false, "item": "ip_vs_sh", "msg": "[Errno 2] No such file or directory: '/lib/modules/5.15.0-73-generic/modules.builtin'", "name": "ip_vs_sh", "params": "", "state": "present"}

the reason was i tried to install k8s via kubespray inside lxd container. thats why of course the folder /lib/modules was empty inside lxd container.

i dont know your case but:

  • if you try to install k8s on usual linux host then file "modules.builtin" is a part of package "linux-modules-5.2.0-generic"
  • if you try to install k8s inside lxd container then go back to the main host and load the following kernel modules:
    br_netfilter
    ip_vs
    ip_vs_rr
    ip_vs_wrr
    ip_vs_sh
    nf_conntrack

to be sure they are loaded every host boot use the following

# cat /etc/modules-load.d/modules.conf  | grep -v '#'

br_netfilter
ip_vs
ip_vs_rr
ip_vs_wrr
ip_vs_sh
nf_conntrack

#  systemctl restart systemd-modules-load
#  systemctl status  systemd-modules-load

the file in ansible that generates the error is the following:

$kubespray_folder/kubespray/roles/kubernetes/node/tasks/main.yml

hope it helps as it has done to me

Alex
  • 290
  • 3
  • 7