[systemd-devel] Mounting / as writable without in `/etc/fstab`

Paul Menzel pmenzel+systemd-devel at molgen.mpg.de
Mon Nov 23 15:23:09 UTC 2020


Dear systemd folks,


Is an entry for / in `/etc/fstab` still needed, or is there a systemd 
way of doing it?

Installing Debian bullseye/testing with the Debian Installer, it creates 
a GPT and `/etc/fstab`.

     $ systemd --version
     systemd 246 (246.6-2)
     +PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP 
+LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID 
+ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid

```
$ sudo gdisk /dev/nvme0n1
GPT fdisk (gdisk) version 1.0.5

Partition table scan:
   MBR: protective
   BSD: not present
   APM: not present
   GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/nvme0n1: 1000215216 sectors, 476.9 GiB
Model: SAMSUNG MZVKW512HMJP-00000
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): E367AC65-C92D-4600-8071-7F122612CC59
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1000215182
Partitions will be aligned on 2048-sector boundaries
Total free space is 2669 sectors (1.3 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
    1            2048         1050623   512.0 MiB   EF00
    2         1050624       998215679   475.5 GiB   8300
    3       998215680      1000214527   976.0 MiB   8200
```

```
$ more /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p2 during installation
UUID=d23ce27e-5c5c-45fb-bfa8-79a87caff13f /               ext4 
errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
#UUID=FCD0-628D  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/nvme0n1p3 during installation
UUID=ab3adb78-b618-48d3-8316-3177f20b03f8 none            swap    sw 
          0       0
```

Commenting out the entries for `/`, the root partition is mounted as 
read-only.

     $ findmnt /
     TARGET SOURCE         FSTYPE OPTIONS
     /      /dev/nvme0n1p2 ext4   ro,relatime

Shouldn’t it be mounted as writable?

     $ sudo /lib/systemd/systemd-remount-fs
     $ findmnt /
     TARGET SOURCE         FSTYPE OPTIONS
     /      /dev/nvme0n1p2 ext4   rw,relatime,errors=remount-ro

The log says:

     [    2.320133] systemd[179]: 
/usr/lib/systemd/system-generators/systemd-gpt-auto-generator succeeded.

I can work around it changing `ro` to `rw` on the Linux command line, 
but I thought, it is possible without that.


Kind regards,

Paul


More information about the systemd-devel mailing list