Solved FreeBSD System Rescue - HowTo Use FreeBSD Memstick Image as Live Rescue System

Hi @ll, :cool:

I'm playing a bit around with the amd64 memstick image and I was wondering how can install a few packages after the installer came up and I entered the shell.

I already tried the following:

Code:
# dhclient em0
# mount -t tmpfs -o size=5G tmpfs /var/db/pkg
# mount -t tmpfs -o size=5G tmpfs /var/db/ports
# mount -t tmpfs -o size=5G tmpfs /var/cache
# mount -t tmpfs -o size=5G tmpfs /usr/local
# pkg bootstrap -f
The package management tool is not yes installed on your system.
Do you want to fetch and install it now ? [y/N]: y
Bootstrapping pkf from ...
Verifying signature ...
Installing pkg-1.18.4 ...
Extracting pkg-1.18.4: 100%
# pkg update
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100% 163 B 0.2 kB/s 00:01
Fetching pacakgesite.pkg: 100% 6MiB 2.2MB/s 00:03
pkg: Error extracting the archive: 'Write error'
pkg: No signature found
Unable to update repository FreeBSD
Error updating repositories!
#

Unfortunately I'm stuck at that point, what do I miss ?

Code:
# mount
/dev/ufs/FreeBSD_Install on / (ufs, local, noatime, read-only)
devfs on /dev (devfs)
tmpfs on /tmp (devfs, local)
tmpfs on /var (devfs, local)
tmpfs on /usr/local (devfs, local)
tmpfs on /var/db/pkg (devfs, local)
tmpfs on /var/cache (devfs, local)
tmpfs on /var/db/ports (devfs, local)
# df -hl
Filesystem                                 Size     Used     Avail    Capacity      Mounted on
/dev/ufs/FreeBSD_Install          1.1G     1.0G    -15M    102%           /
devfs                                         1.0K      1.0K       0B     100%           /dev
tmpfs                                         20M      8.0K     20M    0%               /tmp
tmpfs                                         32M     156K     32M    0%               /var
tmpfs                                         5.0G     60M      4.9G   1%               /usr/local
tmpfs                                         5.0G     372K     5.0G   0%              /var/db/pkg
tmpfs                                         5.0G     4.0K      5.0G   0%               /var/db/cache
tmpfs                                         5.0G     4.0K      5.0G   0%               /var/db/ports
 
Nope, unfortunately that is not the issue.

Code:
# mkdir /usr/local/scratch
# cp -a /usr/share/certs/* /usr/local/scratch/.
# mount -t tmpfs -o size=5G tmpfs /usr/share/certs
# cp -a /usr/local/scratch/* /usr/share/certs/.
# pkg update
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100% 163 B 0.2 kB/s 00:01
Fetching pacakgesite.pkg: 100% 6MiB 2.2MB/s 00:03
pkg: Error extracting the archive: 'Write error'
pkg: No signature found
Unable to update repository FreeBSD
Error updating repositories!

I'm still missing something.:(
 
/var is only 32MB, you probably need more space in /var/tmp, /tmp is also quite small (20MB). You can also have a look at pkg -d update to get more information.

Code:
    -d, --debug
             Show debug information.
 
Thx, that's exactly what I just achieved, is there a way to add this to the FreeBSD Handbook ?
 
SirDice, I just had a quick look at that link and it seems there is no obvious way to make that suggestion, so I guess I'll finish my business first and come back later.
 
I was wondering how can install a few packages after the installer came up
There is more than one way to do things. Besides what VladiBG suggested, since this is a USB installer image, the whole file system can be mounted read/write easily, without the need of tmpfs(5). The following method makes the package installation rather permanent.

Assuming the FreeBSD installer is da0 and the USB is larger in size than the installed FreeBSD memstick image:
Code:
  boot into single user mode
# gpart resize -i2 da0       # make room for packages
# service growfs onestart    # expand an existing UFS file system
# mount -uw /                # mount file system read/write
# vi /etc/fstab              # change root file system ro -> rw permanent
# exit                       # boot into multi user mode
  drop to "Live CD"
# dhclient <interface>
# pkg bootstrap
# pkg install <packages>
 
It's already done, increasing the size of /var/tmp and /tmp solved the issue.

Some background:

My upgrade from 12.3-p7 to 13.1-p2 failed yesterday, my BE for 12.3-p7 is also broken, kernel modules are unable to load anymore, so I figured as this is my production system I move forward and install 13.1-RELEASE from scratch.

Right now, I got 256 GB NVME storage, but I still got that Intel 2TB NVME which I salvaged from a different system a year ago and there is still some "damaged" zfs pool on it. So why not use that opportunity to replace the 256 GB with the 2TB NVME and "rescue" that pool in the process. ?

So it would actually be very handy to have the information in the handbook:
Rescue FreeBSD Data using FreeBSD memstick img
  1. Create USB thumbdrive and boot from it
  2. Prepare "Live System" to install pkg management systems
  3. Use pkg to install required packages, in my case: OpenZFS support, Fuse-NTFS, Veracrypt, rsync
  4. Rescue your data
  5. Move on with your business
I'm at stage 4 now, data is copying to my USB harddrive which is encrypted using Veracrypt.
 
T-Daemon, that sounds even more handy then what I actual did and seems so far the most simple way to approach that subject.
 
Summary - FreeBSD System Rescue - HowTo Use FreeBSD Memstick Image as Live Rescue:

1. Download FreeBSD 13.1-RELEASE memstick image, or whatever the latest RELEASE is.

2. Write it to a USB thumb drive, see handbook here.

3. Boot from USB thumb drive.

4. Select Shell and press Enter.

5. Select keyboard layout:
# kbdmap

6. Preparing for package manager installation
# mount -t tmpfs tmpfs /usr/local
# mkdir /usr/local/tmp
# mount -t tmpfs tmpfs /var/db/pkg
# mount -t tmpfs tmpfs /var/cache
# mount -t tmpfs tmpfs /boot/modules
# tar -cvf /usr/local/tmp/tmp.tar /tmp
# mount -t tmpfs tmpfs /tmp
# tar -C / -xvf /usr/local/tmp/tmp.tar


7. Get an ip address by using DHCP
# dhclient em0

8. Install FreeBSD package manager
# pkg bootstrap -f
# pkg update -f


9. Done. For convenience I like to use screen, so I get multiple virtual terminals, and can switch between them.
# pkg install screen

10. Launch screen
# /usr/local/bin/screen
 
Back
Top