4

I am trying to install docker on Ubuntu 20.04.3 LTS. I installing from *.deb packages. While installing docker, it runs into the following error.

Failed to mount overlay: no such device storage-driver=overlay2

I created

{
  "storage-driver": "overlay2"
}

as per https://docs.docker.com/storage/storagedriver/overlayfs-driver/ but that did not help either.

Edit 1:

lsmod | grep overlay returns empty.

sudo modprobe overlay' returns fatal error. In fact, there are no module files under /lib/modules/' for the 'uname -a' version of the kernel.

user3817287
  • 119
  • 1
  • 13
  • 1
    What's the result of `lsmod | grep overlay`? If the return is empty, try `sudo modprobe overlay` and then try to start docker. If this fixes the issue, you will then have to find out why this kernel module is not loaded by default when it should be. The most obvious is to look if it is not blacklisted in some file under `/etc/modprobe.d/*.conf`. Note: if the module is loaded by default, please do not reply in comments: edit your question. – Zeitounator May 04 '22 at 18:58
  • `lsmod | grep overlay` returns empty. `sudo modprobe overlay' returns fatal error. In fact, there are no module files under `/lib/modules/' for the 'uname -a' version of the kernel. – user3817287 May 04 '22 at 21:41
  • 1
    Do you have a `linux-modules-$(uname -r)` package installed? It holds the overlay module which should be present in `/lib/modules/$(uname -r)/kernel/fs/overlayfs/overlay.ko` – Zeitounator May 04 '22 at 22:00
  • 1
    If this was an upgrade, based on [this answer](https://serverfault.com/questions/1028682/iptables-kernel-module-missing-after-upgrade-from-ubuntu-18-04-20-04), I suggest you run `sudo apt-get install --reinstall linux-modules-$(uname -r)` to see if it fixes your issue. – Zeitounator May 04 '22 at 22:04
  • It does not have `linux-modules-$(uname -r)` installed. I can't do `linux-modules-$(uname -r)` because this is a VM isolated from internet (although I can transfer data via other means into.) Are there any linux-module installation files from which we can install `/lib/module` files? I have been looking without success. – user3817287 May 04 '22 at 22:20
  • 1
    For example on [this apt mirror](http://fr.archive.ubuntu.com/ubuntu/pool/main/l/linux/) – Zeitounator May 04 '22 at 22:36

1 Answers1

8

for me the error was thrown when trying to start the docker.service, I found out that it was because I have upgraded the kernel and not yet rebooted the system, modprobe will fail with no error message, because the path /usr/lib/modules/$(uname -r)/ no longer exists.

I rebooted the system and the service starts normally again.

IMAD OUCHAIB
  • 141
  • 2
  • 7