Bug 235321 - freebsd-update gets confused when updating a jail, and jail is missing ${j}/boot and/or ${j}/rescue and/or others
Summary: freebsd-update gets confused when updating a jail, and jail is missing ${j}/b...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-30 13:56 UTC by Martin eto Misuth
Modified: 2019-04-09 14:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin eto Misuth 2019-01-30 13:56:23 UTC
When updating jail without boot and/or kernel eg. /boot and/or /boot/kernel freebsd-update blows up in two ways:

 +1 It becomes impossible to update jail with freebsd-update from within jail 
    because freebsd-update cannot find kernel files and learn kernel version 
    from them (unless jail is package/world builder that requires kernel files 
    to be present to build something, kernel files in jail make no sense, after
    all).

 +2 It breaks up jail update from host, when using freebsd-update basedir -b
    option.

This happens despite jail's ${jailpath}/etc/freebsd-update.conf containing only:

01 # Components of the base system which should be kept updated.
02 Components world

Eg. no source or kernel. Tangentially related bug #223470.

Case 1 is not easily solvable (without copying some kind of backup of kernel tre back and forth), but case 2 can be hacked around.

In case 2, during first install phase mtree fails with:

>>Installing updates...mtree: ${jailpath}/boot/kernel: No such file or directory
>>cd: ${jailpath}/boot/kernel: No such file or directory
>>ln: ${jailpath}/boot/loader: No such file or directory
>>ln: ${jailpath}/boot/loader.efi: No such file or directory
>>ln: ${jailpath}/boot/userboot.so: No such file or directory
>>chflags: ${jailpath}/boot/loader_lua.efi: No such file or directory
>>chflags: ${jailpath}/boot/loader_lua: No such file or directory
>>chflags: ${jailpath}/boot/userboot_lua.so: No such file or directory

This can be hacked around temporarily with:

sudo mkdir ${jailpath}/boot/kernel
sudo touch ${jailpath}/boot/loader
sudo touch ${jailpath}/boot/loader.efi
sudo touch ${jailpath}/boot/userboot.so
sudo touch ${jailpath}/boot/loader_lua.efi
sudo touch ${jailpath}/boot/loader_lua
sudo touch ${jailpath}/boot/userboot_lua.so

Which will make install move forward.

Further phases also have problems with ${jailpath}/rescue missing, but that won't make freebsd-update fail and thus prevent it from updating the jail.

I don't know how much life freebs-update has left, given packaged base, but even then it would be cool, if both freebs-update and pkg took into account slimmed down jails without directories like:

/boot
/boot/kernel
/rescue
/proc
/media
/mnt

Eg. "even if it doesn't exist, don't try to update it" (unless told explicitly somehow).