Adding aufs support to Ubuntu LTS 14.04 with 3.16-rc5 kernel

Adding aufs support to 3.16-rc5 is little different than what is was for older kernels. Below works for Ubuntu LTS 14.04.



# Switch to mainline kernel without Ubuntu patches
# We do this so we have "known good" kernel to troubleshoot
# if something goes wrong and also for suitable kernel config file
mkdir -p /opt/src/3.16rc5
cd /opt/src/3.16rc5
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16-rc5-utopic/linux-headers-3.16.0-031600rc5-generic_3.16.0-031600rc5.201407131735_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16-rc5-utopic/linux-headers-3.16.0-031600rc5_3.16.0-031600rc5.201407131735_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16-rc5-utopic/linux-image-3.16.0-031600rc5-generic_3.16.0-031600rc5.201407131735_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16-rc5-utopic/0001-base-packaging.patch
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16-rc5-utopic/0002-debian-changelog.patch
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16-rc5-utopic/0003-configs-based-on-Ubuntu-3.16.0-3.8.patch
dpkg -i linux-*3.16*.deb
 
# Deps for compiling kernel
apt-get update
apt-get -y install git-core kernel-package fakeroot build-essential ncurses-dev
 
# Download aufs, must match with kernel installed
mkdir -p /opt/src/aufs
cd /opt/src/aufs
git clone git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git aufs3-standalone.git
cd aufs3-standalone.git
#git checkout origin/aufs3.x-rcN
git checkout 501539c
 
# Get kernel source
mkdir -p /opt/src/3.16rc5aufs
cd /opt/src/3.16rc5aufs
wget https://www.kernel.org/pub/linux/kernel/v3.x/testing/linux-3.16-rc5.tar.gz
 
# Extract and patch with Ubuntu configs
tar xvzf linux-3.16-rc5.tar.gz
cd linux-3.16-rc5
patch -p1 </opt/src/3.16rc5/0001-base-packaging.patch
patch -p1 </opt/src/3.16rc5/0002-debian-changelog.patch
patch -p1 </opt/src/3.16rc5/0003-configs-based-on-Ubuntu-3.16.0-3.8.patch
 
# Apply aufs patches
patch -p1 </opt/src/aufs/aufs3-standalone.git/aufs3-base.patch
patch -p1 </opt/src/aufs/aufs3-standalone.git/aufs3-standalone.patch
patch -p1 </opt/src/aufs/aufs3-standalone.git/aufs3-mmap.patch

# Compile kernel and generate new dpkgs
cp /boot/config-3.16.0-031600rc5-generic .config
make olddefconfig
CONCURRENCY_LEVEL=4 fakeroot make-kpkg --initrd --append-to-version=-aufs kernel_image kernel_headers
 
# Install new kernel
cd ..
dpkg -i linux-headers-3.16.0-rc5-aufs_3.16.0-rc5-aufs-10.00.Custom_amd64.deb \
        linux-image-3.16.0-rc5-aufs_3.16.0-rc5-aufs-10.00.Custom_amd64.deb
 
# Prevent future kernel updates breaking things
echo "linux-image-3.16.0-rc5-aufs hold"             | dpkg --set-selections
echo "linux-headers-3.16.0-rc5-aufs hold"           | dpkg --set-selections
echo "linux-image-3.16.0-031600rc5-generic hold"    | dpkg --set-selections
echo "linux-headers-3.16.0-031600rc5-generic hold"  | dpkg --set-selections
 
# For new Ubuntu versions with silly grub submenu layout
# https://help.ubuntu.com/community/Grub2/Submenus#Setting_a_Submenu_entry_as_the_default
sed -i.bak /etc/default/grub \
    -e's|^GRUB_DEFAULT=.*|GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 3.16.0-rc5-aufs"|g'
 
# and run update-grub
update-grub
 
# Reboot

# Next aufs module
cd /opt/src/aufs/aufs3-standalone.git/
 
# Enable hnotify, allows direct access to branches bypassing aufs
sed -i.bak config.mk \
    -e's|^CONFIG_AUFS_HNOTIFY.*|CONFIG_AUFS_HNOTIFY = y|g' \
    -e's|^CONFIG_AUFS_HFSNOTIFY.*|CONFIG_AUFS_HFSNOTIFY = y|g'
 
# Fix missing binary that prevents compiling aufs
cd /opt/src/3.16rc5aufs/linux-3.16-rc5/scripts/
gcc unifdef.c -o unifdef
cd -
 
# Compile aufs
make
 
# Install aufs
make install
depmod -a
 
# We skip aufs-utils install as they're not needed

Comments

  1. I hope this comment finds you in good health and well being; thank you very much for providing this information. I had come into complications trying to boot isos created with remastersys and it was because there was no aufs support. I will be able to sleep tonight!

    ReplyDelete
  2. May you please adapt instructions to work for kernel 3.17 or 3.17.1? - I am unable to compile aufs-standalone after compiling kernel. I type make and there are errors.

    ReplyDelete
    Replies
    1. I used the same instructions, but, changing only the version.It works perfectly, without errors. you can skip the patching process of mainline kernel, they are already patched, you will need only the aufs patching process. You may change also the version of Linux makefile for the last three instruction to rcX-aufs, if no, you will get error during installation, complaining on no such directory. these are the main keys. Hope you get it. cheers.

      Delete
    2. Ouali, any chance you could clarify your answer?
      Just like 0E 800 above, I can compile (and boot) the new kernel, but when trying to build aufs-standalone I get errors (including:
      "scripts/Makefile:257: recipe for target '/opt/src/aufs/aufs3-standalone.git/fs/aufs/module.o' failed" and "Makefile:41: recipe for target 'fs/aufs/aufs.ko' failed". Any help is appreciated.

      Delete
    3. In case anyone's interested, my problem was solved by compiling 3.18 instead of 3.17. Aufs built without a hitch on the newer kernel.

      Delete

Post a Comment

Got something to say?!