27.4.tar.gz not found ...

Started by Patrick M. Hausen, July 24, 2024, 09:33:39 PM

Previous topic - Next topic
root@freebsd:/home/vagrant # sh opnsense-bootstrap.sh -r 27.4 -y
This utility will attempt to turn this installation into the latest
OPNsense 27.4 release.  All packages will be deleted, the base
system and kernel will be replaced, and if all went well the system
will automatically reboot.

fetch: https://github.com/opnsense/core/archive/stable/27.4.tar.gz: Not Found


Did anything change in that regard?
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)


July 24, 2024, 09:35:45 PM #2 Last Edit: July 24, 2024, 09:37:23 PM by Patrick M. Hausen
*patsch* (german onomatopoeia for my hand hitting my forehead)  :)

Thanks.

But that was only the manual try to debug why my Vagrant file doesn't work and the Vagrant file got it correctly. I'll probably follow up with a different issue.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Yep ... that matches my Vagrant output:

root@freebsd:/home/vagrant # sh ./opnsense-bootstrap.sh -r 24.7 -y
This utility will attempt to turn this installation into the latest
OPNsense 24.7 release.  All packages will be deleted, the base
system and kernel will be replaced, and if all went well the system
will automatically reboot.

/tmp/opnsense-bootstrap/core.tar.gz                   7683 kB 8348 kBps    00s
pkg: 12 packages installed
bash-5.2.26_1: already unlocked


When executed with `sh -x` the final lines are:

+ pkg -N
pkg: 12 packages installed
+ pkg unlock -ya
bash-5.2.26_1: already unlocked
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)


July 24, 2024, 09:41:53 PM #5 Last Edit: July 24, 2024, 09:43:37 PM by Patrick M. Hausen
IMHO you should simply not `set -e`, so the script will continue to run in case an irrelevant command exists with a status != 0.

The patch you linked does not change opnsense-bootstrap.sh.in - that tool won't work on any system that already has any package installed ...
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

set -e is good practice. It found an upstream bug after all. :)

Besides if you want reliable firmware scripting there's no way around aborting on issues early rather than late.


Cheers,
Franco

Will you adapt opnsense-bootstrap.sh.in?
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

July 24, 2024, 10:00:28 PM #8 Last Edit: July 24, 2024, 10:03:35 PM by Patrick M. Hausen
I now patch opnsense-bootstrap.sh.in in my Vagrant file and it fails in line 205:
rm -f /var/db/pkg/*

Error message:
rm: /var/db/pkg/repos: is a directory

And well it is:
root@freebsd:/var/db # ls -lR pkg/
total 4
drwxr-xr-x  3 root wheel 512 Jun 15 14:40 repos

pkg/repos:
total 4
drwxr-xr-x  2 root wheel 512 Jun 15 14:40 FreeBSD

pkg/repos/FreeBSD:
total 62760
-rw-r--r--  1 root wheel 64212992 Jun 15 03:40 db
-rw-r--r--  1 root wheel        0 Jun 15 14:40 db-journal
-rw-r--r--  1 root wheel        2 Jun 15 14:40 groups.ucl
-rw-r--r--  1 root wheel        0 Jun 15 14:41 lock
-rw-r--r--  1 root wheel      172 Jun 15 14:40 meta


Going to patch that too for now, but the bootstrap script needs an overhaul if it is supposed to work on a FreeBSD 14.1 system that has any packages installed, already.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

The patch for pkg will be released sooner or later which fixes this just the way it broke it.

https://github.com/freebsd/pkg/issues/2278

I think the bigger issue is that this went unnoticed for a couple of months.

We're still at pkg 1.19 where it isn't broken.


Cheers,
Franco

Looks like the repos subdir was added since:

https://github.com/freebsd/freebsd-ports/commit/c923e0d7d

Can fix that, no problem.


Cheers,
Franco


That's from April ... I need to deploy OPNsense in Vagrant now.

*sigh*

Thanks for fixing the subdir problem. Why didn't you just nuke /var/db/pkg from orbit? Only way to be sure  ;) I mean rm -rf that thing?

I'll keep the code to remove the pkg unlock line in my Vagrant project. After all I know that my base boxes don't have any locked packages.

Kind regards,
Patrick
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

July 24, 2024, 10:14:30 PM #13 Last Edit: July 24, 2024, 10:18:07 PM by Patrick M. Hausen
Quote from: franco on July 24, 2024, 10:11:30 PM
https://github.com/opnsense/update/commit/3881cbf56

That won't remove anything in there starting with a dot. I try to avoid shell glob patterns in scripts like the proverbial plague. Why not rm -rf /var/db/pkg?

Plus your fix is not in the tagged 24.7 release.

I load bootstrap.sh.in from

https://raw.githubusercontent.com/opnsense/update/#{$opnsense_release}/src/bootstrap/opnsense-bootstrap.sh.in

Because I want to be able to set the FreeBSD base version (13.2/3 or 14.1) and the matching OPNsense version (24.1 or 24.7). Because of the explicit FreeBSD version checks that you have in place that prohibit just fetching from master.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

That's dangerous when pkg is a link for whatever reason or a mount point which can't be removed.

A bit of ancient cruft of /var MFS functionality... https://github.com/opnsense/core/commit/aa2bc6599e


Cheers,
Franco