unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Adam Van Ymeren <adam@vany.ca>
Cc: 27242@debbugs.gnu.org
Subject: bug#27242: Fail to load LUKS encrypted rootfs, attempts to open luks device before it's ready.
Date: Mon, 05 Jun 2017 06:07:52 -0400	[thread overview]
Message-ID: <87y3t6693b.fsf@netris.org> (raw)
In-Reply-To: <87r2yzl86g.fsf@vany.ca> (Adam Van Ymeren's message of "Sun, 04 Jun 2017 18:06:15 -0400")

Adam Van Ymeren <adam@vany.ca> writes:

> On my machine when booting GuixSD, it fails to find the rootfs from the
> initramfs.  It errors out attempting to find the luks device node.
> Shortly after it errors is when I see the kernel dmesg output of the
> nvme0 device becomining ready.
>
> It looks like we need to wait for the device node to become ready, or
> poll/sleep a few times if we fail to locate the device.

I ran into the same problem at one point, and have applied the following
patch to my private branch of Guix.  Perhaps it should be applied to
master.

      Mark


From b7c1947d050a944937b983532d940491821fa75f Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Tue, 28 Mar 2017 05:52:28 -0400
Subject: [PATCH] DRAFT: Cope with delayed appearance of LUKS source.

---
 gnu/system/mapped-devices.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index 2959802c9..3659ac2d6 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -101,6 +101,7 @@
     #~(let ((source #$source))
         ;; XXX: 'use-modules' should be at the top level.
         (use-modules (rnrs bytevectors)           ;bytevector?
+                     (srfi srfi-1)
                      ((gnu build file-systems)
                       #:select (find-partition-by-luks-uuid)))
 
@@ -114,7 +115,11 @@
                         ;; udev-populated /dev/disk/by-id directory but udev may
                         ;; be unavailable at the time we run this.
                         (if (bytevector? source)
-                            (or (find-partition-by-luks-uuid source)
+                            (or (let loop ((tries-left 10))
+                                  (and (positive? tries-left)
+                                       (or (find-partition-by-luks-uuid source)
+                                           (begin (sleep 1)
+                                                  (loop (- tries-left 1))))))
                                 (error "LUKS partition not found" source))
                             source)
 
-- 
2.13.0

  reply	other threads:[~2017-06-05 10:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-04 22:06 bug#27242: Fail to load LUKS encrypted rootfs, attempts to open luks device before it's ready Adam Van Ymeren
2017-06-05 10:07 ` Mark H Weaver [this message]
2017-06-05 16:10   ` Adam Van Ymeren
2017-06-07 23:10     ` Mark H Weaver

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=87y3t6693b.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=27242@debbugs.gnu.org \
    --cc=adam@vany.ca \
    /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).