Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 549072 - sys-apps/portage-2.2.18: read-only package directory blocks installation of packages from package directory
Summary: sys-apps/portage-2.2.18: read-only package directory blocks installation of p...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal critical (vote)
Assignee: Portage team
Keywords: InVCS
Depends on:
Blocks: 484436
  Show dependency tree
Reported: 2015-05-10 14:49 UTC by David Klaftenegger
Modified: 2015-05-19 19:55 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description David Klaftenegger 2015-05-10 14:49:52 UTC
When installing binary packages (created from FEATURES="binpkg"), the emerge command ends immediately instead of installing from the binpkg if the PKGDIR is mounted read-only. This should not happen, as installation from binary packages does not re-create them, and thus write access to PKGDIR is not required.

Reproducible: Always

Steps to Reproduce:
1. emerge -avk portage
Actual Results:  
 * IMPORTANT: 16 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.

These are the packages that would be merged, in order:

Calculating dependencies... done!
[binary   R    ] sys-apps/portage-2.2.18::gentoo  USE="(ipc) (selinux) (xattr) -build -doc -epydoc" LINGUAS="-ru" PYTHON_TARGETS="python2_7 python3_3 (-pypy) -python3_4" 0 KiB

Total: 1 package (1 reinstall, 1 binary), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No] y
!!! Read-only file system: /srv/portage/packages

Expected Results:  
package being unpacked and installed, as no write access to PKGDIR is required for this operation.

Portage 2.2.18 (python 2.7.9-final-0, hardened/linux/amd64/selinux, gcc-4.8.4, glibc-2.20-r2, 3.16.5-hardened-dklvs x86_64)
System uname: Linux-3.16.5-hardened-dklvs-x86_64-Intel_Xeon_E312xx_-Sandy_Bridge-with-gentoo-2.2
KiB Mem:      498968 total,     67984 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Mon, 27 Apr 2015 19:30:01 +0000
sh bash 4.2_p53
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash:          4.2_p53::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.9-r1::gentoo, 3.3.5-r1::gentoo, 3.4.1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.13.11::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.69::gentoo
sys-devel/automake:       1.13.4::gentoo
sys-devel/binutils:       2.24-r3::gentoo
sys-devel/gcc:            4.8.4::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.20-r2::gentoo

    location: /srv/portage/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000

    location: /srv/portage/overlay
    masters: gentoo
    priority: 0

CFLAGS="-O2 -pipe -march=core2 -mtune=generic"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=core2 -mtune=generic"
EMERGE_DEFAULT_OPTS="--jobs=8 --load-average=16"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
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"
USE="acl amd64 apache2 authlib berkdb bzip2 caps cli cracklib crypt cxx dri fam gdbm git gssapi hardened iconv icu idn ipv6 jabber jingle justify kerberos ldap mmx mmxext modules multilib ncurses nls nptl open_perms openmp pam pax_kernel pcre postgres readline samba sasl selinux session snmp sse sse2 ssl syslog tcpd threads unconfined unicode urandom vhosts vim-syntax xattr xtpax zlib" ABI_X86="64" 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 proxy proxy_http proxy_balancer" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" 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 itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-4" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware 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"
Comment 1 Adam Feldman gentoo-dev 2015-05-12 22:07:21 UTC
Worth noting, on my system where I --getbinpkg, it puts a copy of every binpkg there.

I have a nagging suspicion that portage attempts to place a copy of the binpkg in PKGDIR, and then dies (since it is read-only).   

To test this idea, I ro mounted my PKGDIR, and attempted to --getbinpkg, and it also failed.  So, I'd suspect that this is the source of the issue.

That's my theory, at least.
Comment 2 David Klaftenegger 2015-05-12 22:20:32 UTC
In my particular setup this is a kerberized NFS share only available readonly. This setup avoids putting a copy of the packages on every virtual machine without having to deal with security issues on the binpkgs and still only compiling each package once on a VM with write access to the directory but only ssh running.

If you need more information or I can help by testing specific things please tell me, as this bug currently prevents me from updating my machines.
Comment 3 Zac Medico gentoo-dev 2015-05-12 23:05:33 UTC
Currently, it will allow PKGDIR to be readonly if you use the --usepkgonly/-K option:
Comment 4 Brian Dolbec gentoo-dev 2015-05-12 23:17:57 UTC
Looking at the code, it looks like it might be a user config error.

in emerge.actions.action_build():

				if need_write_bindb and \
					("buildpkg" in trees[eroot]["root_config"].
					settings.features or
					"buildsyspkg" in trees[eroot]["root_config"].
					settings.features) and \
					not trees[eroot]["bintree"].dbapi.writable:
					writemsg_level("!!! %s\n" %
						_("Read-only file system: %s") %
						level=logging.ERROR, noiselevel=-1)
					return 1

So, Do you have either of those features set in the consumer VM's?  Your Read only file system error message implies it is coming from that function and the above code.

Looking at the code, it only checks for permissions when it has to write the index or inject a pkg into it (thereby needing to write the index)

I'll try to set my system up to do some testing.  But if you could ensure those features are not set and that it still fails.  That would be great.
Comment 5 David Klaftenegger 2015-05-12 23:35:13 UTC
Removing buildpkg from FEATURES does solve the issue, and if I am told that my setup is a clear misconfiguration I will consider changing it.

The reason FEATUES=buildpkg is set is that this way I can keep make.conf in sync between the producer and consumer VMs. As I do not intend to normally "build" on the consumer VMs I would expect the FEATURE to have no effect. I would in fact appreciate the "read only filesystem" error, if I was trying to install a non-binary package!

For now, I can also work with running "emerge -pvk" to check whether all packages are available in binary form, and then proceeding with "emerge -K" to finalize it, instead of "emerge -avk" that I was using previously. (I also tested this, it works.) Thanks Zac for pointing to that one.
Comment 6 Brian Dolbec gentoo-dev 2015-05-13 01:13:52 UTC
just some more options for you:

[18:00] <dol-sen> isn't make.conf still a stacked value?
[18:01] <dol-sen> he could have a /etc/make.conf for general use, add one in /etc/portage adding buildpkg for the build vm
[18:02] <zmedico> yeah, incrementals like FEATURES are stacked automatically
[18:02] <dol-sen> I know others were using that technique for multi-instance use
[18:02] <zmedico> make.conf can be a directory nowadays
[18:02] <dol-sen> it sounds like he might be sharing /etc/portage via nfs as well
[18:04] <dol-sen> so if he symlinked /etc/make.conf to /etc/make.conf/consumer.conf on the build system
[18:05] <dol-sen> and added pkgbuilder.conf in /etc/portage/make.conf/
[18:05] <dol-sen> then they still share the consumer.conf and only add anything special for the build vm
[18:07] <zmedico> sure
Comment 8 Brian Dolbec gentoo-dev 2015-05-19 19:55:05 UTC
Released in portage-2.2.19