Subject: Bug#836211: dpkg: Cannot upgrade some packages on overlayfs: Invalid cross-device link

From: Nicolas Schier <[email-masked]>
Date: Fri, 21 May 2021 12:08:29 +0200

Hi,

On Sun 02 May 2021 09:06:49 GMT, Salvatore Bonaccorso wrote:
> Hi,
> 
> On Mon, Sep 04, 2017 at 03:01:26PM +0200, Raphael Hertzog wrote:
> > Control: reopen -1
> > Control: notfixed -1 4.10.0-1~exp1
> > Control: found -1 4.12.6-1
> > 
> > On Fri, 25 Aug 2017, Raphael Hertzog wrote:
> > > I verified today that the issue is gone with Linux 4.12 and apparently
> > > the appropriate patches have been merged for Linux 4.10 already (merged by
> > > linus in commit ff0f962ca3c38239b299a70e7eea27abfbb979c3).
> > 
> > I don't know how I did my check last time, but I was wrong. The changes
> > merged above fixed issues about tools being confused with the unexpected
> > st_dev values on files but they did not fix the fact that overlayfs
> > might return EXDEV when renaming a directory that is part of the lower
> > layer.
> > 
> > So I'm opening the bug again.
> 
> Doing some maintenance on open kernel bugs. Is this by now still an
> issue with recent kernels? If not can we close this bug? Part of the
> isuses at leas were fixed in 4.10.0-1~exp1, but what about the
> remaining or followup issue mentioned by Raphael?
> 
> Regards,
> Salvatore

the EXDEV return value is still reproducible:

    $ mkdir -p /tmp/ovl/{lower/dir,upper,work,mount}
    $ sudo mount -t overlay -o lowerdir=/tmp/ovl/lower,upperdir=/tmp/ovl/upper,workdir=/tmp/ovl/work none /tmp/ovl/mount
    $ strace -e trace=rename,renameat,renameat2 mv /tmp/ovl/mount/dir /tmp/ovl/mount/newname
    renameat2(AT_FDCWD, "/tmp/ovl/mount/dir", AT_FDCWD, "/tmp/ovl/mount/newname", RENAME_NOREPLACE) = -1 EXDEV (Invalid cross-device link)
    +++ exited with 0 +++

and in dpkg sources I cannot find any special handling for EXDEV.  From 
my point of view, the bug is still not fixed.

Kind regards,
Nicolas