How to enable AUFS on Debian?

18,350

Solution 1

aufs is not supported by modern kernels, so you should skip to overlayfs from aufs. Just restart your docker daemon with the option:

--storage-driver=overlay2

(or add this option to /etc/default/docker)

In some systems you should add the processing of the file /etc/default/docker to start procedure by creating /etc/systemd/system/docker.service with content:

[Service]
EnvironmentFile=-/etc/default/docker
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// $OPTIONS \
      $DOCKER_STORAGE_OPTIONS \
      $DOCKER_NETWORK_OPTIONS \
      $BLOCK_REGISTRY \
      $INSECURE_REGISTRY \
      $DOCKER_OPTS

More info here

Execute

systemctl daemon-reload

for changes to take effect.

Caution! All your images become unreachable. If you want to keep them, just save and reload them. You can find the good description here

UPD. I've changed overlay to overlay2 because it solves a little bit more problem than described here

UDP. Not relevant, since overlay2 used by default in modern version of docker (18-06).

Solution 2

Actually installing a stock jessie gives you a kernel that comes with aufs support. My guess is you upgraded to a higher kernel version through jessie-backports which is not not the standard jessie setup.

This was tested with current Debian jessie 8.7.1 amd64 and kernel 3.16.0.4.

# cat /etc/debian_version
8.7
# dpkg --get-selections | grep linux-image
linux-image-3.16.0-4-amd64          install
linux-image-amd64                   install

# dpkg -L linux-image-3.16.0-4-amd64 | grep aufs
/lib/modules/3.16.0-4-amd64/kernel/fs/aufs
/lib/modules/3.16.0-4-amd64/kernel/fs/aufs/aufs.ko

So to answer your question:

You could re-install Debian Jessie or down-grade to the default kernel and you have a jessie with aufs support.

For installing aufs on Debian 9 aka Debian stretch one just have to issue an apt-get install aufs-dkms. This is sadly not available for jessie-backports at this time.

At our company we are driving our docker hosts with an jessie aufs setup and everything is running flawlessly.

Update 08-2018

Even now I can not recommend overlay2 for production. We currently have an issue with containers where mysql is not able to create the /var/run/mysqld.sock when running in a container with the overlay2 storage.

This is addressed in this one year old issue as of August 2018.

Share:
18,350
Oliver Salzburg
Author by

Oliver Salzburg

Never forget: :w !sudo tee % Save a file in vim when you neglected to open the file with sudo but already made changes you don't want to lose. Ctrl+X,* Evaluate globbing on your current input on the bash command line. postfix flush Pump out the postfix queue on your backup MX after you've fixed the issue with your primary MX. git tag -l | xargs -n 1 git push --delete origin; git tag | xargs git tag -d Delete all tags from a git repo - remotely and locally. sudo apt-get purge $(for tag in "linux-image" "linux-headers"; do dpkg-query -W -f'${Package}\n' "$tag-[0-9]*.[0-9]*.[0-9]*" | sort -V | awk 'index($0,c){exit} //' c=$(uname -r | cut -d- -f1,2); done) Delete old kernels https://signup.microsoft.com/productkeystart Register new Office 365 product keys for an existing tenant.

Updated on July 18, 2022

Comments

  • Oliver Salzburg
    Oliver Salzburg over 1 year

    When I try to install docker via:

    curl -sSL https://get.docker.com/ | sh
    

    I get the message:

    Warning: current kernel is not supported by the linux-image-extra-virtual package. We have no AUFS support. Consider installing the packages linux-image-virtual kernel and linux-image-extra-virtual for AUFS support.

    However, neither package seems to exist on Debian Jessie:

    # apt-get install linux-image-virtual linux-image-extra-virtual
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package linux-image-virtual
    E: Unable to locate package linux-image-extra-virtual
    

    What am I missing here?

  • Oliver Salzburg
    Oliver Salzburg over 7 years
    A package like that doesn't seem to exist: packages.debian.org/jessie/linux-image-extra
  • jfornoff
    jfornoff over 7 years
    You are right, I was assuming it is analogous to Ubuntu. What does uname -a tell? And on which infrastructure are you trying to run docker? Some virtualization environments are having problems with the lxc / AUFS business.
  • Oliver Salzburg
    Oliver Salzburg over 7 years
    uname -a prints Linux server.name 4.4.8-x86_64-jb1 #1 SMP Thu Apr 21 08:07:36 CEST 2016 x86_64 GNU/Linux. I'm not quite sure what our provider uses, but the server itself is virtual.
  • jfornoff
    jfornoff over 7 years
    It seems to be a known thing with Debian Jessie, AUFS is not included in upstream kernels from what I have read. Try mv /var/lib/docker/aufs /var/lib/docker/aufs_bk and restart your Docker daemon. Apparently Docker is smart enough to use another filesystem from AUFS. Alternatively you can start the Docker daemon with the --storage-driver parameter to manually specify another.
  • Oliver Salzburg
    Oliver Salzburg over 7 years
    Well, it seems like AUFS isn't really required for Docker to function, as the Gitlab CI is now running fine with the Docker executor. I just thought this would be a bit cleaner. Thanks for your efforts!
  • itsafire
    itsafire almost 7 years
    As of now (January 2017) overlayfs is not considered production ready. Please consult docs.docker.com/engine/userguide/storagedriver/selectadriver
  • AstraSerg
    AstraSerg almost 7 years
    @itsafire Can't find info about production readiness on those page. Could you edit your link adding anchor (#) to the exact chapter?
  • itsafire
    itsafire almost 7 years
    I'd added the anchor, but there is none available. Read down to Future-proofing or find the text ` Many people consider OverlayFS as the future... There you will find a nice chart with pros and cons of all those device drivers.
  • AstraSerg
    AstraSerg almost 7 years
    O, now I see, sorry. But the key of my answer is aufs is not supported by modern kernels You may say that there is devicemapper, but many people prefer overlay, just google overlay vs devicemapper
  • itsafire
    itsafire almost 7 years
    The subject of the original question is about aufs and not devicemapper. Even the upcoming debian stretch with kernel 4.8 will have support for aufs by installing it via apt-get install aufs-dkms.
  • AstraSerg
    AstraSerg almost 7 years
    I believe it is better to use modern driver than return to system dropped one.
  • itsafire
    itsafire almost 7 years
    It is not dropped. Modern is good. But keeping an eye on recommendations by the manufacturer is also good. Everyone takes his side.
  • AstraSerg
    AstraSerg almost 7 years
    Sorry, I used an inaccurate word. As written in wikipedia AUFS was rejected:aufs was rejected for merging into mainline Linux. Its code was criticized for being "dense, unreadable, and uncommented". Instead, OverlayFS was merged in the Linux kernel.
  • emi
    emi over 6 years
    If you had Docker running, you probably had some layers on your machine. When switching to OverlayFS, you have to move away aufs stuff before Docker accepts to start: service docker stop && umount /var/lib/docker/aufs && mv /var/lib/docker/aufs /var/lib_docker_aufs