after upgrading to 15.1, /var was changed to tmpfs or not mounted correctly. Why is this happening?

Code:
root@:~ # gpart show
=>       40  976773088  ada0  GPT  (466G)
         40     409600     1  efi  (200M)
     409640  968474616     2  freebsd-ufs  (462G)
  968884256    7888872     3  freebsd-swap  (3.8G)

root@:~ # cat /etc/fstab
# Device    Mountpoint    FStype    Options    Dump    Pass#
/dev/ada0p2    /        ufs    rw    1    1
/dev/ada0p3    none        swap    sw    0    0
root@:~ # df -h -t tmpfs
Filesystem    Size    Used   Avail Capacity  Mounted on
tmpfs          20M    4.0K     20M     0%    /tmp
tmpfs          32M    636K     31M     2%    /var
root@:~ # mount -v | grep tmpfs
tmpfs on /tmp (tmpfs, local, fsid 01ff008787000000, vnodes: count 2 )
tmpfs on /var (tmpfs, local, fsid 02ff008787000000, vnodes: count 67 )
root@:~ # uname -v
FreeBSD 15.1-RELEASE releng/15.1-n283562-96841ea08dcf GENERIC
root@:~ #
how to solve this?
 
It's apparently not being mounted through fstab, not sure where this would have come from. You're not accidentally booted from an mfsBSD stick?
 
These values come from /etc/defaults/rc.conf, tmpsize and varsize respectively.

/tmp and /var are mounted as tmpfs by default if your root filesystem is read-only, or if you have tmpmfs="YES" (for /tmp) or varmfs="YES" (for /var) in your /etc/rc.conf.

How these settings got into your upgrade I can't tell.
 
varmfs is defaulted to "AUTO" even on recently EoL'ed 13.5.
And /var is handled by /etc/rc.d/var. If varmfs is set to "NO", physical filesystem (/, if no /var partition nor ZFS dataset mounted to /var exist) should be used.

Note that (not /var itself, but one of its subdirectory) both var_run_enable and var_run_autosave are defaulted to "YES" starting from 14.2.
This is handled by /etc/rc.d/var_run.
The system has been continuously upgraded from version 13 to the current version. When version 15.1 required manual merging, after running `freebsd-update install,shutdown -r +10min "Rebooting for a kernel upgrade"`, the above problem occurred. Firstly, the hostname was empty, although it existed in `rc.conf` but wasn't being read. Other issues also arose. The temporary solution is to set `varmfs_enable="NO"` to `varmfs="NO"` and `tmpmfs="NO"`, and then set `rc_local="/etc/rc.local"` to `/etc/rc.local`.
 
Back
Top