Bug 248502 - Running multiple concurrent instances of freebsd-update(8) cause weird errors
Summary: Running multiple concurrent instances of freebsd-update(8) cause weird errors
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.1-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2020-08-06 16:42 UTC by Moviuro
Modified: 2022-12-15 00:46 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moviuro 2020-08-06 16:42:34 UTC
I tried using freebsd-update(8) at once to update both my system (on /) and my basejail. It did not end well.

  # freebsd-update fetch
  # freebsd-update -b /usr/jails/basejails/12.1_amd64 fetch # at the same time

This will cause lots of weird errors (but it didn't actually break anything, which is a relief):

* Checksum mismatch
* Missing files (patchlist, files.wanted, filelist)
* Patch count errors (was that 21 patches? or 278?)
* etc.

Expected behavior:

* Either fail "another instance of freebsd-update(8) is running in workdir: [...] Remove the lockfile (/path) if you're sure about it."
* Or gracefully handle multiple concurrent freebsd-update(8) by using a specific subdirectory in workdir (e.g. /var/db/freebsd-update/Lw== and L3Vzci9qYWlscy9iYXNlamFpbHMvMTIuMV9hbWQ2NA==, respectively - just a base64 encode of the basedir)

https://github.com/freebsd/freebsd/blob/6b0fd688d5fee8dfd4e0a28ae52741be85dc80ea/usr.sbin/freebsd-update/freebsd-update.sh#L137-L143

https://github.com/freebsd/freebsd/blob/6b0fd688d5fee8dfd4e0a28ae52741be85dc80ea/usr.sbin/freebsd-update/freebsd-update.sh#L1139-L1142