CONFIG_OVERLAY_FS_REDIRECT_DIR unset in Clear Linux 30950

This change was announced on the Clear Linux dev mailing list:

You can subscribe to the Clear Linux mailing list at https://lists.clearlinux.org/mailman/listinfo/dev.

As of Clear Linux version 30950, the kernel configuration CONFIG_OVERLAY_FS_REDIRECT_DIR has been unset. CONFIG_OVERLAY_FS_REDIRECT_DIR specifies the default behavior of the overlay module when renaming lower directories. This was done to resolve GitHub issues #1107, #1141 and #1044, all related to docker images and builds. This same problem is also described in a StackOverflow question.

Background:

According to the Linux Kconfig documentation and kernel documentation:

If this feature is disabled, then rename(2) on a lower or merged directory will fail with EXDEV (“Invalid cross-device link”).

Note, that redirects are not backward compatible. That is, mounting an overlay which has redirects on a kernel that doesn’t support this feature will have unexpected results.

For more information, see the “renaming directories” section of the kernel documentation on overlayfs.

Impact:

  • Overlayfs is used by the Docker storage engine for images. For Docker users, no action should be required.

  • For users with a manually created overlayfs filesystem, renaming directories in lowerdirs will no longer work. If your usage of overlayfs requires this functionality, see the instructions below to restore previous behavior.

Instructions to restore previous behavior:
Although redirect_dir has been disabled by default, it can be manually enabled on systems that require it by following these steps:

  1. Create the directory /etc/modprobe.d with the command:
    $ sudo mkdir -p /etc/modprobe.d

  2. Create an overlay-redirect-dir.conf file specifying options for the overlay module with the command:
    $ echo “options overlay redirect_dir=on” | sudo tee /etc/modprobe.d/overlay-redirect-dir.conf

  3. Unload and reload the overlay module with the command:
    $ sudo modprobe -r overlay && sudo modprobe overlay

Or, reboot the system with the command:
$ sudo reboot