# Installing FreeBSD 12.3 from DVD1 (USB) without network



## smithi (Apr 16, 2022)

Hi Crew,

Firstly, I'm an old hand who ran FreeBSD servers from '98 to 2020, but fell ill in 2017, now living in a care home attached to a small rural hospital.  I'm short of breath, but still have a small collection of marbles 

My only net connection is mobile phone over very marginal rural links, and l need to be able to install Xorg, KDE, Firefox, docs, maybe other packages from the DVD1 image, booted from USB, on a refurb Thinkpad T430s.

Now, I realise I'm already in peril of breaking Forum rules on my very first post, i.e.

"Installing and upgrading the FreeBSD base system. Do not post questions about ports or packages here."

However I plead that this and the more detailed sticky post from October 2014 do not cover the situation: my problem is with a failure of operation of bsdinstall and bsdconfig on the release media, and I'm in need of advice from someone knowing that system to proceed, after I've spent days exploring that code without enlightenment.

The base system install worked fine, and that to slice 4 of a shrunk Win10 system with 32GB common FAT32 partition, so I can leave the results of my longterm project accessible to my Win- and Mac-using family, 

However the post-install packages menu (and the docs section during install) refused to work without net connection, despite the detail description under 'dvd1' at
https://www.freebsd.org/releases/12.3R/announce/

I know, already TL;DR and I'm just starting. I'd post to questions@ but really can't deal with so much mail until I've a mailer going.  So first off, is it ok if I proceed here?

TIA, Ian


----------



## grahamperrin@ (Apr 27, 2022)

Welcome to FreeBSD Forums.

I'll take a look at FreeBSD-12.3-RELEASE-amd64-dvd1.iso.

Did you not want 13.0-RELEASE (or a release candidate for 13.1)? There's a better feature set.


----------



## eternal_noob (Apr 27, 2022)

I agree with grahamperrin 
Just wait a few days until 13.1 is released. Should be around 9th of may.









						FreeBSD 13.1 Release Process
					

FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms.




					www.freebsd.org


----------



## grahamperrin@ (Apr 27, 2022)

smithi said:


> the post-install packages menu



Where's that? 

I see nothing package-related beyond this point:


----------



## smithi (May 1, 2022)

grahamperrin said:


> Where's that?
> 
> I see nothing package-related beyond this point:


Yeah, no, bsdconfig needs running after booting into the new system (and can be, anytime afterwards).

Might be able to run in Live CD mode, but there may be chroot(8) issues.

It's 100% sh(1) in 
	
	



```
/usr/sbin/bsdconfig
/usr/share/bsdconfig/
/usr/libexec/bsdconfig/
```
 and it's a monster.

More below, if I post it right, and thanks already for your interest.

cheers, Ian


----------



## smithi (May 1, 2022)

The below began 2022-04-20 21:38

Well, I've found the problem, or at least the one blocking the installation of dvd1 packages.

It's not been so easy.  The handbook section on installation doesn't mention needing to run bsdconfig for the post-install functions including packages and docs installation without any net connection; newcomers would be at a complete loss.

Searching forums dug up clues that obviously comes from experience gained elsewhere, such as where the /dist dir in the repository URL comes from; I still haven't found that in the very clever but (to me) very obscure bsdconfig sh(1) code.

(Edit: bsdinstall creates that)

Long story short: the packages directory on the 12.3R dvd1:


```
!ls -lrtR packages/ > ~/ls-lrt_dvd1_packages.txt

total 4
lrwxr-xr-x  1 root  wheel    16 Dec  2 17:30 freebsd:12:x86:64 -> FreeBSD:12:amd64
drwxr-xr-x  2 root  wheel  2048 Dec  2 17:34 repos
drwxr-xr-x  4 root  wheel  2048 Dec  2 17:34 FreeBSD:12:amd64

packages/repos:
total 0
-rw-r--r--  1 root  wheel  310 Dec  2 17:34 FreeBSD_install_cdrom.conf

packages/FreeBSD:12:amd64:
total 462
drwxr-xr-x  2 root  wheel  186368 Dec  2 17:33 All
drwxr-xr-x  2 root  wheel    2048 Dec  2 17:33 Latest
lrwxr-xr-x  1 root  wheel       8 Dec  2 17:33 meta.txz -> meta.pkg
-rw-r--r--  1 root  wheel     163 Dec  2 17:33 meta.conf
lrwxr-xr-x  1 root  wheel      15 Dec  2 17:33 packagesite.txz -> packagesite.pkg
-rw-r--r--  1 root  wheel  285172 Dec  2 17:33 packagesite.pkg
-rw-r--r--  1 root  wheel     236 Dec  2 17:33 meta.pkg

packages/FreeBSD:12:amd64/Latest:
total 0
lrwxr-xr-x  1 root  wheel  21 Dec  2 17:33 pkg.txz -> ../All/pkg-1.17.2.txz

(( NB the target file as *.txz ))

packages/FreeBSD:12:amd64/All:
total 2204897
-rw-r--r--  1 root  wheel        544 Jul 11  2017 docbook-1.5.pkg
-rw-r--r--  1 root  wheel      13244 Apr 16  2020 lua52-json-1.3.4_1.pkg
{...}
-rw-r--r--  1 root  wheel        596 Oct 16  2021 xorg-7.7_3.pkg
-rw-r--r--  1 root  wheel        604 Nov  1 00:19 freebsd-doc-all-20211029,1.pkg
-rw-r--r--  1 root  wheel    7649160 Nov  4 12:13 pkg-1.17.2.pkg
{...}

(( NB all ~1150 are *.pkg ))

!cat packages/repos/FreeBSD_install_cdrom.conf
#
# $FreeBSD: releng/12.3/release/scripts/FreeBSD_install_cdrom.conf 266554 2014-05-22 19:25:41Z gjb $
#
# The pkg(8) repository configuration file for the installation DVD.
#

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

FreeBSD: {
  enabled: no
}
```

Note that packages in All/ are all *.pkg, whereas in 11.3 I'd installed a fortnight earlier they were all *.txz, so the error on the link in Latest/ is understandable - although the failure to test it is a worry - not that I'm blaming anyone, just a bit disappointed when this is an advertised feature, as it were.

Ok, so that *couldn't* work, also explaining why bsdinstall was unable to install the docs; bsdconfig calls bsdinstall to do that, making a similar debugging /tmp/bsdinstall_log.

I should mention that the rest of the installation went well.

So, what to do?  cd9660 images being readonly, I tried copying its contents back to first /dist and later another directory on the installed system, fixing the broken link then trying the directory method for installation media.

That gets further, but winds up in another hole that I then couldn't make sense of without more study.

The above was mostly last updated on 2022/04/27.

I've since found more, but am head-high in a hole so maybe it's time to stop digging ... surely I'm not the only one who's tried to use the dvd1 image offline to install the mooted "graphical workstation up and running"?

Ah, the heady days of installs from 4 CD sets of FreeBSD 2, 3 and 4 with sysinstall (thanks, Trev!) including many useful packages ... now you'll see the same *intention* if you browse bsdconfig packages code in

```
/usr/share/bsdconfig/packages/*
```
 I don't know if it's ever worked, though I've seen noone say that it didn't.

musthavepkg.subr sets ASSUME_ALWAYS_YES=1 but pkg rejects 1 as a valid boolean; once changed to YES it works, surviving a pkg update (all seen in logs obtained by running

```
# bsdconfig -D mylog
```
 which log I filter with 
	
	



```
egrep -v "f_include|New var|loading incl" "$1" | less -S
```
 to trim the crap a bit.

Then later in index.subr, when it looks all set to go there's another failure to find the correct sqlite bits, at which point I'm too lost.

Some further notes, while I'm overdoing it:

If anyone can show that it's known broken on 12, 12.3 at least, and known fixed on 13, sure I'll try that - but given my perilous mobile connection, taking half day with AndFtp (which handles resuming broken downloads well), I won't just punt on that. 12-STABLE will outlive me anyway, and I need to USE FreeBSD, not debug bits anymore ... I have my own project to finish if I can.

I made sure that pkg wouldn't try using the online repo by the advised methods, and that works (or things get worse with mismatched pkg versions).

I needed to 'pkg delete -f pkg' to get further along sometimes.

More than enough is enough.

Thanks if anyone can assist.


----------



## smithi (Sep 26, 2022)

Ok, many moons later.  After no feedback apart from encouragement by Graham Perrin (thanks!) and a bout of poor health, I at last succeeded in installing Xorg, KDE and some other packages from the dvd1 set.

I have to do it again soon, not having allowed enough space; FreeBSD is BIG these days and I'm getting old.  I'm posting this now however, on hearing that code freeze for 12.4-RELEASE is soon .. hopefully not too soon.

Here's how:

In  ${dvd1}/packages/FreeBSD:12:amd64/Latest the single file was:


```
lrwxr-xr-x  1 root  wheel  21 Dec  2 17:33 pkg.txz -> ../All/pkg-1.17.2.txz
```

but the target file for (at least) 12.3-RELEASE needs to be ../All/pkg-1.17.2.pkg as all files in ../All are "*.pkg".

Since we can't update the readonly cd9660 filesystem, and since  ../../repos/FreeBSD_install_cdrom.conf points to URL: file:///dist/packages/${ABI}

so (where $dvd1 is memstick mountpoint e.g. /mnt) we must do either:

    a) if there is at least 2.1GiB free on the / filesystem

```
mkdir -p /dist
cp -pR ${dvd1}/packages /dist
```

    else b)

```
mkdir -p /another/directory
ln -s -Ff /another/directory /dist
cp -pR ${dvd1}/packages /dist
```

then 
	
	



```
cd /dist/packages/FreeBSD:12:amd64/Latest
ln -s -Ff ../All/pkg-1.17.2.pkg pkg.txz
```

then apply the three patches below to the installed /usr/share/bsdconfig/

Now you can run bsdconfig, select 'packages', select device 'directory' and provide '/dist' as the directory.

So here are the necessary patches, all in directory /usr/share/bsdconfig/packages

(ignore my '#% comments')


```
--- musthavepkg.subr.orig	2021-12-02 16:47:55.000000000 +1100
+++ musthavepkg.subr	2022-04-29 02:29:09.755308000 +1000
@@ -76,7 +76,7 @@
 	# Bootstrap pkg(8)
 	f_dialog_info "$msg_bootstrapping_pkg"
 	f_eval_catch -k PKG_ABI $funcname pkg \
-		"ASSUME_ALWAYS_YES=1 pkg -vv | awk '%s'" "$pkg_abi_awk" ||
+		"ASSUME_ALWAYS_YES=YES pkg -vv | awk '%s'" "$pkg_abi_awk" ||
 		f_die 1 "$msg_must_have_pkg_to_execute" "$pgm"
 
 	f_dprintf "PKG_ABI=[%s]" "$PKG_ABI"
```

Note: '1' is an illegal value for ASSUME_ALWAYS_YES, amounting to 'NO' and so causing index.subr to fail.



```
--- index.subr.orig	2021-12-02 16:47:55.000000000 +1100
+++ index.subr	2022-06-12 05:34:03.156918000 +1000
@@ -47,7 +47,8 @@
 #
 # Default path to pkg(8) repo-packagesite.sqlite database
 #
-SQLITE_REPO="/var/db/pkg/repo-FreeBSD.sqlite"
+#% not for dvd1: SQLITE_REPO="/var/db/pkg/repo-FreeBSD.sqlite"
+SQLITE_REPO="/var/db/pkg/repo-FreeBSD_install_cdrom.sqlite"
 
 #
 # Default path to on-disk cache INDEX file
```

Note: it seems a switch is needed, to select between using dvd packages or (later) online FreeBSD repositories?



```
--- packages.subr.orig	2021-12-02 16:47:55.000000000 +1100
+++ packages.subr	2022-06-12 05:29:37.622022000 +1000
@@ -54,7 +54,8 @@
 #
 # Package extensions to try
 #
-PACKAGE_EXTENSIONS=".txz .tbz .tbz2 .tgz"
+#% ng for 12.3-RELEASE: PACKAGE_EXTENSIONS=".txz .tbz .tbz2 .tgz"
+PACKAGE_EXTENSIONS=".pkg .txz .tbz .tbz2 .tgz"
 
 #
 # Variables used to track runtime states
```

Note: at 11.3-RELEASE packages were all called *.txz; I haven't seen 12.0, 12.1 or 12.2 dvds.

Maybe I'm the only one who cares, in the bandwidth-rich world anyway, but if that's the case we should stop offering the dvds or else fix them, which to me means also documenting how to use bsdconfig to provide a package browsing, selection and installation experience not seen since the early days of 4-cd sets.

cheers, Ian


----------

