Bug 234771 - freebsd-update(8) fails with opaque error attempting to upgrade from other than a release
Summary: freebsd-update(8) fails with opaque error attempting to upgrade from other th...
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Ed Maste
URL:
Keywords: needs-patch
Depends on:
Blocks:
 
Reported: 2019-01-09 00:52 UTC by Yuri Victorovich
Modified: 2019-01-17 21:39 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer 2019-01-09 00:52:27 UTC
Here is the log:

# freebsd-update -r 11.2-CURRENT upgrade
Fetching public key from update2.freebsd.org... failed.
Fetching public key from update1.freebsd.org... failed.
Fetching public key from update4.freebsd.org... failed.
No mirrors remaining, giving up.

# uname -a
FreeBSD hp 11.1-STABLE FreeBSD 11.1-STABLE #1 r326681M: Thu Dec  7 22:18:45 PST 2017     xx@hp:/usr/obj/usr/src/sys/GENERIC  amd64
Comment 1 Yuri Victorovich freebsd_committer 2019-01-09 00:53:09 UTC
The same failure occurs with
# freebsd-update -r 12.0-RELEASE upgrade
Comment 2 Xin LI freebsd_committer 2019-01-09 01:01:23 UTC
My understanding is that you can't upgrade from a -STABLE (or -CURRENT) with freebsd-update.  You should either upgrade by source, or update your system to a releng/ or release/ version via source, then use freebsd-update.

An alternative would be to extract base.txz/kernel.txz from a release iso and overwrite your system with the contents (except etc/ needs to be merged).
Comment 3 Yuri Victorovich freebsd_committer 2019-01-09 01:21:17 UTC
(In reply to Xin LI from comment #2)

Hmm, it should at least say that it can't upgrade from a -STABLE (or -CURRENT). The error above looks more like an internal failure.

Upgrading base in FreeBSD is for the most part rewriting files. It's also strange that it expects some specific versions that it can upgrade, and can't upgrade arbitrary versions.

Yuri
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2019-01-09 02:26:52 UTC
(In reply to Yuri Victorovich from comment #3)

One can also use --currently-running <release>, which is a new command line frontend for the previously environment-based variable (UNAME_r) override used to 'fake' the current versions. From man freebsd-update:

     --currently-running release
                    Do not detect the currently-running release; instead,
                    assume that the system is running the specified release.
                    This is most likely to be useful when upgrading jails.

This issue ("fetching key ... failed") is a frequently asked question/reported issue. It would be great to improve the error/messaging and user experience for these cases.
Comment 5 Ed Maste freebsd_committer 2019-01-09 20:39:55 UTC
Subject was "freebsd-update(8) fails on 11.1-STABLE: fetching public key fails", updated to reflect that this is a general issue.
Comment 6 Ed Maste freebsd_committer 2019-01-09 20:43:43 UTC
(In reply to Kubilay Kocak from comment #4)
>   --currently-running release
>                -- Update as if currently running this release

Further issues - this command does not indicate the required format of the "release" string or validate the provided release, so the same opaque error is emitted if the user specifies e.g. "11.2" instead of "11.2-RELEASE".
Comment 7 commit-hook freebsd_committer 2019-01-17 21:39:13 UTC
A commit references this bug:

Author: emaste
Date: Thu Jan 17 21:38:58 UTC 2019
New revision: 343122
URL: https://svnweb.freebsd.org/changeset/base/343122

Log:
  freebsd-update: Clarify unsupported release upgrade error message

  Notify users that upgrading from -CURRENT or -STABLE is unsupported by
  freebsd-update.

  Also ensure --currently-running provides a correctly formatted release
  (as done by -r).

  PR:		234771
  Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
  Reported by:	yuri
  Reviewed by:	bcran
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D18803

Changes:
  head/usr.sbin/freebsd-update/freebsd-update.sh