"Could not open moddep file '/lib/modules/3.XX-generic/modules.dep.bin'" when mounting using a loop

Running 14.04 in virtualbox 4.3.8

Unable to detect the guest additions.iso when i selected the guest additions.iso in the IDE Secondary Master.

No problem, so I used wget and downloaded the iso into the guest ubuntu headless.

when I attempt to load the iso from inside using these commands:

sudo mkdir /media/iso
sudo modprobe loop
sudo mount filename.iso /media/iso -t iso9660 -o loop

At the sudo modprobe loop, I got the following error:

modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/3.13.0-24-generic/modules.dep.bin'

Here are my lsb_release -a:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04 LTS
Release:    14.04
Codename:   trusty

EDIT:

When I typed

ls /lib/modules/*/modules.dep.bin

I get back

/lib/modules/3.11.0-20-generic/modules.dep.bin  /lib/modules/3.13.0-24-generic/mo‌​dules.dep.bin /lib/modules/3.5.0-49-generic/modules.dep.bin

Solution 1:

Thanks to Braiam comments, I have solved it using

sudo apt-get install --reinstall linux-image-3.13.0

Solution 2:

No need to reinstall linux image

sudo depmod

works fine for me. credit goes to @pabouk

Solution 3:

It may be system changes waiting for a reboot after updates. My installation was pointing to the wrong /lib/modules/<version>, but it worked itself out after a reboot.

#:/ $ sudo modinfo iptable_nat
libkmod: ERROR ../libkmod/libkmod.c:557 kmod_search_moddep: could not open moddep file '/lib/modules/4.1.18+/modules.dep.bin'
modinfo: ERROR: Module alias iptable_nat not found.

Solution 4:

 # apt-get install --reinstall linux-image-`uname -r`

This will do the trick unless you want to upgrade your kernel.

Solution 5:

In my case on a raspberry 3b+ running on the raspbian OS, trying to run a cryptsetup command which uses dm_mod in the kernel, which was not included in my kernel, this helped without needing a re-flash of the raspberry:

sudo apt-get install --reinstall --yes raspberrypi-bootloader raspberrypi-kernel
sudo reboot

Taken from this thread: https://www.raspberrypi.org/forums/viewtopic.php?t=282802

My cryptsetup command worked afterwards, while having the same error like OP stated: Cannot initialize device-mapper. Is dm_mod kernel module loaded? previously.