From owner-freebsd-questions@freebsd.org Wed Jun 13 13:12:33 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 1E1841009B2F for ; Wed, 13 Jun 2018 13:12:33 +0000 (UTC) (envelope-from 4250.10.freebsd-questions=freebsd.org@email-od.com) Received: from s1-b0c6.socketlabs.email-od.com (s1-b0c6.socketlabs.email-od.com [142.0.176.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB0B081FFB for ; Wed, 13 Jun 2018 13:12:32 +0000 (UTC) (envelope-from 4250.10.freebsd-questions=freebsd.org@email-od.com) DKIM-Signature: v=1; a=rsa-sha256; d=email-od.com;i=@email-od.com;s=dkim; c=relaxed/relaxed; q=dns/txt; t=1528895553; x=1531487553; h=content-transfer-encoding:content-type:mime-version:references:in-reply-to:message-id:subject:to:from:date:x-thread-info; bh=vXlOZgZvhNG496+2mwFftAxzzbYYmTwKyHGzRejv4WQ=; b=pfbbAkx06pCP3aVKNEY7xgk2sH0arhXVOPekI9QbeAbjmw5lAjCgA8ZxOjyeRc26gQtSWJnsPdhayTJPS+0e1mTBh7OfyG4iqWuuxClLIQV9+bgfaeEfazSmlS5BUsXlGmxkVa+EgO4XRmylVpSJbXT9lSu97qcUlB8NeZc5Cro= X-Thread-Info: NDI1MC4xMi4xOGQwMDAwMDE1YjU1NGYuZnJlZWJzZC1xdWVzdGlvbnM9ZnJlZWJzZC5vcmc= Received: from r3.h.in.socketlabs.com (r3.h.in.socketlabs.com [142.0.180.13]) by mxsg2.email-od.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Wed, 13 Jun 2018 09:12:19 -0400 Received: from smtp.lan.sohara.org (EMTPY [89.127.62.20]) by r3.h.in.socketlabs.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Wed, 13 Jun 2018 09:12:19 -0400 Received: from [192.168.63.1] (helo=steve.lan.sohara.org) by smtp.lan.sohara.org with smtp (Exim 4.90_1 (FreeBSD)) (envelope-from ) id 1fT5ZR-000BTM-Lm for freebsd-questions@freebsd.org; Wed, 13 Jun 2018 13:12:17 +0000 Date: Wed, 13 Jun 2018 14:12:17 +0100 From: Steve O'Hara-Smith To: freebsd-questions@freebsd.org Subject: Re: How to detect single user mode in FreeBSD ? Message-Id: <20180613141217.a3ab7160a55398bf5ed56ef2@sohara.org> In-Reply-To: References: X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd11.1) X-Clacks-Overhead: "GNU Terry Pratchett" Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 13:12:33 -0000 On Wed, 13 Jun 2018 18:04:08 +0530 Manish Jain wrote: > 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 The runlevel concept comes from sysV init, it isn't a BSD thing at all. There isn't a real difference at all between single user and multi user. Single user mode is really just one of two states - before enabling ttys and running the rc scripts with start or after disabling the ttys and running the rc.shutdown script. There's nothing special about it. If you feel a need to test for single user then you should probably be testing for something else - such as whether a filesystem is mounted before running fsck on it which is what really matters and is completely independent of whether or not the system is running multi-user. -- Steve O'Hara-Smith