Upgrade vom 22.10 (business) to 23.1 (community)

Started by moware, April 17, 2023, 04:15:57 PM

Previous topic - Next topic
I already have a running opnsense firewall, and I want to use a second device as cold standby. I bought one of the Deciso devices, and they arrive pre-installed with opnsense business (22.10). For compatibility reasons (I want both devices to have exactly the same configuration), I also want this device to run the community edition (just like the main device).

So far, I did the following:

  • Connect on the serial console.
  • Import the configuration from the main device via a USB stick with "8 Shell" and "opnsense-installer".
  • Now, when I try to upgrade the device with "12) Update from console", I get the following error message:


Fetching change log information, please wait... fetch: https://pkg.opnsense.org/FreeBSD:13:amd64/22.10/sets/changelog.txz: Not Found

This will automatically fetch all available updates and apply them.

Usage: pkg version [-IPR] [-hoqvU] [-l limchar] [-L limchar] [-Cegix pattern]
                    [-r reponame] [-O origin|-n pkgname] [index]
        pkg version -t <version1> <version2>
        pkg version -T <pkgname> <pattern>

For more information see 'pkg help version'.
This update requires a reboot.

Proceed with this action? [y/N]:


Indeed, https://pkg.opnsense.org/FreeBSD:13:amd64/22.10/sets/changelog.txz does not exist.

How do I tell my device (from the CLI) to upgrade to the latest community edition?

I'm not entirely sure we are looking at the full picture. The business edition 22.10 now has the 23.1 config of the other device? It should move over to opnsense package with a full transition but seeing it not do that has me wondering about what state config.xml might be in. Can you grep the following for me?

# grep "<type>" /conf/config.xml

If it says "opnsense-business" you need to edit /conf/config.xml and remove that whole line.


Cheers,
Franco

Quote from: franco on April 17, 2023, 06:04:12 PM
The business edition 22.10 now has the 23.1 config of the other device?

Yes, that should be the case. The CLI shows the network configuration from the main device, so I have to assume that the import was successful.

I'll check for <type> on Friday, when I'm back at the office, and report back. Thanks!

OK, here we go: config.xml did *not* have opnsense-business anywhere.

I tried the upgrade process again, and, this time, I was bold and chose "y" despite the scary sounding error message about pkg being called with the wrong parameters and... it worked. First it downgraded to 22.7.11 and repeating the upgrade process eventually upgraded it to 23.1.6. :-)




Naturally, I wanted to find out *why* that scary pkg message turned up, and the root cause seems to be the following code in scripts/firmware/reboot.sh:

if [ -n "${LQUERY}" -a -n "${RQUERY}" -a \
    "$(${PKG} version -t ${LQUERY} ${RQUERY})" = "<" ]; then
echo ${RQUERY%%_*}
fi


Apparently test's -a doesn't short-circuit, so, when RQUERY is empty (due to failing to fetch a server-side file?), pkg version still displays error output. My sh skills are a bit rusty, but I see a few ways to fix that:

  • Use short-circuiting tests instead: if [ -n "${LQUERY} ] && [ -n "${RQUERY}" ] && ...
  • Quote the parameters: Double quotes can be nested inside $(...), so just putting double quotes around ${LQUERY} and ${RQUERY} should work.
  • Suppress stderr output from pkg.

Best regards and thanks for all the great work on opnsense
Heinzi