Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 621994

Summary: emerge -v1 -d --nodeps =sys-kernel/gentoo-sources-4.9.32 failure on btrfs
Product: Portage Development Reporter: Octavian <octavsly>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED NEEDINFO    
Severity: normal CC: kensington
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 635020    
Attachments: emerge --info
another failing emerge.

Description Octavian 2017-06-17 09:23:53 UTC
Created attachment 476734 [details]
emerge --info

emerge -v1 -d --nodeps =sys-kernel/gentoo-sources-4.9.32

....

--- /usr/
--- /usr/share/
--- /usr/share/doc/
>>> /usr/share/doc/gentoo-sources-4.9.32/
!!! copy /var/tmp/portage/sys-kernel/gentoo-sources-4.9.32/image/usr/share/doc/gentoo-sources-4.9.32/0000_README.bz2 -> /usr/share/doc/gentoo-sources-4.9.32/0000_README.bz2 failed.
!!! [Errno 22] Invalid argument
....

This is the first file to get copied.
Comment 1 Octavian 2017-06-17 10:02:11 UTC
ls -al /usr/share/doc/gentoo-sources-4.9.32/

-rw-rw-rw- 1 root root 0 Jun 17 10:42 /usr/share/doc/gentoo-sources-4.9.32/0000_README.bz2#new
Comment 2 Octavian 2017-06-19 13:56:06 UTC
Created attachment 477212 [details]
another failing emerge.

All emerges suffer from the same issue. I added -d during emerge but still cannot get a clue what is happening. 

See the attached log file.

I would appreciate some help since I cannot emerge any packages anymore. It must be something very simple.
Comment 3 Octavian 2017-06-19 19:25:53 UTC
Something similar with Bug 402323 but -xattr does not make any difference.
Comment 4 Octavian 2017-06-19 20:46:07 UTC
I think I found the issue:

It's related to btrfs.
Although I have the partitions for a long time the failure appeared this month.

I have the following btrfs subvolumes: 

btrfs subvolume list   /
ID 1473 gen 2152663 top level 5 path var/tmp
....


If I change PORTAGE_TMPDIR=/tmp emerge <whatever> then it works since it is on the same volume with the files being installed. 

Could you check that copying over different subvolumes in btrfs still works?

Best regards,
Octavian

P.S.
I used btrfs subvolume create btrfs partitions.
Comment 5 Zac Medico gentoo-dev 2017-06-25 08:04:45 UTC
As a workaround, you can add a setting like this to /etc/portage/package.use:

sys-apps/portage -native-extensions

It works for me with btrfs subvolumes on 4.9.31 kernel. For example:

> # btrfs subvolume create /src
> Create subvolume '//src'
> # btrfs subvolume create /dst
> Create subvolume '//dst'
> # echo foo > /src/foo
> # strace python -c 'from portage.util.file_copy import copyfile; copyfile("/src/foo", "/dst/foo")' &> /strace.log

In strace.log it shows copy_file_range succeed:

> lseek(3, 0, SEEK_DATA)                  = 0
> lseek(3, 0, SEEK_HOLE)                  = 4
> lseek(3, 0, SEEK_SET)                   = 0
> copy_file_range(3, NULL, 4, [0], 4, 0)  = 4
> lseek(3, 4, SEEK_DATA)                  = -1 ENXIO (No such device or address)
> lseek(3, 0, SEEK_END)                   = 4
> ftruncate(4, 4)                         = 0
> close(4)                                = 0
> close(3)                                = 0