installation of 12.1R and 11.3R fails

Michael Sierchio kudzu at tenebras.com
Mon May 25 23:30:05 UTC 2020


This is way more complex than what you need, edit away.  I've never
observed this to fail.  I avoid UEFI boot unless it's unavoidable.

I've never observed it to fail, and I use it to build EC2 instances where I
have no console access.  It might seem that there are a lot of partitions,
but I build security appliances.

#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
DISK="$1"

BOOTSIZ="128k"
ROOTSIZ="1GB"
SWAPSIZ="1GB"
TMPSIZ="1GB"
VARSIZ="2GB"

# Why have a separate /var/tmp partition? Security.
# world-writable directories (with mode 041777) should be noexec,nosuid

VARTMPSIZ="1GB"

# you really want this to be unique for each disk

PFX="XG55qAUrKwbPR"


################################################################################
# Partition Disk
################################################################################

# delete any partition data already on disk

offset=`diskinfo $DISK | awk '{ print $4 - 128 }'`
dd if=/dev/zero of=/dev/$DISK bs=${BOOTSIZ} count=1
dd if=/dev/zero of=/dev/$DISK seek=$offset

# create partition table
gpart create -s gpt ${DISK}

# add boot partition
# p1
gpart add -t freebsd-boot -l $PFX-boot -s ${BOOTSIZ} ${DISK}

# put boot code in boot partition
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ${DISK}

# add root, make sectors aligned
# p2
gpart add -t freebsd-ufs -l $PFX-root -a ${BOOTSIZ} -s ${ROOTSIZ} ${DISK}

# add swap
# p3
gpart add -t freebsd-swap -l $PFX-swap -a ${BOOTSIZ} -s ${SWAPSIZ} ${DISK}

# add tmp
# p4
gpart add -t freebsd-ufs -l $PFX-tmp -a ${BOOTSIZ} -s ${TMPSIZ} ${DISK}

# add var
# p5
gpart add -t freebsd-ufs -l $PFX-var -a ${BOOTSIZ} -s ${VARSIZ} ${DISK}

# add vartmp
# p6
gpart add -t freebsd-ufs -l $PFX-vartmp -a ${BOOTSIZ} -s ${VARTMPSIZ}
${DISK}

# add usr (remainder of disk)
# p7
gpart add -t freebsd-ufs -l $PFX-usr -a ${BOOTSIZ} ${DISK}

################################################################################
# make filesystems, mount points, mount all
################################################################################

echo "making filesystems..."
# make filesystems, no softupdates on root
newfs /dev/${DISK}p2

echo "mounting filesystems..."
mkdir -p /mnt
mount -o rw,noatime /dev/${DISK}p2 /mnt

mkdir -p /mnt/tmp /mnt/var /mnt/usr
chmod a+rwxt /mnt/tmp

newfs -U /dev/${DISK}p4
newfs -U /dev/${DISK}p5
newfs -U /dev/${DISK}p6
newfs -U /dev/${DISK}p7

mount -o rw,nosuid,noexec /dev/${DISK}p4 /mnt/tmp
mount -o rw,noatime /dev/${DISK}p5 /mnt/var
mount -o rw,noatime /dev/${DISK}p7 /mnt/usr

mkdir -p /mnt/var/tmp
mount -o rw,nosuid,noexec /dev/${DISK}p6 /mnt/var/tmp

chmod a+rwxt /mnt/tmp /mnt/var/tmp

tar -xf /usr/local/src/base.txz -C /mnt
tar -xf /usr/local/src/kernel.txz -C /mnt
tar -xf /usr/local/src/lib32.txz -C /mnt
tar -xf /usr/local/src/src.txz -C /mnt

cat <<EOF > /mnt/etc/fstab
/dev/gpt/${PFX}-root      /          ufs     rw,noatime          1 1
/dev/gpt/${PFX}-swap.eli  none       swap    sw                  0 0
/dev/gpt/${PFX}-tmp       /tmp       ufs     rw,noexec,nosuid    2 2
/dev/gpt/${PFX}-var       /var       ufs     rw,noatime          2 2
/dev/gpt/${PFX}-vartmp    /var/tmp   ufs     rw,noexec,nosuid    2 2
/dev/gpt/${PFX}-usr       /usr       ufs     rw,noatime          2 2
EOF

cat <<EOFF > /mnt/etc/rc.conf
fsck_y_enable="YES"
background_fsck="YES"
background_fsck_delay="60"

hostname="name-me"

# this nonsense is because I don't know what instance type I am yet
# one is guaranteed to fail, the other, to succeed

network_interfaces="lo0 xn0 ena0 eth0 enc0"
ifconfig_xn0="name eth0"
ifconfig_ena0="name eth0"

ifconfig_eth0="SYNCDHCP"   # do what you like here

sshd_enable="YES"

syslogd_enable="YES"
syslogd_flags="-sCcc"

service_enable="YES"

firewall_enable="NO"
EOFF

On Mon, May 25, 2020 at 9:03 AM Donald Wilde <dwilde1 at gmail.com> wrote:

> > Sometimes a specific combination of
> >
> >        { GPT | MBR | dedicated } x { BIOS | UEFI }
> >
> > can cause problems. It _should_ not, though.
>
> You would think, wouldn't you? When I enabled UEFI, it promptly
> ignored everything except my NICs so that was out. Using Legacy BIOS
> it successfully built and allowed access to my system but only with
> MBR-format file system. No GPT worked, at least with <AUTO>
> partitioning.
>
> > > I did have a glitch that led to a recursive stack crash, though,
> > > forcing a reinstall. Updating the Handbook required me to build both
> > > graphviz and vala, but neither of them would work without already
> > > having a graphviz and vala on the system. Install with 'pkg install'
> > > worked.
> >
> > It would be very strange if there was a "cyclic dependency"
> > for those ports... however, using "pkg install" solves most
> > problems with ports. :-)
>
> As I say, /usr/ports/misc/freebsd-doc-en did me in. Corrupted the
> whole system. Anybody else want to play guinea pig?
>
> Steps to reproduce:
>
> 1) Update to 12-STABLE from 12.1R
> 2) Update the Handbook installation (without first installing
> dependencies graphics/graphviz and lang/vala)
>
> Reminded me of how much a 'learning experience' FreeBSD is... This
> port is such an amazing, layered set of dependencies it is starkly
> amazing that it can be made to work at all.
>
> Vala? WT[DELETED] is vala? I had to look it up! :)
>
> The flexibility of FreeBSD can be tiresome at times but that
> configurability will come to my rescue at some point.
>
> Game on, and again, thanks for all the advice! :D
>
> --
> Don Wilde
> ****************************************************
> * What is the Internet of Things but a system *
> * of systems including humans?                     *
> ****************************************************
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"
>


-- 

"Well," Brahmā said, "even after ten thousand explanations, a fool is no
wiser, but an intelligent person requires only two thousand five hundred."

- The Mahābhārata


More information about the freebsd-questions mailing list