8000 remounting overlayfs fails · Issue #2528 · util-linux/util-linux · GitHub
[go: up one dir, main page]

Skip to content

remounting overlayfs fails #2528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mwhudson opened this issue Oct 5, 2023 · 5 comments
Open

remounting overlayfs fails #2528

mwhudson opened this issue Oct 5, 2023 · 5 comments

Comments

@mwhudson
Copy link
mwhudson commented Oct 5, 2023

I found this digging in to https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/2037417 where I thought something a bit deeper around an overlayfs that was using paths no longer available from the current mount namespace was going on, but no:

mwhudson@orcrist:~/tmp/lp-2037417$ cat repro2.sh
#!/bin/bash
set -eux
mkdir -p lower work upper mountpoint
mount -o ro,lowerdir=lower,upperdir=upper,workdir=work -t overlay overlay mountpoint
mount -o remount,rw mountpoint
mwhudson@orcrist:~/tmp/lp-2037417$ sudo bash repro2.sh
+ mkdir -p lower work upper mountpoint
+ mount -o ro,lowerdir=lower,upperdir=upper,workdir=work -t overlay overlay mountpoint
+ mount -o remount,rw mountpoint
mount: /home/mwhudson/tmp/lp-2037417/mountpoint: mount point not mounted or bad option.
       dmesg(1) may have more information after failed mount system call.

The failure seems to be this syscall:

mwhudson@orcrist:~/tmp/lp-2037417$ sudo strace -e fsconfig mount -o remount,rw mountpoint 
fsconfig(4, FSCONFIG_SET_STRING, "lowerdir", "lower", 0) = -1 EINVAL (Invalid argument)
mount: /home/mwhudson/tmp/lp-2037417/mountpoint: mount point not mounted or bad option.
       dmesg(1) may have more information after failed mount system call.
+++ exited with 32 +++
@t-8ch
Copy link
Member
t-8ch commented Oct 5, 2023

The inability to reconfigure overlayfs seems to be intentional:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/overlayfs/params.c?id=3006adf3be79cde4d14b1800b963b82b6e5572e0#n549

It never did anything but when using the new API it actively throws an error.

@mwhudson
Copy link
Author
mwhudson commented Oct 5, 2023

I think it would be reasonable for mount -o remount,lowerdir=/something/new to error rather than silently do nothing but it's definitely surprising to me that remount,rw or remount,ro would fail.

(It's probably not strictly necessary to call those in the boot process that's currently failing but it's definitely breaking something that used to work)

@t-8ch
Copy link
Member
t-8ch commented Oct 5, 2023

The best way forward would probably be to make sure to only set filesystem options that are not already set to the same value.

@karelzak
Copy link
Collaborator

Not sure if I see an error there. man mount:

          The remount functionality follows the standard way the mount command works with options
           from fstab. This means that mount does not read fstab (or mtab) only when both device and
           dir are specified.

           mount -o remount,rw /dev/foo /dir

           After this call all old mount options are replaced and arbitrary stuff from fstab (or
           mtab) is ignored, except the loop= option which is internally generated and maintained by
           the mount command.

           mount -o remount,rw /dir

           After this call, mount reads fstab and merges these options with the options from the
           command line (-o). If no mountpoint is found in fstab, then it defaults to mount options
           from /proc/self/mountinfo.

And note there is also --options-mode <ignore, append, prepend, replace> to work wit options from fstab/mtab.

@karelzak
Copy link
Collaborator

Please let's continue the discussion on #2576 to keep it all in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0