How to deploy a FreeBSD installation to given partition?

Spartrekus

Aspiring Daemon

Thanks: 84
Messages: 508

#1
Hello,

I would like to deploy a fresh installation, from a current FreeBSD (notebook, ada0, partition 1, with networking / web) to external drive or usb memstick.

I have created a new ufs partition on the external drive.
I would like to deploy a sort of FreeBSD on it (sort of debootstrap).

Is there maybe a possible method?

thank you in advance greatly.
 
Last edited:

Deever

Member

Thanks: 3
Messages: 23

#3
bsdinstall doesn't do much more than creating the partition, fetching and extracting the (required) distributions, installing the boot loader and editing rc.conf. But instead of doing this manually, you probably better boot the FreeBSD installer and use that.
 
OP
OP
Spartrekus

Spartrekus

Aspiring Daemon

Thanks: 84
Messages: 508

#4
Have you tried to run bsdinstall from the FreeBSD installation?
I would like a sort of script to have the power into the hands.

During installation with bsdinstall of FreeBSD v.12 to a given partition, I did ps aux >> commands-done.lst
Sort of monitoring.

I try to find out the steps to make it in a sort of small script (in TCSH, little joke btw: not python ;)).

Because 12 and 13 are not working due to Entropy bug, I need to install it by hands.
Actually good exercise because I can bring BSD on mini own made pendrives.
Maybe a ToRam BSD usb stick would be useful for pc rescue.

My friend actually got issue(s) with his vista (MS$) and it could help a bit.
 

Beastie

Daemon

Thanks: 468
Messages: 2,174

#5
This is straightforward to do (as all things FreeBSD usually are) and we already have a howto for just that, courtesy of ShelLuser.

Regardless of the choices you make concerning the partitioning scheme or the file system, the basic principles will remain the same. Just be careful with those device nodes.
 
OP
OP
Spartrekus

Spartrekus

Aspiring Daemon

Thanks: 84
Messages: 508

#6
This is straightforward to do (as all things FreeBSD usually are) and we already have a howto for just that, courtesy of ShelLuser.

Regardless of the choices you make concerning the partitioning scheme or the file system, the basic principles will remain the same. Just be careful with those device nodes.
Thank you very much for the links, I am looking at it.

The process of installing FreeBSD is just uncompressing kernel and core system.

However, as you mention, the device nodes are more complex, and this needs more careful concern.
Maybe to set the passwd root to *null* would me easy the process.

edit:
how can you wget those files, without HTTPS (for an old wget without ssl)?

# cd /tmp/zfs
# tar xvJf /usr/freebsd-dist/base.txz
# tar xvJf /usr/freebsd-dist/kernel.txz
# tar xvJf /usr/freebsd-dist/lib32.txz

maybe they are inside?
https://download.freebsd.org/ftp/sn.../i386/Latest/FreeBSD-13.0-CURRENT-i386.raw.xz
 

Beastie

Daemon

Thanks: 468
Messages: 2,174

#7
The process of installing FreeBSD is just uncompressing kernel and core system.
  1. Creating partitions and newfs-ing them accordingly if need be;
  2. Installing the appropriate boot code chain if need be;
  3. Uncompressing the distribution archives (base.txz and kernel.txz, at the very least);
  4. Populating the target /etc/fstab.

However, as you mention, the device nodes are more complex, and this needs more careful concern.
Since you're installing to a USB-connected external disk, make sure your target is da-something, not ada-something and you'll be fine.

Maybe to set the passwd root to *null* would me easy the process.
You'll need a single log in/log out. Everything can be done in one session in under a few minutes.

how can you wget those files, without HTTPS (for an old wget without ssl)?
1. You don't have to use HTTPS
2. You can also use fetch -rR <URL>

Of course yes. All distribution archives are included in the ISOs/IMGs. But these also include an entire live system which is useless for you right now. You can get the distribution archives separately from here. It's especially convenient if you're low on bandwidth.
 

_martin

Aspiring Daemon

Thanks: 155
Messages: 765

#8
I think it was vermaden who first created howto here (or one of the first, as few others did too). His thread is here. You don't need to do ZFS stuff, but the core installation (manual debootstrap if you like) is shown there.
 
OP
OP
Spartrekus

Spartrekus

Aspiring Daemon

Thanks: 84
Messages: 508

#11
Have you tried to run bsdinstall from the FreeBSD installation?
it would look interesting but here some errors (1), which are given in following images/shots.
1.png


The main issue, while processing.... occurs.
error-manifest-2.png


But there is internet. however net is there.
3.png
 

Phishfry

Son of Beastie

Thanks: 1,129
Messages: 3,219

#12
I am curious how you make out.
Many times I buy embedded gear off ebay and like to boot up off FreeBSD on USB stick and examine the guts of the computer.
It would be real handy to be able to run the installer straight from my portable FreeBSD usb disk with full Xorg installed.
Maybe you need to setup a chroot and run the installer there... I dunno but I have been meaning to ask this very question.
Perhap a setup script to prep the new disk install before running bsdinstall including some set env settings.
 
OP
OP
Spartrekus

Spartrekus

Aspiring Daemon

Thanks: 84
Messages: 508

#14
As a workaround, I always place the *.txz archives and the MANIFEST manually into /usr/freebsd-dist/ on the running system, before running bsdinstall. It works this way.
<------------ what it means in practice?

I find no base.txz else than my own files, in the current installed 13 Freebsd
Code:
cd /
nconfig ld base.txz
./usr/home/spartrekus/12/cdrom-content/usr/freebsd-dist/base.txz
./target/usr/freebsd-dist/base.txz

thank you... I was working on one too.
maybe we can keep in touch with im / icq/msn/.... over centerim.
 

Phishfry

Son of Beastie

Thanks: 1,129
Messages: 3,219

#15
Well first think I would ensure that bsdinstall is installing the exact same version.
Example: Host install must be same as what you are trying to install. Using different versions sounds like trouble to me.
So download the tgz files and mainfest to /usr/freebsd-dist/ and run bsdinstall.
Problem Solved. Yes you need to create the directory.

amd64
https://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.0-RELEASE/
http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.2-RELEASE/
i386
https://ftp.freebsd.org/pub/FreeBSD/releases/i386/12.0-RELEASE/

You can also untar the ISO like the PR shows.
 
OP
OP
Spartrekus

Spartrekus

Aspiring Daemon

Thanks: 84
Messages: 508

#16
Thank you ... in progress, during installation bsdinstall, there is the following mounted devices.
seems ok

$ mount
/dev/ada0s2a on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
/dev/cd0 on /media/mncd (cd9660, local, read-only)
/dev/da0s1a on /mnt (ufs, local, journaled soft-updates)
devfs on /mnt/dev (devfs, local, multilabel)
/mnt/usr/freebsd-dist on /usr/freebsd-dist (nullfs, local, union)

EDIT:
nope not working, not booting.

1) So I took a new disk, and I copied files as shown in bug, with version 12.
2) bsdinstall and bring it on the external harddisk
3) I start it on the new modern notebook with entropy failure.
4) it hangs (version 12. 0 0 of freebsd) FreeBSD 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC i386
ittelsl

loadeking kernel...
/boot/kernel/kernl text==0x1484bc0 data 0x11bb78... bla
loadking conifugred moduels...
/boo/entropiy size=0x1000
-

nothing else and more, it is frozen.
 
OP
OP
Spartrekus

Spartrekus

Aspiring Daemon

Thanks: 84
Messages: 508

#17
BSDINSTALL + with files for /usr/freebsd-dist/ is highly recommended !

Herewith a possible deploy method on USB Memstick, with dd and wget, on the da0.
(no warranty).

Bash:
echo "** Expert use only"
echo "** Fast deployment, without security at all. no warranty "
echo "** Press Enter"
read abcd

echo Copying mbr with dd...
wget https://raw.githubusercontent.com/spartrekus/deploy-FreeBSD/master/mbr.bin -O mbr.bin
md5 mbr.bin
dd if=mbr.bin of=/dev/da0

gpart list da0

echo Execute newfs on da0s1a
newfs /dev/da0s1a

umount /target
mkdir /target
mount /dev/da0s1a  /target
cd /target


echo Fetching the kernel.txz file
wget "https://netix.dl.sourceforge.net/project/freebsd-12-r328126/r328126-freebsd-dist/usr/freebsd-dist/kernel.txz"    -O kernel.txz
echo Fetching the base.txz file
wget "https://netcologne.dl.sourceforge.net/project/freebsd-12-r328126/r328126-freebsd-dist/usr/freebsd-dist/base.txz"  -O base.txz


echo Uncompress kernel file
md5 kernel.txz
tar xpfz kernel.txz

echo Uncompress base file
md5 base.txz
tar xpfz base.txz

echo Create fstab
echo "/dev/da0s1a     /               ufs     rw      1       1" > /target/etc/fstab
echo "/dev/da0s1b     none            swap    sw      0       0" >> /target/etc/fstab


cd /tmp
umount /target
cd /tmp
echo "Mission Completed."
echo "End of Transmission."
 
Top