From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guillaume Le Vaillant Subject: bug#37977: Mount options ignored for root file system Date: Sun, 17 Nov 2019 15:17:24 +0100 Message-ID: <87pnhqy4cr.fsf@yamatai> References: <87pnif6ec0.fsf@yamatai> <87eeyjils5.fsf@yamatai> <87bltapyuc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:51635) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWLNM-0007WK-8z for bug-guix@gnu.org; Sun, 17 Nov 2019 09:18:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWLNK-0005ZQ-RO for bug-guix@gnu.org; Sun, 17 Nov 2019 09:18:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59912) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWLNK-0005ZJ-Ns for bug-guix@gnu.org; Sun, 17 Nov 2019 09:18:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWLNK-0000VX-GG for bug-guix@gnu.org; Sun, 17 Nov 2019 09:18:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-reply-to: <87bltapyuc.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 37977@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s skribis: > The root file system is mounted by =E2=80=98mount-root-file-system=E2=80= =99 in > linux-boot.scm, and you=E2=80=99re right: it happily ignores any options = in the > object for =E2=80=9C/=E2=80=9D. :-) > > A solution would be to have =E2=80=98boot-system=E2=80=99 take an additio= nal > #:root-file-system-options parameter that it would pass down to > =E2=80=98mount-root-file-system=E2=80=99, 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 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. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-linux-boot-Don-t-ignore-options-when-mounting-root-f.patch Content-Transfer-Encoding: quoted-printable >From 3597f0fda6f6a13bf1fdab0fcde4f72ece688d93 Mon Sep 17 00:00:00 2001 From: Guillaume Le Vaillant 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 =C2=A9 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Cour= t=C3=A8s ;;; Copyright =C2=A9 2017 Mathieu Othacehe +;;; Copyright =C2=A9 2019 Guillaume Le Vaillant ;;; ;;; This file is part of GNU Guix. ;;; @@ -357,15 +358,16 @@ the last argument of `mknod'." (filter-map string->number (scandir "/proc"))))) =20 (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-RO= OT? 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." =20 (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") =20 @@ -382,7 +384,7 @@ using the kernel built-in overlayfs." "lowerdir=3D/real-root,upperdir=3D/rw-root/upper,workdir=3D= /rw-root/work")) (begin (check-file-system root type) - (mount root "/root" type))) + (mount root "/root" type 0 options))) =20 ;; Make sure /root/etc/mtab is a symlink to /proc/self/mounts. (false-if-exception @@ -472,6 +474,12 @@ upon error." mounts) "ext4")) =20 + (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") =20 @@ -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")) =20 ;; Mount the specified file systems. --=20 2.24.0 --=-=-=--