History log of /freebsd-10.0-release/etc/rc.initdiskless
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 243374 21-Nov-2012 crees

Revert r243228. This commit appears to cause more trouble than
it was designed to avoid; the issue described in the PR was no
longer an issue anyway.


# 243228 18-Nov-2012 crees

cp -R misses out dotfiles; use pax instead to copy file hierarchies

PR: conf/99721 (based on)
Submitted by: Florian Zavatzki <f_zavatzki@blue-network.org>
Approved by: hrs
MFC after: 1 month


# 229783 07-Jan-2012 uqs

Spelling fixes for etc/


# 208060 14-May-2010 dougb

Remove trailing white space. No functional changes.


# 182895 09-Sep-2008 bms

Add support to rc.initdiskless for /conf/T/M/remount_subdir.
This allows the location of the configuration data to be relocated
within the filesystem containing it. A nullfs mount is used in order
to achieve this.

Obtained from: XORP, Inc.


# 179014 15-May-2008 bms

Add support for /conf/T/M/remount_optional.

The rc.initdiskless functionality is used by NanoBSD to allow configuration
files to live on a separate configuration slice, which acts as NVRAM, whilst
the system image is mounted read-only.

Normally, if the remount command fails during boot, this is regarded as
a fatal error. If /conf/T/M/remount_optional is present, this error is
non-fatal. If the file is not present, the default behaviour is unchanged.

This is very useful for people building live CD images using FreeBSD,
where the NVRAM lives somewhere completely differently from the system image,
and may be present on removable media which is not present during the
initial boot.


# 164862 03-Dec-2006 luigi

- put some common code in a function handle_remount();
- add better checks on non-existing directories to prevent error
messages at run time;
- introduce a function log() to help debugging diskless booting
when things don't work;
- modify the parsing of diskless_remount so you can add mount_nfs
options after the pathname. You could use 'remount' to do something
similar, but this way is more convenient because you don't have to
hardwire the server name in the command.
- document the above.

I have been running the above in a diskless lab since february on RELENG_6.

MFC after: 1 week


# 161824 01-Sep-2006 brooks

- Document /conf/diskless_remount in the list of special files.
- Note that diskless_remount files may use ".." to support mounts above
the root path.
- Copy dot files when populating directories from /conf. [1]

PR: misc/102724 [1]
Submitted by: Attila Nagy <bra at fsn.hu> [1]


# 161533 22-Aug-2006 ru

Fix example:

/conf/base/diskless_remount -> /conf/base/etc/diskless_remount

MFC after: 3 days


# 154239 11-Jan-2006 brooks

Creating memory file systems with softupdates enabled is pointless,
don't do it.

PR: conf/85558
Submitted by: Ralf Wenk <RZ dash FreeBSD0605 at hs dash karlsruhe dot de>
MFC after: 5 days


# 151916 31-Oct-2005 brooks

Add items to unmount to the front of the list so they are unmounted in
reverse (thus allowing /conf to be unmounted).


# 151914 31-Oct-2005 brooks

Switch from pax to tar for extracting cpio archives. pax requires a
writable /tmp (or TMPDIR) and thus is unsuitable for this job.

Tested by: Joerg Pulz <Joerg dot Pulz at frm2 dot tum dot de>
PR: conf/88293


# 151908 31-Oct-2005 brooks

The -x <format> option of pax is for creation of archives, not
extraction.

This will allow cpio archive support to work, at least in situations
where /tmp is writable. Because pax requires a writable /tmp it is
unsuitable for this task, but replacing it will come in a later commit.

Submitted by: Joerg Pulz <Joerg dot Pulz at frm2 dot tum dot de>
PR: conf/88293


# 150169 15-Sep-2005 rwatson

Use sysctl -q when querying for kern.bootp_cookie in order to avoid
printing boot-time errors that don't reflect true error conditions.

MFC after: 1 week


# 149556 28-Aug-2005 bmah

Fix minor typo in a comment.


# 149170 16-Aug-2005 brooks

Add two new template sources, /conf/bcast/${ipbca} and /conf/ip/${ip}.
These allow large installations to keep their /conf directory down to a
managable number of entries.

Clean up the handling of dhcp_cookie.


# 145693 29-Apr-2005 brooks

To allow /etc to be as minimal as possible in a diskless setup, we need
to run initdiskless before we run rcorder on /etc/rc.d. To allow this,
move /etc/rc.d/initdiskless to /etc/rc.initdiskless and run it directly
from /etc/rc.

Remove /etc/rc.d/preseedrandom as it is no longer necessicary (we start
with entropy unblocked) and was only used by initdiskless when it
was needed.

Discussed on: freebsd-rc
Repocopy by: peter


# 138729 12-Dec-2004 obrien

Use utils from /rescue vs. /stand. Also use pax rather than cpio & gzip.


# 137246 05-Nov-2004 mtm

- Make the header conform to standard rc.d style.
- The 'before ipfw' directive seems bogus, and should instead
be 'before rcconf'.


# 136224 07-Oct-2004 mtm

Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days


# 130151 06-Jun-2004 schweikh

Removed whitespace at BOF, EOL & EOF.


# 128713 28-Apr-2004 phk

Initdiskless must run before ipfw, or people will not be able to
use the conf/* stuff for their firewall configuration.

Running ipfw before could seem to make sense in that it would allow
one to setup access to the NFS server on a "default-deny" kernel,
but it is pretty obvious to the casual observer that such a configuration
never makes it far enough to mount the NFS-root in the first place.


# 128706 28-Apr-2004 ru

Replace shell's positional parameters safely.


# 128685 27-Apr-2004 phk

When using this in non-NFSroot circumstances, `mount -t nfs` may
return empty. Add a dummy element to prevent the alternate action
of the shell builtin "set"


# 128286 15-Apr-2004 brooks

Band-aid diskless booting by running a new preseedrandom script before
initdiskless. The output of several commands and if available the
contents of /entropy are feed into /dev/random to kickstart the PRNG.
/etc/rc.d/initrandom is left alone to maintain the previous behavior as
much as possiable.

Further work in this area is probably needed.

Discussed with: markm


# 127663 31-Mar-2004 luigi

Extensive documentation changes to the script, but only
comments and empty lines have been touched.

All of this should go in the diskless(8) manpage, now if we had
some kind of 'literate programming' tool to extract the comments
from the script and put them in a reasonable nroff format, it
would be a lot easier to keep code and docs in sync


# 127657 31-Mar-2004 luigi

Minor changes mostly as discussed on the lists a few days ago:

+ SUBDIR.cpio.gz prevents files from SUBDIR/ to be copied when
priming the memory filesystems. This restores the old behaviour
and makes the copy process a lot more efficient

+ look for templates also in the list of directories supplied by
bootp/dhcp via the T134 option aka kern.bootp_cookie

+ keep track of directories temporarily mounted with "remount"
or "diskless_remount" commands and unmount them once we are done
with them (at the end of this script).


# 126868 12-Mar-2004 brooks

If /conf/diskless_remount exists, use it to remount the entire /conf
directory. This allows multiple roots (say for different architectures)
to share the same set of /conf files.


# 126787 09-Mar-2004 phk

Make this file more generally usable:

Trigger not only on diskless booting sysctls being set, but also
on the existence of the file "/etc/diskless". But do not try to
extract IP# related keywords in that case.

Add a general "remount" facility to allow non-NFS remounting.


# 126744 08-Mar-2004 pjd

Mark scripts as not usable inside a jail by adding keyword 'nojail'.

Some suggestions from: rwatson, Ruben de Groot <mail25@bzerk.org>


# 121067 13-Oct-2003 dougb

Remove trailing whitespace


# 121066 13-Oct-2003 dougb

Update references to rc.diskless[12]


# 121014 11-Oct-2003 kris

Bump default /etc size from 2MB to 5MB to deal with bloat^Wgrowth in
the size of /etc.


# 118638 07-Aug-2003 fjoe

Correct typo in Matt's name.


# 117087 30-Jun-2003 brooks

Allow diskless_remount files to contain path beginning with / which will
be mounted relative to the NFS root mountpoint.

Reviewed by: dillon at backplane.com
MFC After: 3 days


# 110942 15-Feb-2003 jhay

Add another backslash ('\').


# 108191 22-Dec-2002 dillon

Do not unconditionally load the configuration files for the RCNG case.
Instead, load them as part of the rc.d system. This allows us to prioritize
the initidiskless script so it runs before the configuration files are loaded
and allows us to get rid of the exit 2 hack in /etc/rc. The exit 2 never
worked anyway since it did not unset the prior configuration, causing the
diskless code to not operate properly.

Do a major cleanup and revamping of the diskless code for RCNG. This will
be backported to the non-RCNG scripts as well as -stable.

With suggestions from: Mike Makonnen <mtm@identd.net>
MFC after: 7 days


# 104980 12-Oct-2002 schweikh

Fix style bugs:
* Space -> tabs conversion.
* Removed blanks before semicolon in "if ... ; then".
* Proper indentation of misindented lines.
* Put a full stop after some comments.
* Removed whitespace at end of line.

Approved by: silence from gordon


# 104334 01-Oct-2002 dd

In a diskless setup, rc.d/initdiskless may overwrite parts of /etc on
a per-machine or per-cluster (with different ways of expressing what's
part of a cluster) basis. In order for this to be effective, rc.conf
has to be reread after initdiskless is finished. Implement this by
adding a hook to etc/rc which rereads rc.conf by request. This can
also be implemented by renaming initdiskless to initdiskless.sh and
sourcing rc.conf there manually, but it was decided that, that would
be uglier than a hook in etc/rc.

Developed in concert with: gordon


# 103799 22-Sep-2002 phk

Use mdmfs(8) rather than rolling our own RAM-disks.

Sponsored by: DARPA & NAI Labs.


# 100791 28-Jul-2002 dd

Stock -current has more than 300 files in /etc, so 255 inodes for the
/etc filesystem isn't enough; consequently, add "-i 4096" to the newfs
command for /etc. This results in 1022 inodes, which should be enough
for the forseeable future (although I don't know why we would ever
have more than 1000 files in a default /etc).

Silence by: -current


# 100280 18-Jul-2002 gordon

Merge in all the changes that Mike Makonnen has been maintaining for a
while. This is only the script pieces, the glue for the build comes next.

Submitted by: Mike Makonnen <makonnen@pacbell.net>
Reviewed by: silence on -current and -hackers
Prodded by: rwatson


# 95280 22-Apr-2002 obrien

Utilize dhcp information in the kernel environment if we don't have
hostname and DNS information already.

Submitted by: Danny Braniss <danny@cs.huji.ac.il>


# 91105 22-Feb-2002 obrien

The usage of 'newaliases' needs to be after we know for sure that /usr
is mounted.

Submitted by: rizzo


# 91074 22-Feb-2002 obrien

The existing bazaar and site-specific policy in rc.diskless1 is Just Wrong;
and looks like no other Unix diskless configuration I've ever seen.
Thus allow a more traditional /etc.

Note, the use of an MFS /var should also be settable.
Otherwise installing ports(packages) is just a total PITA.


# 89438 16-Jan-2002 rwatson

o Improve the line-wrapping of additional comments, some of which appeared
to be wrapped around 60, others around 40 columns.


# 89437 16-Jan-2002 rwatson

o Remove a somewhat less comprehensible comment about modifying /etc/rc.
o Improve line-wrapping of another comment for consistency.


# 88496 26-Dec-2001 rwatson

Remove incorrect comments about the population of /etc: no attempt is
made to copy the NFS-mounted on to /tmp/etc, instead, it is populated
entirely from /conf/default, then overriden from /conf/IP.


# 76409 09-May-2001 bsd

* Simplify the population of the /etc memory filesystem. To avoid
the null mount, we currently create a temporary mfs on /tmp, copy
/etc to /tmp, then mount /etc as mfs and copy everything back from
/tmp, then delete the /tmp mfs.

The patch eliminates the temporary /tmp mfs and the subsequent
copying and simply populates the /etc mfs by copying from
/conf/default/etc. This requires that /conf/default/etc contain a
complete copy of all the /etc stuff instead of just overrides. I
don't think that is too much of an extra step in setting up a
diskless environment.

* Provide the ability to make /tmp a memory filesystem independent
of /var. This removes the requirement that /tmp be a symlink to
/var/tmp and this makes the diskless code work with the default
filesystem layout. If a seperate /tmp memory filesystem is
created, the 'tmpsize' environment variable is used to determine
its size (default to 10 Meg).

* Reduce diffs between the -current and -stable versions of these
files to a bare minimum. Only the definition of the shell
function 'mount_md' is different.

Not Objected to by: -arch@, -small@

MFC after: 2 days


# 75931 25-Apr-2001 imp

Move to using md.
o create a simple wrapper function mount_md that makes it easy to
move from mount_mfs.

# NOTE: you will need to MAKEDEV md[0123] in order for this to work.

Reviewed by: bsd, keichii


# 75746 20-Apr-2001 bsd

Eliminate the null mount for /etc for diskless clients.


# 75101 02-Apr-2001 bsd

Change the order in which /etc files are copied into place; copy
default first, then network-specific files, then host-specific files.
I think this was the original intent, as Matt indicated the previous
code appeared to be a bug.


# 66830 08-Oct-2000 obrien

Add copyright notices. Other systems have been barrowing our /etc files
w/o giving any credit.


# 55520 06-Jan-2000 luigi

Cleanup diskless support in current, mostly aligning it to the one
in the 3.x branch. Also remove the dependency on /usr to find the
boot address/interface.
Mostly-submitted-abd-tested-by: MIHIRA Sanpei Yoshiro <sanpei@sanpei.org>


# 51237 13-Sep-1999 peter

Add/adjust some $FreeBSD$ tags.

Noted by: Doug <Doug@gorean.org>


# 51231 13-Sep-1999 sheldonh

Apply a consistent style to most of the etc scripts. Particularly, use
case instead of test where appropriate, since case allows case is a sh
builtin and (as a side-effect) allows case-insensitivity.

Changes discussed on freebsd-hackers.

Submitted by: Doug Barton <Doug@gorean.org>


# 50357 25-Aug-1999 sheldonh

Style clean-up:

* All variables are now embraced: ${foo}

* All comparisons against some value now take the form:
[ "${foo}" ? "value" ]
where ? is a comparison operator

* All empty string tests now take the form:
[ -z "${foo}" ]

* All non-empty string tests now take the form:
[ -n "${foo}" ]

Submitted by: jkh


# 43803 09-Feb-1999 dillon

Revamp rc.diskless. Split into rc.diskless1 and rc.diskless2. provide
more opportunities for overriding. Clean up /etc/rc ( remove conf_dir,
remove startup mount special cases, remove other special cases )