← Back to team overview

cloud-init team mailing list archive

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


On 31 May 2017, at 9:36 PM, Ryan Harper <ryan.harper@xxxxxxxxxxxxx> wrote:

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

This is an unfortunate regression.

> 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 <http://cloudinit.readthedocs.io/en/latest/topics/modules.html#bootcmd>
Alas, bootcmd also runs before the disk_setup stage, and as a result the disk doesn’t exist yet that the directories need to be created on.

# The modules that run in the 'config' stage
# Emit the cloud config ready event
# this can be used by upstart jobs for 'start on cloud-config'.
 - emit_upstart
 - disk_setup
 - mounts

“mounts” seems to be run directly after “disk_setup”, giving no option to do anything in between.

What is the cleanest way to fix this?

Maybe something like this:

 - label: postfix
   device: /dev/xvde
   filesystem: ext4
   mkdir: upperdir workdir


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Follow ups