NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Can't open /boot | biosboot via GPT on raidframe on GPT (NetBSD 9.0/amd64_RC2)



Hi there,

in the meantime I would like to clarify my fuzzy question somewhat. According to [1] the constellation GPT-on-Raidframe-on-GPT is supported, but according to [2] not for biosboot (but only with EFI). Have I understood that correctly?

If this is not the case and - in this case what is the correct use of the commands "gpt biosboot" and "installboot" so that all required parts are installed in the correct place?

Thank you & best regards
Matthias


[1] http://mail-index.netbsd.org/port-i386/2019/08/10/msg003805.html
[2] http://mail-index.netbsd.org/port-i386/2019/09/10/msg003823.html

On 11.02.20 00:23, Matthias Petermann wrote:
Hello everybody

I'm currently in doubt about everything and need advice from someone who is familiar with NetBSD's boot processes.

I am trying to set up a system with two hard drives as RAID 1. To do this, I create a GPT on both disks with a single partition of the type raid on each. I then mirror these partitions together into a RAID 1 using raidframe. I then create an embedded GPT with the netbsd partitions into the raidframe. the first partition carries the root filesystem from which I also want to boot. And this is what I don't succeed.

The crazy thing is, a while ago I managed a similar setup on the same computer (but with different hard drives). At that time I wrote an installer script and it doesn't seem to work anymore either. I now doubt whether I still made some manual adjustments to make it work.

So if someone has experience with the boot process, I would be very grateful if they could take a look at the script to see if it was correct at the critical points. I am thinking primarily of the places where installboot and gpt biosboot are called.

The error pattern looks like this: when the installation is complete, i get the text of the primary bootstap when booting from hard disk:

     NetBSD/x86 ffsv2 Primary Bootstrap
     Boot failed (errno  2): Can't open /boot

I attach the script directly to this email and remain with
kind regards

Matthias


#!/bin/sh

##### Cleanup pre-existing partitioning ###############################
gpt destroy -f raid0
raidctl -u raid0
dkctl wd0 delwedge dk0
dkctl wd1 delwedge dk1
gpt destroy -f wd0
gpt destroy -f wd1

##### Create GPT partition tables on disks ############################
gpt create wd0
gpt create wd1

gpt add -l sys0 -a 2m -t raid wd0
gpt add -l sys1 -a 2m -t raid wd1

##### Create RAID #####################################################
cat <<EOF >/tmp/raid0.conf
START array
1 2 0

START disks
/dev/dk0
absent

START layout
128 1 1 1

START queue
fifo 100
EOF

raidctl -C /tmp/raid0.conf raid0
raidctl -I 2020020900 raid0
raidctl -i raid0
raidctl -A softroot raid0

##### Create GPT partition tables on RAID #############################
gpt destroy -f raid0
gpt create raid0

gpt add -l root -a 2m -s 16G -t ffs  raid0
gpt add -l swap -a 2m -s 8G  -t swap raid0
gpt add -l usr  -a 2m -s 96G -t ffs  raid0
gpt add -l var  -a 2m -s 8G  -t ffs  raid0

##### Mark partitions bootable ########################################
gpt biosboot -A -i 1 wd0
gpt biosboot -A -i 1 wd1

gpt set -a biosboot,bootme -i 1 wd0
gpt set -a biosboot,bootme -i 1 wd1

##### Format partitions ###############################################
newfs -O2 NAME=root
newfs -O2 NAME=usr
newfs -O2 NAME=var

##### Create mountpoints and mount ####################################
mkdir -p /targetroot
mount -o log NAME=root /targetroot
mkdir -p /targetroot/usr
mount -o log NAME=usr /targetroot/usr
mkdir -p /targetroot/var
mount -o log NAME=var /targetroot/var

##### Create empty directories ########################################
mkdir -p /targetroot/kern
mkdir -p /targetroot/proc
mkdir -p /targetroot/dev/pts
mkdir -p /targetroot/cdrom
mkdir -p /targetroot/var/shm
mkdir -p /targetroot/etc

##### Create fstab ####################################################
cat <<EOF >/targetroot/etc/fstab
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
NAME=root       /               ffs     rw,log      1 1
NAME=swap       none            swap    sw,dp       0 0
NAME=usr        /usr            ffs     rw,log      1 2
NAME=var        /var            ffs     rw,log      1 2
tmpfs           /tmp            tmpfs   rw,-m=1777,-s=ram%25
kernfs          /kern           kernfs  rw
ptyfs           /dev/pts        ptyfs   rw
procfs          /proc           procfs  rw
/dev/cd0a       /cdrom          cd9660  ro,noauto
tmpfs           /var/shm        tmpfs   rw,-m1777,-sram%25
EOF

##### Install bootstrap ###############################################
cp /usr/mdec/boot /targetroot/boot
installboot -o console=pc,speed=9600 /dev/rdk0 /usr/mdec/bootxx_ffsv2

##### Extract distribution sets #######################################
cd /targetroot
progress -zf /release/amd64/binary/sets/kern-GENERIC.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/modules.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/base.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/etc.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/comp.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/games.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/man.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/misc.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/rescue.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/tests.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/text.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/xbase.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/xcomp.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/xetc.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/xfont.tar.xz tar --chroot -xpPf -
progress -zf /release/amd64/binary/sets/xserver.tar.xz tar --chroot -xpPf -

##### Make device nodes ###############################################
cd /targetroot/dev
/bin/sh MAKEDEV all

##### Set console keyboard layout #####################################
sed -an -e 'H;$!d;g' -e 's/\nencoding [a-zA-Z0-9.]*\n/\
encoding de.nodead\
/; t done' -e 's/\n#encoding [a-zA-Z0-9.]*\n/\
encoding de.nodead\
/; t done' -e 's/$/\
encoding de.nodead/' -e ':done' -e 'w /targetroot/etc/wscons.conf' /targetroot/etc/wscons.conf

##### Configure network ###############################################
/etc/rc.d/random_seed stop
ifconfig re0 media autoselect
dhcpcd -d -n re0
ifconfig lo0 127.0.0.1
cp /etc/resolv.conf /targetroot/etc/resolv.conf

cat <<EOF >>/targetroot/etc/ifconfig.re0
up
media autoselect
EOF

cat <<EOF >>/targetroot/etc/rc.conf
dhcpcd=YES
dhcpcd_flags="-qM re0"
EOF

##### Configure options ###############################################
cat <<EOF >>/targetroot/etc/rc.conf
sshd=YES
ntpd=YES
lvm=YES
wscons=YES
EOF

sed -an -e 's/^rc_configured=NO/rc_configured=YES/;H;$!d;g;w /targetroot/etc/rc.conf' /targetroot/etc/rc.conf

##### Configure ttys ##################################################
sed -an -e '/^ttyE[1-9]/s/off/on/;H;$!d;g;w /targetroot/etc/ttys' /targetroot/etc/ttys sed -an -e 's/vt100/wsvt25/g;H;$!d;g;w  /targetroot/etc/ttys' /targetroot/etc/ttys

##### /etc/hosts ######################################################
#cat > /targetroot/etc/hosts << EOF
#127.0.0.1   localhost localhost. ws1.local
#EOF

##### Add user #######################################################
chroot /targetroot /usr/sbin/useradd -m -G wheel -p '$sha1$PASSWORDREMOVED' user

##### Timezone ########################################################
ln -fs /usr/share/zoneinfo/Europe/Berlin /targetroot/etc/localtime




Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



Home | Main Index | Thread Index | Old Index