me
/
guix
Archived
1
0
Fork 0

installer: Add core dump support.

Fixes: <https://issues.guix.gnu.org/58733>

* gnu/installer.scm (installer-program): Enable core dump generation.
* gnu/installer/dump.scm (%core-dump): New variable.
(prepare-dump): Copy the core dump file.
* gnu/installer/newt/welcome.scm (run-welcome-page): Propose to report an
installation that previously generated a core dump.
Mathieu Othacehe 2022-10-31 13:03:46 +01:00
parent 868a1e7f32
commit 80387bc7c3
No known key found for this signature in database
GPG Key ID: 8354763531769CA6
3 changed files with 30 additions and 1 deletions

View File

@ -389,6 +389,12 @@ selected keymap."
(ice-9 match) (ice-9 match)
(ice-9 textual-ports)) (ice-9 textual-ports))
;; Enable core dump generation.
(setrlimit 'core #f #f)
(call-with-output-file "/proc/sys/kernel/core_pattern"
(lambda (port)
(format port %core-dump)))
;; Initialize gettext support so that installers can use ;; Initialize gettext support so that installers can use
;; (guix i18n) module. ;; (guix i18n) module.
#$init-gettext #$init-gettext

View File

@ -28,13 +28,17 @@
#:use-module (web http) #:use-module (web http)
#:use-module (web response) #:use-module (web response)
#:use-module (webutils multipart) #:use-module (webutils multipart)
#:export (prepare-dump #:export (%core-dump
prepare-dump
make-dump make-dump
send-dump-report)) send-dump-report))
;; The installer crash dump type. ;; The installer crash dump type.
(define %dump-type "installer-dump") (define %dump-type "installer-dump")
;; The core dump file.
(define %core-dump "/tmp/installer-core-dump")
(define (result->list result) (define (result->list result)
"Return the alist for the given RESULT." "Return the alist for the given RESULT."
(hash-map->list (lambda (k v) (hash-map->list (lambda (k v)
@ -66,6 +70,10 @@ RESULT is the installer result hash table. Returns the created directory path."
;; syslog ;; syslog
(copy-file "/var/log/messages" "syslog") (copy-file "/var/log/messages" "syslog")
;; core dump
(when (file-exists? %core-dump)
(copy-file %core-dump "core-dump"))
;; dmesg ;; dmesg
(let ((pipe (open-pipe* OPEN_READ "dmesg"))) (let ((pipe (open-pipe* OPEN_READ "dmesg")))
(call-with-output-file "dmesg" (call-with-output-file "dmesg"

View File

@ -20,6 +20,7 @@
(define-module (gnu installer newt welcome) (define-module (gnu installer newt welcome)
#:use-module ((gnu build linux-modules) #:use-module ((gnu build linux-modules)
#:select (modules-loaded)) #:select (modules-loaded))
#:use-module (gnu installer dump)
#:use-module (gnu installer steps) #:use-module (gnu installer steps)
#:use-module (gnu installer utils) #:use-module (gnu installer utils)
#:use-module (gnu installer newt page) #:use-module (gnu installer newt page)
@ -132,6 +133,20 @@ work well with only free software. Expect trouble. If after installation,
the system does not boot, perhaps you will need to add nomodeset to the the system does not boot, perhaps you will need to add nomodeset to the
kernel arguments and need to configure the uvesafb kernel module.") kernel arguments and need to configure the uvesafb kernel module.")
(G_ "Pre-install warning"))) (G_ "Pre-install warning")))
(when (file-exists? %core-dump)
(match
(choice-window
(G_ "Previous installation failed")
(G_ "Continue")
(G_ "Report the failure")
(G_ "It seems that the previous installation exited unexpectedly \
and generated a core dump. Do you want to continue or to report the failure \
first?"))
(1 #t)
(2 (raise
(condition
(&message
(message "User abort.")))))))
(run-menu-page (run-menu-page
(G_ "GNU Guix install") (G_ "GNU Guix install")
(G_ "Welcome to GNU Guix system installer! (G_ "Welcome to GNU Guix system installer!