Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 201090 - emerge =portage-2.1.4_rc6: permission denied because /tmp is noexec
Summary: emerge =portage-2.1.4_rc6: permission denied because /tmp is noexec
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: x86 Linux
: High trivial (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
Depends on:
Blocks: 200044
  Show dependency tree
 
Reported: 2007-12-03 12:08 UTC by Norberto Bensa
Modified: 2007-12-09 19:14 UTC (History)
1 user (show)

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


Attachments
make the temp directory inside PORTAGE_TMPDIR (noexec.patch,661 bytes, patch)
2007-12-03 21:01 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Norberto Bensa 2007-12-03 12:08:19 UTC
$ sudo emerge -v portage

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

Calculating dependencies... done!
[ebuild   R   ] sys-apps/portage-2.1.4_rc6  USE="-build -doc -epydoc (-selinux)" LINGUAS="-pl" 0 kB

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

>>> Verifying ebuild Manifests...

>>> Emerging (1 of 1) sys-apps/portage-2.1.4_rc6 to /
 * portage-2.1.3.16.tar.bz2 RMD160 SHA1 SHA256 size ;-) ...                                                      [ ok ]
 * portage-2.1.4_rc6.patch.bz2 RMD160 SHA1 SHA256 size ;-) ...                                                   [ ok ]
 * checking ebuild checksums ;-) ...                                                                             [ ok ]
 * checking auxfile checksums ;-) ...                                                                            [ ok ]
 * checking miscfile checksums ;-) ...                                                                           [ ok ]
 * checking portage-2.1.3.16.tar.bz2 ;-) ...                                                                     [ ok ]
 * checking portage-2.1.4_rc6.patch.bz2 ;-) ...                                                                  [ ok ]
>>> Unpacking source...
>>> Unpacking portage-2.1.3.16.tar.bz2 to /var/tmp/portage/sys-apps/portage-2.1.4_rc6/work
>>> Unpacking portage-2.1.4_rc6.patch.bz2 to /var/tmp/portage/sys-apps/portage-2.1.4_rc6/work
 * Applying portage-2.1.4_rc6.patch ...                                                                          [ ok ]
 * Setting portage.VERSION to 2.1.4_rc6 ...                                                                      [ ok ]
>>> Source unpacked.
>>> Compiling source in /var/tmp/portage/sys-apps/portage-2.1.4_rc6/work/portage-2.1.3.16 ...
>>> Source compiled.
>>> Test phase [not enabled]: sys-apps/portage-2.1.4_rc6

>>> Install portage-2.1.4_rc6 into /var/tmp/portage/sys-apps/portage-2.1.4_rc6/image/ category sys-apps
patching file make.conf
>>> Completed installing portage-2.1.4_rc6 into /var/tmp/portage/sys-apps/portage-2.1.4_rc6/image/

ecompressdir: bzip2 -9 usr/share/man
strip: i686-pc-linux-gnu-strip --strip-unneeded -R .comment
   usr/lib/portage/bin/tbz2tool
* checking 159 files for package collisions
>>> Merging sys-apps/portage-2.1.4_rc6 to /
[portage-2.1.4_rc6] bash: /tmp/tmpUg2AgR/bin/ebuild.sh: /bin/bash: bad interpreter: Permission denied
!!! FAILED preinst: 126


I can emerge other packages without problems, though

Reproducible: Always

Steps to Reproduce:
Comment 1 Zac Medico gentoo-dev 2007-12-03 21:01:00 UTC
Created attachment 137646 [details, diff]
make the temp directory inside PORTAGE_TMPDIR

If this is saved as /tmp/noexec.patch, then it can be applied as follows:

patch /usr/lib/portage/pym/portage.py < /tmp/noexec.patch
Comment 2 Zac Medico gentoo-dev 2007-12-04 01:29:48 UTC
This has been released in 2.1.4_rc7.
Comment 3 Volker Hemmann 2007-12-04 22:28:46 UTC
2.1.4_rc7 fails with the exact same error.

>>> Merging sys-apps/portage-2.1.4_rc7 to /
[portage-2.1.4_rc7] bash: /tmp/tmp0Vfe5C/bin/ebuild.sh: /bin/bash: bad interpreter: Permission denied
!!! FAILED preinst: 126

so it is certainly not fixed.
Comment 4 Norberto Bensa 2007-12-04 22:40:13 UTC
I've not tested rc7 yet, but my /var is noexec too, so the patch doesn't work for me either (I have /var/tmp/portage on a separate partition just in case you're wondering how in earth do I run emerge without problems :) )

Comment 5 Zac Medico gentoo-dev 2007-12-05 00:34:55 UTC
(In reply to comment #3)
> 2.1.4_rc7 fails with the exact same error.
> 
> >>> Merging sys-apps/portage-2.1.4_rc7 to /
> [portage-2.1.4_rc7] bash: /tmp/tmp0Vfe5C/bin/ebuild.sh: /bin/bash: bad
> interpreter: Permission denied
> !!! FAILED preinst: 126
> 
> so it is certainly not fixed.
> 

Have you applied the patch? Without that patch, noexec /tmp can prevent you from being able to install rc7.

(In reply to comment #4)
> I've not tested rc7 yet, but my /var is noexec too, so the patch doesn't work
> for me either (I have /var/tmp/portage on a separate partition just in case
> you're wondering how in earth do I run emerge without problems :) )

In that case, you should set PORTAGE_TMPDIR="/var/tmp/portage".
Comment 6 Volker Hemmann 2007-12-08 02:21:34 UTC
Portage 2.1.4_rc5 (default-linux/amd64/2007.0/desktop, gcc-4.2.2, glibc-2.7-r0, 2.6.23.9reiser4 x86_64)
=================================================================
System uname: 2.6.23.9reiser4 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
Timestamp of tree: Sat, 08 Dec 2007 02:00:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.3
dev-lang/python:     2.5.1-r4
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.10-r5
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18.50.0.3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.23-r2
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8 -O2 -msse3 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=k8 -O2 -msse3 -pipe"
DISTDIR="/var/portage/distfiles"
FEATURES="autoconfig candy ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://ftp.tu-clausthal.de/pub/linux/gentoo/"
LANG="de_DE@euro"
LC_ALL="de_DE@euro"
LINGUAS="de"
MAKEOPTS="-j3"
PKGDIR="/var/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/var/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/nouveau /usr/portage/local/layman/xeffects /usr/portage/local/layman/kde /usr/local/portage /usr/local/portage/gentoo-de"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext 7zip S3TC X Xaw3d a52 aac acpi addbookmarks aiglx aim aio akode alias alsa altenburgcards amarok amd64 amr amrnb amrwb aotuv aqua_theme asf athena audiofile autoreplace bash-completion berkdb binary-drivers bitmap-fonts bluetooth boost bzip2 cairo cdda cddb cdinstall cdparanoia cdr cdrom cdsound cegui cg clamav cli connectionstatus contactnotes cpudetection cracklib crypt css cups curl dbus depth32 dhcp dio divx dnd double-precision dpms dri dts dv dvb dvbplayer dvbsetup dvd dvdr dvdread eds emboss emerald emul-linux-x86 encode evo exif expat exscalibar extra-cardsets fame fasttrack ffmpeg fftw filter_default filter_legacy filter_light firefox flac foomaticdb fortran ftp gadu gdbm gif gimp gimpprint glitz glut glx gnokii gnutella gpgme gpm gtk gtk2 hal hddtemp highlight history iconv icq id3 ieee1394 imagemagick imlib inotify irc irmc isdnlog jabber java javascript jce jingle joystick jpeg jpeg2k kcal kde kdecards kdeenablefinal kdehiddenvisibility kdepim kdm kexi kipi kqemu lame lcms lesstif libsamplerate libwww lirc lm_sensors logitech-mouse lzo lzw mad magic maps matroska midi mikmod mime mixer mjpeg mmap mmx mmxext mng mp3 mp4 mpeg mpeg2 mplayer msn mudflap mule musepack ncurses neXt net newspr ngui nls no-old-linux nocd nosendmail nowin nowlistening nptl nptlonly nsplugin nvidia offensive ogg openexr opengl openmp oscar pam paste64 pch pcre pdf perl physfs player plugins png pnm posix ppds pppd python qt3 qt3support qt4 quicktime rar readline recode reflection reiser4 reiserfs remix resolvconf rogue rtc samba sametime scanner schedule scsi sdl sdl-sound sdlaudio sendfile server session sharedmem slp smp sms sndfile sockets sounds spell spl sqlite sqlite3 srt sse sse-filters sse2 sse3 ssl ssse3 startup-notification statistics stats stencil-buffer stroke subp subtitles svg sysfs sysvipc szip tcpd texteffect textures tga theora threads tiff timidity tk toolbar tools transcode translator truetype truetype-fonts tv tv_check tv_combiner tv_pick_cgi type1 type1-fonts unicode unzip usb userlocales utempter v4l v4l2 vcd videos visualization vorbis webdav webpresence wmf wmp wxwindows x264 xanim xcomposite xemacs xext xface xine xml xorg xosd xpm xrandr xscreensaver xskatcards xv xvid xvmc yiff yv12 zlib zvbi" ALSA_CARDS="emu10k1" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de" LIRC_DEVICES="devinput" USERLAND="GNU" VIDEO_CARDS="nvidia vesa vga v4l nv"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

and:

so I have to patch portage manually to be able to upgrade?
(btw -r8 fails too)

Comment 7 Zac Medico gentoo-dev 2007-12-08 05:17:57 UTC
(In reply to comment #6)
> so I have to patch portage manually to be able to upgrade?
> (btw -r8 fails too)

There are a least a couple of other alternatives:

a) Temporarily set some directory that is not mounted with the noexec option in one of the TMPDIR, TEMP or TMP environment variables. For example:

  export TMPDIR=/
  emerge portage
  unset TMPDIR

b) Temporarily remount /tmp without the noexec option and upgrade portage.

The easiest option is probably (a).
Comment 8 Volker Hemmann 2007-12-09 16:42:21 UTC
yeah, a) was easier and worked fine. Thank you.
Comment 9 Norberto Bensa 2007-12-09 17:38:18 UTC
I keep wondering... Why "emerge portage" worked before rc5? What does this change do? 

And BTW, "mount -o remount,exec /tmp" seems easier to me ;)

Comment 10 Zac Medico gentoo-dev 2007-12-09 19:14:22 UTC
When upgrading or downgrading, earlier versions of portage always assumed that the bash files located in /usr/lib/portage/bin/ (especially ebuild.sh) are compatible with the other version of portage being installed. This made it impossible to make any really significant changes in the way that those file interact with the the python code that is located in /usr/lib/portage/pym/.

For example, when portage-2.1.3.19 upgrades to portage-2.1.4_rc9, after it merges the new version into /usr/lib/portage, it uses the new versions bash code to run the pkg_postinst phase of the new version and the pkg_prerm and pkg_postrm phases of itself.  When it's running those phases, it's using the old version's python code which is still in memory. Any incompatibility between the old version's python code and the new version's bash code can potentially cause the upgrade to fail in some unexpected way.

Therefore, >=portage-2.1.4_rc5 makes backup copies of any files that it might need to complete the install, and it uses those versions instead of the potentially incompatible ones from the new version. This allows >=portage-2.1.4_rc5 to make assumptions about how it's bash code will behave, even in cases when it is upgrading or downgrading itself. We could not make this assumption before and it limited the kinds of changes we could make. For now, we still have to make the bash code backward compatible so that older versions of portage can safely upgrade to portage-2.1.4. However, once all users have upgraded to >=portage-2.1.4, that will no longer be an issue. We'll be able to make all kinds of incompatible changes without causing any problems for upgrades or downgrades.