a package is unexpectedly uninstalled from plugin when patching jail

judgefred

Cadet
Joined
Aug 28, 2021
Messages
2
I have a mineos plugin with default settings.

In the jail, I have installed a few packages, for example zsh. Zsh isn't included by default (see the original mineos.json).

When updating the jail from the TrueNAS WebUI, zsh is uninstalled automatically.

Just now, the jail was updated from 12.2-RELEASE-p9 to 12.2-RELEASE-p10. Zsh disappeared and since it's my default shell in the jail, I needed to install it from "outside the jail" in order to have a working console:

> iocage exec thejailname pkg install zsh

That works. However, although I appreciate that there is a motive for automatically uninstalling "extra" packages, I wonder if I can do so my extra packages remain when I upgrade the jail?

Regards,
Fred
 

Tigersharke

BOfH in User's clothing
Administrator
Moderator
Joined
May 18, 2016
Messages
893
zsh is not vanilla or default which is why it would not be kept at update/upgrade. I believe that it should be possible to configure a FreeBSD jail as you see fit to do so, but I cannot describe how this is accomplished on TrueNAS. Surely others with much more experience with jails and TrueNAS can give a much more complete answer or point to tutorials or other documentation. I tried a google search for terms related to your query but I was unable to reach a satisfactory answer.
 

tprelog

Patron
Joined
Mar 2, 2016
Messages
297
This was briefly explained to me here.
So how iocage handles this is that it completely removes all packages from the container on update and then installs them new.

The easiest solution might be to submit a pull request and see if zsh can be added to the manifest. An extra package maybe acceptable. However, I've been asked on several occasions to add one-off packages to a particular plugin of my own. I quickly realized that I could not accommodate everyone's request, so to be fair I removed them all.

Instead, I came up with a workaround. It may not be the best solution but I've added a few lines to the plugins post_update.sh script.

Code:
. /etc/rc.subr && load_rc_config
: "${plugin_enable_pkglist:="NO"}"

install_pkglist() {
  ## If enabled, re-install packages from a pkglist, after a Plugin UPDATE
  ## Use `sysrc plugin_pkglist="/path/to/pkglist"` to set a pkglist
  ## Use `sysrc plugin_enable_pkglist=YES` to enable
  local pkgs ; pkgs=$(cat "${plugin_pkglist:-/dev/null}")
  echo -e "\nChecking for additional packages to install..."
  echo "${pkgs}" | xargs pkg install -y
}

checkyesno plugin_enable_pkglist && install_pkglist


This allows a user to create their own package list, which is just a text file containing one package name per line. When enabled, packages in this file gets reinstalled after an update (or upgrade)

IDK, maybe the maintainers of mineos will accept a pull request for something similar, if they are against just adding extra packages by request.


Of course, you could just drop the plugin and setup mineos in a regular jail - Then you have complete control
 
Top