gpg-agent not killed when using pacstrap's new -K option
#23 added an option to initialize an empty keyring in the new root. This is implemented by running pacman-key --gpgdir "$newroot"/etc/pacman.d/gnupg --init
, which spawns a gpg-agent
on the host.
Unfortunately, the gpg-agent
process is not killed and will stay around after pacstrap
is done. This causes unmounting to fail with umount: /mnt: target is busy.
.
@forty-bot maybe you can chime in with your unshare
expertise :) I think the proper fix is:
diff --git a/pacstrap.in b/pacstrap.in
index 9466aa8..078909e 100644
--- a/pacstrap.in
+++ b/pacstrap.in
@@ -63,7 +63,7 @@ pacstrap() {
if [[ ! -d $newroot/etc/pacman.d/gnupg ]]; then
if (( initkeyring )); then
- pacman-key --gpgdir "$newroot"/etc/pacman.d/gnupg --init
+ $pid_unshare pacman-key --gpgdir "$newroot"/etc/pacman.d/gnupg --init
elif (( copykeyring )) && [[ -d /etc/pacman.d/gnupg ]]; then
# if there's a keyring on the host, copy it into the new root
cp -a --no-preserve=ownership /etc/pacman.d/gnupg "$newroot/etc/pacman.d/"
This issue is similar to #21 (closed).