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

Bug 949009

Summary: emerge coreutils fails due to internal collisions
Product: Gentoo Linux Reporter: Richard Gray <richard>
Component: Current packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED WORKSFORME    
Severity: major CC: richard
Priority: Normal    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Build.log file for coreutils-9.5

Description Richard Gray 2025-01-29 15:07:19 UTC
Here's a snippet of the output:-

>>> Completed (1 of 1) sys-apps/coreutils-9.5::gentoo

>>> Failed to install sys-apps/coreutils-9.5, Log file:

>>>  '/var/tmp/portage/sys-apps/coreutils-9.5/temp/build.log'

 * Messages for package sys-apps/coreutils-9.5:

 * Package 'sys-apps/coreutils-9.5' has internal collisions between non-
 * identical files (located in separate directories in the installation
 * image (${D}) corresponding to merged directories in the target
 * filesystem (${ROOT})):
 * 
 *      /usr/bin/basename
 *              /bin/basename
 *              /usr/bin/basename
 *                      Differences: type, mode
 * 
 *      /usr/bin/chroot
 *              /bin/chroot
 *              /usr/bin/chroot
 *                      Differences: type, mode
 * 
 *      /usr/bin/cut
 *              /bin/cut
 *              /usr/bin/cut
 *                      Differences: type, mode
 * 
 *      /usr/bin/dir
 *              /bin/dir
 *              /usr/bin/dir
 *                      Differences: type, mode

... and loads more.

The error message is deeply misleading. I'll explain as I go along.

I started with a stage3 tarball, and started building the system up from there. Under the revised filesystem, [almost] everything executable is to be found in /usr/bin . The failed install's entrails are found in /var/tmp/portage/sys-apps/coreutils-9.5 . The subdirectory we're interested in here is image/. This is laid out according to the "old" /bin /usr/bin /sbin regime. Some of these would-be executables are actually symbolic links to /usr/bin. If one were to naively install according to the image, we would end-up with symbolic links pointing to themselves, which is really bad! So, a bit of manual intervention is required to work-around this problem. Happily, in this case at least it's very simple - we delete the symlinks since everything is going to end-up in /usr/bin anyway.

I used:-

# cd image
# find . -xdev -type l -print0 | xargs -0 ls -l

to verify I'm only going after symlinks. If that looks fine:

# find . -xdev -type l -print0 | xargs -0 rm -vf

Then, manually copy the remaining binaries (scripts in some cases) to /usr/bin/, as follows:

# cp -v bin/* /usr/bin/
# cp -vr usr/* /usr/   (recursively so that such as /usr/libexec and whatnot are covered too)

In this particular package, there's an etc/ directory as well, which you can update if you want to:

# cp -v etc/* /etc/

Please understand that this is not a definitive guide for every package that might hit this problem; but it will cover most, I expect.

Finally, to make sure that the portage tree is consistent, now that everything has been updated:-

# ebuild /usr/portage/sys-apps/coreutils/coreutils-9.5.ebuild qmerge

I'm not intimately familiar with the guts of portage, but the above worked for me.

Quick check:-

# equery list coreutils
 * Searching for coreutils ...
[IP-] [  ] sys-apps/coreutils-9.5:0

Sorted! :-)

I hope this is helpful.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-29 15:10:57 UTC
Please always include the full build.log and emerge --info.

I'm afraid there's more going on here. You're the first person to report this and both the merged-usr (which is the default now, and certainly most common) and split-usr (non-merged-usr) setups are used by folks.

I suspect you've got a merged-usr system but you're using a split-usr profile, so USE=split-usr which is how you end up with the disjoint layout.
Comment 2 Richard Gray 2025-01-29 15:40:25 UTC
Created attachment 917851 [details]
Build.log file for coreutils-9.5

I don't think this bring much to the party; but here it is.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-29 15:50:41 UTC
It brings everything to the party:
> [32m * [39;49;00mUSE:        abi_x86_64 acl amd64 caps elibc_glibc kernel_linux nls openssl split-usr xattr

On a merged-usr system, you should not have split-usr set. How have you got it on? What profile are you on (which would be in emerge --info)?
Comment 4 Richard Gray 2025-01-29 15:54:32 UTC
I've snipped off the CHOST stuff at the beginning. More comments at the bottom of this.

Portage 3.0.66.1 (python 3.12.8-final-0, default/linux/amd64/17.1, gcc-14, glibc-2.40-r8, 6.6.67-gentoo x86_64)
=================================================================
System uname: Linux-6.6.67-gentoo-x86_64-Intel-R-_Pentium-R-_D_CPU_3.00GHz-with-glibc2.40
KiB Mem:     4037564 total,    868184 free
KiB Swap:   16777212 total,  16776944 free
Timestamp of repository gentoo: Wed, 29 Jan 2025 13:15:00 +0000
Head commit of repository gentoo: aa3e477897014e4a9bb374fb39e30f81b74929dc
sh bash 5.2_p37
ld GNU ld (Gentoo 2.43 p3) 2.43.1
distcc 3.4 x86_64-pc-linux-gnu [disabled]
ccache version 4.10.2 [enabled]
app-misc/pax-utils:        1.3.8::gentoo
app-shells/bash:           5.2_p37::gentoo
dev-build/autoconf:        2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.30.6::gentoo
dev-build/libtool:         2.5.4::gentoo
dev-build/make:            4.4.1-r100::gentoo
dev-build/meson:           1.6.1::gentoo
dev-lang/perl:             5.40.0-r1::gentoo
dev-lang/python:           3.10.16_p1::gentoo, 3.12.8_p1::gentoo, 3.13.1_p1::gentoo
dev-util/ccache:           4.10.2-r1::gentoo
sys-apps/baselayout:       2.17::gentoo
sys-apps/openrc:           0.55.1::gentoo
sys-apps/sandbox:          2.39::gentoo
sys-devel/binutils:        2.43-r2::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/gcc:             14.2.1_p20241221::gentoo
sys-devel/gcc-config:      2.12.1::gentoo
sys-kernel/linux-headers:  6.6-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.40-r8::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.uk.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 3

Binary Repositories:

gentoobinhost
    priority: 1
    sync-uri: https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=nocona"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=nocona"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask n"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live ccache config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="https://www.mirrorservice.org/sites/distfiles.gentoo.org/     http://www.mirrorservice.org/sites/distfiles.gentoo.org/     ftp://ftp.mirrorservice.org/sites/distfiles.gentoo.org/     rsync://rsync.mirrorservice.org/distfiles.gentoo.org/"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
LINGUAS="en_GB en"
MAKEOPTS="-j3"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="aac acl amd64 bzip2 caps cli crypt dri faac flac gdbm git iconv ipv6 lame libtirpc mp3 multilib ncurses nls ogg openmp openssl pam pcre pcre16 pcre32 png readline seccomp split-usr ssl test-rust threads udev unicode wavpack xattr zlib" ABI_X86="64" ADA_TARGET="gcc_13" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_core authn_dbd authn_dbm authn_file authz_core authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock dbd deflate dir env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mime mime_magic negotiation rewrite setenvif socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en-GB en" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12 python3_10" RUBY_TARGETS="ruby32" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

It would appear that the split-usr flag is set by default, which makes it inconsistent with the stage3 tarball I started with. I haven't explicitly set or cleared it, assuming the default to be correct.

If I do:

# USE="-split-usr" emerge coreutils

I get the same result. I have tried the build explicitly setting the USE flag one way or the other and the same result ensues.

Interestingly:

# equery uses coreutils
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for sys-apps/coreutils-9.5:
 U I
 + + acl        : Add support for Access Control Lists
 + + caps       : Add Linux capabilities support in output of file utilities (ls, dir, ...) via sys-libs/libcap
 - - gmp        : Add support for dev-libs/gmp (GNU MP library)
 - - hostname   : Build the hostname program
 - - kill       : Build the kill program
 - - multicall  : Build all tools into a single `coreutils` program akin to busybox to save space
 + + nls        : Add Native Language Support (using gettext - GNU locale utilities)
 + + openssl    : Use openssl libcrypto hash routines for hash functions
 - - static     : !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically
 - - test       : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
 - - vanilla    : Do not add extra patches which change default behaviour; DO NOT USE THIS ON A GLOBAL SCALE as the severity of the meaning changes drastically
 - - verify-sig : Verify upstream signatures on distfiles
 + + xattr      : Add support for extended attributes (filesystem-stored metadata)

No mention of split-usr at all.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-29 15:56:47 UTC
> default/linux/amd64/17.1

This profile is both deprecated and split-usr. The 23.0 migration / news item mentions that with 23.0, merged-usr is the implied default.

It's not clear to me how you also ended up with a merged-usr disk layout without changing your profile. I'm guessing you unpacked a new stage3 and then chose an old profile (17.1 instead of 23.0).

> USE="aac acl amd64 bzip2 caps cli crypt dri faac flac gdbm git iconv ipv6 lame libtirpc mp3 multilib ncurses nls ogg openmp openssl pam pcre pcre16 pcre32 png readline seccomp split-usr ssl test-rust threads udev unicode wavpack xattr zlib" 

This has split-usr in it.

> I get the same result. I have tried the build explicitly setting the USE flag one way or the other and the same result ensues.

It's forced-on/masked on profiles where it is and isn't relevnat.

> No mention of split-usr at all.

'equery u' doesn't show masked/forced flags by default.

> It would appear that the split-usr flag is set by default, which makes it inconsistent with the stage3 tarball I started with. I haven't explicitly set or cleared it, assuming the default to be correct.

See above.
Comment 6 Richard Gray 2025-01-29 16:05:05 UTC
Urgh! I'm on a very stale profile for some reason. I'll retry with the profile set to amd64/23 and -split-usr.
Comment 7 Richard Gray 2025-01-29 16:10:08 UTC
Sh*t! It IS my mistake. I cannot recall setting the profile explicitly, again expecting it to be correct from the tarball. In any case, with the current profile and -split-usr everything seems to be OK. I need to explicitly unset it in my make.conf though.