Subject: trailing / in fstab breaks mount
To: None <tech-userlevel@netbsd.org>
From: Nino Dehne <TeCeEm@gmx.de>
List: tech-userlevel
Date: 05/31/2003 02:31:38
Hi,

today I encountered the following (1.6.1):

    root on wd0a dumps on wd0b
    Fri May 30 23:46:23 GMT 2003
    swapctl: adding /dev/wd0b as swap device at priority 0
    Starting file system checks:
    /dev/rwd0a: file system is clean; not checking
    /dev/rwd0e: file system is clean; not checking
    /dev/rwd0f: file system is clean; not checking
    cd: can't cd to /var/run
    Setting tty flags.
    Setting sysctl variables:
    Starting network.
    /etc/rc: WARNING: $hostname not set.
    IPv6 mode: host
    Configuring network interfaces:.
    Building databases...
    kvm_mkdb: not found
    dev_mkdb: not found
    install: not found
    /etc/rc: WARNING: No /var/crash directory; savecore not run.

Note the errors which indicate missing /var/ and /usr/. Obviously, /var/ 
and /usr/ were not mounted by the mountcritlocal and mountcritremote 
scripts properly.

It turned out I had to 1) remove my trailing slash in fstab:

    /dev/wd0e   /var/   ffs   rw,softdep   0   2
                    ^
    /dev/wd0f   /usr/   ffs   rw,softdep   0   2

or add to /etc/rc.conf:

    critical_filesystems_local="/var/"
    critical_filesystems_remote="/usr/"

The actual problem is not with the rc.d scripts mountcritlocal and 
mountcritremote I think but rather with mount(8) itself not accepting

    mount /var

if fstab contains

    /dev/wd0e   /var/   ffs   rw,softdep   0   2

This is just my personal notion to append a / to anything anywhere in 
config files if it refers to a directory.

Again, this may seem as nitpicking but shouldn't mount(8) be able to 
accept both styles? I can't think of other tools right now that deal 
with directories but fail if you supply a trailing / for whatever 
reason. One might argue that if I insist on putting / everwhere I should 
just do so in rc.conf as well as stated above. However, I'd have to 
override a default setting with a merely cosmetical change. Things 
shouldn't break because of this, should they?

Any comments?

Thanks and regards,

Nino