# [solved] gpg: agent_genkey failed: End of file

## oneone

Hi!

I'm not sure, whether this is the right part of the forum, since it's not exactly networking related, but about gnupg. Please tell me, if there is a better place to post this.

From time to time I send/receive PGP- encrypted mails, but not very often. Recently I got an encrypted mail and was not able to decrypt it. Because it has been some time since I've done that the last time, I can't really say to which changes on my system it could be related to. All I know is, that I haven't done any manual changes to the relevant config files.

To find the error I tried to manually encrypt something with gpg:

```
% gpg --encrypt --armor

You did not specify a user ID. (you may use "-r")

Current recipients:

rsa2048/F3ECF574******** 2019-04-16 "sent@local"

Enter the user ID.  End with an empty line: MyAccount

Current recipients:

rsa2048/8723E173******** 2019-04-07 "MyAccount <user@mail.com>"

rsa2048/F3ECF574******** 2019-04-16 "sent@local"

Enter the user ID.  End with an empty line: 

My Test Message

-----BEGIN PGP MESSAGE-----

hQEMA4cj4XN7HBK/AQf9FpMbkXd8Y9vvv1N0dWAe7XP349V0D4LDO4/qV3llmi1k

m5LoFtSazK9zliKw3hntjSvqfuqE3jczTy+hO2YvPy3oY3IDqVbBQgeWzRtlB81W

hQkh7OfDNg6Q3KMvindetViXT5jGeJFeG/zy4tMHXT4+2MJJ/np3KtDd93kona2M

np9QvTGUneCGuzqMLdT0j8+WZEdOWexvkOZaM+Q44RyiRq68yuYOpHfWknghoxxz

gQ852oCp/nJBt4AopCJqjiOkA0HsQokA8m+doLC1onCknNgp6wx7WNllv7wMkVFw

E8gmlkgNZuyH646fgwBnHzTKwkNoWn0QsKC4X0AUiYUBDAMAAAAAAAAAAAEH/jQM

gDZGj03WM09wUarDdl7Twt6ciSxOrkf2bNaYL+QY5XEUV03B12pyFdPqEvNE1Mv4

eldECBql3NCsHiocRlvY7EU3xgTMmchXWJuLQDlfNDHjUDexYuSXQ15DhCfE6+yV

a42HMfDfJTa1mjyWW63JbdhjFu1v3BobTpPzL7CJGlxt86z/A1KPwclhjvR+5CB9

oWFmUaf9/6TnuBE8xKdWjO2H6yQMaG2NALTjQ1qoUSL6TWQ112ySFEuQ8nkmK596

c46Y3uKLUsD27NbfVtdxZGHTQZ0hU3SvgEoZ0r5R3GqVEseVQaDLV9x2lD1LRSr9

0Im3qsGtG3cHr6nUGufSSwGsqiYbxlkDbLCPavXvuGjiISmC+9ghehOWGd2ckBBW

EFNdsG66JTKOH1CjyXXGBUTzX9cCOl7VMrh+605CaugkIXHv85q0pG8dqw==

=RMoZ

-----END PGP MESSAGE-----

```

(In case you wonder, what sent@local is: That is just  a standard key, I encrypt every message with in order to be able to read it myself. Since I use multiple different e-mail addresses with expiring keys, it seemed to be more comfortable to have just one local key for all my sent messages, which will remain valid)

So, as you can see, encrypting worked without any issue, but decrypting failed as follows:

```
% gpg --decrypt

-----BEGIN PGP MESSAGE-----

hQEMA4cj4XN7HBK/AQf9FpMbkXd8Y9vvv1N0dWAe7XP349V0D4LDO4/qV3llmi1k

m5LoFtSazK9zliKw3hntjSvqfuqE3jczTy+hO2YvPy3oY3IDqVbBQgeWzRtlB81W

hQkh7OfDNg6Q3KMvindetViXT5jGeJFeG/zy4tMHXT4+2MJJ/np3KtDd93kona2M

np9QvTGUneCGuzqMLdT0j8+WZEdOWexvkOZaM+Q44RyiRq68yuYOpHfWknghoxxz

gQ852oCp/nJBt4AopCJqjiOkA0HsQokA8m+doLC1onCknNgp6wx7WNllv7wMkVFw

E8gmlkgNZuyH646fgwBnHzTKwkNoWn0QsKC4X0AUiYUBDAMAAAAAAAAAAAEH/jQM

gDZGj03WM09wUarDdl7Twt6ciSxOrkf2bNaYL+QY5XEUV03B12pyFdPqEvNE1Mv4

eldECBql3NCsHiocRlvY7EU3xgTMmchXWJuLQDlfNDHjUDexYuSXQ15DhCfE6+yV

a42HMfDfJTa1mjyWW63JbdhjFu1v3BobTpPzL7CJGlxt86z/A1KPwclhjvR+5CB9

oWFmUaf9/6TnuBE8xKdWjO2H6yQMaG2NALTjQ1qoUSL6TWQ112ySFEuQ8nkmK596

c46Y3uKLUsD27NbfVtdxZGHTQZ0hU3SvgEoZ0r5R3GqVEseVQaDLV9x2lD1LRSr9

0Im3qsGtG3cHr6nUGufSSwGsqiYbxlkDbLCPavXvuGjiISmC+9ghehOWGd2ckBBW

EFNdsG66JTKOH1CjyXXGBUTzX9cCOl7VMrh+605CaugkIXHv85q0pG8dqw==

=RMoZ

-----END PGP MESSAGE-----

gpg: anonymous recipient; trying secret key 8723E173******** ...

gpg: anonymous recipient; trying secret key F3ECF574******** ...

gpg: encrypted with RSA key, ID 0000000000000000

gpg: encrypted with 2048-bit RSA key, ID 8723E173********, created 2019-04-07

      "MyAccount <user@mail.com>"

gpg: public key decryption failed: End of file

gpg: decryption failed: No secret key

```

It seemed to be quite weird, because according to the output gpg tries to decrypt the message with the correct key, but then it says that it is not available. Of course I checked the keyring and public and secret keys are there.

Next I thought the keys might have gotten corrupted or it is some version conflict with gpg. It's still hard to imagine for me, but apparently some gpg versions cannot handle the keyrings of other versions, I remember to have read somewhere. However, I tried to generate new keys then, and now I don't think anymore that it is an issue with my keys but that it has something to do with gpg or pinentry:

```
% gpg --gen-key --verbose --debug-all

gpg: reading options from '/home/x/.gnupg/gpg.conf'

gpg (GnuPG) 2.2.17; Copyright (C) 2019 Free Software Foundation, Inc.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

gpg: enabled debug flags: packet mpi crypto filter iobuf memory cache memstat trust hashing ipc clock lookup extprog

Note: Use "gpg --full-generate-key" for a full featured key generation dialog.

GnuPG needs to construct a user ID to identify your key.

Real name: Test User

Email address: test@test.com

You selected this USER-ID:

    "Test User <test@test.com>"

Change (N)ame, (E)mail, or (O)kay/(Q)uit? O

We need to generate a lot of random bytes. It is a good idea to perform

some other action (type on the keyboard, move the mouse, utilize the

disks) during the prime generation; this gives the random number

generator a better chance to gain enough entropy.

gpg: DBG: [not enabled in the source] start

gpg: DBG: chan_4 <- OK Pleased to meet you, process 21994

gpg: DBG: connection to agent established

gpg: DBG: chan_4 -> RESET

gpg: DBG: chan_4 <- OK

gpg: DBG: chan_4 -> OPTION ttyname=/dev/pts/4

gpg: DBG: chan_4 <- OK

gpg: DBG: chan_4 -> OPTION ttytype=rxvt-unicode

gpg: DBG: chan_4 <- OK

gpg: DBG: chan_4 -> OPTION display=:0.0

gpg: DBG: chan_4 <- OK

gpg: DBG: chan_4 -> OPTION lc-ctype=en_US.utf8

gpg: DBG: chan_4 <- OK

gpg: DBG: chan_4 -> OPTION lc-messages=en_US.utf8

gpg: DBG: chan_4 <- OK

gpg: DBG: chan_4 -> GETINFO version

gpg: DBG: chan_4 <- D 2.2.17

gpg: DBG: chan_4 <- OK

gpg: DBG: chan_4 -> OPTION allow-pinentry-notify

gpg: DBG: chan_4 <- OK

gpg: DBG: chan_4 -> OPTION agent-awareness=2.1.0

gpg: DBG: chan_4 <- OK

gpg: DBG: chan_4 -> RESET

gpg: DBG: chan_4 <- OK

gpg: DBG: chan_4 -> GENKEY

gpg: DBG: chan_4 <- S INQUIRE_MAXLEN 1024

gpg: DBG: chan_4 <- INQUIRE KEYPARAM

gpg: DBG: chan_4 -> D (genkey(rsa(nbits 4:2048)))

gpg: DBG: chan_4 -> END

gpg: DBG: chan_4 <- INQUIRE PINENTRY_LAUNCHED 22011 curses 1.1.0 /dev/pts/4 rxvt-unicode :0.0

gpg: pinentry launched (22011 curses 1.1.0 /dev/pts/4 rxvt-unicode :0.0)

gpg: DBG: chan_4 -> END

gpg: DBG: chan_4 <- ERR 83902463 End of file <Pinentry>

gpg: agent_genkey failed: End of file

Key generation failed: End of file

gpg: DBG: [not enabled in the source] stop

gpg: keydb: handles=0 locks=0 parse=0 get=0

gpg:        build=0 update=0 insert=0 delete=0

gpg:        reset=0 found=0 not=0 cache=0 not=0

gpg: kid_not_found_cache: count=0 peak=0 flushes=0

gpg: sig_cache: total=0 cached=0 good=0 bad=0

gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0

              outmix=0 getlvl1=0/0 getlvl2=0/0

gpg: rndjent stat: collector=0x0000000000000000 calls=0 bytes=0

gpg: secmem usage: 1344/65536 bytes in 2 blocks

```

I rebuild gnupg, pinentry, libtool and libgcrypt (just in case). Recently updated to new versions of boost and gcc. I don't think that either of them has anything to do with it, but just in case that it has, I mention it.

Doing some websearch I found these two things, which look quite like my case, but didn't really bring me any further:

https://bugzilla.redhat.com/show_bug.cgi?id=1362572

https://gitlab.alpinelinux.org/alpine/aports/issues/5594

But anyway I am kind of stuck at this point now. If anybody can help, it would be much appreciated.

oneone.Last edited by oneone on Thu Nov 07, 2019 7:40 am; edited 1 time in total

----------

## mike155

I guess that something is wrong with your pinentry program. It doesn't seem to return the password(s) you typed in the format GnuPG expects.

Please run as root:

```
eselect pinentry list
```

and select a different pinentry binary:

```
eselect pinentry set <target>
```

It seems that you use the ncurses based pinentry program. If that's the case, it might help to re-install ncurses.

----------

## oneone

I think selecting another pinentry binary is a good idea. However, since I wanted to stick with the ncurses one, I decided to rebuild ncurses. Now every program that depends on ncurses (like mutt) gives me a bus error (some give segmentation faults). Rebuilding mutt didn't help. I also recompiled gpm (what ncurses seems to depend on), but without any effect.

Any idea?

----------

## mike155

 *Quote:*   

> Any idea?

 

That's good - in the sense that you found the culprit.  :Smile: 

First of all: it's rather unusual that programs stop working when you recompile ncurses. Something must have happened before. Any idea? A failed profile update or a failed GCC or glibc update? Or did you change CFLAGS?

Please post the ouput of

```
emerge --info
```

We should double-check that your configuration is fine.

Have you run

```
emerge --update --deep --newuse @world
```

lately? If not: do it!

You could rebuild all packages that depend on ncurses. Run

```
equery d ncurses
```

to find those packages and re-emerge them. Don't forget to use emerge option '--oneshot'.

----------

## oneone

Wow, I'm really good at making things worse today.

I thought unmerge and remerge ncurses would be a good idea. Now I cannot even compile anymore   :Very Happy:  Sorry for this dilettantism.

Apparently I'm not the first person, who's got this brilliant idea: https://forums.gentoo.org/viewtopic-t-824420-start-0-postdays-0-postorder-asc-highlight-.html

I tried unpacking a tarball of ncurses-5.9-r3 from http://tinderbox.dev.gentoo.org/ as described in the thread. It didn't work, the same issue that _Luda_ describes (maybe because it current version is ncurses-6.1_p20181020 ??). Is there a tarball of the current version, that I can download, to be able to compile again and perform the steps you suggested?

----------

## oneone

Thank you so much for the help (eventhough I still make things worse..) 

Regarding emerge --update --deep --newuse @world, I do that frequently (last time yesterday, I would say).

I did indeed update gcc to version sys-devel/gcc-8.3.0-r1 recently. I didn't do any special rebuilds after that. What should have been the steps, I should have followed?

----------

## mike155

Tinderbox is outdated, unfortunately...

Try: http://packages.gentooexperimental.org/packages/amd64-stable/sys-libs/ncurses-6.1_p20181020.tbz2

Don't worry. This is Gentoo Linux! We'll bring your machine back to life! Promised!   :Smile: Last edited by mike155 on Wed Nov 06, 2019 7:46 pm; edited 1 time in total

----------

## oneone

Still gives me:

```
%  sudo tar xpf Downloads/ncurses-6.1_p20181020.tbz2  -C / 

Password: 

bzip2: (stdin): trailing garbage after EOF ignored
```

I don't know, whether that is a problem, but ncurses still doesn't compile with "sudo emerge -va ncurses"

----------

## mike155

Wait.. Were you able to download and install the binary package using

```
emerge --oneshot ncurses-6.1_p20181020.tbz2
```

Did it work? Or did you get an error?

----------

## oneone

Trying it like that gives me:

```
% sudo emerge -va1 Downloads/ncurses-6.1_p20181020.tbz2 

Password: 

*** emerging by path is broken and may not always work!!!

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

Calculating dependencies \

*** You need to adjust PKGDIR to emerge this package: /home/x/Downloads/ncurses-6.1_p20181020.tbz2

                                                                                                                                                ... done!
```

Should I copy the file in /var/cache/binpkgs or should I set the PKGDIR to my Downloads folder?

What I did before was the tar command (from the previous post). Trying to "emerge -v1 ncurses" resulted in that: https://pastebin.com/etRzQmtj

----------

## mike155

Please try (as root)

```
cd /tmp

mkdir -p packages/sys-libs

mv <directory to the downloaded ncurses file>/ncurses-6.1_p20181020.tbz2 packages/sys-libs/

chown -R portage:portage packages

cd packages

PKGDIR="/tmp/packages" emerge --oneshot sys-libs/ncurses-6.1_p20181020.tbz2

```

----------

## oneone

It doesn't complain about the PKGDIR anymore, but I get a bunch of Python errors from the emerge script now: https://pastebin.com/aY91xgak

----------

## oneone

Okay, it worked now. Had to unmerge it again (for some reason..) and now:

```
/tmp/packages # PKGDIR="/tmp/packages" emerge --oneshot sys-libs/ncurses-6.1_p20181020.tbz2

*** emerging by path is broken and may not always work!!!

Calculating dependencies... done!

>>> Emerging binary (1 of 1) sys-libs/ncurses-6.1_p20181020::gentoo

 * ncurses-6.1_p20181020.tbz2 size ;-) ...                               [ ok ]

>>> Extracting info

>>> Extracting sys-libs/ncurses-6.1_p20181020

>>> Installing (1 of 1) sys-libs/ncurses-6.1_p20181020::gentoo

>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.

```

But: I still cannot compile anything else..  :Sad: 

EDIT: Also when trying to recompile ncurses (because I have the gpm useflag which isn't activated in that binary tarball), I still get the "checking for C compiler default output... configure: error: C compiler cannot create executables" error.

----------

## mike155

1) What happens if you run

```
emerge --oneshot ncurses
```

2) Please post the output of

```
emerge --info
```

Last edited by mike155 on Wed Nov 06, 2019 8:34 pm; edited 1 time in total

----------

## oneone

When trying to recompile ncurses I still get the "checking for C compiler default output... configure: error: C compiler cannot create executables" error.

This is the output of "emerge --info":

```
Portage 2.3.76 (python 3.6.9-final-0, default/linux/amd64/17.1/desktop, gcc-8.3.0, glibc-2.29-r2, 4.19.72-gentoo x86_64)

=================================================================

System uname: Linux-4.19.72-gentoo-x86_64-Intel-R-_Core-TM-_i5-5250U_CPU_@_1.60GHz-with-gentoo-2.6

KiB Mem:     8068732 total,   5295852 free

KiB Swap:    8703996 total,   8703996 free

Head commit of repository gentoo: 18f8d14a296d48b829eb8f4f78e554e78c216dc9

Head commit of repository wine: 09ba77c3f606472ca38d5eea4c94877a4c5aa4c6

sh bash 4.4_p23-r1

ld GNU ld (Gentoo 2.32 p2) 2.32.0

app-shells/bash:          4.4_p23-r1::gentoo

dev-java/java-config:     2.2.0-r4::gentoo

dev-lang/perl:            5.28.2-r1::gentoo

dev-lang/python:          2.7.16::gentoo, 3.6.9::gentoo

dev-util/cmake:           3.14.6::gentoo

dev-util/pkgconfig:       0.29.2::gentoo

sys-apps/baselayout:      2.6-r1::gentoo

sys-apps/openrc:          0.41.2::gentoo

sys-apps/sandbox:         2.13::gentoo

sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo

sys-devel/automake:       1.11.6-r3::gentoo, 1.13.4-r2::gentoo, 1.15.1-r2::gentoo, 1.16.1-r1::gentoo

sys-devel/binutils:       2.32-r1::gentoo

sys-devel/gcc:            8.3.0-r1::gentoo

sys-devel/gcc-config:     2.0::gentoo

sys-devel/libtool:        2.4.6-r3::gentoo

sys-devel/make:           4.2.1-r4::gentoo

sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)

sys-libs/glibc:           2.29-r2::gentoo

Repositories:

gentoo

    location: /usr/portage

    sync-type: rsync

    sync-uri: rsync://rsync.gentoo.org/gentoo-portage

    priority: -1000

    sync-rsync-verify-metamanifest: yes

    sync-rsync-verify-jobs: 1

    sync-rsync-verify-max-age: 24

    sync-rsync-extra-opts: 

localrepo

    location: /var/db/repos/localrepo

    masters: gentoo

wine

    location: /var/db/package-manager/repos/wine

    sync-type: git

    sync-uri: https://anongit.gentoo.org/git/repo/proj/wine.git

    masters: gentoo

toaster

    location: /var/lib/layman/toaster

    masters: gentoo

    priority: 50

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA FraunhoferFDK"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=native -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"

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.3/ext-active/ /etc/php/cgi-php7.3/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="-march=native -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 strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

FFLAGS="-march=native -O2 -pipe"

GENTOO_MIRRORS="http://ftp.uni-erlangen.de/pub/mirrors/gentoo"

LANG="en_US.utf8"

LDFLAGS="-ltinfo"

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 alsa amd64 berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli consolekit crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam ffmpeg flac fortran gdbm gif gpg gpm gtk iconv icu intel ipv6 jpeg jpeg2k lcms ldap libnotify libtirpc mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf pgp_classic png policykit postgres ppds pulseaudio python qt5 readline sdl seccomp spell split-usr ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb v4l vorbis wxwidgets x264 xattr xcb xml xv xvid 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="efi-64" INPUT_DEVICES="mouse keyboard libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="x86_64 arm" QEMU_USER_TARGETS="x86_64 arm" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="intel i965" 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, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

----------

## oneone

I can compile by setting ABI_X86="64", my normal setting is ABI_X86="32 64". Maybe the problem is that it is a 64-bit-only version of ncurses in the tarball. Is it possible to just install a 32-bit tarball "on top of it" to fix this?

EDIT: In Tinderbox there was a amd64_x32/ folder.. that might be exactly what I need to make this work again.

----------

## mike155

The ouput of 'emerge --info' looks good.   :Smile: 

Let's recapitulate what happened:

You had problems with ncurses, but GCC worked

You uninstalled ncurses

You installed a ncurses 5.9 binary package from the tinderbox manually

You installed a ncurses 6.1 binary package from gentooexperimental.org using emerge

Your GCC doesn't work anymore

Is that true? If that's the case:

It could well be that there are some left-overs from ncurses 5.9 which distrurb gcc and other programs. Never(!) install anything without emerge to Gentoo system directories - because Portage won't be able to delete those files. You could try to manually remove any left-overs from your ncurses 5.9 install.

Try to find out what annoys gcc. You could write a small 'hello world' C program and try to compile it with GCC. Does it work? Do you get error messages? 

You could take a look at the log files which were created when you invoked 'emerge --oneshot ncurses'. Look at 

```
/var/tmp/portage/sys-libs/ncurses-6.1_p20181020/temp/* 
```

and especially at 

```
/var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1-abi_x86_64.amd64/ncurses/config.log
```

Are there any error messages which tell you what's wrong?

----------

## mike155

 *oneone wrote:*   

> I can compile by setting ABI_X86="64", my normal setting is ABI_X86="32 64". Maybe the problem is that it is a 64-bit-only version of ncurses in the tarball. Is it possible to just install a 32-bit tarball "on top of it" to fix this?

 

Sounds logical and comprehensible. 

 *oneone wrote:*   

> EDIT: In Tinderbox there was a amd64_x32/ folder.. that might be exactly what I need to make this work again.

 

Don't do that! amd64_x32 is probably something totally different (see https://en.wikipedia.org/wiki/X32_ABI) and installing this package could you destroy your machine irreversibly  :Sad: 

----------

## oneone

Yes, there is indeed something. I remember that there was something with ncurses and tinfo that tends to make problems.. At least I ran into some kind of problem iwth that some time ago..

This is from my /var/tmp/portage/sys-libs/ncurses-6.1_p20181020/work/ncurses-6.1-abi_x86_32.x86/ncurses/config.log  (The amd64 one doesn't exist and it's the 32-bit version having the problems anyway)..

```
configure:1703: $? = 0

configure:1705: x86_64-pc-linux-gnu-gcc -m32 -v </dev/null >&5

Using built-in specs.

COLLECT_GCC=x86_64-pc-linux-gnu-gcc

COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/8.3.0/lto-wrapper

Target: x86_64-pc-linux-gnu

Configured with: /var/tmp/portage/sys-devel/gcc-8.3.0-r1/work/gcc-8.3.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/8.3.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 8.3.0-r1 p1.1' --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-libmpx --disable-systemtap --enable-vtable-verify --enable-lto --without-isl --enable-default-pie --enable-default-ssp

Thread model: posix

gcc version 8.3.0 (Gentoo 8.3.0-r1 p1.1) 

configure:1708: $? = 0

configure:1710: x86_64-pc-linux-gnu-gcc -m32 -V </dev/null >&5

x86_64-pc-linux-gnu-gcc: error: unrecognized command line option '-V'

x86_64-pc-linux-gnu-gcc: fatal error: no input files

compilation terminated.

configure:1713: $? = 1

configure:1733: checking for C compiler default output

configure:1736: x86_64-pc-linux-gnu-gcc -m32 -march=native -O2 -pipe  -ltinfo conftest.c  >&5

/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -ltinfo

collect2: error: ld returned 1 exit status

configure:1739: $? = 1

configure: failed program was:

#line 1717 "configure"

#include "confdefs.h"

int

main (void)

{

  ;

  return 0;

}

configure:1762: error: C compiler cannot create executables

```

EDIT: I manually checked the files that I extracted to /usr/lib and /lib with "equery belongs ..." and deleted the ones that weren't claimed by portage..

EDIT: Is there any way to compile ncurses without the tinfo useflag? I seem to be not able to deactivate it.

----------

## oneone

Ah, I knew it would cause more problems one day.. and I should have written comments, why I added "-tinfo" to the LDFLAGS in make.conf

I removed it and ncurses compiles now. Oh, and I thought it was an issue with gpg intitially. Sorry for going so absolutely offtopic. It seems to be more about my probably incomplete gcc-update.

I also recompiled ncurses-compat and some messages like this:

```
>>> Regenerating /etc/ld.so.cache...

/sbin/ldconfig: /usr/lib64/libformw.so.5 is not a symbolic link

/sbin/ldconfig: /usr/lib64/libform.so.5 is not a symbolic link

/sbin/ldconfig: /usr/lib64/libpanel.so.5 is not a symbolic link

/sbin/ldconfig: /usr/lib64/libpanelw.so.5 is not a symbolic link

/sbin/ldconfig: /usr/lib64/libmenuw.so.5 is not a symbolic link

/sbin/ldconfig: /usr/lib64/libmenu.so.5 is not a symbolic link
```

What's ldconfig's problem? Those files have all been install by ncurses-compat and should be there I think.

Coming back (slowly but surely) to my gpg problem (remember, I wanted to read an encrypted email with mutt):

Mutt  (and alsamixer and cmus and...) still give me bus errors.

Rebuilding the packages suggested by "equery d ncurses" (https://pastebin.com/z0Xddg0Z) doesn't look promising. I did rebuild the sys-lib packages and mutt, without any effect. Most of the other packages don't seem to depend on each other.. but maybe I should give it a try.

EDIT: Is there a command to rebuild all the dependencies found by "equery d ..." or do I have to copy everything from the list manually?

EDIT: The ldconfig issue was possible to resolve by removing some more manually installed libraries in /usr/lib64. During rebuild some packages complained about a missing libtinfo.so now. These packages were the reason, why I added LDFLAGS="-tinfo" to my make.conf in the first place. I added it again and ncurses compiled without any problem. I'm now rebuilding all the packages that depend on ncurses again. So far I got cmus and vifm to work again. Mutt still isn't working.

But to be on topic again: selecting pinentry-tty with eselect solved the initial gpg problem for me. Thanks for all the help!!!

EDIT: Doing 

```
sudo LDFLAGS="" emerge -va mutt cmus alsamixer vifm
```

 made those programs work again. Maybe I should have a look at pkg-config or something like that to solve this properly. But first, I will finally respond to that mail  :Very Happy:   :Very Happy: 

I mark this thread as solved now and might open a new one about my problem with ncurses and tinfo.

And... is there any short and simple answer, what to do (what to rebuild) when you do a gcc version update from e.g. 8.2.0 to 8.3.0?

----------

## mike155

oneone, I don't fully understand what you did and what went wrong.

I think I would:

remove all files that you installed manually in one of the Gentoo systems directories (like /*bin, /lib*, /usr/*bin, /usr/lib*, etc.). NEVER (!!!) do that again!

check all settings you made in /etc/portage/*, especially in /etc/poratge/make.conf.

clean up /var/lib/portage/world

rebuild the whole system

```
emerge -e @world
```

In case the rebuild stops, you can solve the problem and continue with

```
emerge --resume
```

If you can't solve the problem, you can try:

```
emerge --resume --skipfirst
```

run

```
emerge --depclean
```

I use 'emerge -e @world' very rarely (once in 5 years), but I would use it it in this case.

----------

## oneone

I think the whole problem was caused by having ncurses and ncurses-compat compiled with different LDFLAGS (see https://bugs.gentoo.org/457530). I removed the manually installed files and everything works well now.

Generally I think I have a tidy system and I also avoid installing things without using portage. Yesterday I just kind of paniced  :Very Happy: .. Sometimes I clone stuff vom github and install them via make, make install, but just when I'm sure that I can also make uninstall. Would you recommend not doing so and rather building my own ebuilds in a local repo for these cases? Is that really necessary?

I'm updating to gcc 9.3.0 now and maybe I will do the complete rebuild that you suggested, just to be sure, everything is fine. Everything works now, but maybe I'm just lucky to not come across any bugs yet.

----------

## mike155

 *Quote:*   

> Yesterday I just kind of paniced ..

 

No problem. That's the situation where we learn the most!  :Smile: 

Gentoo is good-natured and forgives many mistakes. I have never lost an installation in all those years. I have always been able to recover, even after making the biggest mistakes. 

 *Quote:*   

> Sometimes I clone stuff vom github and install them via make, make install, but just when I'm sure that I can also make uninstall. Would you recommend not doing so and rather building my own ebuilds in a local repo for these cases? Is that really necessary? 

 

That's what '/usr/local' is for. Run

```
configure --prefix=/usr/local
```

It's not easy to analyze and solve problems that are caused by stray files in Gentoo's system directories. I remember threads where users reported strange problems and it took 50 or more posts until we found out that a stray file in /usr/lib was the root cause. So at least on my machines, I don't allow anyone else than Portage (emerge) to write to Gentoo's system directories.

----------

## oneone

 *Quote:*   

> That's what '/usr/local' is for.

 

Oh, wow. That is super useful, I didn't know that.

 *Quote:*   

> That's the situation where we learn the most!

 

I definitely learned a lot yesterday  :Very Happy: 

----------

## Hu

I recommend against installing anything to /usr/local if it can have the same name as a Portage-managed file.  When Portage builds packages, those packages can see the contents of /usr/local, and may preferentially use those contents over the files found in /usr.  We have had problems before where users installed foo-1 to /usr/local, waited a few years, emerged foo-4 to /usr, then emerged bar-4 which requires >=foo-4.  Portage would note that it had installed foo-4, and be satisfied.  bar-4 would find foo-1 in /usr/local and fail.  Removing the stale unmanaged foo-1 would fix the problem.

Instead, you should find or write an ebuild so that Portage knows what is installed.

----------

## oneone

 *Quote:*   

> Instead, you should find or write an ebuild so that Portage knows what is installed.

 

Thanks for the advice.

I'm still busy rebuilding my system - but so far without any issues  :Smile: 

----------

