Solved Adding pkgs to the memstick img

JonaEngel

New Member

Reaction score: 2
Messages: 17

Hey there, I'd like to get a live system (meaning all just temporary and nothing installed to disk) on a memory stick.
But with pkgs.
In fact, I only need ntfs-3g support (the sysutils/fusefs-ntfs port) on an amd64 system.
Networking is available and the precompiled pkg could be loaded from the internet.

But pkg bootstrapping fails as the system is read-only.

How would you do it?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,685
Messages: 39,278

But pkg bootstrapping fails as the system is read-only.
Did you use the memstick or the ISO image to write to the memory stick? The ISO image is indeed read-only because it's meant to be written to read-only media.

Another solution is to just create your own image, it's not that difficult to do. Or you can have a look at mfsBSD and customize that to your liking.
 
OP
J

JonaEngel

New Member

Reaction score: 2
Messages: 17

Did you use the memstick or the ISO image to write to the memory stick? The ISO image is indeed read-only because it's meant to be written to read-only media.

Another solution is to just create your own image, it's not that difficult to do. Or you can have a look at mfsBSD and customize that to your liking.
I did use the memstick image on a usb pen drive.
 

T-Daemon

Daemon

Reaction score: 929
Messages: 1,816

NOTE: Deleted my previous posts #5, #7, #8 to improve and to consolidate in one post.

Steps to create a Live system from a official installer *-memstick.img image on USB:

Option 1: The easy and fast way:

Take two USB sticks, install from the FreeBSD installer USB stick on the target USB stick, add packages to the system.

Option 2: In case there is no second USB stick at hand:

1 - Increase the size of FreeBSD's file system partition on the installer USB to allow the installation of addition files. Assuming the USB sticks capacity is larger than the *-memstick.img copied over, boot into single user mode, execute:
Code:
# gpart resize -i 2 da0
# gpart resize -i 1 da0s2
# service growfs onestart
Eventually adapt da0.

2 - Mount file system read/write
Code:
# mount -urw /
3 - To set the systems file system from read only to read/write edit the mount option in /etc/fstab
Code:
/dev/ufs/FreeBSD_Install   /    ufs   rw,noatime    1   1
4 - Continue boot into multi user mode
Code:
# exit
5 - At the FreeBSD Installer "Welcome" dialog drop to "Shell"
6 - Configure a DNS name server
Code:
# echo "nameserver 8.8.8.8" > /tmp/bsdinstall_etc/resolv.conf
7 - Acquire IP address
Code:
# dhclient em0
(replace em0 with what interface name the network card was assigned to)

7 - Bootstrap ports-mgmt/pkg
Code:
# pkg
8 - Install sysutils/fusefs-ntfs
Code:
# pkg install sysutils/fusefs-ntfs
9 - Optional install additional packages
10 - Optional disable FreeBSD installer dialog
Code:
# mv /etc/rc.local /etc/rc.local.0
11 - Edit /etc/rc.conf
Code:
hostname=LiveSystem.stick
ifconfig_DEFAULT="DHCP"
keymap="uk"
kld_list="fusefs"
Add additional needed kernel modules or services, i.e. sshd, zfs, change keymap, etc.

12 - Optional change file system back to read only in /etc/fstab

Live system ready. Login name is "root" if /etc/rc.local is disabled, no password. Optional set "root" password, add users.

Option 3+: One of the other suggested methods in the thread.
 

roccobaroccoSC

Aspiring Daemon

Reaction score: 225
Messages: 749

Hey there, I'd like to get a live system (meaning all just temporary and nothing installed to disk) on a memory stick.
But with pkgs.
In fact, I only need ntfs-3g support (the sysutils/fusefs-ntfs port) on an amd64 system.
Networking is available and the precompiled pkg could be loaded from the internet.

But pkg bootstrapping fails as the system is read-only.

How would you do it?
What is different when installing FreeBSD on a USB drive? As far as I know, the installer does not care what kind of storage you put your boot partition and system root on.

You don't need to create a live media or an installer, right? Then simply install FreeBSD on the USB drive and boot from it.
In FreeBSD installer and select the USB drive as your target device. Then do automatic partitioning and when you boot you can install whatever packages you need.
I have used this with a NAS, it works exactly as if it were installed on a HDD.
 

grahamperrin

Son of Beastie

Reaction score: 801
Messages: 2,608

… a live system (meaning all just temporary and nothing installed to disk) … with pkgs. …

Airyx™ might be of future interest. A live desktop environment that can be OK with 1 GB memory (probably less). Unfortunately not yet using a FreeBSD repo for packages; I'm in discussion.

In the meantime we have GhostBSD, for example (not the most recent release):

1633676438114.png

The live ISO requires at least 4 GB to boot, which is fair enough for the target audience.
 
OP
J

JonaEngel

New Member

Reaction score: 2
Messages: 17

NOTE: Deleted my previous posts #5, #7, #8 to improve and to consolidate in one post.

Steps to create a Live system from a official installer *-memstick.img image on USB:

Option 1: The easy and fast way:

Take two USB sticks, install from the FreeBSD installer USB stick on the target USB stick, add packages to the system.

Option 2: In case there is no second USB stick at hand:

1 - Increase the size of FreeBSD's file system partition on the installer USB to allow the installation of addition files. Assuming the USB sticks capacity is larger than the *-memstick.img copied over, boot into single user mode, execute:
Code:
# gpart resize -i 2 da0
# gpart resize -i 1 da0s2
# service growfs onestart
Eventually adapt da0.

2 - Mount file system read/write
Code:
# mount -urw /
3 - To set the systems file system from read only to read/write edit the mount option in /etc/fstab
Code:
/dev/ufs/FreeBSD_Install   /    ufs   rw,noatime    1   1
4 - Continue boot into multi user mode
Code:
# exit
5 - At the FreeBSD Installer "Welcome" dialog drop to "Shell"
6 - Configure a DNS name server
Code:
# echo "nameserver 8.8.8.8" > /tmp/bsdinstall_etc/resolv.conf
7 - Acquire IP address
Code:
# dhclient em0
(replace em0 with what interface name the network card was assigned to)

7 - Bootstrap ports-mgmt/pkg
Code:
# pkg
8 - Install sysutils/fusefs-ntfs
Code:
# pkg install sysutils/fusefs-ntfs
9 - Optional install additional packages
10 - Optional disable FreeBSD installer dialog
Code:
# mv /etc/rc.local /etc/rc.local.0
11 - Edit /etc/rc.conf
Code:
hostname=LiveSystem.stick
ifconfig_DEFAULT="DHCP"
keymap="uk"
kld_list="fusefs"
Add additional needed kernel modules or services, i.e. sshd, zfs, change keymap, etc.

12 - Optional change file system back to read only in /etc/fstab

Live system ready. Login name is "root" if /etc/rc.local is disabled, no password. Optional set "root" password, add users.

Option 3+: One of the other suggested methods in the thread.
Thanks, that was exactly what I was looking for.
 
Top