Subject: bug#37977: Mount options ignored for root file system

From: Guillaume Le Vaillant <[email-masked]>
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?