Package: mount
Version: 2.38.1-4
Severity: normal

Hello,

I have been trying different commands to temporarily mount a partition
as read-only in a different place than the one declared in fstab
(which will be used by a different partition). I tried simple commands
and ended passing all long parameters hoping it was a
misunderstanding:

---8<---
# umount /dev/mapper/VGSeagate1500-LVStorageA
# mount --verbose --type ext4 --options-source disable --options ro,noload 
--source /dev/mapper/VGSeagate1500-LVStorageA --target /mnt/storage-b
mount: /mnt/storage-b: /dev/mapper/VGSeagate1500-LVStorageA already mounted or 
mount point busy.
       dmesg(1) may have more information after failed mount system call.
# mount --verbose --type ext4 --options-source disable --options relatime 
--source /dev/mapper/VGSeagate1500-LVStorageA --target /mnt/storage-b
mount: /dev/mapper/VGSeagate1500-LVStorageA mounted on /mnt/storage-b.
--->8---

The man page says "To prevent this kind of write access, you may want
to mount an ext3 or ext4 filesystem with the ro,noload mount options
or set the block device itself to read-only mode, see the blockdev(8)
command." That is "or", not "and", and failed anyway.

Replacing "ro,noload" with "relatime" lets it mount, but RW. The only
text in dmesg is "dm-10: Can't mount, would change RO state" when it
fails. I also tried removing the line from /etc/fstab (assuming it was
getting in the way, even with "--options-source disable"), still not
mounting as read-only.

OK, lets try with blockdev too:

---8<---
# umount /dev/mapper/VGSeagate1500-LVStorageA
# blockdev --getro /dev/mapper/VGSeagate1500-LVStorageA
0
# blockdev --setro /dev/mapper/VGSeagate1500-LVStorageA
# blockdev --getro /dev/mapper/VGSeagate1500-LVStorageA
1
# mount --verbose --type ext4 --options-source disable --options ro,noload 
--source /dev/mapper/VGSeagate1500-LVStorageA --target /mnt/storage-b
mount: /mnt/storage-b: /dev/mapper/VGSeagate1500-LVStorageA already mounted or 
mount point busy.
       dmesg(1) may have more information after failed mount system call.
# mount --verbose --type ext4 --options-source disable --options relatime 
--source /dev/mapper/VGSeagate1500-LVStorageA --target /mnt/storage-b
mount: /mnt/storage-b: /dev/mapper/VGSeagate1500-LVStorageA already mounted or 
mount point busy.
       dmesg(1) may have more information after failed mount system call.
# blockdev --setrw /dev/mapper/VGSeagate1500-LVStorageA
# blockdev --getro /dev/mapper/VGSeagate1500-LVStorageA
0
# mount --verbose --type ext4 --options-source disable --options relatime 
--source /dev/mapper/VGSeagate1500-LVStorageA --target /mnt/storage-b
mount: /dev/mapper/VGSeagate1500-LVStorageA mounted on /mnt/storage-b.
--->8---

This is even worse, no mount possible until "--setrw". dmesg showed
"/dev/mapper/VGSeagate1500-LVStorageA: Can't open blockdev" and
"dm-10: Can't mount, would change RO state" after the first "--options
realtime" cmd (while getro = 1). I assume the "change RO state" now
means to writable, and the other times was to not writable.

Maybe the bug is in the man page (needs update to newer procedure?),
maybe bug in code (mount? filesystem? LVM?). There must be a way to
mount read-only as initial state (not via second invocation with
"remount,ro", which works), to avoid even the tiniest window of
writability (not important for my usage, but surely for others). And
if not possible anymore (uh? since when?), it could be explicitly
documented.

Cheers,
GSR
 

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
merged-usr: no
Architecture: amd64 (x86_64)

Kernel: Linux 5.17.0-2-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled

Versions of packages mount depends on:
ii  libblkid1      2.38.1-4
ii  libc6          2.36-7
ii  libmount1      2.38.1-4
ii  libselinux1    3.3-1+b1
ii  libsmartcols1  2.38.1-4

mount recommends no packages.

Versions of packages mount suggests:
ii  nfs-common  1:1.3.4-4

-- no debconf information

Reply via email to