From owner-freebsd-questions@FreeBSD.ORG Thu Aug 28 03:27:04 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9777716A4BF for ; Thu, 28 Aug 2003 03:27:04 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (smtp.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id A91A943FE9 for ; Thu, 28 Aug 2003 03:27:01 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [127.0.0.1]) h7SAQPLa009111 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 28 Aug 2003 11:26:56 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)h7SAQPoC009110; Thu, 28 Aug 2003 11:26:25 +0100 (BST) (envelope-from matthew) Date: Thu, 28 Aug 2003 11:26:25 +0100 From: Matthew Seaman To: David Landgren Message-ID: <20030828102625.GB6697@happy-idiot-talk.infracaninophile.co.uk> Mail-Followup-To: Matthew Seaman , David Landgren , FreeBSD Questions List References: <014d01c36d24$1f8c1430$0201a8c0@dredster> <3F4DB8A2.8040007@landgren.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="R3G7APHDIzY6R/pk" Content-Disposition: inline In-Reply-To: <3F4DB8A2.8040007@landgren.net> User-Agent: Mutt/1.5.4i X-Spam-Status: No, hits=-8.1 required=5.0 tests=AWL,EMAIL_ATTRIBUTION,IN_REP_TO,PGP_SIGNATURE_2, QUOTED_EMAIL_TEXT,REFERENCES,REPLY_WITH_QUOTES, USER_AGENT_MUTT autolearn=ham version=2.55 X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: FreeBSD Questions List Subject: Re: Setting sysctl variables BEFORE the kernel boots and runs init? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Aug 2003 10:27:04 -0000 --R3G7APHDIzY6R/pk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 28, 2003 at 10:09:06AM +0200, David Landgren wrote: > Micheal Patterson wrote: >=20 > > > >----- Original Message -----=20 > >From: "Donald Burr" > >To: "FreeBSD Questions List" > >Sent: Wednesday, August 27, 2003 6:11 PM > >Subject: Setting sysctl variables BEFORE the kernel boots and runs init? > > > > > > > >>I would like to be able to set certain sysctl variables in the kernel, > >>preferably BEFORE the kernel finishes booting and runs init, etc. (or > >>at the worst case, very shortly after init runs) I thought I > >>remembered that there was a way to do this through the boot loader. > >>Can anyone enlighten me? Thanks. > [...] > >You can configure sysctl options if you create the file /etc/sysctl.conf= =20 > >and > >put your changes there. Is this what you're looking for? >=20 > That happens in the late stages if the game. init is running the main=20 > rc script, disks have been fscked and mounted, swap is up. It does=20 > happen before network setup, IIRC. It depends on what variables the OP=20 > is talking about I guess. Yes -- however /etc/sysctl.conf is still too late compared to what the OP was asking for. You can modify some kernel tunables very early in the boot process by setting variables in the loader. According to loader(8) the tunables that are available are: kern.maxusers kern.ipc.nmbclusters kern.vm.kmem.size kern.maxswzone kern.maxbcache machdep.pccard.pcic_irq net.inet.tcp.tcbhashsize (This is on 4.9-PRERELEASE, other OS versions may differ) These are normally set using compiled-in values derived from settings like MAXUSERS, NMBCLUSTERS, TCBHASHSIZE in the kernel config. These values have to be set early because they define the size of various critical memory structures within the kernel that can't be modified while the system is running. You can set these values by editing /boot/loader.conf -- eg, add: kern.maxusers=3D"32" to that file. The operation of loader.conf deliberately parallels the way that /etc/rc.conf works. See /boot/defaults/loader.conf for default settings for the available variables. Any other modifications to sysctl settings can and should be made via /etc/sysctl.conf Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --R3G7APHDIzY6R/pk Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/TdjRdtESqEQa7a0RAgu2AJoCvLTSPUWjiMM0Odrow9Si2w/wJACfbUwm Eh64BKic7c8i+ULJt6pyliQ= =vX8a -----END PGP SIGNATURE----- --R3G7APHDIzY6R/pk--