Solved [Solved]: mount -o rw / doesn't work

  • Thread starter Thread starter osp
  • Start date Start date
O

osp

Guest
I wanted change the default shell of the only user on my testing installation of FreeBSD which is root...and used to from linux I didn't even bother to look where was bash actually installed and put /bin/bash in passwd file and now I cannot log in :)

First I tried in rescue mode:
Code:
mount -o remount,rw /
which does not work on FreeBSD and then I tried
Code:
mount -o rw /
and also nothing. I googled up this: http://www.cyberciti.biz/faq/howto-freebsd-remount-partition/ so it should work - what am I doing wrong?
 
Re: mount -o rw / doesn't work

As mentioned there is no remount option on FreeBSD. To be honest, having that as an option doesn't make much sense either.

In rescue mode the root file system is already mounted, in read-only mode. Trying to remount the file system will not work, because you cannot un-mount root. You need to use the -u option to change the options of an already mounted file system.

Code:
mount -u w /

-u The -u flag indicates that the status of an already mounted file
system should be changed. Any of the options discussed above
(the -o option) may be changed; also a file system can be changed
from read-only to read-write or vice versa.
 
Re: mount -o rw / doesn't work

SirDice said:
Those commands are for UFS. I'm guessing you have ZFS? In that case it's zfs set readonly=off zroot.

That was it. Thank you!
 
  • Thanks
Reactions: mro
FW
Re: mount -o rw / doesn't work

Use mount -u /
FWIW, mount -u <mountpoint> for zfs does not work at this time on FreeBSD 14 (untested yet on 15 or later, but I don't expect any different behavior). Lots of updates have been pulled in for ZFS since 2014, of course, but it doesn't work now. Just posting the current situation in case someone reads this [admittedly older] post and comes away with the incorrect expectation.

Current version of FreeBSD 14:
Code:
> zfs -V
zfs-2.2.9-FreeBSD_g079ba86d7
zfs-kmod-2.2.9-FreeBSD_g079ba86d7


This 'temporary mount point properties' issue has been an inconsistency in zfs (as implemented in FreeBSD or other operating systems) for some time (read various upstream github issues for OpenZFS), and it CAN sometimes differ depending on whether you use 'mount' or 'zfs mount' and which version of zfs.

Importantly, the tools (mount or zfs mount) are silently accepting the temporary readonly mount option without letting the user know it is failing to apply the option. Whether the temporary properties issue is eventually fixed or not, the requested operation by the user should not be silently ignored - at least, it should provide some feedback: warning message, error message, error code. Best would be an error code and a refusal to change any options if one of the options fails, but there could be a case for different behavior than that. Silently ignoring is not an acceptable option, but that is what we currently have.

See "Temporary Mount Point Properties" in zfsprops(8). It is documented that 'readonly' is one of the temporary properties that can be set (on or off), but it seems that currently it is not behaving as documented. Whether you temporarily want to set readonly from off to on or on to off, it silently does neither (whether trying to use 'mount' or 'zfs mount' with the desired temporary ro/rw option).

This failure to be able to set "Temporary Mount Point Properties" (only tested by me for 'readonly' property at this time) is true even if
mountpoint=legacy which hands the mounting off to mount(8) instead of zfs mount. It looks to be that FreeBSD (14 at least) does not work with "Temporary Mount Point Properties" - I have found no way to get FreeBSD to set zfs properties with a "temporary" state at all (they do work on Rocky Linux 9, for one other OS).
 
Back
Top