Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 May 2020 16:29:28 -0700
From:      Michael Sierchio <kudzu@tenebras.com>
To:        dwilde1@gmail.com
Cc:        Polytropon <freebsd@edvax.de>, David Christensen <dpchrist@holgerdanske.com>,  FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: installation of 12.1R and 11.3R fails
Message-ID:  <CAHu1Y72BR=G2hxBRM8WbwprON5wRcK=uUtXBcvpFMs8k1jKSNw@mail.gmail.com>
In-Reply-To: <CAEC7391n9L85sPH-%2BKVgE6quFGM_bpUQS_Y7GvUgU1s2X0CR0Q@mail.gmail.com>
References:  <CAEC7393CTQGQ=zQ7fM63iSkpdvO8R0q-q6iLWUOx4=XaYanO1A@mail.gmail.com> <d760435a-af0d-8a84-b350-43311c8e321e@holgerdanske.com> <CAEC73938_0co-Sk3JzZz10gP%2BVg6%2Bk1jWj87KJbU3_XkLU2Spg@mail.gmail.com> <f4a4889a-1e7f-b951-3d67-35994cbcf2a6@holgerdanske.com> <CAEC7390f3b6iwwjV9Zpv5hsRbv=t81_WnFDbePwDG4V66A1z0w@mail.gmail.com> <CAEC7391PVoPo%2BgSD6a3zWYF4bGfyxpri-gRrQNGsASQMK8ZPDA@mail.gmail.com> <20200525110946.dd7440ac.freebsd@edvax.de> <CAEC7391n9L85sPH-%2BKVgE6quFGM_bpUQS_Y7GvUgU1s2X0CR0Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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=3D/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
DISK=3D"$1"

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

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

VARTMPSIZ=3D"1GB"

# you really want this to be unique for each disk

PFX=3D"XG55qAUrKwbPR"


###########################################################################=
#####
# Partition Disk
###########################################################################=
#####

# delete any partition data already on disk

offset=3D`diskinfo $DISK | awk '{ print $4 - 128 }'`
dd if=3D/dev/zero of=3D/dev/$DISK bs=3D${BOOTSIZ} count=3D1
dd if=3D/dev/zero of=3D/dev/$DISK seek=3D$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=3D"YES"
background_fsck=3D"YES"
background_fsck_delay=3D"60"

hostname=3D"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=3D"lo0 xn0 ena0 eth0 enc0"
ifconfig_xn0=3D"name eth0"
ifconfig_ena0=3D"name eth0"

ifconfig_eth0=3D"SYNCDHCP"   # do what you like here

sshd_enable=3D"YES"

syslogd_enable=3D"YES"
syslogd_flags=3D"-sCcc"

service_enable=3D"YES"

firewall_enable=3D"NO"
EOFF

On Mon, May 25, 2020 at 9:03 AM Donald Wilde <dwilde1@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@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe@freebsd.org"
>


--=20

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

- The Mah=C4=81bh=C4=81rata



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHu1Y72BR=G2hxBRM8WbwprON5wRcK=uUtXBcvpFMs8k1jKSNw>