DaemonForums  

Go Back   DaemonForums > NetBSD > NetBSD Installation and Upgrading

NetBSD Installation and Upgrading Have trouble getting NetBSD on your toaster?

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 20th October 2021
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,389
Default Howto - Dual booting NetBSD from most Linux systems

The following instructions resulted in a functional Crux Linux/NetBSD 9.2
x86_64 system.

Crux was installed first to the following 3 GPT partitions
1 - vfat and tagged as System EFI boot
2 - Linux - swap
3 - Linux - ext4

I roughly split my hard drive in half with the first 3 partitions occupying
the first half. I was also generous with the 1st partition and gave it
1024Mb.

The disk layout should work with Debian/Crux/Slackware. The Fedora/RHEL
derivatives use logical-volume/xfs for default partitioning and I was unable
to get logical-volume/xfs to boot NetBSD. It did work in Fedora/RHEL
derivatives with standard gpt partitions and an ext4 /.
1 - /boot/efi 600 MiB
2 - / as ext4 and roughly 1/2 disk size - (swap+ 1 Gib)
3 - swap

From the working Linux install, use the partition manager to add
4 - NetBSD ufs2 (aka ffsV2)
5 - NetBSD swap

Then boot into the NetBSD install image select the / install destination as
dk3 (NetBSD numbers dk's from 0). When prompted to add NetBSD swap select yes.

Drop out of the install to the shell and mount another usb thumb drive. vfat/msdos
partitions are /dev/sd*e where * is the number assigned to your thumb drive.
cp /usr/mdec/bootx64.efi to the thumb drive. If you are installing to one of the
quirky laptops that uses bootia32.efi, copy that too.
While in the shell, you can check your partitioning by running
Code:
dkctl wd0 listwedges
.
NetBSD lables these as dk* wedges and you can have more than swap and /.
I also chose to format the ffsV2 partition although the installer, when you return to it,
should also format it.
Code:
newfs -O 2 dk3
As a side note, OpenBSD makes obtaining the *.EFI easy, it's at the top of the
download list:

Quote:
[PARENTDIR] Parent Directory -
[ ] BOOTIA32.EFI 2021-09-30 13:01 124K
[ ] BOOTX64.EFI 2021-09-30 13:01 138K

[ ] BUILDINFO 2021-09-30 13:34 54
[ ] INSTALL.amd64 2021-09-30 13:33 43K
[ ] SHA256 2021-09-30 14:05 1.9K
[ ] SHA256.sig 2021-09-30 14:05 2.1K
[ ] base70.tgz 2021-09-30 13:26 303M
[ ] bsd 2021-09-30 13:25 21M
[ ] bsd.mp 2021-09-30 13:25 21M
[ ] bsd.rd 2021-09-30 13:34 4.0M
Be nice if NetBSD did the same.

"exit" the shell and return to the installer.

The installer has a quirk where it loops back to the initial installation step
when you select Install sets. The work around is to select
option c: Re-install sets ...

Re-install does not allow any post install configuration options or set
rc_configured=YES - your initial NetBSD boot will be in single user mode.

From single user mode mount the / partition(s):
Code:
mount -u /
and set the default terminal
Code:
TERM=vt220 ; export TERM
Edit /etc/rc.conf and change rc_configured to YES, set the hostname=
and setup your network.
Set root password
Code:
# passwd
Set user
Code:
useradd -m -G wheel -s /bin/sh "username"
Set user password
Code:
# passwd "username"
Set timezone
Code:
ln -sf /usr/share/zoneinfo/"Your Continent/Your zone" /etc/localtime
See the NetBSD guide for details and additional options
https://www.netbsd.org/docs/guide/en/
Provision /etc/rc.conf
Code:
rc_configured=YES
hostname=
"Network per NetBSD guide"
wscons=YES
My keyboard and mouse gave me fits without wscons enabled.

Boot back into linux and copy bootx64.efi (bootx32.efi) to /boot/efi/

Edit /etc/grub.d/40_custom

Code:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry 'NetBSD 9.2' {
         insmod part_gpt
         insmod search_fs_uuid
         insmod chain
         chainloader (hd0,gpt1)/bootx64.efi
}
Rebuild grub with
Code:
grub-mkconfig -o /boot/grub/grub.cfg
or with Debian systems
Code:
update-grub
For Fedora/RHEL
Code:
grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg
For Fedora/RHEL derivatives, adjust "rocky" in the output path for your variant.

Last edited by shep; 2 Weeks Ago at 12:30 PM. Reason: corrected useradd shell, spelling Added Fedora/RHEL
Reply With Quote
  #2   (View Single Post)  
Old 21st October 2021
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Bloaty McBloatFace
 
Join Date: Dec 2015
Location: London
Posts: 264
Default

Great guide, thanks for this!

A few points, if I may:
Quote:
Originally Posted by shep View Post
cp /usr/mdec/bootx64.efi to the drive. If you are installing to one of the
quirky laptops that uses bootx32.efi, copy that too.
I think the 32-bit loader is supposed to be called bootia32.efi (at least according to the UEFI standard).

Quote:
Originally Posted by shep View Post
Edit /etc/grub.d/40_custom

Code:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry 'NetBSD 9.2' {
         insmod part_gpt
         insmod search_fs_uuid
         insmod chain
         chainloader (hd0,gpt1)/bootx64.efi
}
If multiple drives are connected then the (hd0,gpt1) identifier might not be consistently correct.

I prefer to use this (replace $uuid with the actual UUID of the EFI system partition):
Code:
menuentry 'NetBSD' {
   search --fs-uuid --set=root $uuid
   chainloader /bootx64.efi
}
I've never needed to manually load GRUB modules. YMMV.

HTH.
__________________
Linux is for people who hate Windows. BSD is for people who love UNIX.
Reply With Quote
  #3   (View Single Post)  
Old 21st October 2021
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,389
Default

Quote:
Originally Posted by Head_on_a_Stick View Post

I think the 32-bit loader is supposed to be called bootia32.efi (at least according to the UEFI standard).
Corrected - Thanks

Quote:
Originally Posted by Head_on_a_Stick View Post

I've never needed to manually load GRUB modules. YMMV.
In part, I'm compulsive and want to make sure they get loaded. In the context of a guide, I also lean towards showing what is going on under the hood.

Last edited by shep; 23rd October 2021 at 04:21 PM.
Reply With Quote
  #4   (View Single Post)  
Old 22nd October 2021
Sensucht94's Avatar
Sensucht94 Sensucht94 is offline
Real Name: Paolo Vincenzo Olivo
Package Pilot
 
Join Date: Oct 2017
Location: Rome
Posts: 140
Default

Amazing guide, thank you for having taken the time to write this up.
__________________
“Mi casa tendrá dos piernas y mis sueños no tendrán fronteras„
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keeping Windows and dual booting acampbell OpenBSD Installation and Upgrading 7 4th May 2018 03:24 PM
Booting both UEFI and BIOS systems egency NetBSD Installation and Upgrading 22 21st April 2018 08:46 PM
dual booting OpenBSD and NetBSD daemonfowl NetBSD Installation and Upgrading 1 21st February 2012 01:06 PM
Dual Booting Questions sepuku OpenBSD Installation and Upgrading 3 8th September 2011 09:24 PM
dual booting OS X with Windows dipalina Other BSD and UNIX/UNIX-like 3 13th January 2010 08:46 PM


All times are GMT. The time now is 06:16 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick