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

Bug 756292

Summary: app-admin/eselect: eselect profile list fails with $PORTAGE_CONFIGROOT different than "/"
Product: Gentoo Linux Reporter: Kai Peter <kp>
Component: Current packagesAssignee: Gentoo eselect Team <eselect>
Status: UNCONFIRMED ---    
Severity: normal CC: dev-portage, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=648062
Whiteboard:
Package list:
Runtime testing required: ---

Description Kai Peter 2020-11-24 08:30:25 UTC
The command 'eselect profile list' fails if $PORTAGE_CONFIGROOT is set to a different value than the default one ("/"). The 'make.profile' symlink in the new location is not recognized.



Reproducible: Always

Steps to Reproduce:
1. Set $PORTAGE_CONFIGROOT="/somewhere"
2. mv /etc/portage /somewhere/etc/portage
3. eselect profile list
!!! Error: Failed to get a list of valid profiles
exiting

It works if the make.profile symlink is in /etc/portage:
4. ln -s /somewhere/etc/portage /etc/portage
Comment 1 Ulrich Müller gentoo-dev 2020-12-27 14:26:51 UTC
Sorry, but I cannot reproduce this. Please specify:

a. The version of eselect
b. Output of emerge --info
c. The exact commands to reproduce (not some pseudo-code as in your 1. and 2.)
d. What is the output of the following commands:
   $ portageq get_repos "${EROOT:-/}"
   $ portageq get_repo_path "${EROOT:-/}" gentoo
Comment 2 Kai Peter 2020-12-27 18:45:21 UTC
a)
$> 
eselect version
eselect 1.4.16

Copyright (c) 2005-2019 Gentoo Authors.
Distributed under the terms of the GNU GPL version 2 or later.

b)
$> emerge --info
Portage 3.0.9 (python 3.7.9-final-0, !../../../var/portage/qlinux/profiles/default/17.1.0/server/qemu, gcc-9.3.0, glibc-2.32-r3, 4.14.83-gentoo x86_64)
=================================================================
System uname: Linux-4.14.83-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E3-1235L_v5_@_2.00GHz-with-gentoo-2.7
KiB Mem:     4031604 total,     55324 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sun, 27 Dec 2020 02:30:01 +0000
Head commit of repository gentoo: 36781efd38eb25f8e0d4643af2c44029f61f702c
Timestamp of repository kailay: Thu May 7 09:01:37 CEST 2015
Timestamp of repository qlinux: Thu May 7 09:01:37 CEST 2015
Head commit of repository qlinux: 0348976dfda3f2ce8b2c6858c157a2d71a954e94

sh bash 5.0_p18
ld GNU ld (Gentoo 2.34 p6) 2.34.0
app-shells/bash:          5.0_p18::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          3.7.9::gentoo, 3.8.6::gentoo, 3.9.0::gentoo
dev-util/cmake:           3.17.4-r1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.69-r5::gentoo
sys-devel/automake:       1.16.2-r1::gentoo
sys-devel/binutils:       2.34-r2::gentoo
sys-devel/gcc:            9.3.0-r1::gentoo
sys-devel/gcc-config:     2.3.2-r1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.32-r3::gentoo
Repositories:

gentoo
    location: /var/portage/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: no
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: --exclude-from=/qlinux/etc/portage/rsync_excludes

kailay
    location: /var/portage/kailay
    sync-type: rsync
    sync-uri: rsync://razor.hm.qware.org/kailay
    masters: gentoo
    sync-rsync-extra-opts: --exclude-from=/qlinux/etc/portage/rsync_excludes

qlinux
    location: /var/portage/qlinux
    sync-type: git
    sync-uri: https://gitlab.com/kaili/qlinux.git
    masters: gentoo

ACCEPT_KEYWORDS="amd64 amd64-qLinux"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.4/ext-active/ /etc/php/cgi-php7.4/ext-active/ /etc/php/cli-php7.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/ssl/certs /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/var/portage/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY 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"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox 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="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/var/portage/packages"
PORTAGE_CONFIGROOT="/qlinux/"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/qlinux/etc/portage/rsync_excludes"
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"
USE="acl amd64 bzip2 clean cli crypt dri fortran gdbm iconv ipv6 libglvnd libtirpc multilib ncurses nls nptl openmp pcre qlinux readline seccomp split-usr ssl tcpd unicode xattr zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id 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" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" RUBY_TARGETS="ruby25 ruby26" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS


c)
$> export PORTAGE_CONFIGROOT="/qlinux"
$> set | grep PORTAGE
PORTAGE_CONFIGROOT=/qlinux
$> mkdir /qlinux
$> mv /etc/portage /qlinux/etc/portage

The symlink make.profile is broken now, correction:

$> cd /qlinux/etc/portage
$> ln -s ../../../../var/portage/qlinux/profiles/default/17.1.0/server/qemu make.profile
$> ls -l make.profile
lrwxrwxrwx 1 root root 63 Dec 27 18:50 make.profile -> ../../../../var/portage/qlinux/profiles/default/17.1.0/server/qemu

Symlink is valid now.

$> eselect profile list
!!! Error: Failed to get a list of valid profiles
exiting

d)
$> portageq get_repos "${EROOT:-/}"
gentoo

--> this is wrong (emerge --info is correct)

$> portageq get_repo_path "${EROOT:-/}" gentoo
/var/db/repos/gentoo

--> this is wrong too.

Some more info:

$> eselect profile show
Current /qlinux/etc/portage/make.profile symlink:
  var/portage/qlinux/profiles/default/17.1.0/server/qemu

However, this shows where the symlink is pointing to always, even if the link is broken!

The used profile is based on 
[1]   qlinux:gentoo/default/17.1 (stable)
as parent and does add one USE flag and 3 packages only. This profile works perfect on several machines.

I don't think eselect is the issue, but it is somewhere in portage's complexity. But I'm not a Gentoo dev. If you really want to investigate and fix this I will help - meanwhile I reverted the change cause there came up more issues.
Comment 3 Ulrich Müller gentoo-dev 2020-12-27 20:31:38 UTC
CCing portage team, any insights what is going on here?

In a nutshell, we have (see comment #2):

> $> emerge --info
> [...]
> 
> gentoo
>     location: /var/portage/gentoo

but also:

> $> portageq get_repo_path "${EROOT:-/}" gentoo
> /var/db/repos/gentoo

where the former is correct but the latter is not.
Comment 4 Zac Medico gentoo-dev 2020-12-27 22:26:01 UTC
The portageq "EROOT" argument overrides the PORTAGE_CONFIGROOT environment variable, since this change:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=382f4be415394886026ccd5dcd08ca96ecda31fa

commit 382f4be415394886026ccd5dcd08ca96ecda31fa
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-03-23 16:29:13 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-03-26 17:42:50 +0000

    portageq repos_config: fix <eroot> parameter (bug 648062)
    
    The <eroot> parameter is ineffective for commands that query
    configuration, since the PORTAGE_CONFIGROOT variable controls
    the location of configuration files. Therefore, for portageq
    repos_config, implicitly set PORTAGE_CONFIGROOT equal to the
    value of the <eroot> parameter. Note that this works correctly
    for both prefix and non-prefix systems, because both EROOT and
    PORTAGE_CONFIGROOT are supposed to include the EPREFIX offset.
    
    Bug: https://bugs.gentoo.org/648062

 bin/portageq | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)}