0

Brief question: Docker, Ubuntu 16.04, auto-security-upgrades & reboot. Then how can I ensure the newest linux-image-extra-`uname -r` has been installed before Docker attempts to start the containers after an auto-security-upgrade-and-reboot?

Detailed question: (everything below)

I'm using Docker and Docker-Compose to deploy my web app. I've configured the Docker containers to start automatically on reboot. And, I've configured automatic security upgrades, including automatic restarts.

This means that every now and then, a new kernel gets automatically installed and the server reboots. After this, Docker will fail to start, because:

prior storage driver "aufs" failed: driver not supported

(says service docker start). To solve this, one needs to:

sudo apt-get install linux-image-extra-`uname -r`

So I've added this to crontab:

root@edgoew1dal16gandi:~# crontab -l
...
@reboot apt-get install linux-image-extra-`uname -r` 2>&1 >> /tmp/cron-edm.log

But this fails because: (I see in the /tmp/cron-edm.log file)

Err:1 http://security.ubuntu.com/ubuntu xenial-security/main
                amd64 linux-image-extra-4.4.0-24-generic amd64 4.4.0-24.43
  Temporary failure resolving 'europe-west1.gce.archive.ubuntu.com'

However if I run the command manually after reboot, then it works. Apparently, apt-get fails because it gets run too early after reboot?

Hence I'm wondering, how can I somehow do this:

apt-get install linux-image-extra-`uname -r`

automatically, after each server reboot, and before Docker starts, without this failing because of the above "Temporary failure ..." error?

KajMagnus
  • 375
  • 1
  • 4
  • 14

1 Answers1

2

You have to install the virtual package for the current kernel. linux-image-extra-.* should be a dependency then.

So when you have installed the generic kernel, you should have the linux-image-generic package installed. It depends on the current linux-image-extra-.* as you can see here.

This is not a normal problem by the way. It should usually just work.

Christopher Perrin
  • 4,741
  • 17
  • 32
  • 1
    Works fine: I see in `/var/log/apt/history.log` that my servers have recently installed a new kernel, as part of an automatic security update. And since I've added `linux-image-generic`, the correct `linux-mage-extra...` got installed too, so Docker never stopped working. — Previously, on my Google Compute Engine Ubuntu 16.04 servers, Docker always stopped working, after auto security upgrades that installed new kernels. On my Linux Mint laptop too as far as I can remember. – KajMagnus Jul 16 '16 at 17:57