NanoBSD update scripts are broken when using disk labels

Ilya Bakulin webmaster at kibab.com
Sun Nov 24 21:13:07 UTC 2013


Hi list,
I'm trying to build a NanoBSD image for the small Soekris net5501 board.
Everything went well, including flashing on the CF card and then booting
from the first partition.
However after generating an update image I couln't flash it, update
scripts don't work.

After looking in the /root/updatep2 script I realized that it cannot
work when NANO_LABEL parameter
is set when building the NanoBSD image.

I use NANO_LABEL="FBSDFLT", so after booting the system it has the
following configuration:

# uname -a
FreeBSD fbsd-gs 11.0-CURRENT FreeBSD 11.0-CURRENT #0
af4d383(fbsd-gs)-dirty: Sun Nov 24 19:03:58 CET 2013
root at olymp.kibab.com:/stor0/jails/buildhost.kibab.com/usr/home/kibab/repos/freebsd-git/gs0/obj/i386.i386/stor0/jails/buildhost.kibab.com/usr/home/kibab/repos/freebsd-git/freebsd/sys/GS0
 i386

("dirty" is because I haven't committed GS0 kernel configuration file,
the repository is clean)

# cat /etc/nanobsd.conf
NANO_DRIVE=ufs/FBSDFLT

# glabel status
          Name  Status  Components
 ufs/FBSDFLTs3     N/A  ada0s3
 ufs/FBSDFLTs4     N/A  ada0s4
ufs/FBSDFLTs1a     N/A  ada0s1a
ufs/FBSDFLTs2a     N/A  ada0s2a

# ls -1 /dev/ufs
FBSDFLTs1a
FBSDFLTs2a
FBSDFLTs3
FBSDFLTs4

... and here is the actual problem. The system doesn't create a separate
entry for FBSDFLTs1 and FBSDFLTs2.

The update scripts expect such entries to exist:

# cat /root/updatep2
[... BSD license ...]

. /etc/nanobsd.conf

if mount | grep ${NANO_DRIVE}s2 > /dev/null ; then
	echo "You are running partition 2 already"
	echo "you probably want to use 'updatep1' instead"
	exit 1
fi

# Blow away old system.
dd if=/dev/zero of=/dev/${NANO_DRIVE}s2 bs=1m count=1 > /dev/null 2>&1

# Copy in new system
dd of=/dev/${NANO_DRIVE}s2 obs=64k

----------------------------

So, it tries to `dd` to /dev/ufs/FBSDFLTs1 which doesn't exist.
I haven't found a good way to resolve ufs/FBSDFLTs1a to ada0s1 (actually
ada0s1 is the parent of ufs/FBSDFLTs1a).

Maybe someone has a good solution for this?
--
Ilya


More information about the freebsd-embedded mailing list