← Back to team overview

cloud-init team mailing list archive

Re: cloud-init + overlayfs: after ubuntu trusty -> xenial upgrade, missing 'workdir'

 

On Wed, May 31, 2017 at 12:02 PM, Graham Leggett <minfrin@xxxxxxxx> wrote:

> Hi all,
>
> I have a cloud-init template that deploys an Ubuntu Trusty 14.04 machine
> that mounts an overlayfs at /var/spool/postfix, and this works great:
>
> fs_setup:
>   - label: postfix
>     device: /dev/xvde
>     filesystem: ext4
> mounts:
> - [ /dev/xvde, /mnt/postfix-overlay ]
> - [ overlayfs, /var/spool/postfix, "overlayfs",
> "defaults,lowerdir=/var/spool/postfix,upperdir=/mnt/postfix-overlay",
> "0", "2" ]
> mount_default_fields: [ None, None, "auto", "defaults,nobootwait", "0",
> "2” ]
>
> Upgrading the system image to Xenial 16.04 causes the overlayfs to fail to
> mount with the error “missing ‘workdir’”.
>
> Turns out, between Trusty and Xenial, the “workdir” directory in overlayfs
> went from optional to mandatory, and now the system no longer deploys.
>

Yes, the overlay module doesn't seem to have a way to find a default
workdir value by itself.  =(


>
> What needs to happen is that after the fs_setup step that creates
> /mnt/postfix-overlay, but before the mounts section where the overlayfs is
> created, the workdir and upperdir directories need to be created on the
> /mnt/postfix-overlay disk as /mnt/postfix-overlay/upperdir and
> /mnt/postfix-overlay/workdir (or something) respectively.
>
> Is there something that can be done in cloud-init to make this possible?
>

Surely it can; I think it's a matter of module timing: you need the
directory to be created prior to the mounts module running.
Looking at /etc/cloud/cloud.cfg, the cloud_init_modules list, shows that
'bootcmd'[1] will run before the 'mounts' stage, so
it should be possible to include a command like this:

bootcmd:
  - mkdir -p /mnt/postfix-overlay-workdir

And to update the overlayfs mount command to specify the workdir path.

That's untested, but I think should do what you need.

1. http://cloudinit.readthedocs.io/en/latest/topics/modules.html#bootcmd

Ryan Harper



>
> Regards,
> Graham
> —
>
>
> --
> Mailing list: https://launchpad.net/~cloud-init
> Post to     : cloud-init@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~cloud-init
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References