You are not logged in.

#1 2024-01-05 10:52:04

Joss
Member
Registered: 2024-01-05
Posts: 2

pacstrap: keyring not writable and pacman-key --init

I have been working my way through https://wiki.archlinux.org/title/Installation_guide on an HP 250 G6 and got stuck at 2.2, Install essential packages.

cat /proc/mounts shows /dev/sda3 at /mnt (ext4, rw) and /dev/sda1 at /mnt/sda1 (vfat, rw)


Running, # pacstrap -K /mnt base linux linux-firmware,

I get the normal output, with 146 packages listed, then I get warning: Public keyring not found; have you run 'pacman-key --init'?, followed by a list of error: keyring is not writable

So of course I try # pacman-key --init and I get lots of errors like cannot touch '/etc/pacman.d/gnupg//pubring.gpg': Read-only file system.
Other such commands (eg pacman-key --populate archlinux) either have a similar issue or rely on pacman-key --init having been run.

# pacman -Syu says failed to synchronize all databases (unexpected system error)

# pacman --sysroot /mnt -Syu says error: config file /etc/pacman.conf could not be read: No such file or directory

# timedatectl shows the right time and the right timezone as well.


Trying to arch-chroot and run anything in sda3 fails due to not finding /bin/bash which I assume is because I haven't pacstrapped anything there which leads me to this frustrating circular problem where I can't run things to get keys within the root filesystem because I haven't got pacman set up, due to not having keys.


I've gone through a lot of Reddit posts, Google searches and posts here and I've tried to make sure I've included all the obvious things that I went through, please let me know if the formatting needs to improve, I don't think you can do inline monospace so I've just got with emphasised text.

Many thanks.

Offline

#2 2024-01-05 11:01:57

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 622

Re: pacstrap: keyring not writable and pacman-key --init

You most likely ran pacstrap while pacman-init.service was still active.
When

# systemctl status pacman-init.service

shows "(code=exited, status=0/SUCCESS)" only then you can safely run pacman and pacstrap commands in the live environment.

Offline

#3 2024-01-05 11:38:55

Joss
Member
Registered: 2024-01-05
Posts: 2

Re: pacstrap: keyring not writable and pacman-key --init

nl6720 wrote:

You most likely ran pacstrap while pacman-init.service was still active.
When

# systemctl status pacman-init.service

shows "(code=exited, status=0/SUCCESS)" only then you can safely run pacman and pacstrap commands in the live environment.

I actually tried

# systemctl start pacman-init.service

a while ago but that gave me an error (I can't remember what, I think it was something about a readonly filesystem again).

I was doing this yesterday and only posted today after trying pacstrap again this morning (to see what the error was again - same error) so I can't see how that would be the cause.


Having said that, in the past few minutes when running things and expecting errors so I could note down what it was saying (running a few commands over and over because I forgot to write various things down), the errors suddenly stopped.

For reference,

# systemctl status pacman-init.service

now displays

Loaded: loaded (/etc/systend/system/pacman-init.service: enabled; present: disable)
Active: active (exited)
Process: 20148 ExecStart=/usr/bin/pacman-key --init (code=exited, status=0/SUCCESS)
Process: 20181 ExecStart=/usr/bin/pacman-key --populate (code=exited, status=0/SUCCESS)
Main PID: 20181 (code=exited, status=0/SUCCESS

(Crucially, Main PID indicates all is fine)

Sadly I didn't get a chance to try # systemctl status pacman-init.service before everything started behaving so I can't find out whether it was like that beforehand.

Last edited by Joss (2024-01-05 11:41:18)

Offline

#4 2024-02-22 00:40:05

antmont
Member
Registered: 2024-02-22
Posts: 1

Re: pacstrap: keyring not writable and pacman-key --init

Hi,

I ran into the same problem, and this thread was very helpful in solving it.

Joss wrote:
nl6720 wrote:

You most likely ran pacstrap while pacman-init.service was still active.
When

# systemctl status pacman-init.service

shows "(code=exited, status=0/SUCCESS)" only then you can safely run pacman and pacstrap commands in the live environment.

I actually tried

# systemctl start pacman-init.service

a while ago but that gave me an error (I can't remember what, I think it was something about a readonly filesystem again).

I was doing this yesterday and only posted today after trying pacstrap again this morning (to see what the error was again - same error) so I can't see how that would be the cause.

...

Sadly I didn't get a chance to try # systemctl status pacman-init.service before everything started behaving so I can't find out whether it was like that beforehand.

The output I got from

# systemctl status pacman-init.service

when the error was happening was (run Thu 2024-02-22 10:50:08 AEDT):

○ pacman-init.service - Initializes Pacman keyring
     Loaded: loaded (/etc/systemd/system/pacman-init.service; enabled; preset: disabled)
     Active: inactive (dead) since Wed 2024-02-21 14:58:02 AEDT; 19h ago
   Duration: 1d 16h 23min 39.447s
    Process: 989 ExecStart=/usr/bin/pacman-key --init (code=exited, status=0/SUCCESS)
    Process: 1023 ExecStart=/usr/bin/pacman-key --populate (code=exited, status=0/SUCCESS)
   Main PID: 1023 (code=exited, status=0/SUCCESS)
        CPU: 23.689s

Feb 19 22:34:21 archiso pacman-key[1256]: gpg: (use option "--allow-weak-key-signatures" to override)
Feb 19 22:34:23 archiso pacman-key[1256]: gpg: marginals needed: 3  completes needed: 1  trust model: pgp
Feb 19 22:34:23 archiso pacman-key[1256]: gpg: depth: 0  valid:   1  signed:   5  trust: 0-, 0q, 0n, 0m, 0f, 1u
Feb 19 22:34:23 archiso pacman-key[1256]: gpg: depth: 1  valid:   5  signed:  98  trust: 0-, 0q, 0n, 5m, 0f, 0u
Feb 19 22:34:23 archiso pacman-key[1256]: gpg: depth: 2  valid:  74  signed:  22  trust: 74-, 0q, 0n, 0m, 0f, 0u
Feb 19 22:34:23 archiso pacman-key[1256]: gpg: next trustdb check due at 2024-04-10
Feb 19 22:34:23 archiso systemd[1]: Finished Initializes Pacman keyring.
Feb 21 14:58:02 archiso systemd[1]: pacman-init.service: Deactivated successfully.
Feb 21 14:58:02 archiso systemd[1]: Stopped Initializes Pacman keyring.
Feb 21 14:58:02 archiso systemd[1]: pacman-init.service: Consumed 23.689s CPU time.

I think the problem might be related to the "Active: inactive (dead) since..." line. I'm working through this install over a number of days, so the dates are correct.

# systemctl start pacman-init.service

fixed the issue for me.

Thanks.

Offline

Board footer

Powered by FluxBB