Page MenuHomeFreeBSD

Verify the system can perform install/rollback
Needs ReviewPublic

Authored by on Jan 11 2019, 9:29 PM.



Ensure that / and /usr have read-write permissions before install/rollback.

Ensure that chflags is supported by the file system (i.e. NFS does not support chflags).

PR: 128501

Diff Detail

Lint OK
No Unit Test Coverage
Build Status
Buildable 22036
Build 21264: arc lint + arc unit

Event Timeline

  • Ensure install flags can be removed

This is a problem for NFS users. Exit early if it isn't supported with an error message with next steps.

Also do both system checks on rollback (since the same issues can occur then as well) retitled this revision from Verify that / and /usr are mounted with read-write to Verify the system can perform install/rollback.Jan 15 2019, 7:35 PM edited the summary of this revision. (Show Details)

I think this is not complete. For example, /usr may be a symlink to somewhere else, and freebsd-update needs to have write access there (this applies to /boot, /var, etc. too).


I really don't like this approach: what if the system have a file called "chflags_test"?


I don't think this would work: chflags(1) only attempt to make modification when the old flags is different (and freebsd-update wouldn't complain if schg can't be applied at a later time).

Maybe just issue a warning if we are running over NFS (or if / and /usr is neither UFS nor ZFS) instead ?

This revision now requires changes to proceed.Jan 18 2019, 12:59 AM

One idea: perhaps we could do:

for mp in / /usr /boot ...; do

if mount -p ${mp} ...


and examine the file system properties and issue warning or bail out?

Note that you should consider BASEDIR as well.

  • Update permissions check and chflag check

Simplify chflag test to just check if they are on NFS

Check for read-write permissions of mounted directory (using BASEDIR).


Please check the return value of mount -p: it's possible that e.g. /boot is a directory, in which case checking / would covered us, but with the current code it would go to the * case and fail.


Note that shell case would not fall through, therefore I think this would have covered IS_NFS case, if the file system is mounted read-write. added inline comments.

If $required_dir is not the mounted filesystem directory, then $mounted_dir should match the directory it's mounted on. i.e. required_dir=/boot should map to mounted_dir=/ in normal cases.


Also which directories should be included here? I think you also wanted /var in this list but I assume there are others...

Also sometimes these directories (i.e. $BASEDIR/boot) don't exist, would it be reasonable to skip them?


Do we have a good list of potential mount points? At least ones that would form part of the base system?