mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-18 21:46:35 +01:00
scripts: environment: Display friendly container error messages.
* guix/scripts/environment.scm (assert-container-features): New procedure. (guix-environment): Use it.
This commit is contained in:
parent
b7d48312bb
commit
00bfa7ea25
1 changed files with 18 additions and 0 deletions
|
@ -437,6 +437,21 @@ (define (handle-argument arg result)
|
||||||
opts
|
opts
|
||||||
(alist-cons 'exec command opts)))))
|
(alist-cons 'exec command opts)))))
|
||||||
|
|
||||||
|
(define (assert-container-features)
|
||||||
|
"Check if containers can be created and exit with an informative error
|
||||||
|
message if any test fails."
|
||||||
|
(unless (user-namespace-supported?)
|
||||||
|
(report-error (_ "cannot create container: user namespaces unavailable\n"))
|
||||||
|
(leave (_ "is your kernel version < 3.10?\n")))
|
||||||
|
|
||||||
|
(unless (unprivileged-user-namespace-supported?)
|
||||||
|
(report-error (_ "cannot create container: unprivileged user cannot create user namespaces\n"))
|
||||||
|
(leave (_ "please set /proc/sys/kernel/unprivileged_userns_clone to \"1\"\n")))
|
||||||
|
|
||||||
|
(unless (setgroups-supported?)
|
||||||
|
(report-error (_ "cannot create container: /proc/self/setgroups does not exist\n"))
|
||||||
|
(leave (_ "is your kernel version < 3.19?\n"))))
|
||||||
|
|
||||||
;; Entry point.
|
;; Entry point.
|
||||||
(define (guix-environment . args)
|
(define (guix-environment . args)
|
||||||
(with-error-handling
|
(with-error-handling
|
||||||
|
@ -474,6 +489,9 @@ (define (guix-environment . args)
|
||||||
'()))
|
'()))
|
||||||
inputs))
|
inputs))
|
||||||
eq?)))
|
eq?)))
|
||||||
|
|
||||||
|
(when container? (assert-container-features))
|
||||||
|
|
||||||
(with-store store
|
(with-store store
|
||||||
(run-with-store store
|
(run-with-store store
|
||||||
(mlet* %store-monad ((inputs (lower-inputs
|
(mlet* %store-monad ((inputs (lower-inputs
|
||||||
|
|
Loading…
Reference in a new issue