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

2016-09-01 Thread Felipe Sateler
On 1 Sep 2016 3:59 a.m., "Johannes Schauer"  wrote:
>
> Hi,
>
> On Wed, 31 Aug 2016 12:16:10 -0300 Felipe Sateler 
wrote:
> > overlayfs does not support renaming directories when the directories
> > live in the lower filesystem:
> >
> >  * Directory renames only allowed on "pure upper" (already created on
> >  * upper filesystem, never copied up).  Directories which are on lower
or
> >  * are merged may not be renamed.  For these -EXDEV is returned and
> >  * userspace has to deal with it.  This means, when copying up a
> >  * directory we can rely on it and ancestors being stable.
> >
> >
https://github.com/torvalds/linux/blob/v4.8-rc2/fs/overlayfs/copy_up.c#L318-L322
> >
> > Unfortunately this means that dpkg fails at least in the case where a
> > directory is converted into a file: apt 1.3~rc2 moves
> > /usr/share/bug/apt/script to /usr/share/bug/apt . This causes dpkg to
> > fail when running in an overlayfs with the following error:
> >
> > # dpkg -i /var/cache/apt/archives/apt_1.3~rc3_amd64.deb
> > (Reading database ... 11401 files and directories currently installed.)
> > Preparing to unpack .../archives/apt_1.3~rc3_amd64.deb ...
> > Unpacking apt (1.3~rc3) over (1.3~rc2) ...
> > dpkg: error processing archive
> > /var/cache/apt/archives/apt_1.3~rc3_amd64.deb (--install):
> >  unable to move aside './usr/share/bug/apt' to install new version:
Invalid cross-device link
> > dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
> > Processing triggers for libc-bin (2.23-5) ...
> > Errors were encountered while processing:
> >  /var/cache/apt/archives/apt_1.3~rc3_amd64.deb
> >
> > I don't know what the correct workaround should be.
> >
> > This can break pre-build upgrades in sbuild when the schroot is of
> > overlayfs type.
>
> thanks for the analysis!
>
> I just stumbled across the exact same problem with sbuild in a directory
type
> overlayfs schroot. My workaround: destroy the chroot (you can now use
> sbuild-destroychroot) and then recreate it with sbuild-createchroot. :(

You can also enter the source chroot and upgrade there, as that skips the
overlayfs setup. I used  sbuild-update and it worked OK.

I discussed this with Guillem on IRC and he doesn't think adding
workarounds for this is reasonable, and this should be fixed in overlayfs.
Assuming a directory lives in the same device as itself seems reasonable to
me, and overlayfs should try hard to pretend it does.

Saludos


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

2016-09-01 Thread Johannes Schauer
Hi,

On Wed, 31 Aug 2016 12:16:10 -0300 Felipe Sateler  wrote:
> overlayfs does not support renaming directories when the directories
> live in the lower filesystem:
> 
>  * Directory renames only allowed on "pure upper" (already created on
>  * upper filesystem, never copied up).  Directories which are on lower or
>  * are merged may not be renamed.  For these -EXDEV is returned and
>  * userspace has to deal with it.  This means, when copying up a
>  * directory we can rely on it and ancestors being stable.
> 
> https://github.com/torvalds/linux/blob/v4.8-rc2/fs/overlayfs/copy_up.c#L318-L322
> 
> Unfortunately this means that dpkg fails at least in the case where a
> directory is converted into a file: apt 1.3~rc2 moves
> /usr/share/bug/apt/script to /usr/share/bug/apt . This causes dpkg to
> fail when running in an overlayfs with the following error:
> 
> # dpkg -i /var/cache/apt/archives/apt_1.3~rc3_amd64.deb 
> (Reading database ... 11401 files and directories currently installed.)
> Preparing to unpack .../archives/apt_1.3~rc3_amd64.deb ...
> Unpacking apt (1.3~rc3) over (1.3~rc2) ...
> dpkg: error processing archive
> /var/cache/apt/archives/apt_1.3~rc3_amd64.deb (--install):
>  unable to move aside './usr/share/bug/apt' to install new version: Invalid 
> cross-device link
> dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
> Processing triggers for libc-bin (2.23-5) ...
> Errors were encountered while processing:
>  /var/cache/apt/archives/apt_1.3~rc3_amd64.deb
> 
> I don't know what the correct workaround should be.
> 
> This can break pre-build upgrades in sbuild when the schroot is of
> overlayfs type.

thanks for the analysis!

I just stumbled across the exact same problem with sbuild in a directory type
overlayfs schroot. My workaround: destroy the chroot (you can now use
sbuild-destroychroot) and then recreate it with sbuild-createchroot. :(

cheers, josch


signature.asc
Description: signature