unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo Famulari <leo@famulari.name>
To: Marius Bakke <marius@gnu.org>
Cc: 42129@debbugs.gnu.org
Subject: bug#42129: guix-install.sh does not add build users to kvm group
Date: Thu, 8 Apr 2021 19:03:26 -0400	[thread overview]
Message-ID: <YG+LvpQrqF0icNPd@jasmine.lan> (raw)
In-Reply-To: <YG+GA/0KSRuqnbM2@jasmine.lan>


[-- Attachment #1.1: Type: text/plain, Size: 517 bytes --]

On Thu, Apr 08, 2021 at 06:38:59PM -0400, Leo Famulari wrote:
> On Mon, Jun 29, 2020 at 10:01:54PM +0200, Marius Bakke wrote:
> > guix-install.sh should add the build users to the 'kvm' group if present
> > so that commands that require use of KVM can succeed.
> 
> Here is a patch (untested) that makes sure a 'kvm' group exists and adds
> it to the guixbuilders' groups.

I realized that you specified that the build users should be added to
the kvm group 'if' it is present. So, here is a revised patch.

[-- Attachment #1.2: v2-0001-guix-install.sh-Add-the-build-users-to-the-kvm-gr.patch --]
[-- Type: text/plain, Size: 1613 bytes --]

From 1a9fd7decd843f21c36d8ec4d1e218f478b983cf Mon Sep 17 00:00:00 2001
From: Leo Famulari <leo@famulari.name>
Date: Thu, 8 Apr 2021 18:34:43 -0400
Subject: [PATCH v2] guix-install.sh: Add the build users to the 'kvm' group.

* etc/guix-install.sh (sys_create_build_user): If a 'kvm' group exists,
add it to the guixbuilders' lists of supplementary groups.
---
 etc/guix-install.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index c84e7b7577..f3fcbf5d05 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -330,15 +330,20 @@ sys_create_build_user()
         _msg "${PAS}group <guixbuild> created"
     fi
 
+    if [ $(getent group kvm) ]; then
+        _msg "${INF}group kvm exists and build users will be added to it"
+	local KVMGROUP=,kvm
+    fi
+
     for i in $(seq -w 1 10); do
         if id "guixbuilder${i}" &>/dev/null; then
             _msg "${INF}user is already in the system, reset"
-            usermod -g guixbuild -G guixbuild           \
+            usermod -g guixbuild -G guixbuild{$KVMGROUP}     \
                     -d /var/empty -s "$(which nologin)" \
                     -c "Guix build user $i"             \
                     "guixbuilder${i}";
         else
-            useradd -g guixbuild -G guixbuild           \
+            useradd -g guixbuild -G guixbuild{$KVMGROUP}     \
                     -d /var/empty -s "$(which nologin)" \
                     -c "Guix build user $i" --system    \
                     "guixbuilder${i}";
-- 
2.31.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-04-08 23:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 20:01 bug#42129: guix-install.sh does not add build users to kvm group Marius Bakke
2021-04-08 22:38 ` Leo Famulari
2021-04-08 23:03   ` Leo Famulari [this message]
2021-04-14 19:33     ` Leo Famulari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YG+LvpQrqF0icNPd@jasmine.lan \
    --to=leo@famulari.name \
    --cc=42129@debbugs.gnu.org \
    --cc=marius@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).