Examples of using rc.initdiskless

Thanks for referring me to the above page... I have read those instructions many times and am able to pxeboot FreeBSD but unable to make /etc and /var writable and was never really sure how /etc/rc.initdiskless came into play.... but here its is plain as day:-

When booting from an NFS root volume, /etc/rc detects the NFS boot and runs /etc/rc.initdiskless. In this case, /etc and /var need to be memory backed file systems so that these directories are writable but the NFS root directory is read-only:

Seems as though I need to figure this bit out before revisiting diskless booting...
Code:
# chroot ${NFSROOTDIR}
# mkdir -p conf/base
# tar -c -v -f conf/base/etc.cpio.gz --format cpio --gzip etc
# tar -c -v -f conf/base/var.cpio.gz --format cpio --gzip var
 
I see that you have asked this before, and I'm already answered to you thoroughly in Thread diskless-help.71975.
/etc in diskless setup shouldn't be writeable, and /var is temporary memory-backed FS. You can make /etc writeble, if you mount writeble NFS share above it, but I don't see why you would want to do this.

Maybe you should post your diskless /etc/fstab here, so that we can start from somewhere. Also read again my message in old thread.
 
After much trial and error (mostly error) I have my system remote booting with writable directories... but can't yet figure out how to install pkgs. I tried to copy a FreeBSD installation which included installed pkgs to ${NFSROOTDIR}
but that didn't work. Also tried chroot ${NFSROOTDIR} and pkg add -y mc but that didn't work either...

Accodring to http://www.nber.org/sys-admin/FreeBSD-diskless.html

Upates with pkg-add
pkg-add keeps a database of installed packages at /var/db/pkg. We do updates from a client machine with rw access to /pxeroot and the original freebsdboot:/pxeroot/var mounted as its /var.

.... unfortunately I don't follow how to do this....
 
root@freenas:/ # chroot /mnt/nas/tftproot/FreeBSD
root@freenas:/ # pkg install -y mc
pkg: /var/db/pkg/local.sqlite permissions (0775) too lax

I managed to change this to (0644) but then got:-
root@freenas:/ # pkg install -y mc
pkg: /var/db/pkg/local.sqlite wrong user or group ownership (expected 0/0 versus actual 65534/65534)

After setting chmod and chown correctly and trying again I get:-
oot@freenas:/ # pkg install -y mc
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The most recent versions of packages are already installed

This clearly isn't correct since when I try running mc various libs are missing.....

Maybe I should delete it and try again...
 
Also it will be good to know your system versions in both of your system's root and your $NFSROOT. And which way did you take to you make your $NFSROOT - make buildworld installworld, bsdinstall or other.
 
Thanks for the suggestions on how to install mc, but something is missing.... mc is installed but I get:-
ld-elf.so.1: Shared object "libslang.so.2" not found, required by "mc"
 
Also it will be good to know your system versions in both of your system's root and your $NFSROOT. And which way did you take to you make your $NFSROOT - make buildworld installworld, bsdinstall or other.

I will try and create a script to detail exactly what I did, but in brief terms I just extracted kernel.txz and base.txz from https://download.freebsd.org/ftp/releases/amd64/12.0-RELEASE/ into $NFSROOT.

I did try 12.1 but that wouldn't even boot.
 
I will try and create a script to detail exactly what I did, but in brief terms I just extracted kernel.txz and base.txz from https://download.freebsd.org/ftp/releases/amd64/12.0-RELEASE/ into $NFSROOT.

You forgot to extract lib32.txz, amd64 arch requires it. You can try the script that I wrote for simple and fast installing of FreeBSD - on the new system or as a jail template or as the diskless root - you can take it in this thread: .
 
I've just installed FreeBSD 12.0 amd64 from scratch and only need kernel.txz and base.txz and as soon as the system booted I ran pkg install -y mc and misc/mc got installed without a problem...

I guess I'll try copying this partition to ${NFSROOTDIR} and see if it works....
 
It works!

Now to try hone things.... I notice a number errors such as 'Write to restore size failed' but they scroll past too quickly and nothing seems to get shown when running dmesg.
 
Back
Top