GNU bug report logs - #37977
Mount options ignored for root file system

Previous Next

Package: guix;

Reported by: Guillaume Le Vaillant <glv <at> posteo.net>

Date: Tue, 29 Oct 2019 10:25:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37977 in the body.
You can then email your comments to 37977 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#37977; Package guix. (Tue, 29 Oct 2019 10:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Guillaume Le Vaillant <glv <at> posteo.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 29 Oct 2019 10:25:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Guillaume Le Vaillant <glv <at> posteo.net>
To: bug-guix <at> gnu.org
Subject: Mount options ignored for root file system
Date: Tue, 29 Oct 2019 11:22:39 +0100
The filesystem options declared for the root file system are apparently
ignored. This happens for a btrfs root filesystem on a LUKS volume.


Exerpt from '/etc/config.scm":

--8<---------------cut here---------------start------------->8---
(mapped-devices
  (list (mapped-device
          (source
            (uuid "ee90b2aa-97e8-4ae5-ac72-9bf9058cc949"))
          (target "cryptroot")
          (type luks-device-mapping))
        (mapped-device
          (source
            (uuid "ec9cd327-0370-4e20-baa4-254d03b1901e"))
          (target "cryptguillaume")
          (type luks-device-mapping))))
(file-systems
  (cons* (file-system
           (mount-point "/")
           (device "/dev/mapper/cryptroot")
           (type "btrfs")
           (options "autodefrag,compress=lzo")
           (dependencies mapped-devices))
         (file-system
           (mount-point "/home/guillaume")
           (device "/dev/mapper/cryptguillaume")
           (type "btrfs")
           (options "autodefrag,compress=lzo")
           (dependencies mapped-devices))
         %base-file-systems))
--8<---------------cut here---------------end--------------->8---


Exerpt from '/etc/fstab':

--8<---------------cut here---------------start------------->8---
/dev/mapper/cryptroot / btrfs autodefrag,compress=lzo	
/dev/mapper/cryptguillaume /home/guillaume btrfs autodefrag,compress=lzo
--8<---------------cut here---------------end--------------->8---


Exerpt from '/etc/mtab':

--8<---------------cut here---------------start------------->8---
/dev/mapper/cryptroot / btrfs
  rw,relatime,ssd,space_cache,subvolid=5,subvol=/
  0 0

/dev/mapper/cryptguillaume /home/guillaume btrfs
  rw,relatime,compress=lzo,ssd,space_cache,autodefrag,subvolid=5,subvol=/
  0 0

/dev/mapper/cryptroot /gnu/store btrfs
  ro,relatime,ssd,space_cache,subvolid=5,subvol=/gnu/store
  0 0
--8<---------------cut here---------------end--------------->8---

Here we see that the options 'autodefrag' and 'compress=lzo' have
disappeared on the root filesystem. Maybe it has something to do with
the new '/gnu/store' subvolume that appeared?




Information forwarded to bug-guix <at> gnu.org:
bug#37977; Package guix. (Thu, 07 Nov 2019 18:29:02 GMT) Full text and rfc822 format available.

Message #8 received at 37977 <at> debbugs.gnu.org (full text, mbox):

From: Guillaume Le Vaillant <glv <at> posteo.net>
To: 37977 <at> debbugs.gnu.org
Subject: Re: Mount options ignored for root file system
Date: Thu, 07 Nov 2019 19:28:10 +0100
Guillaume Le Vaillant skribis:

> The filesystem options declared for the root file system are apparently
> ignored. This happens for a btrfs root filesystem on a LUKS volume.

This also happens on a basic btrfs root file system (without LUKS).

I tried adding "rootflags=defaults,autodefrag,compress=lzo" in kernel
arguments, but it didn't have any effect.

I then tried adding a one-shot service that remounts the root file
system, and it works, the options declared in '/etc/fstab' are taken
into consideration. This service just does 'mount -o remount /'.

--8<---------------cut here---------------start------------->8---
(define remount-rootfs-service-type
  (shepherd-service-type
   'remount-rootfs
   (const
    (shepherd-service
     (documentation "Remount rootfs with correct options.")
     (requirement '(udev))
     (provision '(remount-rootfs))
     (one-shot? #t)
     (start #~(lambda _
                (invoke (string-append #$util-linux "/bin/mount")
                        "-o" "remount" "/")))))))

(operating-system
  ...
  (services
    (cons* ...
           (service remount-rootfs-service-type #f)
           ...)))
--8<---------------cut here---------------end--------------->8---


I saw that the 'start' function of 'root-file-system-service-type'
doesn't do anything. Is it on purpose? Or could we make it remount the
root filesystem?




Information forwarded to bug-guix <at> gnu.org:
bug#37977; Package guix. (Sun, 17 Nov 2019 10:44:02 GMT) Full text and rfc822 format available.

Message #11 received at 37977 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Guillaume Le Vaillant <glv <at> posteo.net>
Cc: 37977 <at> debbugs.gnu.org
Subject: Re: bug#37977: Mount options ignored for root file system
Date: Sun, 17 Nov 2019 11:43:39 +0100
Hi Guillaume,

Guillaume Le Vaillant <glv <at> posteo.net> skribis:

> Guillaume Le Vaillant skribis:
>
>> The filesystem options declared for the root file system are apparently
>> ignored. This happens for a btrfs root filesystem on a LUKS volume.
>
> This also happens on a basic btrfs root file system (without LUKS).
>
> I tried adding "rootflags=defaults,autodefrag,compress=lzo" in kernel
> arguments, but it didn't have any effect.

[...]

> I saw that the 'start' function of 'root-file-system-service-type'
> doesn't do anything. Is it on purpose? Or could we make it remount the
> root filesystem?

By definition, when shepherd is started, the root file system is already
mounted; that’s why the ‘start’ method of the ‘root-file-system-service’
does nothing.

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?

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#37977; Package guix. (Sun, 17 Nov 2019 14:18:02 GMT) Full text and rfc822 format available.

Message #14 received at 37977 <at> debbugs.gnu.org (full text, mbox):

From: Guillaume Le Vaillant <glv <at> posteo.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 37977 <at> debbugs.gnu.org
Subject: Re: bug#37977: Mount options ignored for root file system
Date: Sun, 17 Nov 2019 15:17:24 +0100
[Message part 1 (text/plain, inline)]
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.

[0001-linux-boot-Don-t-ignore-options-when-mounting-root-f.patch (text/x-patch, attachment)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 18 Nov 2019 10:33:02 GMT) Full text and rfc822 format available.

Notification sent to Guillaume Le Vaillant <glv <at> posteo.net>:
bug acknowledged by developer. (Mon, 18 Nov 2019 10:33:02 GMT) Full text and rfc822 format available.

Message #19 received at 37977-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Guillaume Le Vaillant <glv <at> posteo.net>
Cc: 37977-done <at> debbugs.gnu.org
Subject: Re: bug#37977: Mount options ignored for root file system
Date: Mon, 18 Nov 2019 11:32:16 +0100
Hello Guillaume,

Guillaume Le Vaillant <glv <at> posteo.net> skribis:

> 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?

It looks great to me.

> From 3597f0fda6f6a13bf1fdab0fcde4f72ece688d93 Mon Sep 17 00:00:00 2001
> From: Guillaume Le Vaillant <glv <at> 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'.

Applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 16 Dec 2019 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 126 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.