From owner-freebsd-questions@freebsd.org Wed Jun 13 12:35:54 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99BF81006627 for ; Wed, 13 Jun 2018 12:35:54 +0000 (UTC) (envelope-from jude.obscure@yandex.com) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 24030803B9 for ; Wed, 13 Jun 2018 12:35:53 +0000 (UTC) (envelope-from jude.obscure@yandex.com) Received: from mxback4j.mail.yandex.net (mxback4j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10d]) by forward105p.mail.yandex.net (Yandex) with ESMTP id 46FB24083327; Wed, 13 Jun 2018 15:35:44 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback4j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id h3IT2AZQxV-ZiIquOtN; Wed, 13 Jun 2018 15:35:44 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.com; s=mail; t=1528893344; bh=NyEurnz0YEpb1W8M64AxvVydzuCj/AW3UWhRy6hflnQ=; h=Subject:To:References:From:Message-ID:Date:In-Reply-To; b=fDs3X3dfvWT4TmvrEFuZUKff88LxOREgbFJzLtjYEHqPxYQkoEll7s09L6R2SXIvP Tyy6g3t2p5esB9R8mO5zmKyY66GWa5ureGBk4vLMLu1CWPGbcbiCMV17GWiTTsm/4c PVI+c8qTLXCVuEfAp9pA544/z0gA6a9sofBkKWI4= Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ioCGuCqXn3-Zaomujw7; Wed, 13 Jun 2018 15:35:37 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.com; s=mail; t=1528893338; bh=NyEurnz0YEpb1W8M64AxvVydzuCj/AW3UWhRy6hflnQ=; h=Subject:To:References:From:Message-ID:Date:In-Reply-To; b=DUQGL5XtxJMjl/vlTfEJLHOD87vt6pvANkrIXAVkTSNUJDiK3dEhntipczL4JW5KW 1tvsSIwUw5pmfGVmppwMqNpHI2S1R8tuxsV+nfBs0oNoeH/KBCJUXirOQapigvmp6f FTsnA3Xz7HQDxqtob3+3kcy1y/4xiaY+o6WKK2g8= Authentication-Results: smtp2p.mail.yandex.net; dkim=pass header.i=@yandex.com Subject: Re: How to detect single user mode in FreeBSD ? To: Shane Ambler , freebsd-questions@freebsd.org References: From: Manish Jain Message-ID: Date: Wed, 13 Jun 2018 18:04:08 +0530 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2018 12:35:54 -0000 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