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

Bug 676856

Summary: sys-apps/portage-2.3.59: emerge fails with IOError: [Errno 1] Operation not permitted
Product: Portage Development Reporter: Jean-Francois Ostiguy <jfostiguy>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: major Keywords: InVCS, REGRESSION
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 658182, 671498    

Description Jean-Francois Ostiguy 2019-01-29 17:40:44 UTC
emerge --oneshot  portage fails. 

>> Verifying ebuild manifests
>>> Running pre-merge checks for sys-apps/portage-2.3.59-r1
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     4.19.9-gentoo
 * Checking for suitable kernel configuration options...                                                                            [ ok ]
Traceback (most recent call last):
  File "/var/tmp/portage/._portage_reinstall_.DK0xCg/bin/pid-ns-init", line 127, in <module>
    sys.exit(main(sys.argv))
  File "/var/tmp/portage/._portage_reinstall_.DK0xCg/bin/pid-ns-init", line 82, in main
    fcntl.ioctl(sys.stdout, termios.TIOCSCTTY, 0)
IOError: [Errno 1] Operation not permitted


Reproducible: Always




# emerge --info
!!! Repository 'science' has sync-uri attribute, but is missing sync-type attribute
Portage 2.3.59 (python 2.7.15-final-0, default/linux/amd64/17.0/desktop/plasma, gcc-8.2.0, glibc-2.28-r5, 4.19.9-gentoo x86_64)
=================================================================
System uname: Linux-4.19.9-gentoo-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9550_@_2.83GHz-with-gentoo-2.6
KiB Mem:     8085624 total,    821224 free
KiB Swap:   25173848 total,  25173080 free
Timestamp of repository gentoo: Tue, 29 Jan 2019 12:00:01 +0000
Head commit of repository gentoo: a29d1447f46a87dc5f2351ba6db54914f4caad9f
sh bash 5.0_p2
ld GNU ld (Gentoo 2.30 p3) 2.30.0
ccache version 3.6 [disabled]
app-shells/bash:          5.0_p2::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.28.0::gentoo
dev-lang/python:          2.7.15::gentoo, 3.5.5-r1::gentoo, 3.6.6::gentoo, 3.7.0::gentoo
dev-util/ccache:          3.6::gentoo
dev-util/cmake:           3.13.3::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.40.3::gentoo
sys-apps/sandbox:         2.15::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.12.6-r1::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15.1-r1::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.28.1::gentoo, 2.29::gentoo, 2.29.1-r1::gentoo, 2.30-r3::gentoo, 2.31.1-r3::gentoo
sys-devel/gcc:            6.4.0-r5::gentoo, 7.3.0-r3::gentoo, 8.2.0-r6::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.20::gentoo (virtual/os-headers)
sys-libs/glibc:           2.28-r5::gentoo
Repositories:

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

LocalOverlay
    location: /usr/local/portage
    masters: gentoo

local-crossdev
    location: /usr/local/portage-crossdev
    masters: gentoo
    priority: 10

science
    location: /var/lib/layman/science
    sync-uri: git://github.com/gentoo-science/sci.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 x86 ~amd64 ~x86"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.1/ext-active/ /etc/php/apache2-php7.2/ext-active/ /etc/php/apache2-php7.3/ext-active/ /etc/php/cgi-php7.1/ext-active/ /etc/php/cgi-php7.2/ext-active/ /etc/php/cgi-php7.3/ext-active/ /etc/php/cli-php7.1/ext-active/ /etc/php/cli-php7.2/ext-active/ /etc/php/cli-php7.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN 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 sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="/usr/lib/systemd /etc/systemd /run/systemd"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
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"
USE="X a52 aac acl acpi activities alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cleartype cli consolekit corefonts crypt cups cxx dbus declarative dri dts dvd dvdr dvdread egl emboss encode evdev exif fam ffmpeg fftw flac fontconfig fortran gdbm geant4 gif glamor glut gpm gssapi gtk hal iconv icu ipv6 ipython java jpeg kde kerberos kipi kpathsea kwallet lcms ldap libnotify libtirpc mad mng mp3 mp4 mpeg multilib mysql ncurses nls nptl nptlonly nsplugin odbc ogg opengl openmp pam pango pcre pdf phonon php plasma png policykit postgres ppds pulse pulseaudio python qml qt5 readline real scipy sdl seccomp semantic-desktop spell sql sqlite ssl startup-notification svg taglib tcpd threads tiff tinfo tk truetype truetype-fonts type1 type1-fonts udev udisks unicode upower usb vhosts vorbis webkit widgets wxwidgets x264 xattr xcb xcomposite xinerama xml xv xvid zlib" ABI_X86="64 32" 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 sse3 sse4_1 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" L10N="en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport java websvccommon php profiler" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php-5-6" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5 python3_6" RUBY_TARGETS="ruby24 ruby25 ruby26" USERLAND="GNU" VIDEO_CARDS="nouveau" 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, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Brian Evans Gentoo Infrastructure gentoo-dev 2019-01-29 18:20:26 UTC
Ensure you have CONFIG_PID_NS in your kernel.  If not, enable it or set FEATURES="-pid-sandbox" for the time being
Comment 2 Zac Medico gentoo-dev 2019-01-29 19:01:56 UTC
The issue is actually fixed in sys-apps/portage-2.3.59-r1, but you'll have to use FEATURES="-pid-sandbox" if you currently have sys-apps/portage-2.3.59 installed.

The bug has been referenced in the following commit(s):

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

commit d66f4238e6b5dca2bbc0fb04f64c67f3e0bc3586
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-01-28 19:27:47 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-01-28 19:42:21 +0000

    pid-sandbox: handle EnvironmentError for python2 compat (bug 675868)
    
    The fcntl.ioctl call raises IOError, which is different from OSError
    for python2. Use EnvironmentError for compatibility.
    
    Bug: https://bugs.gentoo.org/675868
    Reported-by: Ivan Ivanich <ivanich@ivanich.org.ua>
    Fixes: ce0656337268 ("pid-sandbox: pid-ns-init TIOCSCTTY after setsid (bug 675868)")
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 bin/pid-ns-init | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a89abbf82cc13d266d512b3100bb990ed7718f40

commit a89abbf82cc13d266d512b3100bb990ed7718f40
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-01-28 19:41:43 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-01-28 19:47:08 +0000

    sys-apps/portage: revbump to 2.3.59-r1 for bug 675868
    
    Bug: https://bugs.gentoo.org/675868
    Reported-by: Ivan Ivanich <ivanich@ivanich.org.ua>
    See: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d66f4238e6b5dca2bbc0fb04f64c67f3e0bc3586
    Package-Manager: Portage-2.3.59, Repoman-2.3.12
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/{portage-2.3.59.ebuild => portage-2.3.59-r1.ebuild} | 3 +++
 1 file changed, 3 insertions(+)
Comment 3 Zac Medico gentoo-dev 2019-01-29 19:25:57 UTC
This issue was first reported in bug 675868, comment 18.
Comment 4 Saul Peebsen 2019-02-02 18:41:47 UTC
I'm using sys-apps/portage-2.3.59-r1, -pid-sandbox does not help.

Traceback (most recent call last):
  File "/usr/lib/portage/python3.6/socks5-server.py", line 231, in <module>
    asyncio.start_unix_server(s.handle_proxy_conn, sys.argv[1], loop=loop))
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/usr/lib64/python3.6/asyncio/streams.py", line 151, in start_unix_server
    return (yield from loop.create_unix_server(factory, path, **kwds))
  File "/usr/lib64/python3.6/asyncio/coroutines.py", line 212, in coro
    res = func(*args, **kw)
  File "/usr/lib64/python3.6/asyncio/unix_events.py", line 290, in create_unix_server
    sock.bind(path)
PermissionError: [Errno 13] Permission denied

However, it does not stop emerge, just distcc fails.
Comment 5 Zac Medico gentoo-dev 2019-02-02 19:02:42 UTC
(In reply to Saul Peebsen from comment #4)
> I'm using sys-apps/portage-2.3.59-r1, -pid-sandbox does not help.
> 
> Traceback (most recent call last):
>   File "/usr/lib/portage/python3.6/socks5-server.py", line 231, in <module>
>     asyncio.start_unix_server(s.handle_proxy_conn, sys.argv[1], loop=loop))
>   File "/usr/lib64/python3.6/asyncio/base_events.py", line 468, in
> run_until_complete
>     return future.result()
>   File "/usr/lib64/python3.6/asyncio/streams.py", line 151, in
> start_unix_server
>     return (yield from loop.create_unix_server(factory, path, **kwds))
>   File "/usr/lib64/python3.6/asyncio/coroutines.py", line 212, in coro
>     res = func(*args, **kw)
>   File "/usr/lib64/python3.6/asyncio/unix_events.py", line 290, in
> create_unix_server
>     sock.bind(path)
> PermissionError: [Errno 13] Permission denied
> 
> However, it does not stop emerge, just distcc fails.

That's unrelated to bug 676856, you have an issue with FEATURES=network-sandbox-proxy there. I haven't seen any reports like that, please file a new bug.
Comment 6 Anthony Waters 2019-03-28 21:07:52 UTC
(In reply to Zac Medico from comment #5)
> (In reply to Saul Peebsen from comment #4)
> > I'm using sys-apps/portage-2.3.59-r1, -pid-sandbox does not help.
> > 
> > Traceback (most recent call last):
> >   File "/usr/lib/portage/python3.6/socks5-server.py", line 231, in <module>
> >     asyncio.start_unix_server(s.handle_proxy_conn, sys.argv[1], loop=loop))
> >   File "/usr/lib64/python3.6/asyncio/base_events.py", line 468, in
> > run_until_complete
> >     return future.result()
> >   File "/usr/lib64/python3.6/asyncio/streams.py", line 151, in
> > start_unix_server
> >     return (yield from loop.create_unix_server(factory, path, **kwds))
> >   File "/usr/lib64/python3.6/asyncio/coroutines.py", line 212, in coro
> >     res = func(*args, **kw)
> >   File "/usr/lib64/python3.6/asyncio/unix_events.py", line 290, in
> > create_unix_server
> >     sock.bind(path)
> > PermissionError: [Errno 13] Permission denied
> > 
> > However, it does not stop emerge, just distcc fails.
> 
> That's unrelated to bug 676856, you have an issue with
> FEATURES=network-sandbox-proxy there. I haven't seen any reports like that,
> please file a new bug.

Completely unrelated to this bug, but in case someone comes across the Permission denied issue the cause for me was the PORTAGE_TMPDIR wasn't writable by portage (usually portage writes to PORTAGE_TMPDIR/portage, which was writable)