unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Guillaume Le Vaillant <glv@posteo.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 37977@debbugs.gnu.org
Subject: bug#37977: Mount options ignored for root file system
Date: Sun, 17 Nov 2019 15:17:24 +0100	[thread overview]
Message-ID: <87pnhqy4cr.fsf@yamatai> (raw)
In-Reply-To: <87bltapyuc.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 914 bytes --]


Ludovic Courtès skribis:

> The root file system is mounted by ‘mount-root-file-system’ in
> linux-boot.scm, and you’re right: it happily ignores any options in the
> <file-system> object for “/”.  :-)
>
> A solution would be to have ‘boot-system’ take an additional
> #:root-file-system-options parameter that it would pass down to
> ‘mount-root-file-system’, which would honor it.
>
> Would you like to give it a try?

The attached patch adds an 'options' parameter to
'mount-root-file-system' and makes 'boot-system' use it with the
content of the 'options' field of the <file-system> object for "/".

It's not exactly the solution you described (adding a keyword argument
to 'boot-system'), but I think it should work. What do you think?

I tried it with my btrfs root file system, and it is correctly mounted
with the options declared in my '/etc/config.scm' file.


[-- Attachment #2: 0001-linux-boot-Don-t-ignore-options-when-mounting-root-f.patch --]
[-- Type: text/x-patch, Size: 3205 bytes --]

From 3597f0fda6f6a13bf1fdab0fcde4f72ece688d93 Mon Sep 17 00:00:00 2001
From: Guillaume Le Vaillant <glv@posteo.net>
Date: Sun, 17 Nov 2019 14:15:21 +0100
Subject: [PATCH] linux-boot: Don't ignore options when mounting root file
 system.

* gnu/build/linux-boot.scm (mount-root-file-system): Add the 'options'
  keyword argument and use it when mounting the root file system.
  (boot-system): Pass the root file system options to
  'mount-root-file-system'.
---
 gnu/build/linux-boot.scm | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 84a5447977..a8a9c2e2c8 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -357,15 +358,16 @@ the last argument of `mknod'."
           (filter-map string->number (scandir "/proc")))))
 
 (define* (mount-root-file-system root type
-                                 #:key volatile-root?)
+                                 #:key volatile-root? options)
   "Mount the root file system of type TYPE at device ROOT.  If VOLATILE-ROOT?
 is true, mount ROOT read-only and make it an overlay with a writable tmpfs
-using the kernel built-in overlayfs."
+using the kernel built-in overlayfs.  OPTIONS indicates the options to use
+to mount ROOT."
 
   (if volatile-root?
       (begin
         (mkdir-p "/real-root")
-        (mount root "/real-root" type MS_RDONLY)
+        (mount root "/real-root" type MS_RDONLY options)
         (mkdir-p "/rw-root")
         (mount "none" "/rw-root" "tmpfs")
 
@@ -382,7 +384,7 @@ using the kernel built-in overlayfs."
                "lowerdir=/real-root,upperdir=/rw-root/upper,workdir=/rw-root/work"))
       (begin
         (check-file-system root type)
-        (mount root "/root" type)))
+        (mount root "/root" type 0 options)))
 
   ;; Make sure /root/etc/mtab is a symlink to /proc/self/mounts.
   (false-if-exception
@@ -472,6 +474,12 @@ upon error."
              mounts)
         "ext4"))
 
+  (define root-fs-options
+    (any (lambda (fs)
+           (and (root-mount-point? fs)
+                (file-system-options fs)))
+         mounts))
+
   (display "Welcome, this is GNU's early boot Guile.\n")
   (display "Use '--repl' for an initrd REPL.\n\n")
 
@@ -524,7 +532,8 @@ upon error."
                              (else (file-system-label root)))))
              (mount-root-file-system (canonicalize-device-spec root)
                                      root-fs-type
-                                     #:volatile-root? volatile-root?))
+                                     #:volatile-root? volatile-root?
+                                     #:options root-fs-options))
            (mount "none" "/root" "tmpfs"))
 
        ;; Mount the specified file systems.
-- 
2.24.0


  reply	other threads:[~2019-11-17 14:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-29 10:22 bug#37977: Mount options ignored for root file system Guillaume Le Vaillant
2019-11-07 18:28 ` Guillaume Le Vaillant
2019-11-17 10:43   ` Ludovic Courtès
2019-11-17 14:17     ` Guillaume Le Vaillant [this message]
2019-11-18 10:32       ` Ludovic Courtès

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=87pnhqy4cr.fsf@yamatai \
    --to=glv@posteo.net \
    --cc=37977@debbugs.gnu.org \
    --cc=ludo@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).