Solved Completing a botched pending update with some files missing

Is it possible to resume a pending update (after rebooting with new kernel) if freebsd-update install complains about missing files? That is, to re-download those files and continue with the second stage of update.

My machine almost went out of disk space after the first stage: before rebooting after freebsd-update -r 11.2-RELEASE upgrade, I also ran pkg upgrade and received an error message about only a few megabytes being left free. Clearing /var/cache/pkg/ did not give that much space, so I decided to salvage /var/db/freebsd-update/files/ too — for the first time, actually, as that was filled with tons of files left from previous updates and upgrades. As it was hard to screen all those countless files properly, I just applied a rule of thumb that removing files older than 180 days will be reasonable enough, since 11.2-RELEASE is only 45 days old. However, after the system rebooted and I tried to complete the upgrade, it complained about missing files:
Code:
# freebsd-update install
Installing updates...Update files missing -- this should never happen.
Re-run '/usr/sbin/freebsd-update fetch'.
What I have tried so far:
Code:
# freebsd-update -r 11.2-RELEASE upgrade
freebsd-update: Cannot upgrade from 11.2-RELEASE to itself

# freebsd-update fetch
You have a partially completed upgrade pending
Run '/usr/sbin/freebsd-update install' first.
Run '/usr/sbin/freebsd-update fetch -F' to proceed anyway.

# freebsd-update fetch -F
........
No updates needed to update system to 11.2-RELEASE-p0.

# freebsd-update install
No updates are available to install.
Run '/usr/sbin/freebsd-update fetch' first.

# freebsd-update rollback
Uninstalling updates...Update files missing -- this should never happen.
Re-run '/usr/sbin/freebsd-update fetch'.
I also tried altering /usr/sbin/freebsd-update program to not fail in install_verify() function when a file listed somewhere is missing from disk, but that did not matter already, as it appears that some flag files were already deleted by the program, so it thinks that no update is pending anymore. In other words, the system thinks it is perfectly up to date and does not want to upgrade, even by force; nor does it want to roll back due to missing (backup?) files. Is there any way to fix this, or do I have to wait until 12.0-RELEASE in hope that virtually all of the files will be susceptible to upgrade? Or may be I just have to wait until 11.2-RELEASE-p1? (I am afraid it will be quite the opposite: I won't be able to update to p1 due to having files not from p0.)

PS. Trying to find an already posted solution, I was surprised by not finding any. Am I the only person being so stupid to ruin the upgrade by improperly purging the cache?
 
If you know the exact version it was before you can try something like freebsd-update -r 11.2-RELEASE --currently-running 11.1-RELEASE-p10 upgrade.

Code:
     --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.
From freebsd-update(8)
 
freebsd-update -r 11.2-RELEASE --currently-running 11.1-RELEASE-p10 upgrade
That appeared to do the trick, although not without peculiarities:
  • only 2 patches and 5 files were downloaded again (out of 49'000 initially loaded);
  • notorious error: cannot open files/.gz: No such file or directory.
Nevertheless, upon completion the remaining files were updated and seem operational. Thanks for the tip!
 
Back
Top