How to detect single user mode in FreeBSD ?

Manish Jain jude.obscure at yandex.com
Wed Jun 13 12:35:54 UTC 2018


On 06/13/18 15:55, Shane Ambler wrote:
> When in single user mode PID 1 should be "/sbin/init -s" which becomes
> "/sbin/init --" in multi user mode.
> 
> The next closet to knowing would be looking at mount, in single user
> mode you will only have / mounted read only and /dev. It is rare for any
> system to be past single user mode with only that mount setup but the
> user can mount the filesystems before starting your script and still be
> in single user mode.

Hi Shane,

Tx for replying. But don't you think there should ideally be a sysctl to 
be detect the runlevel, particularly single user mode ? It makes things 
easily documentible, just as when we can use sysctl to find out if the 
OS is virtualized (I think kern.vm_guest).

Manish Jain


More information about the freebsd-questions mailing list