Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 222091 - All merge fails at 'postint' because of "Argument list too long" errors due to "vga" variable in env
Summary: All merge fails at 'postint' because of "Argument list too long" errors due t...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: AMD64 Linux
: High major with 1 vote (vote)
Assignee: Gentoo Release Team
: 234962 236743 (view as bug list)
Depends on:
Blocks: 240304
  Show dependency tree
Reported: 2008-05-14 15:45 UTC by drozofil
Modified: 2018-06-07 05:58 UTC (History)
14 users (show)

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

emerge --info output (emerge-info.txt,2.93 KB, text/plain)
2008-05-14 18:59 UTC, drozofil
emerge -v --info (,10.38 KB, text/plain)
2008-06-01 05:11 UTC, blackd
emerge --verbose --info (emerge-verbose-info,10.09 KB, text/plain)
2008-06-14 23:13 UTC, Matteo 'The Peach' Pescarin
emerge --verbose --info (,11.09 KB, text/plain)
2008-07-27 11:45 UTC, Thimo Langbehn
filter \1 (start of heading) characters for portage- (soh_2.1.4.4.patch,327 bytes, patch)
2008-09-01 19:47 UTC, Zac Medico
Details | Diff
filter \1 (start of heading) characters for portage-2.2_rc8 (soh_2.2_rc8.patch,1.30 KB, patch)
2008-09-01 19:56 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description drozofil 2008-05-14 15:45:00 UTC
I'm using the 2008.0 beta 2 install cd for amd64. I haven't booted into my system yet (trying to merge system packages).
All merge are concerned.

Sample lines:
/usr/lib64/portage/bin/ line 1658: /bin/tr: Argument list too long
/usr/lib64/portage/bin/ line 1658: /bin/sort: Argument list too long
/usr/lib64/portage/bin/ line 1444: /usr/lib64/portage/bin/ Argument list too long
/usr/lib64/portage/bin/ line 1791: /bin/bzip2: Argument list too long

Finally fails with:
!!! FAILED postinst:1

Points to bugs 190128 and 200313 but I couldn't grasp what was relevant with them.

Package seems to get correctly merged, but this does break multi package merges since portage breaks at the first error

Reproducible: Always

Steps to Reproduce:
1. emerge awk
2. see
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2008-05-14 16:52:39 UTC
emerge --info, please.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2008-05-14 17:11:54 UTC
emerge --nodeps portage might help too.
Comment 3 drozofil 2008-05-14 18:59:35 UTC
Created attachment 153155 [details]
emerge --info output

I've already done "emerge --nodeps portage" but unfortunately this hasn't solved the problem. I've attached the results of the emerge --info as a text file.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2008-05-15 16:51:56 UTC
There should be only one of these:
app-shells/bash:     3.2_p17-r1, 3.2_p33

Could you try and re-emerge bash?
Comment 5 drozofil 2008-05-15 18:18:44 UTC
I've re-emerged bash, but this didn't solve the problem.
I'm using the app-shell/bash-3.2_p33 ebuild. bash --version returns "GNU bash, version 3.2.33(1)-release (x86_64-pc-linux-gnu)"
Comment 6 drozofil 2008-05-15 20:11:11 UTC
I have added "set -x" and "set -x" around the script file.

Considering that there are only simple quotes on the command lines, I don't think there is any globbing taking place, and the length of the command line doesn't explain the "Argument list too long error message".

Any clue ?

/usr/lib64/portage/bin/ line 1448: /usr/lib64/portage/bin/ Argument list too long
Comment 7 drozofil 2008-05-19 20:59:00 UTC
This bug is definitely portage related !
I reinstalled a fresh 2007.0 on my box. First thing I did was emerge --nodeps portage (can't do with deps due to an obscure problem with bash). Guess what ? It started to fail the same way all over again ! But with the provided version everything worked fine. Too bad it's out of the tree  ...
Comment 8 blackd 2008-05-31 11:03:03 UTC
I had ran to this problem with the minimal install cd and after some digging I have found that the intstall cd sets the $vga env var to some binnay data that later is expanded to \xxx\xxx values by the and for some reason it grows until everything you call with that enviromen returns an Argument line too long error.  A quick fix is to unset the $vga variable.
Comment 9 SpanKY gentoo-dev 2008-06-01 02:09:43 UTC
thanks for the tip ... i would post the output of `emerge --verbose --info` as an attachment
Comment 10 blackd 2008-06-01 05:11:44 UTC
Created attachment 155061 [details]
emerge -v --info
Comment 11 SpanKY gentoo-dev 2008-06-01 05:40:16 UTC
blackd: sorry, i meant for drozofil to post his
Comment 12 blackd 2008-06-01 12:04:47 UTC
with my you can see the $vga value
and he already have posted his
Comment 13 SpanKY gentoo-dev 2008-06-01 21:50:14 UTC
he posted --info, not --info --verbose
Comment 14 drozofil 2008-06-02 17:05:28 UTC
Updated portage today (armed with a full dump of my disk in case stuff go wild), and ***no problem***. The only thing that have changed is that I'm in my fully functionnal gentoo environment (i.e. booting on it) while doing this, and not into the livecd chrooted environment with the framebuffer ($VGA ?).

Now I could completely start all over again a fresh install to exhibit the problem, as I'm sure it's 100% reproductible.

I've checked $VGA prior updating and after, and in both cases it was empty.
Sorry not beeing able to give more info. Anything you want me to take back if I'm to spend a few hours installing something that will be eventually broken at some point ?
Comment 15 SpanKY gentoo-dev 2008-06-02 17:55:33 UTC
$VGA is not the same as $vga
Comment 16 Matteo 'The Peach' Pescarin 2008-06-14 23:13:44 UTC
Created attachment 156805 [details]
emerge --verbose --info

i've stepped into the very same problem:
> /usr/lib64/portage/bin/ line 1492: /bin/touch: Argument list too long
unmerging app-portage/eix-0.10.5.ebuild
I've seen the long vga string in the environment file but I've got no $vga variables defined, nor I didn't understand where I should add/remove it.
Comment 17 Matteo 'The Peach' Pescarin 2008-06-15 19:00:28 UTC
I forgot to mention that this happens on "postrm" phase. 
Comment 18 SpanKY gentoo-dev 2008-06-16 21:42:55 UTC
just do "unset vga" before emerging something

releng: can we track down this vga env var and squash it ?  i dont think it needs to be exported to the environment anywhere ...
Comment 19 Andrew Gaffney (RETIRED) gentoo-dev 2008-06-16 21:56:17 UTC
Why are we being "blamed" here? He said that it happened with 2007.0. If this were a problem with the media, *somebody* would have hit it in the last year.
Comment 20 SpanKY gentoo-dev 2008-06-17 01:46:38 UTC
please refrain from using words like "blame" and assist in the debug process instead of trying to point fingers

the original reporter said they're using 2008 beta 2 ... other people have seen the same issue with older versions.  considering release team creates/boots livecds quite often, it's a lot easier for you to boot up a recent image and see if 'vga' is set than it is for me ... especially seeing as how i havent booted up a livecd in over a year ...
Comment 21 blackd 2008-06-17 05:43:35 UTC
I have tried this on both 2007.0 and 2008 beta 2 and the problem shows on both after first portage update.
Comment 22 SpanKY gentoo-dev 2008-06-17 06:15:20 UTC
you see 'vga' in the env while in the livecd (not chroot), correct ?

could you try doing:
grep -Ir '\<vga\>' /etc /lib*

and posting the results
Comment 23 blackd 2008-06-17 07:39:48 UTC
Hmm it appears that this is hardware dependent because I cannot reproduce it on my work machine or in vmware VM.
You´ll have to wait until I return home.
Comment 24 Christian Schmidt 2008-06-17 11:00:29 UTC
I do have the same problem on two of my amd64 machines, regularly during postinstall (after the old package is unmerged).
Now, while testing an ebuild I'm working on I received it earlier:

ebuild OpenXPKI-0.9.1263.ebuild install
>>> Existing ${T}/environment for 'OpenXPKI-0.9.1263' will be sourced. Run
>>> 'clean' to start with a fresh environment.
 * OpenXPKI-0.9.1263.tar.gz RMD160 SHA1 SHA256 size ;-) ...               [ ok ]
 * checking ebuild checksums ;-) ...                                      [ ok ]
 * checking auxfile checksums ;-) ...                                     [ ok ]
 * checking miscfile checksums ;-) ...                                    [ ok ]
 * checking OpenXPKI-0.9.1263.tar.gz ;-) ...                              [ ok ]
/usr/lib64/portage/bin/ line 1504: /bin/touch: Argument list too long
 * ERROR: dev-perl/OpenXPKI-0.9.1263 failed.

Line 1504 is touch "${T}/environment.success". dumping ${T} shows /tmp/portage/dev-perl/OpenXPKI-0.9.1263/temp/environment.success, which is not too long.

ok, i changed the /usr/lib64/portage/bin/ preprocess_ebuild_env() function to this:

preprocess_ebuild_env() {
                export SANDBOX_ON=1
                set > /tmp/dbg1
                source "${T}/environment" || exit $?
                export SANDBOX_ON=0

                set > /tmp/dbg2
                source "${PORTAGE_BIN_PATH}/" || exit $?

                save_ebuild_env || exit $?
                set > /tmp/dbg3
                touch "${T}/environment.success" || exit $?
        ) > "${T}/environment.filtered"

The dbg2 file id 600kb(!) bigger than dbg1. Is has the following extra:
and a lot more of this. It is in the imported environment file as well.

I actually have no clue yet where it is set. Unsetting KRB5CCNAME before running ebuild/emerge solves the problem.
Comment 25 Christian Schmidt 2008-06-17 11:17:21 UTC
Another short update:

/lib64/security]>grep -r KRB5CCNAME .
Binary file ./ matches
{root}-(Tue Jun 17 14:05:05)-<dnnote>
[/lib64/security]>strings ./ | grep KRB5CCNAME
pam_mount(%s:%u) KRB5CCNAME setenv failed

Maybe this is a candidate. Both of the machines I experienced the bug on are relying on pam_mount for encrypted home directories. Timewise correlation to the upgrade to pam_mount-0.38+ could fit.
Comment 26 SpanKY gentoo-dev 2008-06-17 11:34:05 UTC
your issue is unrelated.  you should open a different bug.
Comment 27 blackd 2008-06-17 20:37:07 UTC
grep -Ir '\<vga\>' /etc /lib*
/etc/brltty.conf:#screen-parameters lx:Hfb=auto # [auto,vga,fb,0-7]

striped some "No such file or directory" warnings no copy&paste in links2

Any way this seems to be hardware related because at least for me the $vga var is set to some binary value only on PCs with nvidia graphics (any one that can verify that)
Comment 28 blackd 2008-06-17 21:30:17 UTC
So little more digging and i found that the vga var is actually passed as parameter to the kernel by grub (2008 beta 2 uses grub) any way there is a problem whit the command line processing by the kernel OR the way the command line is passed to the kernel and some binary data is appended the the last parameter (zero termination any one?).

The initrd scripts use the /proc/cmdline (command line passed to the kernel) to do some initializations and for some reason sets the vga var with the value of the vga parameter.

So in my opinion the problem comes from the way kernel cmdline is passed to or processed by the kernel. And for some reason this does not manifest it self on all hardware configurations.

Comment 29 SpanKY gentoo-dev 2008-06-17 22:09:35 UTC
there was a bug with grub where it wouldnt correctly NUL terminate the cmdline string, but that should be fixed in the latest version

but i thought the livecd used like syslinux as the boot loader, so grub wouldnt be involved here at all

i dont think there's a need for the initrd to bleed any environment settings from the /proc/cmdline into the shell environment ...

if you look at /proc/<pid>/environment, you should be able to trace the parents of your shell and see what process first has the setting ...
Comment 30 blackd 2008-06-18 07:32:16 UTC
I´ve added "debug" to the kernel cmd line this causes the initrd script to spawn a shell before giving control to the real init.

# cat /proc/1/environ

vga=791.....(binary data)

The above lines are join together, cat strips the \0 chars.

The process with PID 1 is "/bin/sh /init dokeymap cdroot"

It seems that initrd leaks some kernel parameters in the environment.

On a production system where the genkernel initrd is used there some kernel parameters like "real_root=/dev/evms/root" in the environment of the real init proces but they are missing in the other processes.

p.s. This all is for 2008 beta2. I´ll it with 2007.0 this evening. 
Comment 31 blackd 2008-06-18 19:51:55 UTC
It appears that there is no such problem with 2007.0 at least not with the $vga var as it's not with binary value. 
Comment 32 Andrew Gaffney (RETIRED) gentoo-dev 2008-06-20 01:27:54 UTC
Okay, so the *real* issue here is the grub bug causing non-termination of the kernel commandline string. The 2008.0_beta[12] x86/amd64 CDs used grub, but the 2008.0 final will go back to isolinux due to other issues we ran into. If you encounter this from your normal system, upgrade grub and reinstall it.
Comment 33 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-06-20 01:46:08 UTC
This is a duplicate of 216307. Upgrade your grub fully folks. Make _really_ sure that the files in /boot/grub/ get updated.

*** This bug has been marked as a duplicate of bug 216307 ***
Comment 34 blackd 2008-06-20 02:04:16 UTC
Actually I do not agree.
Sure grub causes the problem but still portage have to be prepared to handle such rough environment, or at least has to show a decent error message.
Comment 35 SpanKY gentoo-dev 2008-06-20 11:03:58 UTC
this isnt a dupe of grub persay ... the install media needs updating
Comment 36 SpanKY gentoo-dev 2008-06-20 11:04:34 UTC
Robin: also, genkernel shouldnt go bleeding random things from /proc/cmdline into the environment
Comment 37 Andrew Gaffney (RETIRED) gentoo-dev 2008-06-20 12:31:02 UTC
Do you see where the genkernel init scripts are doing this? I only see 2 variables actually being exported (which is required for it to bleed into another process's env, correct?). Those variables are CDBOOT and MLIST.
Comment 38 blackd 2008-06-20 14:48:20 UTC
Well exported or not they do exist. Try 
less /proc/1/environ
In a system that uses the genkernel initrd. Main has "real_root=/..."

Or you can add debug parameter to the kernel and inspect the environment of the debug shell. 
Comment 39 johannes sollner 2008-06-27 09:26:55 UTC
I want to comment that I also ran into this problem when installing gentoo from a 2008.0 beta2 minimal install CD. I had to boot via CD / chroot several times (problems with the hardware, i.e. no boot from hard-disk) before the error occured for the fist time, though. Maybe that helps.

Comment 40 Andrew Gaffney (RETIRED) gentoo-dev 2008-07-11 23:50:21 UTC
This is "fixed" on the 2008.0 final install media, since we've switched back to isolinux for other reasons. While genkernel still leaks a few vars to the env, it's very few and they'll get fixed in an upcoming refactoring of the genkernel code.
Comment 41 Douglas Sherwood 2008-07-17 09:45:18 UTC
im mot sure if this needs to be reopened or not, but I just started installing from the 2008.0 amd64 non beta disk and got the same exact error. When I used the command "echo $vga" it printed gibberish and messed up the characters on the console. It looks like you are still using grub as the boot loader for the amd64 minnimal cd.
Comment 42 blackd 2008-07-17 09:47:17 UTC
Well it appears that it is not fixed so I suggest that you reopen it.
Comment 43 Douglas Sherwood 2008-07-17 10:02:44 UTC
I tried but I don't have the privileges to do that.
Comment 44 Matteo 'The Peach' Pescarin 2008-07-17 10:41:14 UTC
I still have issues with this problem. I need an advice because I don't know if I need to open a different bug or not.
I started having a 'postrm' error (touch arg too long - vga) upgrading eix; after reading this thread I tried to upgrade grub, but I got the same error, so currently I have two ebuilds that can't be uninstalled.
In the root shell `echo $vga` produces nothing, while looking at the ebuild environment I get the long vga string and also this string:
  declare -x vga="791�������������������������������������������������ȈJ�"

Any help will be very much appreciated! thanks!
Comment 45 Andrew Gaffney (RETIRED) gentoo-dev 2008-07-17 14:34:28 UTC
It looks like the amd64 minimal CD got built with grub instead of isolinux somehow. Reopening until we put out a -r1.
Comment 46 Matteo 'The Peach' Pescarin 2008-07-17 17:54:09 UTC
(In reply to comment #44)
I must underline that my problem happens on an already installed machine, that used the 2008_beta2 as install medium.
as stated before the only place where the vga mess happens is during postrm time, maybe only in sandbox.
Comment 47 Andrew Gaffney (RETIRED) gentoo-dev 2008-07-17 18:10:09 UTC
Yes, because you're using the old grub version that the CD was. Upgrade your grub and be sure to re-install it into the MBR.
Comment 48 Douglas Sherwood 2008-07-18 04:26:08 UTC
Well looks like it is working for me now. I didn't really do anything to fix it. After about 4-5 restarts using the minimal amd64 disk it compiled the kernel, a few needed tools and grub so I could boot it without the cd. When I was messing around with the grub.conf file I noticed if you disable the framebuffer it would cause it to not find the root partition on the cd and load the ash shell for recovery. 
Comment 49 Matteo 'The Peach' Pescarin 2008-07-18 13:18:45 UTC
(In reply to comment #47)
> Yes, because you're using the old grub version that the CD was. Upgrade your
> grub and be sure to re-install it into the MBR.

I've upgraded to grub-0.97-r6, I've reflashed the MBR but once rebooted I still get the error when trying to emerge --clean on postrm phase.
The grub-1* ebuild is just broken (can't detect lzo-2*) so I hope you don't mean that.
did I miss something?
Comment 50 Andrew Gaffney (RETIRED) gentoo-dev 2008-07-18 14:15:55 UTC
Did you run 'emerge --config' for grub? You have to do that in new versions to copy the new files to /boot/grub/, iirc.
Comment 51 Matteo 'The Peach' Pescarin 2008-07-18 15:08:56 UTC
(In reply to comment #50)
> Did you run 'emerge --config' for grub? You have to do that in new versions to
> copy the new files to /boot/grub/, iirc.

the --config part, as stated in the einfo msg, is only to be done if the files are to be copied elsewhere, btw nothing changed, I did, specifying /boot as destination directory and rerun setup on the MBR. No way. Still have the postrm errors.
Comment 52 Markus Ewald 2008-07-20 15:28:51 UTC
I've got this problem too, on various packages of my gentoo 2008.0 amd64 box.

Tried doing an emerge -e world because I added a compiler flag (-fno-strict-aliasing because the compiler warnings in several packages were scaring me). Only used stable packages.

I have seen the binary garbage being passed to the kernel on the minimal install iso, but this is occurring in the already installed and self-booting OS with up-to-date grub and bash. I see no excessively long environment variables, $vga is not set.

Portage (default/linux/amd64/2008.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.25-gentoo-r6 x86_64)
System uname: 2.6.25-gentoo-r6 x86_64 AMD Athlon(tm) 64 Processor 3500+
Timestamp of tree: Sun, 20 Jul 2008 14:45:01 +0000
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.5.2-r5
dev-python/pycrypto: 2.0.1-r6
sys-devel/autoconf:  2.13, 2.61-r2
sys-devel/automake:  1.7.9-r1, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
CFLAGS="-march=athlon64 -O3 -pipe -fomit-frame-pointer -mmmx -msse -msse2 -m3dnow -fno-strict-aliasing"
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=athlon64 -O3 -pipe -fomit-frame-pointer -mmmx -msse -msse2 -m3dnow -fno-strict-aliasing"
FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
USE="3dnow X a52 aac acl acpi alsa amd64 apache2 apm bash-completion berkdb bzip2 cairo cdr cli cracklib crypt ctype cups cxx dri dvd dvdr encode exif expat ffmpeg firefox flac fontconfig fortran ftp gd gdbm gif gpm graphviz gtk hal hddtemp iconv imagemagick imap innodb ipv6 isdnlog java jpeg jpeg2k kde lame lua lzo mad matroska midi mime mmx mng mono mozilla mp3 mpeg mplayer mudflap multilib mysql mysqli ncurses nls nocd nptl nptlonly ogg openal openexr opengl openmp oss pam pch pcre pdf perl png pppd python qt3 qt4 quicktime raw rdesktop readline reflection rss ruby samba sdl session shorten soap sockets speex spell spl sqlite sqlite3 sse sse2 ssl subversion svg syslog tcl tcpd theora threads tiff tk truetype unicode videos vorbis wavpack wmf x264 xml xmlrpc xorg xvid zlib" 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" 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" USERLAND="GNU" VIDEO_CARDS="fbdev glint i810 mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo"

Comment 53 Jinesh Choksi 2008-07-20 16:45:05 UTC
I came across this today on the AMD64 minimal install CD (2008.0).

I entered the word debug after the vga=791 line on the Gentoo grub entry when booting from the CD and it booted up as normal. Upon chrooting and trying to emerge the package which failed earlier (gentoo-sources) it worked fine this time around.

I can confirm I have a nvidia card built into the motherboard.

Odd behaviour!
Comment 54 Markus Ewald 2008-07-20 18:09:08 UTC
Same with me, if I "emerge --update package" the failed ebuild manually after the error occurs, it works fine.

When I then do another "emerge -e world", the error pops up again (after maybe 30 minutes of compiling) in the very same packages.

Tried the ~amd64 portage to no avail.

The specific error I'm seeing in the console is
/usr/lib64/portage/bin/ line 1496 - /bin/touch - Argument list too long

I tried dumping the environment like Christian Schmidt did, but since I do an "emerge -e world", the changes will be overwritten right when the emerge begins. If I try to add the lines later on, Python gets confused with the file offset and dies.
Comment 55 Markus Ewald 2008-07-20 19:38:37 UTC
Got a workaround:

Edit /usr/src/linux/include/linux/limits.h

  #define ARG_MAX       131072  /* # bytes of args + environ for exec() */
  #define ARG_MAX      1048576

Recompile your kernel, update the kernel image on your boot partition.

Truely an ugly and ignorant hack ;-). Christian Schmidt mentioned a 600 kb size increase in the environment, so doing the simple math, 1mb > (131072b + 600kb), the new kernel will happily cope with all the garbage and let me recompile my system.

Still hoping for a real solution!
Comment 56 Markus Ewald 2008-07-21 17:29:54 UTC
Sorry that workaround didn't... work around the problem after all. Still getting the errors.

I can see the $vga variable in eg.
but not from typing 'set' or 'env' in my bash.

I'm not too experienced here, anyone got an idea how to track down the source of these strings?

Or was the $vga variable only set when I booted from the Gentoo 2008.0 install DVD and emerge somehow saves the original environment a package was built under?

That would mean a) it should not happen again once I get rid of that string from the saved environments (HOW?) and b) the Gentoo 2008.0 install DVD could somehow cope with this long string -- it got my packages compiled, after all.

For me this bug is a blocker since I can't recompile or update any package on my system anymore.
Comment 57 blackd 2008-07-21 17:42:03 UTC
look at /var/db/pkg/package name/environment.bz2

may be you have to edit this file to remove the vga var

p.s. keep a copy of the original just in case 
Comment 58 Markus Ewald 2008-07-22 13:57:44 UTC
I would try that, but this error occurred in hundreds of packages.

In the meantime, my careless fixing attempts ended up in disaster and I ended up deleting my whole /var/db/ directory (: - I'm reinstalling my system with "unset vga".

For the actual binary data contained in the $vga variable and some more info, check this forum post by me:
Comment 59 Gregg Casillo 2008-07-22 14:27:02 UTC
I applied Jinesh's solution in comment #53 during a fresh install from a 2008.0 minimal CD yesterday. I edited the kernel line in the boot menu by appending "debug" to the end of the line. Seemed to work, and I never saw this error during the entire installation. *shrug*
Comment 60 Thimo Langbehn 2008-07-27 11:45:28 UTC
Created attachment 161457 [details]
emerge --verbose --info

I got the same Problem with a huge vga string in the environment file, but (as of now) only for pkgconfig-0.22:
> /usr/lib64/portage/bin/ line 1492: /bin/touch: Argument list too long

However, while my system is amd64 and was installed from the amd64 minimal disc, i use lilo as Bootloader (with the line "vga=0x31B" in lilo.conf).
Therefore the Problem might not be limited to grub, or it is caused elsewhere.
Appending a "debug" at the end, eliminating the "vga=0x31B" or changing it to "vga=346" did not solve the problem for me.

I made an upgrade to Python 2.5 and to the 2.6.25 kernel right before i got this error, and i use a NVIDIA Card, too.
Comment 61 Denis V. Lunev 2008-08-10 21:21:22 UTC
the problem is present on ATI video too.
At least for my
01:05.0 VGA compatible controller: ATI Technologies Inc Unknown device 796e
Comment 62 Denis V. Lunev 2008-08-10 21:41:57 UTC
Removing vga helps. Simple scripts below could help unattended user :)

bzcat $1 | sed -e '/^declare -x vga/d' >$ || exit -1
bzip2 $ || exit -1
mv $ $1

bzcat $1 | sed -e '/^vga/d' >$ || exit -1
bzip2 $ || exit -1
mv $ $1

After that:
cd /var/db/pkg
find . -name environment.bz2 -exec /tmp/ \{} \;
find . -name environment.bz2 -exec /tmp/ \{} \;

Somebody could combine them into one :) It is too late for me to do so.
Comment 63 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-08-16 23:58:02 UTC
*** Bug 234962 has been marked as a duplicate of this bug. ***
Comment 64 junkmail 2008-08-17 01:42:07 UTC
(In reply to comment #63)

Don't know if this adds any more information to help, but I'm having the same problem, installed from AMD64 Beta2 (can't remember if it was minimal or not), with an on-board ATI 780G video chipset. I use pam_mount to mount an encrypted partition on login, though it's not the home partition. I'm pretty sure I've updated grub, but I'll need to check that tomorrow.

'# echo $vga' returns no data.

'emerge -e system' made no difference.
Comment 65 junkmail 2008-08-24 08:45:05 UTC
(In reply to comment #64)
> (In reply to comment #63)

Just for the record, upgrading to grub version 0.97-r6 followed by grub-install hasn't solved the problem. Portage versions and both show the error. In fact, my problem looks more like comment 25 as it appears to be something to do with $KRB5CCNAME rather than $vga, because that's the long gibberish string in the environment files.

My problem looks more like bug 230738, but it is not fixed in portage as that bug would suggest.
Comment 66 Andrew Gaffney (RETIRED) gentoo-dev 2008-08-24 20:36:17 UTC
The issues at hand (grub not putting a terminating NUL and the amd64 2008.0 minimal using grub instead of isolinux) have been fixed. As far as I can tell, this wasn't genkernel's fault (as it appears it was busybox init exporting the kernel commandline to the env), either, so there's nothing to fix.
Comment 67 junkmail 2008-08-25 21:17:27 UTC
(In reply to comment #66)
> ... so there's nothing to fix.

So do I need to open a new bug then, because there is very much something broken on my system?
Comment 68 Mina Naguib 2008-08-29 14:15:19 UTC
I think there are two manifestations of this bug.  I can confirm that at least one of them is not fixed, which means this bug should be opened, however read below for more info:

The first manifestation is if your current environment has an overly large $vga variable.  Many commands (even outside of portage.  try `find /tmp` for example) will choke on it.  You can check this with echo $vga to see if that's your case.

The second manifestation, and the one I ran into, is that even if the $vga is not set, it might have been set at some point in time and captured into the "environment snapshot" when installing a package.  This snapshot is restored at package unmerging time and the bug crops up. (sometimes.. it depends on the site of $vga - I've seen some snapshots with a few Ks and some a bit over 700Ks)

I believe the above happened to me since I installed gentoo (2008 minimal amd64) using framebuffer mode.  I rebuilt my own kernel and manually configured grub for the actual installation, so packages installed after the first reboot were not affected.

This command lists installed packages which have a vga captured environment variable:
for f in /var/db/pkg/*/*/environment.bz2; do bzcat $f | grep -q vga=; if [ "$?" == "0" ]; then echo $f; fi; done

As you can see, the output on my machine lists packages very commonly installed during the installer cd process:

The fix is fairly easy.  I simply use `vi` to edit all those files (it can natively handle bz2 files) and delete all the "vga=" and "declare -x vga=" lines.

As mentioned above, new packages installed after the reboot don't suffer from this problem.

I'm not too familiar with the internals of portage, but perhaps the next update should filter out this variable when restoring the snapshott-ed environment ?  It might help people avoid this problem instead of having to manually fix their snapshots as described above.

Comment 69 junkmail 2008-08-31 14:38:27 UTC
(In reply to comment #68)

For me it's definitely nothing to do with the $vga variable. The symptoms are the same, but running your script gives no output. It is however something to do with the $KRB5CCNAME variable which is very, very long in all the affected packages.

I'm really frustrated having had my bug moved into this RESOLVED, FIXED one, when it's neither resolved nor fixed.

Does anyone know what sets the KRB5CCNAME variable? I suppose it's something to do with kerberos, and have thought about putting USE="-kerberos" in /etc/make.conf, but I'm frightened of screwing something else up, as this is my office's main server.
Comment 70 Markus Ewald 2008-09-01 05:38:35 UTC
Agreed. Sometimes I've got the impression Gentoo's quality is not exactly on the rise. That this bug even made it beyond the first release candidate is surprising. That there's no fix provided is disconcerting. And now it's even marked as resolved.


FYI to the other people plagued with this:

The bug affects the last environment variable passed to the kernel. During my search for help, both 'VGA' and 'KRB5CCNAME' were the candidates that seemed to pop up most often.

As you have noticed, this bug is not resolved at all. Even if the install DVD had been fixed in the meantime, all the users out there with the garbage environment variable in their system are still prevented from updating.

A small automated script which corrects the contents of the various environment.bz2s in /var/db (for example by capping all environment variables in there to 64k characters) would solve all these users issues.

But, as it stands now, the only solution is to either write this script yourself or to reinstall from scratch, running "unset VGA" or "unset KRB5CCNAME" directly after booting from the install DVD.
Comment 71 Andrew Gaffney (RETIRED) gentoo-dev 2008-09-01 05:59:09 UTC
For people still being hit by this bug after upgrading grub, have you tried just removing the environment.bz2 and re-emerging the effected packages?
Comment 72 Zac Medico gentoo-dev 2008-09-01 19:47:45 UTC
Created attachment 164284 [details, diff]
filter \1 (start of heading) characters for portage-

Use this patch if you have portage- If this patch is saved as /tmp/soh_2.1.4.4.patch then it can be applied as follows:

patch /usr/lib/portage/bin/ /tmp/soh_2.1.4.4.patch
Comment 73 Zac Medico gentoo-dev 2008-09-01 19:56:11 UTC
Created attachment 164288 [details, diff]
filter \1 (start of heading) characters for portage-2.2_rc8

If this patch is saved as /tmp/soh_2.2_rc8.patch then it can be applied as follows:

patch /usr/lib/portage/bin/ /tmp/soh_2.2_rc8.patch
Comment 74 junkmail 2008-09-02 15:38:40 UTC
(In reply to comment #71)
That stopped being funny a *long* time ago. Having to continually delete environment files and re-emerge is very annoying, especially if it's a bigish package like php for example.

(In reply to comment #72)

What does your script do Zac?
Comment 75 Zac Medico gentoo-dev 2008-09-02 19:32:10 UTC
(In reply to comment #74)
> What does your script do Zac?

It's a patch which causes portage's environment filter to exclude \1 characters which trigger the problem. Here's the comment from the patch that applies to portage-2.2_rc8 which is in svn and is also attached to this bug:

+	# Filter out any instances of the \1 character from variable values
+	# since this character multiplies each time that the environment
+	# is saved (strange bash behavior). This can eventually result in
+	# mysterious 'Argument list too long' errors from programs that have
+	# huge strings of \1 characters in their environment. See bug #222091.
Comment 76 Mike Pagano gentoo-dev 2008-09-04 15:08:57 UTC
*** Bug 236641 has been marked as a duplicate of this bug. ***
Comment 77 junkmail 2008-09-04 19:12:14 UTC
(In reply to comment #75)

Great, that's sorted it. Thank you Zac :-)
Comment 78 Zac Medico gentoo-dev 2008-09-07 22:51:06 UTC
*** Bug 236743 has been marked as a duplicate of this bug. ***