Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 May 2013 09:11:11 +0200
From:      Matthias Apitz <guru@unixarea.de>
To:        FreeBSD Current <freebsd-current@freebsd.org>
Cc:        Matthias Apitz <guru@unixarea.de>
Subject:   Re: head && auditdistd
Message-ID:  <20130515071110.GA965@tiny.Sisis.de>
In-Reply-To: <4461yli2jq.fsf@lowell-desk.lan>
References:  <20130514064752.GA1098@tiny.Sisis.de> <CAHSQbTCzAfJE2NP3vRipmm0QUSTPSyhJe-qS0tJRmsiX0yHong@mail.gmail.com> <20130514170856.GA7271@sh4-5.1blu.de> <4461yli2jq.fsf@lowell-desk.lan>

next in thread | previous in thread | raw e-mail | index | archive | help

--Dxnq1zWXvFF0Q93v
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

El día Tuesday, May 14, 2013 a las 07:07:05PM -0400, Lowell Gilbert escribió:

> Matthias Apitz <guru@unixarea.de> writes:
> 
> > El día Tuesday, May 14, 2013 a las 07:20:02AM -0700, Justin Hibbits escribió:
> >
> >> You should run 'mergemaster -p' before installworld, as that would add any
> >> necessary new users to the file.
> >
> > I see no need to run 'mergemaster' if one installs world and kernel into
> > an empty mount point (device). There is nothing to merge.
> 
> Fine, if that provides a sufficiently complete system for your needs.
> That must be a pretty unusual set of needs, though.
> I'm interested: what do you do with a system that is complete except 
> for not including /etc?

The procedure described in the attachment produces a complete and
bootable system on an USB key; this is what I always use to install
FreeBSD on my other netbooks and laptops once the system (kernel, world
and ports) are compiled on some master "bakery" machine.

After adding there the missing user 'auditdistd' the procedure went fine
again and the netbook boots fine from the produced USB key (having all
/etc and so on).

As you see, I copied as well a copy of /usr/src and /usr/obj to the key
to run the installation now based on the booted key and having the
new target root (the netbook) mounted as /mnt; something must have failed
with that copy because the "make installworld DESTDIR=/mnt" failed now
there; but the system on the USB key itself is pretty much fine;

Do you have an idea what is missing, see the attached nohup.out of the
installation attempt.

Thanks

	matthias
-- 
Sent from my FreeBSD netbook

Matthias Apitz               |  - No system with backdoors like Apple/Android
E-mail: guru@unixarea.de     |  - Never being an iSlave
WWW: http://www.unixarea.de/ |  - No proprietary attachments, no HTML/RTF in E-mail
phone: +49-170-4527211       |  - Respect for open standards

--Dxnq1zWXvFF0Q93v
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="buildingBootKey.txt"


$Id: buildingImage.txt,v 1.5 2012/06/09 06:22:27 guru Exp $

Some ideas are stolen from:
http://bsdimp.blogspot.com/2007/10/building-bootable-freebsdi386-images.html

Building bootable FreeBSD/i386 USB keys 

If you want to build world and kernel out of SVN in 'src' and into 'obj', but in
some other place as /usr/[src|obj], for example in /home/guru/head/[src|obj]
use this procedure:

# mkdir -p /home/guru/head/obj
# MAKEOBJDIRPREFIX=/home/guru/head/obj ; export MAKEOBJDIRPREFIX
# cd /home/guru/head
# svn checkout svn://svn.freebsd.org/base/head src

# cd /home/guru/head/src
# make buildworld
# make buildkernel KERNCONF=GENERIC
...

or do the above just in the normal /usr/src (see kernel.txt);

How to install a booting FreeBSD onto an USB key as /dev/da0:

File operations, esp. of a large amount of small files, are very SLOW
on USB keys. That's why we use in general the following procedure:

1. dd(1) the complete /dev/da0 to a plain file, an image of the USB key;
2. use mdconfig(8) to make a memory disk of this file and mount(8) it;
3. do everything of the formatting and installation in this virtual disk;
4. unmount(8) it and dd(1) it back to the USB key;

here we go (use for /dev/da0 what your key is in /var/log/messages):

# dd if=/dev/da0 of=da0.r250588 bs=8m

note: this step is essential to get an image which later fits again to the
real USB key;

attach the file da0.r250588 as memory disk:

# mdconfig -a -t vnode -f da0.r250588
md0

wipe out all blocks to zero on the memory disk:

# dd if=/dev/zero of=/dev/md0 bs=1m
dd: /dev/md0: end of device
14785+0 records in
14784+0 records out
15502147584 bytes transferred in 1459.484517 secs (10621659 bytes/sec)

now use the normal procedure to create a bootable UFS on it:

# fdisk -I md0
# fdisk -B md0
# bsdlabel -w md0s1 auto
# bsdlabel -B md0s1
# bsdlabel -e md0s1  # edit the disk label and change partition "a" from "unused" to "4.2BSD"

build the file system:

# newfs /dev/md0s1a
# mount /dev/md0s1a /mnt

if you have built the kernel and world in some other place as /usr/src:

    # MAKEOBJDIRPREFIX=/home/guru/head/obj ; export MAKEOBJDIRPREFIX
    # cd /home/guru/head/src

or just run 'make' from the default place /usr/src 

    # cd /usr/src

since 20121201 (see src/UPDATING) the system where the build is
done needs a new user 'auditdistd'; we add this with:

# pw useradd -n auditdistd -g audit -c "Auditdistd unprivileged user" -d /var/empty -s /usr/sbin/nologin

now we can install world an kernel:

# make installworld  DESTDIR=/mnt
# make installkernel DESTDIR=/mnt KERNCONF=GENERIC INSTALL_NODEBUG=t
# make distrib-dirs  DESTDIR=/mnt
# make distribution  DESTDIR=/mnt

# echo /dev/da0s1a / ufs rw 1 1 > /mnt/etc/fstab
# cp /etc/wpa_supplicant.conf /mnt/etc

# cat <<EOF > /mnt/etc/rc.conf
wlans_ath0="wlan0"
ifconfig_wlan0="WPA DHCP"
ifconfig_bge0="DHCP"
hostname=tinyCaracas
sshd_enable="YES"
keymap="german.iso"
EOF

# cat <<EOF > /mnt/boot/loader.conf
kern.cam.boot_delay="10000"
kern.cam.scsi_delay="3000"
EOF

to use the above created USB key to install a 2nd system (the EeePC for
example, or the Acer) we need 'src' and 'obj' as well on the key:

    # cd /home/guru/head/
    # mkdir -p /mnt/home/guru/head/

    we could do (to avoid copy of .svn dirs):

    # rsync -av --cvs-exclude src /mnt/home/guru/head/
    # rsync -av --cvs-exclude obj /mnt/home/guru/head/

    or (this worked fine every time):

    # cp -Rp src /mnt/home/guru/head/
    # cp -Rp obj /mnt/home/guru/head/

or from the normal place as:

    # cd /usr
    # cp -Rp src /mnt/usr
    # cp -Rp obj /mnt/usr

add an unpriv user (for beeing able to SSH-in):

# chroot /mnt /usr/sbin/adduser

umount the key, detach the memory disk and dd(1) the image to the USB device:

# umount /mnt
# mdconfig -d -u md0
# dd if=da0.r250588 of=/dev/da0 bs=8m


--Dxnq1zWXvFF0Q93v
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="nohup.out"
Content-Transfer-Encoding: quoted-printable


# uname -a
FreeBSD tinyCaracas 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r250588: Mon May 1=
3 22:01:51 UTC 2013     guru@Perlach:/home/guru/head/obj/usr/home/guru/head=
/src/sys/GENERIC  i386

# newfs /dev/ad4s1a
# mount /dev/ad4s1a /mnt
# setenv  MAKEOBJDIRPREFIX /home/guru/head/obj
# cd /home/guru/head/src
# make installworld DESTDIR=3D/mnt

mkdir -p /tmp/install.FrflVwFP
progs=3D$(for prog in [ awk cap_mkdb cat chflags chmod chown  date echo egr=
ep find grep id install install-info  ln lockf make mkdir mtree nmtree mv p=
wd_mkdb  rm sed sh sysctl test true uname wc zic tzsetup; do  if progpath=
=3D`which $prog`; then  echo $progpath;  else  echo "Required tool $prog no=
t found in PATH." >&2;  exit 1;  fi;  done);  libs=3D$(ldd -f "%o %p\n" -f =
"%o %p\n" $progs 2>/dev/null | sort -u |  while read line; do  set -- $line=
;  if [ "$2 $3" !=3D "not found" ]; then  echo $2;  else  echo "Required li=
brary $1 not found." >&2;  exit 1;  fi;  done);  cp $libs $progs /tmp/insta=
ll.FrflVwFP
cp -R ${PATH_LOCALE:-"/usr/share/locale"} /tmp/install.FrflVwFP/locale
cd /home/guru/head/src; MAKEOBJDIRPREFIX=3D/home/guru/head/obj MACHINE_ARCH=
=3Di386 MACHINE=3Di386 CPUTYPE=3D GROFF_BIN_PATH=3D/home/guru/head/obj/home=
/guru/head/src/tmp/legacy/usr/bin GROFF_FONT_PATH=3D/home/guru/head/obj/hom=
e/guru/head/src/tmp/legacy/usr/share/groff_font GROFF_TMAC_PATH=3D/home/gur=
u/head/obj/home/guru/head/src/tmp/legacy/usr/share/tmac PATH=3D/home/guru/h=
ead/obj/home/guru/head/src/tmp/legacy/usr/sbin:/home/guru/head/obj/home/gur=
u/head/src/tmp/legacy/usr/bin:/home/guru/head/obj/home/guru/head/src/tmp/le=
gacy/usr/games:/home/guru/head/obj/home/guru/head/src/tmp/legacy/bin:/home/=
guru/head/obj/home/guru/head/src/tmp/usr/sbin:/home/guru/head/obj/home/guru=
/head/src/tmp/usr/bin:/home/guru/head/obj/home/guru/head/src/tmp/usr/games:=
/tmp/install.FrflVwFP  LD_LIBRARY_PATH=3D/tmp/install.FrflVwFP  PATH_LOCALE=
=3D/tmp/install.FrflVwFP/locale make -f Makefile.inc1    __MAKE_SHELL=3D/tm=
p/install.FrflVwFP/sh reinstall;  MAKEOBJDIRPREFIX=3D/home/guru/head/obj MA=
CHINE_ARCH=3Di386 MACHINE=3Di386 CPUTYPE=3D GROFF_BIN_PATH=3D/home/guru/hea=
d/obj/home/guru/head/src/tmp/legacy/usr/bin GROFF_FONT_PATH=3D/home/guru/he=
ad/obj/home/guru/head/src/tmp/legacy/usr/share/groff_font GROFF_TMAC_PATH=
=3D/home/guru/head/obj/home/guru/head/src/tmp/legacy/usr/share/tmac PATH=3D=
/home/guru/head/obj/home/guru/head/src/tmp/legacy/usr/sbin:/home/guru/head/=
obj/home/guru/head/src/tmp/legacy/usr/bin:/home/guru/head/obj/home/guru/hea=
d/src/tmp/legacy/usr/games:/home/guru/head/obj/home/guru/head/src/tmp/legac=
y/bin:/home/guru/head/obj/home/guru/head/src/tmp/usr/sbin:/home/guru/head/o=
bj/home/guru/head/src/tmp/usr/bin:/home/guru/head/obj/home/guru/head/src/tm=
p/usr/games:/tmp/install.FrflVwFP  LD_LIBRARY_PATH=3D/tmp/install.FrflVwFP =
 PATH_LOCALE=3D/tmp/install.FrflVwFP/locale rm -rf /tmp/install.FrflVwFP
--------------------------------------------------------------
>>> Making hierarchy
--------------------------------------------------------------
cd /home/guru/head/src; make -f Makefile.inc1  LOCAL_MTREE=3D hierarchy
cd /home/guru/head/src/etc; make LOCAL_MTREE=3D distrib-dirs
mtree -deU -f /home/guru/head/src/etc/mtree/BSD.root.dist -p /mnt/
mtree -deU -f /home/guru/head/src/etc/mtree/BSD.var.dist -p /mnt/var
mtree -deU -f /home/guru/head/src/etc/mtree/BSD.usr.dist -p /mnt/usr
mtree -deU -f /home/guru/head/src/etc/mtree/BSD.include.dist -p /mnt/usr/in=
clude
mtree -deU -f /home/guru/head/src/etc/mtree/BIND.chroot.dist -p /mnt/var/na=
med
mtree -deU -f /home/guru/head/src/etc/mtree/BSD.groff.dist -p /mnt/usr
mtree -deU -f /home/guru/head/src/etc/mtree/BSD.sendmail.dist -p /mnt/
install -l s usr/src/sys /mnt/sys
cd /mnt/usr/share/man;  for mandir in man*; do  install -l s ../$mandir  /m=
nt/usr/share/man/en.ISO8859-1/;  install -l s ../$mandir  /mnt/usr/share/ma=
n/en.UTF-8/;  done
cd /mnt/usr/share/openssl/man;  for mandir in man*; do  install -l s ../$ma=
ndir  /mnt/usr/share/openssl/man/en.ISO8859-1/;  done
set - `grep "^[a-zA-Z]" /home/guru/head/src/etc/man.alias`;  while [ $# -gt=
 0 ] ; do  install -l s "$2" "/mnt/usr/share/man/$1";  install -l s "$2"  "=
/mnt/usr/share/openssl/man/$1";  shift; shift;  done
set - `grep "^[a-zA-Z]" /home/guru/head/src/etc/nls.alias`;  while [ $# -gt=
 0 ] ; do  install -l s "$2" "/mnt/usr/share/nls/$1";  shift; shift;  done

--------------------------------------------------------------
>>> Installing everything
--------------------------------------------------------------
cd /home/guru/head/src; make -f Makefile.inc1 install
=3D=3D=3D> share/info (install)
=3D=3D=3D> lib (install)
=3D=3D=3D> lib/csu/i386-elf (install)
cc -O2 -pipe  -I/home/guru/head/src/lib/csu/i386-elf/../common  -I/home/gur=
u/head/src/lib/csu/i386-elf/../../libc/include -std=3Dgnu99 -Qunused-argume=
nts  -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-paramete=
r -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -W=
cast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align=
 -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-=
definition -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int  -c crti.S
cc: not found
*** [crti.o] Error code 127

Stop in /home/guru/head/src/lib/csu/i386-elf.
*** [realinstall] Error code 1

Stop in /home/guru/head/src/lib.
*** [realinstall] Error code 1

Stop in /home/guru/head/src.
*** [reinstall] Error code 1

Stop in /home/guru/head/src.
*** [installworld] Error code 1

Stop in /home/guru/head/src.
*** [installworld] Error code 1

Stop in /home/guru/head/src.
#

# env
VENDOR=3Dintel
LOGNAME=3Droot
PAGER=3Dmore
OSTYPE=3DFreeBSD
MAKEOBJDIRPREFIX=3D/home/guru/head/obj
MACHTYPE=3Di386
MAIL=3D/var/mail/root
PATH=3D/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/=
bin:/root/bin
EDITOR=3Dvi
HOST=3DtinyCaracas
PWD=3D/home/guru/head/src
GROUP=3Dwheel
TERM=3Dxterm
COMPILER_TYPE=3Dclang
HOME=3D/root
USER=3Droot
HOSTTYPE=3DFreeBSD
SHELL=3D/bin/csh
BLOCKSIZE=3DK
SHLVL=3D1

--Dxnq1zWXvFF0Q93v--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130515071110.GA965>