Summary: | freebsd-update should not create boot environment when it's not making changes to the boot environment | ||
---|---|---|---|
Product: | Base System | Reporter: | Xin LI <delphij> |
Component: | bin | Assignee: | Kyle Evans <kevans> |
Status: | Closed FIXED | ||
Severity: | Affects Only Me | CC: | allanjude, bugs, cperciva, emaste, freebsdbugs, grahamperrin, julien, kevans, pat |
Priority: | --- | Flags: | kevans:
mfc-stable13+
kevans: mfc-stable12+ |
Version: | CURRENT | ||
Hardware: | Any | ||
OS: | Any |
Description
Xin LI
2022-01-24 21:39:57 UTC
Also ran into this. We update jails with "freebsd-update -b" from the host and after updating a couple of jails from 12.2 to 12.3 we ended up with 2 BEs per jail + 2 for the host. Today I was upgrading my jails on a 12.3-RELEASE host with $> freebsd-update -j myjail -r 12.3-RELEASE upgrade and also noticed this: a boot environment is created for every upgraded jail. The logic behind "CreateBootEnv" should probably not work when using -j (and/or -b) (In reply to Xin LI from comment #0) Someone pointed out #2 last night in IRC, and I think that alone is EN worthy. I think we want something like: diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 1776115d0776..73b5003ee036 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -890,7 +890,12 @@ install_check_params () { install_create_be () { # Figure out if we're running in a jail and return if we are if [ `sysctl -n security.jail.jailed` = 1 ]; then - return 1 + return 1 + fi + # We may allow overriding the BASEDIR check at a later time via an + # argument, so separate this out. + if [ "$BASEDIR" != "/" ]; then + return 1 fi # Create a boot environment if enabled if [ ${BOOTENV} = yes ]; then (In reply to Kyle Evans from comment #3) Your patch looks good although I don't quite get the comment -- I think Xin Li's comment that the boot env is not going to be changed is clearer. (In reply to Ed Maste from comment #4) The point is that we don't know that it won't change the BE, e.g., if a jail root has been folded in intentionally. It may make sense to provide an override to create it anyways. A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e01e8f911b935eabcc35b4d121951e4e21042ee5 commit e01e8f911b935eabcc35b4d121951e4e21042ee5 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2022-02-12 21:36:24 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2022-02-12 21:36:24 +0000 freebsd-update: improve BE creation feature This addresses one nit and one bug in the BE creation feature of freebsd-update: The nit addressed is that it currently only names the BEs after the userland version, but the kernel version may be higher. After this change, we request both and pass them through sort(1) to choose the highest. This is especially helpful if a freebsd-update patch touched one but not the other. The bug fixed is that roots updated that are not located at '/', e.g., by using -b or -j, will no longer create boot environments automatically. There's a very low chance these will actually change the BE in any meaningful way, anyways. It could make sense in the future to allow an argument-override to create the BE anyways if someone comes up with a non-standard setup, e.g., where a jail is an important part of their boot environment on an appliance or some such setup. Half of this patch is submitted by delphij@, the other half kevans@. PR: 261446 MFC after: 3 days Reviewed by: delphij, emaste, Dave Fullard <dave_fullard.ca> Differential Revision: https://reviews.freebsd.org/D34257 usr.sbin/freebsd-update/freebsd-update.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=47c07814051a86fec9088a1f78d64fdada8abed6 commit 47c07814051a86fec9088a1f78d64fdada8abed6 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2022-02-12 21:36:24 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2022-02-15 06:09:50 +0000 freebsd-update: improve BE creation feature This addresses one nit and one bug in the BE creation feature of freebsd-update: The nit addressed is that it currently only names the BEs after the userland version, but the kernel version may be higher. After this change, we request both and pass them through sort(1) to choose the highest. This is especially helpful if a freebsd-update patch touched one but not the other. The bug fixed is that roots updated that are not located at '/', e.g., by using -b or -j, will no longer create boot environments automatically. There's a very low chance these will actually change the BE in any meaningful way, anyways. It could make sense in the future to allow an argument-override to create the BE anyways if someone comes up with a non-standard setup, e.g., where a jail is an important part of their boot environment on an appliance or some such setup. Half of this patch is submitted by delphij@, the other half kevans@. PR: 261446 (cherry picked from commit e01e8f911b935eabcc35b4d121951e4e21042ee5) usr.sbin/freebsd-update/freebsd-update.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=35d33d408213d20c63d60c0dfcdf77b2b36f5eee commit 35d33d408213d20c63d60c0dfcdf77b2b36f5eee Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2022-02-12 21:36:24 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2022-02-15 06:09:41 +0000 freebsd-update: improve BE creation feature This addresses one nit and one bug in the BE creation feature of freebsd-update: The nit addressed is that it currently only names the BEs after the userland version, but the kernel version may be higher. After this change, we request both and pass them through sort(1) to choose the highest. This is especially helpful if a freebsd-update patch touched one but not the other. The bug fixed is that roots updated that are not located at '/', e.g., by using -b or -j, will no longer create boot environments automatically. There's a very low chance these will actually change the BE in any meaningful way, anyways. It could make sense in the future to allow an argument-override to create the BE anyways if someone comes up with a non-standard setup, e.g., where a jail is an important part of their boot environment on an appliance or some such setup. Half of this patch is submitted by delphij@, the other half kevans@. PR: 261446 (cherry picked from commit e01e8f911b935eabcc35b4d121951e4e21042ee5) usr.sbin/freebsd-update/freebsd-update.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) A commit in branch releng/12.3 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f0df8a13116dca6ac42334d23430160fbeaf6c09 commit f0df8a13116dca6ac42334d23430160fbeaf6c09 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2022-02-12 21:36:24 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-03-15 17:46:50 +0000 freebsd-update: improve BE creation feature This addresses one nit and one bug in the BE creation feature of freebsd-update: The nit addressed is that it currently only names the BEs after the userland version, but the kernel version may be higher. After this change, we request both and pass them through sort(1) to choose the highest. This is especially helpful if a freebsd-update patch touched one but not the other. The bug fixed is that roots updated that are not located at '/', e.g., by using -b or -j, will no longer create boot environments automatically. There's a very low chance these will actually change the BE in any meaningful way, anyways. It could make sense in the future to allow an argument-override to create the BE anyways if someone comes up with a non-standard setup, e.g., where a jail is an important part of their boot environment on an appliance or some such setup. Half of this patch is submitted by delphij@, the other half kevans@. PR: 261446 (cherry picked from commit e01e8f911b935eabcc35b4d121951e4e21042ee5) (cherry picked from commit 35d33d408213d20c63d60c0dfcdf77b2b36f5eee) Approved by: so Security: FreeBSD-EN-22:09.freebsd-update usr.sbin/freebsd-update/freebsd-update.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) |