snapcraft register-key timeout

Bug #2065075 reported by Robin Elvin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
New
Undecided
Unassigned

Bug Description

I'm trying to follow the instructions for creating an Ubuntu Core model assertion but the register-key command doesn't work:

$ snapcraft register-key kiosk-model-key

Enter your Ubuntu One e-mail address and password.
If you do not have an Ubuntu One account, you can create one at https://snapcraft.io/account
Email: email_address@here
Password:

We strongly recommend enabling multi-factor authentication: https://help.ubuntu.com/community/SSO/FAQs/2FA
Registering key ...
error: cannot sign assertion: cannot sign using GPG: /usr/bin/gpg --personal-digest-preferences SHA512 --default-key 0x9CE93AE8F32535693B6E7B6D20A8BBC6BD028FCA --detach-sign failed: exit status 2 ("gpg: signing failed: Timeout\ngpg: signing failed: Timeout\n")
Sorry, an error occurred in Snapcraft:
Command '['snap', 'export-key', '--account=EyLgeiBk4chQJ40ljhXjJvmlfdmRnw0C', 'kiosk-model-key']' returned non-zero exit status 1.
We would appreciate it if you anonymously reported this issue.
No other data than the traceback and the version of snapcraft in use will be sent.
Would you like to send this error data? (Yes/No/Always/View) [no]:

Additionally trying to get more verbose output both turns up the verbosity and exits saying no such option:

$ snapcraft register-key --verbosity=trace kiosk-model-key

2024-05-07 16:42:33.400 Starting snapcraft, version 8.2.5
2024-05-07 16:42:33.400 Logging execution to '/home/rob/.local/state/snapcraft/log/snapcraft-20240507-164233.400089.log'
2024-05-07 16:42:33.401 Raw pre-parsed sysargs: args={'help': False, 'verbose': False, 'quiet': False, 'verbosity': 'trace', 'version': False} filtered=['register-key', 'kiosk-model-key']
2024-05-07 16:42:33.401 General parsed sysargs: command='register-key' args=['kiosk-model-key']
2024-05-07 16:42:33.401 Configuring application...
2024-05-07 16:42:33.401 Preparing application...
2024-05-07 16:42:33.402 Command parsed sysargs: Namespace(key_name='kiosk-model-key')
2024-05-07 16:42:33.402 Build plan: platform=None, build_for=None
2024-05-07 16:42:33.402 Running snapcraft register-key on host
Usage: snapcraft register-key [OPTIONS] <key-name>
Try 'snapcraft register-key -h' for help.

Error: No such option: --verbosity

Tags: craft-2880
Revision history for this message
Robin Elvin (elvintech) wrote :

NOTE: This is using a SSH session. I have executed `export GPG_TTY=$(tty)` in the session beforehand.
Running the command directly in a GUI shell shows the key passphrase window and it works.

Revision history for this message
Callahan Kovacs (mr-cal) wrote :

Are you working in an environment with gnome-keyring?

Based on your comment about being in an SSH session, do you think it is similar to this? https://forum.snapcraft.io/t/snapcraft-login-command-not-working/40013/4

Revision history for this message
Robin Elvin (elvintech) wrote :

No, I am not using gnome-keyring.

Yes, I believe it is the same issue - there is no cli prompt fallback so the command times out waiting for the key to be unlocked.

Revision history for this message
Callahan Kovacs (mr-cal) wrote :

I see, can you provide your OS, desktop environment, and the keyring you are using?

I'm glad you reported this. I was focusing on gnome-keyring but now we will need a more generic solution.

Revision history for this message
Robin Elvin (elvintech) wrote :

I am using Linux Mint 21.3 Virginia, desktop environment Cinnamon.

Can you clarify what you mean by "keyring"? As far as I know this is using a new GPG config created by snapcraft. If you can tell me how to check I'll update this ticket.

Thanks

Revision history for this message
Callahan Kovacs (mr-cal) wrote :

Thanks. By "keyring" I mean the system that stores secrets like GPG keys. The first attachment shows the keyring in the system settings.

I just installed Mint Linux 21.3 (Cinnamon) and reproduced your issue. It looks like Mint uses gnome-keyring is used by default (see second attachment). Note that 'gnome-keyring' is a mostly generic keyring that doesn't have much to do with gnome.

So it looks like we can still target a solution that on focuses on gnome-keyring.

Revision history for this message
Callahan Kovacs (mr-cal) wrote :

(attachment #2)

Revision history for this message
Robin Elvin (elvintech) wrote (last edit ):

Ok, that's great thanks. Sorry for the misinformation about gnome-keyring! Checked and confirmed it is what I have on my installation.

ps aux | grep "gnome-keyring-daemon"
rob 1700 0.0 0.0 241128 5952 ? SLl May02 0:01 /usr/bin/gnome-keyring-daemon --daemonize --login
rob 2494095 0.0 0.0 9220 2416 pts/0 S+ 19:39 0:00 grep --color=auto gnome-keyring-daemon

Revision history for this message
Callahan Kovacs (mr-cal) wrote :

No worries and thanks for the report.

Tracking internally with CRAFT-2880.

tags: added: craft-2880
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.