Solved Install packages from the installer DVD

EDIT (UTC 25-09-04 02:30) : jump straight to post 25 for the final solution,
unless you want to experience all the confusion I went through on the way. :)

Somehow the correct current instructions to do this have eluded me.
I found a few clues, which got me part of the way then hit a wall.
Apologies if I've missed something obvious, but I've spent too long searching already.

After dd'ing the latest (14.3 RELEASE amd64) DVD iso to a stick,
I used it to install FreeBSD on a small SSD in an old laptop.

After booting into the actual OS, the next step is
`mount -t cd9660 /dev/da1 /mnt`
which works OK.

After setting up `/usr/local/etc/pkg/repos/FreeBSD.conf`,
I saw, by trial and error, that `pkg bootstrap` tries to find
`/mnt/packages/FreeBSD:14:amd64/Latest/pkg.pkg`,
and my `/usr/local/etc/pkg/repos/FreeBSD.conf`
eventually looked like this:

```
FreeBSD: {
url: "file:///mnt/packages/FreeBSD:14:amd64",
enabled: yes
}
```

Now, when `pkg bootstrap` tries to open `/mnt/packages/FreeBSD:14:amd64/Latest/pkg.pkg`
it still says "no such file", even though it does exist.
It's a symlink to `/mnt/packages/FreeBSD:14:amd64/All/pkg-2.1.2.pkg`
which also exists, and has a size of ~12.5 MB.

Can't think what to try next.
So I'm hoping someone can point me to the official correct current instructions, ;)
or, if they don't exist, please give me some clues about how to continue from here.

Please don't say "forget the DVD, use the Internet". :)
I did it that way a couple of years ago,
and have read the arguments in favor of it.

(I didn't get around to using FreeBSD back then,
because poor health and lack of time got in the way,
so I'm still a noob with FreeBSD.)

I hope to use the DVD to install LxQt or XFCE,
and at some later stage I'll use the internet to update, of course.

Anyway, I downloaded theDVD, burned it,
got this far, and would like to finish the job this way.

There has to be a way to actually do it, right?
Otherwise they wouldn't provide a DVD installer ...
 
Last edited:
Nice TUI (bsdconfig), but it ends up with the same error:
tried to open `/mnt/packages/FreeBSD:14:amd64/Latest/pkg.pkg`
and "no such file or directory".

I also tried putting the whole file-path
"/mnt/packages/FreeBSD:14:amd64/Latest/pkg.pkg"
in "/usr/local/etc/pkg/repos/FreeBSD.conf",
but then `pkg bootstrap` adds "/Latest/pkg.pkg" after it,
and ends saying "Error: not a directory".
 
Have just now discovered this for pkg(7) :

pkg add [-fy] [-r reponame] pkg.txz
Install pkg(8) from a local package instead of fetching from remote.

So I'll try it soon.
 
Move somewhere your .../FreeBSD.conf, you don't need it at this point.
check (for info) contest of .../packages/FreeBSD:14:amd64/repos/FreeBSD_install_cdrom.conf

If bsdconfig(8) still doesn't work after FreeBSD.conf removal, try:

Code:
su -
mdconfig -t vnode -a -f FreeBSD-14.3-RELEASE-amd64-dvd1.iso -u 3 
mount_cd9660 /dev/md3 /media/ 
/media/usr/sbin/pkg add /media/packages/FreeBSD:14:amd64/Latest/pkg.txz

and then try bsdconfig(8) again.
 
At first, pkg is pkg(7).
When you're online, pkg bootstrap installs pkg(8),
but it doesn't work with offline pkg files.

When offline, with the DVD mounted at /mnt, this did it for me:
pkg add /mnt/packages/FreeBSD:14:amd64/All/pkg-2.1.2.pkg

pkg bootstrap now says that pkg is installed.

(Perhaps if I had first tried the symlink to it,
/mnt/packages/FreeBSD:14:amd64/Latest/pkg.pkg,
that might have worked too.)

So I think the problem is solved.
Will know for sure when I try to install more packages.
 
# env PACKAGESITE=file:///mnt/packages/FreeBSD:14:amd64/ pkg bootstrap -f

Assuming the DVD image is mounted on /mnt. Just tested this, and it works as expected.
 
Code:
/media/usr/sbin/pkg add /media/packages/FreeBSD:14:amd64/Latest/pkg.txz

Thanks, and sorry, I was writing when you replied.

Your command is essentially the same as what I did.
The command did the whole job, and there was no need to run bsdconfig.
(It seems like bsdconfig just runs the command anyway.)

One difference: there is no pkg.txz in the 14.3 installer DVD, it's pkg.tzst,
which is a symlink to pkg.pkg, which is a symlink to ../All/pkg-2.1.2.pkg
 
One difference: there is no pkg.txz in the 14.3 installer DVD, it's pkg.tzst,
I may be somewhat dyslectic but I'm pretty sure it's not *.tzst:
Code:
root@hosaka:~ # ll /mnt/packages/FreeBSD:14:amd64/Latest/
total 0
lrwxr-xr-x  1 root wheel 20 Jun  6 12:12 pkg.pkg@ -> ../All/pkg-2.1.2.pkg
lrwxr-xr-x  1 root wheel  7 Jun  6 12:12 pkg.txz@ -> pkg.pkg
root@hosaka:~ # ll /mnt/packages/FreeBSD:14:amd64/Latest/../All/pkg-2.1.2.pkg
-rw-r--r--  1 root wheel 12554108 May  1 03:05 /mnt/packages/FreeBSD:14:amd64/Latest/../All/pkg-2.1.2.pkg

There's a data.tzst and a packagesite.tzst, but pkg(7) doesn't care about those files, it's pkg(8) that uses these to get the catalog of available packages from this repository.
Code:
root@hosaka:~ # ll /mnt/packages/FreeBSD:14:amd64/
total 1484
drwxr-xr-x  2 root wheel 157696 Jun  6 12:12 All/
drwxr-xr-x  2 root wheel   2048 Jun  6 12:12 Latest/
-rw-r--r--  1 root wheel 300470 Jun  6 12:12 data.pkg
lrwxr-xr-x  1 root wheel      8 Jun  6 12:13 data.tzst@ -> data.pkg
-rw-r--r--  1 root wheel    179 Jun  6 12:12 meta
-rw-r--r--  1 root wheel    179 Jun  6 12:12 meta.conf
-rw-r--r--  1 root wheel 300439 Jun  6 12:12 packagesite.pkg
lrwxr-xr-x  1 root wheel     15 Jun  6 12:12 packagesite.tzst@ -> packagesite.pkg
 
One difference: there is no pkg.txz in the 14.3 installer DVD, it's pkg.tzst,
which is a symlink to pkg.pkg, which is a symlink to ../All/pkg-2.1.2.pkg
Strange, just downloaded FreeBSD-14.3-RELEASE-amd64-dvd1.iso and .../Latest/pkg.txz is definitely there?
 
Last edited:
Apologies.
I saw all the other .tzst files and either forgot or didn't notice that that one is .txz
Not used to working in a TTY that's not in a GUI, no copy/paste, not easy to scroll back... ;)
 
Not used to working in a TTY that's not in a GUI, no copy/paste, not easy to scroll back... ;)
Add moused_enable="YES" in /etc/rc.conf to have mouse in tty, left-click-drag for selection, click on the wheel for paste.
Hit ScrollLock key and then PgUp/PgDn for scrolling in vt buffer (ScrLck again to be able to type again). You can scroll way up, use mouse to select something, release ScrLck and click on the wheel to paste in the prompt line.

Using FreeBSD vt tty can be very comfy 😉
 
Last edited:
# env PACKAGESITE=file:///mnt/packages/FreeBSD:14:amd64/ pkg bootstrap -f

Assuming the DVD image is mounted on /mnt. Just tested this, and it works as expected.

That would be the easier way to do it. :)

pkg install lxqt produced errors, so I tried
env PACKAGESITE=file:///mnt/packages/FreeBSD:14:amd64/ pkg install lxqt
then there were errors about needing an SRV record for the repo FreeBSD-kmods.

I guess I need to add an SRV record in /usr/local/etc/pkg/repos/FreeBSD.conf,
similar to what's in /etc/pkg/FreeBSD.conf but pointing to local dirs.

Would it work if I make the /usr/local/... conf file exactly like /etc/pkg/FreeBSD.conf
with the only difference being the line: url: "file:///mnt/packages/FreeBSD:14:amd64" ?
(If I could copy paste i would just try it, but I'm a very slow typist, especially on the laptop.)

EDIT: could just cp the file then edit it, of course. Sorry, i'm a habitual GUI user.

EDIT2: I'm finding more clues and enjoying the process. Slow, but I'll get there. :)
 
On my linux desktop I extracted the dvd1.iso and examined its contents.
All packages are in one directory: "/packages/FreeBSD:14:amd64/All/".
Only 18 packages have 'kmod' in their filename, and each name starts with 'wifi-firmware-'.
So it looks like video driver kmods are not on the DVD.

If you don't need to install stuff that needs video kmods,
maybe you can install all you need from the DVD.

But if I need wifi kmods, I still wouldn't know what to put in
/usr/local/etc/pkg/repos/FreeBSD.conf in the "FreeBSD-kmods" section.
As the DVD has no separate location for kmods, it can't have a diffent url.

There's a conf on the DVD already, in /packages/repos/, with this content:

Code:
FreeBSD_install_cdrom: {
  url: "file:///dist/packages/${ABI}",
  mirror_type: "none",
  enabled: yes
}

FreeBSD: {
  enabled: no
}

so it looks like there's no need to mention kmods in the conf.

Maybe the error I got happened only because I didn't
properly disable "FreeBSD-kmods" in /etc/pkg/FreeBSD.conf

Probably I won't have time to investigate further, and I'll be
another one of the many who say "don't get the the DVD installer".

The announce pages say "dvd1 ... contains ... pre-built packages
aimed at getting a graphical workstation up and running",
but if there are no graphics kmods, is that really possible?

EDIT 250831-03h UTC :

Whichever way you look at it, there needs to be
more info in the announce pages and the handbook
to advise inexperienced newcomers about
whether the DVD can be used entirely off-line
(i.e. install packages off it without any internet connection)
and if so, exactly what we need to do to accomplish that.

At present it seems like the existence of dvd1.iso
is an invitation to the inexperienced to waste a few GB.

Haven't seen any hints yet that anyone actually uses it
for offline installation of gigabytes of packages.
And isn't that usage the only reason for it to exist? ...

For myself, I'll practice in virtualbox before trying bare metal again,
and will try the other extreme -- boot-only / mini-memstick ;)
 
EDIT (UTC 25-09-04 02:30) : jump to post 25 for the solution.

Found time to try the DVD again.

There are various ways to install packages off the DVD,
but the following seems to be the intended way,
as it uses a conf file provided on the DVD,
and then the usual plain pkg commands
pkg commands with -R can be used.

Use gpart show to find the device to mount;
it's likely to be /dev/da1 for a usb stick

Bash:
mkdir /dist
mount -t cd9660 /dev/cd0 /dist
mkdir -p /usr/local/etc/pkg/repos/
echo 'FreeBSD: { enabled: no }' > /usr/local/etc/pkg/repos/FreeBSD.conf
echo 'FreeBSD-kmods: { enabled: no }' [B]>>[/B] /usr/local/etc/pkg/repos/FreeBSD.conf
env PACKAGESITE='file:///dist/packages/${ABI}' pkg bootstrap -y
pkg -R /dist/packages/repos install xorg

EDIT 3, UTC 25-09-03 07:00 :

Be aware that this is intended to work totally offline.

Have struck-out un-necessary parts.
(strike-out didn't work in the code block, so I deleted parts there.)

It is essential to mount the DVD at /dist/, as this path is
hard-coded in /dist/packages/repos/FreeBSD_install_cdrom.conf.

More details in post 21.

Actually I edited the conf with ee :
ee /usr/local/etc/pkg/repos/FreeBSD_install_cdrom.conf
so the heredoc part of the code above is untested.

The rest of it was actually used, and worked well.

Not sure that it's necessary to add "FreeBSD-kmods" in the DVD conf,
as I didn't try to use pkg before adding it.
FreeBSD-kmods seems to be new in 14.3,
so I thought maybe they forgot to put it in the DVD conf.

EDIT 1: When you've finished installing from the DVD,
remove that conf file from /usr/local/etc/pkg/repos/.
pkg checks any conf file in that folder, no matter what its name is;
if there's nothing there, the default conf file in /etc/pkg/ takes effect.
Once you've updated to newer packages online, don't use the DVD again.


EDIT 2:

As SirDice disables FreeBSD-kmods,
the addition to the DVD conf probably is necessary.


The DVD package repo contains only the Big 2 DEs (KDE and GNOME),
no LXQt or XFCE, not even Openbox.

People talk about the weight of different DEs,
but Xorg alone uses 2 GB of disk space!
Well, that's on a freshly-installed FreeBSD,
so some of it is non-X dependencies you'd need anyway.
 
Last edited:
Add moused_enable="YES" in /etc/rc.conf to have mouse in tty, left-click-drag for selection, click on the wheel for paste.
Today I installed in a VM on my destop, and used the mouse that way.
Nice! It worked that way in ee as well.
The other day I was on an old laptop, and could not use that technique with the trackpad.
 
Would it work if I make the /usr/local/... conf file exactly like /etc/pkg/FreeBSD.conf
with the only difference being the line: url: "file:///mnt/packages/FreeBSD:14:amd64" ?
It's simpler to just disable that FreeBSD-kmods repository.

Create a /usr/local/etc/pkg/repos/FreeBSD.conf:
Code:
FreeBSD-kmods: {
  enabled: no
}

I have a custom package repository, so I've disabled both "FreeBSD" and "FreeBSD-kmods" repositories. Everything should come from my custom repository (which is built for specific versions). So mine contains:
Code:
FreeBSD: { 
  enabled: no
}
FreeBSD-kmods: {
  enabled: no
}
 
I tried
env PACKAGESITE=file:///mnt/packages/FreeBSD:14:amd64/ pkg install lxqt

PACKAGESITE is for bootstrap only; should have used REPOS_DIR instead,
but with the right conf file in the right place, I didn't need either of them.
(I was writing this before SirDice's last post, so it's not a reply to that.)
 
It's simpler to just disable that FreeBSD-kmods repository.

Create a /usr/local/etc/pkg/repos/FreeBSD.conf:
Code:
FreeBSD-kmods: {
  enabled: no
}

I have a custom package repository, so I've disabled both "FreeBSD" and "FreeBSD-kmods" repositories. Everything should come from my custom repository (which is built for specific versions). So mine contains:
Code:
FreeBSD: {
  enabled: no
}
FreeBSD-kmods: {
  enabled: no
}
{DVD}/packages/repos/FreeBSD_install_cdrom.conf seems to do exactly the same,
when copied to /usr/local/etc/pkg/repos/, except they forgot to include the bit that disables kmods.
 
EDIT (UTC 25-09-04 02:30) : jump straight to post 25 for the final solution.

Have done more testing and found a solution that's simpler.

No need to copy 'FreeBSD_install_cdrom.conf',
no need to edit it, no need to remove it later.

Just run pkg install with -R :
pkg -R /dist/packages/repos install xorg

EDIT: the above worked with pkg install,
but when I started afresh on a new VM,
it did not work for pkg bootstrap
The minimal commands that work will be in my next reply.

After I removed the file
/usr/local/etc/pkg/repos/FreeBSD_install_cdrom.conf,
the FreeBSD-kmods entry in /etc/pkg/FreeBSD.conf
was no longer explicitly de-activated anywhere,
but the command above did not raise any error.

"env REPOS_DIR=/dist/packages/repos" had the same effect,
but "-R /dist/packages/repos" is less typing.

The clue is in man pkg(8) :
-R <repo conf dir>, --repo-conf-dir <repo conf dir>
pkg will search the directory for per-repository configuration files.
This overrides any value of REPOS_DIR specified in the main configuration file.

(the main config file seems to be /usr/local/etc/pkg.conf)

So the file {DVD}/packages/repos/FreeBSD_install_cdrom.conf
is quite OK as it is, and all that's needed is info about how to use it.
 
Bash:
# I did all this as root

# find the device to mount
gpart show

mkdir /dist
mount -t cd9660 /dev/cd0 /dist

# add a conf file to cancel out the default one
mkdir -p /usr/local/etc/pkg/repos/
echo 'FreeBSD: { enabled: no }' > /usr/local/etc/pkg/repos/FreeBSD.conf
echo 'FreeBSD-kmods: { enabled: no }' >> /usr/local/etc/pkg/repos/FreeBSD.conf
# note double >> to append the second line

# now pkg(7) can load pkg(8)
env PACKAGESITE='file:///dist/packages/${ABI}' pkg bootstrap -y

# now pkg(8) can install whatever's on the DVD, e.g. xorg:
pkg -R /dist/packages/repos install xorg

# pkg -R does not need this blocking conf file;
# remove it now so that when the DVD is not mounted
# you can get packages online
rm -vi /usr/local/etc/pkg/repos/FreeBSD.conf

# be careful about mixing DVD packages with
# online packages, as the versions will diverge.

After i ran the line with PACKAGESITE, i realized that
the path has single quotes around it, but it worked.
(normally would need double quotes to let a ${var} expand.)

pkg(7) running bootstrap, even with PACKAGESITE set,
needs the normal /etc/pkg/FreeBSD.conf to be blocked;
/usr/local/etc/pkg/repos/FreeBSD.conf is there to block it;
that's its only purpose.

pkg(8) with "-R repodir" simply ignores /etc/pkg/FreeBSD.conf,
and so does not need any blocking conf file.
After a successful pkg bootstrap, you will never run pkg(7) again.
so it's then OK to delete /usr/local/etc/pkg/repos/FreeBSD.conf.

EDIT: i forgot about this for pkg(7): pkg add -y -r reponame pkg.txz
Maybe that could install pkg(8) without needing a blocking conf file?
Didn't realize til now that pkg.txz or pkg.pkg is actually pkg(8) waiting to be installed...
 
After i ran the line with PACKAGESITE, i realized that
the path has single quotes around it, but it worked.
(normally would need double quotes to let a ${var} expand.)
Yes, and no. You're correct that variables are expanded with double quotes but not single quotes. But in the case of ${ABI} in the PACKAGESITE URL you want to pass that variable verbatim to pkg(7)/pkg(8) and not have it interpreted by the shell. Because it's pkg(7)/pkg(8) that will expand it. The variable doesn't exist in the shell's environment.
 
There is a way to do it without making a conf file: use REPOS_DIR,
which overrides all conf files, and which both pkg(7) and pkg(8) can use.
(Previously I thought pkg(7) could use only PACKAGESITE.)

Bash:
mkdir /dist
mount -t cd9660 /dev/xxx /dist
env REPOS_DIR=/dist/packages/repos/ pkg bootstrap -y

Then, using rsync as an example of a package to install,
either of these command patterns can install a package from the DVD:
pkg -R /dist/packages/repos/ install rsync
or
env REPOS_DIR=/dist/packages/repos/ pkg install rsync

Later, to install from pkg.freebsd.org, simply don't use -R ... or env REPOS_DIR....
 

Summary (TL;DR)​

Run the newly installed OS, not the installer.
Insert the installer DVD, or USB stick thereof.
Log in as root, and run these commands.

Get the installer's /dev/ name (replace xxx below with it)
# gpart show

Mount the installer medium (MUST be on /dist/)
# mkdir /dist
# mount -t cd9660 /dev/xxx /dist

Upgrade pkg(7) to pkg(8)
# env REPOS_DIR=/dist/packages/repos/ pkg bootstrap -y

Alternative way to upgrade pkg(7) to pkg(8) (MUST use SINGLE quotes around the path)
# pkg add -y '/dist/packages/${ABI}/Latest/pkg.pkg'

Install a package from the DVD, as often as you want
# pkg -R /dist/packages/repos/ install pkgname

When you want to use the Internet for packages,
first upgrade/update everything, then use only the usual command:
# pkg install pkgname
After this, probably you should not use the DVD again, as package versions may not match.



Here is a fairly complete guide to what I now think is a correct way and the easiest way
to install packages off the FreeBSD dvd1.iso with absolutely no Internet connection at all.

When installing FreeBSD, choose or keep the option
that is something like "mouse pointer in VT",
so you can copy and paste in the terminal:
left-button drag to select; mid-button click to paste at the cursor.

The procedure​

After installing FreeBSD, reboot into the newly-installed OS.

Keep the DVD or USB-stick inserted, or re-insert it after rebooting.

Log in as root, then run these commands:

Bash:
gpart show

mkdir /dist
mount -t cd9660 /dev/xxx /dist

env REPOS_DIR=/dist/packages/repos/ pkg bootstrap -y

Notes on the commands:
They were tested and proven to work.
Line 1: note the device name of your DVD/USB-stick.
Line 2: the path "/dist" is hard-coded in a conf file on the DVD, so don't change it.
Line 3: replace xxx with the device name you got at line 1.
Line 4: this causes pkg(7)() to install pkg(8)().

To install DVD packages from here on:
pkg -R /dist/packages/repos/ install pkgname
(assuming the DVD is still mounted at /dist/)
See pkg(8)() for more ways to use pkg.

When you're ready to switch to installing from pkg.FreeBSD.org
connect to the Internet, do a complete update,
and use just pkg install pkgname from then on.

Be careful of mixing packages from a DVD with packages from pkg.FreeBSD.org,
as the versions at pkg.FreeBSD.org will become newer over time.

How we direct pkg to the right place​

pkg bootstrap and pkg install get the path to a repository from a conf file;
pkg add does not, and instead you must give it the path and exact name of a .pkg file.

The default conf file is /etc/pkg/FreeBSD.conf,
which gives a URL starting with pkg.FreeBSD.org/${ABI}.

To prevent pkg from using that Internet URL, we can
(1) put a blocking conf file in /usr/local/etc/pkg/repos/,
with settings that over-ride those in /etc/pkg/FreeBSD.conf, or
(2) simply use commands that tell pkg not to read default conf files.

Method 2 is less work, and there's more than one way to do it:
(a) put env REPOS_DIR=/path/to/repo/ in front of the pkg command
OR
(b) use the form pkg -R /path/to/repo/ install pkgname
OR
(c) use the form pkg add /path/to/repo/ABI/pkgname-version.pkg

pkg(7)() does not have the -R option, so we cannot use -R for bootstrap.

env REPOS_DIR=/path/to/repo/ and -R /path/to/repo/
seem to be equivalent. They tell pkg to ignore default conf files,
and instead use whatever conf files it finds in /path/to/repo/.

Our REPOS_DIR and -R commands for the DVD
point to /dist/packages/repos/, so pkg then reads
/dist/packages/repos/FreeBSD_install_cdrom.conf,
from which it gets the URL "/dist/packages/${ABI}".
So to use that conf file, we have to mount the DVD at /dist/.

pkg install cannot work without a conf file, so if you mount
the DVD somewhere else, you'll have to make your own conf files,
or use only pkg add, for which you need an exact versioned file name.

Note that env PACKAGESITE does not override conf files at all.

Examples of using those different methods:​

(A) ongoing DVD-package installs could instead be done with
env REPOS_DIR=/dist/packages/repos/ pkg install pkgname

(B) the one-time bootstrap could instead be done with
pkg add -y '/dist/packages/${ABI}/Latest/pkg.pkg'

With (B):

the path must be in single quotes
so that bash will pass ${ABI} unchanged to pkg,
as only pkg knows the value of ABI.

'pkg.pkg' is a symlink; after resolving that and ${ABI}, the real path is
/dist/packages/FreeBSD:14:amd64/All/pkg-2.1.2.pkg
on the FreeBSD 14.3 release DVD.
 
Last edited:
Back
Top