I have a single fs / (no separate /var /usr etc). This line in /etc/fstab md none swap sw,file=/var/swap 0 0 which used to set up swap file properly in 10-STABLE a few months old, started giving this error on startup after the upgrade to 10.1-RELEASE: swapon: /dev/md0: Read-only file system Adding the "late" option to fstab now fixes the issue: ... sw,file=/var/swap,late ...
Over to Hiroki-san who made the swap changes that may be related to this issue. Note that I don't think this is a recent change of behavior -- the code was in 10.0-RELEASE. Additionally, it seems to be not fixable: swap is intentionally set to start before fsck, if there is only one UFS filesystem and swap is on a file, then the swap can not be made available if the file system is corrupted.
Thanks. This looks like a documentation issue, I think some mentioning of the early/late bootup semantics (/etc/rc.d/swaplate) would be appropriate in fstab's manpage where it describes setting up swap space via md.
Thank you your report. This is partially due to a change in r272885 (10.1 also has this change). Before this revision, "late" flag was automatically added when a "file=" was specified because the rc.d/swap script is invoked before mountcritlocal and fsck as Xin also pointed out. It worked, but had a side-effect that "swapoff -a" did not handle a entry with "file=". It was counter-intuitive for sysadmins because "late" was not always in /etc/fstab. So now one should think "file=" always needs "late" flag and documentation should be updated to emphasize it. I will work on it.
(In reply to Hiroki Sato from comment #3) > Thank you your report. This is partially due to a change in r272885 (10.1 > also has this change). Before this revision, "late" flag was automatically > added when a "file=" was specified because the rc.d/swap script is invoked > before mountcritlocal and fsck as Xin also pointed out. It worked, but had > a side-effect that "swapoff -a" did not handle a entry with "file=". It was > counter-intuitive for sysadmins because "late" was not always in /etc/fstab. > > So now one should think "file=" always needs "late" flag and documentation > should be updated to emphasize it. I will work on it. Ping. It would be good to get the documentation in the manpage and handbook updated before 10.2.
batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.