Solved Installing pkgs on alternative partition

How can install pkgs on da0p2 having booted from da0p1?

pkg() mentions

-c <chroot path>, --chroot <chroot path>
pkg will chroot in the <chroot path> environment.

-r <root directory>, --rootdir <root directory>
pkg will install all packages within the specified <root
directory>.

Which of these options should I try to install pkgs on the other partition?

Seeing an example of these options in use would be helpful.
 
Packages are not installed into partitions. They are installed into directories.

What's in da0p2 and why do you want to modify the behaviour of pkg(8) to install packages in a non-standard location?
 
Packages are not installed into partitions. They are installed into directories.

What's in da0p2 and why do you want to modify the behaviour of pkg(8) to install packages in a non-standard location?
After

mount /dev/da0p2 /mnt

is /mnt a partition or a directory?

I have booted from /da0p1 and intend to have a new FreeBSD installation on /da0p2. The base system has already been extracted, I just want to get various pkgs installed in that partition before booting up.
 
I found that this worked fine, (assuming booting from da0p1 and da0p2 has a pristine FreeBSD installation)

Code:
mount /dev/da0p2 /mnt
pkg -r /mnt install -y pkgx

...oops.... just noticed a typo...
 
Last edited:
I found that this worked fine, (assuming booting from da0p1 and da0p2 has a pristine FreeBSD installation)

Code:
mount /dev/da0p2 /mnt
pkg -r /media install -y pkgx

With the --rootdir option of pkg(8), in this context, you'll probably find that:
  • installation to da0p2 will be logged on da0p1
– not necessarily a problem, but bear this in mind if/when you need to view what's logged.
 
Back
Top