Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1251254 > unrolled thread

Bug#1108406: gnupg: On Debian 13, fail to import a secret key exported from a Debian 12 host

Started byFrédéric Boiteux <fboiteux@free.fr>
First post2025-06-27 21:50 +0200
Last post2025-06-30 07:40 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.debian.bugs.dist


Contents

  Bug#1108406: gnupg: On Debian 13, fail to import a secret key exported from a Debian 12 host Frédéric Boiteux <fboiteux@free.fr> - 2025-06-27 21:50 +0200
    Bug#1108406: gnupg: On Debian 13, fail to import a secret key exported from a Debian 12 host Andreas Metzler <ametzler@bebt.de> - 2025-06-28 14:40 +0200
      Bug#1108406: gnupg: On Debian 13, fail to import a secret key exported from a Debian 12 host Fred <fboiteux@free.fr> - 2025-06-30 07:20 +0200
    Bug#1108406: gnupg: On Debian 13, fail to import a secret key exported from a Debian 12 host Fred <fboiteux@free.fr> - 2025-06-30 07:40 +0200

#1251254 — Bug#1108406: gnupg: On Debian 13, fail to import a secret key exported from a Debian 12 host

FromFrédéric Boiteux <fboiteux@free.fr>
Date2025-06-27 21:50 +0200
SubjectBug#1108406: gnupg: On Debian 13, fail to import a secret key exported from a Debian 12 host
Message-ID<L2nfb-dBZh-3@gated-at.bofh.it>
Package: gnupg
Version: 2.4.7-21
Severity: important
X-Debbugs-Cc: fboiteux@free.fr

Dear Maintainer,

I want to use my GnuPG key on a new laptop with Debian 13. I’ve exported my
key from my old computer using :

gpg --export-secret-keys --export-options backup --armor --output cleComplete.gpg.asc fredmob@free.fr

and copied that file cleComplete.gpg.asc on my new laptop, where I typed :

gpg --import cleComplete.gpg.asc

Here, gpg ask me for the key’s passphrase, but it doesn’t recognize it
(asking 3 times), and finally fail to import the secret key.

I tried also import with the option ’--pinentry-mode loopback’, typing the
passphrase in the terminal, but it doesn’t succeed either, with error
message : error sending to agent: Bad passphrase

I’ve tested the same file cleComplete.gpg.asc on another Debian 12 system,
and the importation succeeded on the first try.


    With regards,
        Fred.

-- System Information:
Debian Release: 13.0
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.32-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gnupg depends on:
ii  dirmngr     2.4.7-21+b1
ii  gnupg-l10n  2.4.7-21
ii  gpg         2.4.7-21+b1
ii  gpg-agent   2.4.7-21+b1
ii  gpgsm       2.4.7-21+b1

Versions of packages gnupg recommends:
ii  gnupg-utils     2.4.7-21+b1
ii  gpg-wks-client  2.4.7-21+b1
ii  gpgv            2.4.7-21+b1

Versions of packages gnupg suggests:
pn  gpg-wks-server  <none>
pn  parcimonie      <none>
pn  xloadimage      <none>

-- no debconf information

[toc] | [next] | [standalone]


#1251295

FromAndreas Metzler <ametzler@bebt.de>
Date2025-06-28 14:40 +0200
Message-ID<L2D0B-dLVa-5@gated-at.bofh.it>
In reply to#1251254
On 2025-06-27 Frédéric Boiteux <fboiteux@free.fr> wrote:
> Package: gnupg
> Version: 2.4.7-21
> Severity: important
> X-Debbugs-Cc: fboiteux@free.fr

> Dear Maintainer,

> I want to use my GnuPG key on a new laptop with Debian 13. I’ve exported my
> key from my old computer using :

> gpg --export-secret-keys --export-options backup --armor --output cleComplete.gpg.asc fredmob@free.fr

> and copied that file cleComplete.gpg.asc on my new laptop, where I typed :

> gpg --import cleComplete.gpg.asc

> Here, gpg ask me for the key’s passphrase, but it doesn’t recognize it
> (asking 3 times), and finally fail to import the secret key.
[...]
> I’ve tested the same file cleComplete.gpg.asc on another Debian 12 system,
> and the importation succeeded on the first try.
[...]

Hello Frédéric,

is the locale setup identical on both the Debian 12 and 13 systems? (Check
with the command locale without args.)

Is the keyboard setup identical, are you really typing the correct
string on the new system?

Just to illustrate, both strings look identical but are not binary
identical, just use you password instead of "Frédéric":

ametzler@argenau:~$ locale | grep CTYPE
LC_CTYPE="de_AT.UTF-8"
ametzler@argenau:~$ cat <<EOF | sha1sum
> Frédéric
> EOF
c92eb4d8bb529fc4e131e319705c07a44164a145  -
ametzler@argenau:~$ locale | grep CTYPE
LC_CTYPE="de_AT.iso88591"
ametzler@argenau:~$ cat <<EOF | sha1sum
> Frédéric
> EOF
33fb0da4a9e7c75b5641c2d013abc703b2918a62  -


cu Andreas

[toc] | [prev] | [next] | [standalone]


#1251440

FromFred <fboiteux@free.fr>
Date2025-06-30 07:20 +0200
Message-ID<L3f5T-eanh-3@gated-at.bofh.it>
In reply to#1251295
	Hello Andreas,

  Thanks for your suggestions / help.

Le sam. 28 juin 2025 14:16:41,
Andreas Metzler <ametzler@bebt.de> a écrit :

> is the locale setup identical on both the Debian 12 and 13 systems?
> (Check with the command locale without args.)

Yes, it's a standard French setup, fr_FR.UTF-8.

> Is the keyboard setup identical, are you really typing the correct
> string on the new system?

Yes, standard Bepo [« french » Dvorak] layout, on the 2 computers.

Moreover, my passphrase doesn't contain locale specific characters, no accent…


	Regards,
		Fred.

[toc] | [prev] | [next] | [standalone]


#1251441

FromFred <fboiteux@free.fr>
Date2025-06-30 07:40 +0200
Message-ID<L3fpf-eate-1@gated-at.bofh.it>
In reply to#1251254
	Hello John,

Le dim. 29 juin 2025 00:52:31,
John Scott <jscott@posteo.net> a écrit :
> This is a good point Andreas made here. In general former releases of
> Debian were somewhat permissive other text encoding options, but only
> locales compatible with UTF-8 are supported by the GNU C Library and
> Debian lately. Your new machine is indeed set up to use UTF-8
> correctly based on the info in your original bug report, so that's
> good.

Yes, I use UTF-8 for some Debian releases, for me ISO-8859-1 is old and obsolete for a long time.
 
> Your log appears to use ISO-8859-1 to encode special characters, and
> the GnuPG log says this: gpg: DBG: chan_5 -> OPTION
> …

I was puzzled that my log was in this ISO-8859-1 encoding, and checking it, it appears it's my name attached to the key which is in this encoding… I generated this key a long time ago, indeed !!

> The "LC_CTYPE=C" is odd... My suspicion is that this causes a
> fallback to ISO-8859-1 (for input and output) when necessary because
> GnuPG has its own code to handle that encoding, and maybe GnuPG was
> thrown off by your terminal type as shown by 'ttytype=xterm-kitty'.

No, for the log record, I forced LC_ALL=C to get error messages in english and not in french, for better understanding ! But it doesn't work either with my default fr_FR.UTF-8 locale.

I tried something like :
env LC_ALL=fr_FR.iso88591 gpg -v --import cleComplete.gpg.asc
or
env LC_ALL=fr_FR.iso88591 gpg -v --pinentry-mode loopback --import cleComplete.gpg.asc
but the passphrase isn't recognized either.

> Also, the GNOME/GTK ecosystem deliberately only supports UTF-8 even
> if the system would normally use another encoding, so if GnuPG is
> trying to exchange ISO-8859-1 text with GNOME's Pinentry, that's
> always just wrong and GNOME Pinentry ought to make more noise about
> such an invalid configuration.
> 
> Here are my ideas:
> • What terminal emulator and desktop environment are you using? If
> you don't know, it's probably GNOME Terminal or the newer GNOME
> Console on GNOME. If it is indeed the Kitty terminal emulator, try a
> different one.

I have a Mate environment with i3wm, using kitty as default terminal. I tried running gpg import command from mate-terminal, but it doesn't work better.

> • Try to totally log out of your session or restart, and then try
> importing the key again passing the '--display-charset UTF-8' option.
> This should tell GnuPG not to make guesses but to use UTF-8 for both
> input and output.

I've rebooted meanwhile [for latest Debian 13 kernel update]…
Trying this didn't succeed :
gpg --import --import-options restore --display-charset UTF-8 cleComplete.gpg.asc

> • The easiest thing, however, might be to change your private key's
> password on your old computer to something with only US-ASCII
> characters, export *that* key, and import it on your new computer.
> The characters in US-ASCII are always encoded the same way in all
> encodings that might be at play, so this would allow for more
> forgiveness if the encoding is set wrong.

Note that my passphrase doesn't contain any locale specific character, only US-ASCII ones…

But perhaps all this problem only tell me it's time to change passphrase, or better generate a new key [using latest standards], and migrate to it :-)

I think this bug report should be kept in case other people has the same problem, but for my point, it could be closed or its severity decreased, as I'll going generating a new key…

  Thanks for your support :-)
	Fred.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.bugs.dist


csiph-web