How to know what "version" is ./etc and how to upgrade in jails?

The way we can simply upgrade thin jails as stated in handbook using jail managers (ezjail, bastille etc) leads to 'out of sync' archives in ./etc folder
I'm trying to update etc folder for some jails and it's being harder than I thought.


1- How to determine which freebsd version the current etc folder relates to?
I'm trying to check files inside /etc to discover what version it comes from. Couldn't find some consistent way of doing this. It seemed reasonable checking the COPYRIGHT file as it may contain a line with the version. But this isn't consistent it seems. 14.0-RELEASE COPYRIGHT doesn't contain this information.
Checking the file /etc/ssh/moduli file, it contains the moduli version and date, like "$OpenBSD: moduli,v 1.12 2015/05/22". With this information I was able to check that this module version maps to freebsd 10.2. It's not easy (as I need to download versions base.txz to compare).

There's any easier way to check this but in a consistent way?

2- How to properly update thin jails etc folder?
I'm using a script to compare actual etc state of the files and decide files to keep, files to delete, files/folder to copy over the old ones and new files/folders. But I need to point the actual "version" to this work effectively. That's why my first question.

I'm not used to do 'buildworld' for my hosts/jails. I was trying to understand 'etcupdate' command and if it can be used to update etc of my jails, but could not conclude if it's possible. Or if it's possible then I will need to download/prepare it as if going to 'installworld' and redirect the procedure to my jails?
What's the best approach to have etc upgraded in this case?

Thanks!
 
2- How to properly update thin jails etc folder?
I'm using a script to compare actual etc state of the files and decide files to keep, files to delete, files/folder to copy over the old ones and new files/folders. But I need to point the actual "version" to this work effectively. That's why my first question.

I'm not used to do 'buildworld' for my hosts/jails. I was trying to understand 'etcupdate' command and if it can be used to update etc of my jails, but could not conclude if it's possible. Or if it's possible then I will need to download/prepare it as if going to 'installworld' and redirect the procedure to my jails?
What's the best approach to have etc upgraded in this case?

Thanks!

I use etcupdate and that's ok. But, you need to fetch the sources along with the base (and have a soft link from each jail to those sources) as etcupdate uses them.

I just wrote a set of scripts of my own to manage thin jails. For upgrade, at the end of the process, I run for each jail j :
Code:
jexec $j etcupdate diff > /dev/null
jexec $j etcupdate > /dev/null
jexec $j etcupdate resolve

You may have to manually manage conflicts in the resolve mode.

I tested that from 12.4 to 13.2, 12.4 to 14.0 and 13.2 to 14.0, it's working well.
 
Thank you!
So good to know that's possible then. Thanks for the clues. I will start trying it.
 
Thanks balanga, I edited my previous post and corrected the spelling of that command.

I let here my set of scripts for the ones that are interested to look inside them or to use them. I even wrote an installer and a documentation. Please, consider this as an alpha version. That being said, I use it in my server since one week.

I know it's somewhat far from the FreeBSD philosophy (no pkg, no port). I don't mean to make a port because that code aims just to cover my own needs (and there are better softwares for managing jails). But, maybe, it can be of some use by the community here.

I have been obliged to add a .txt extension in order to be allowed to upload these files. Just remove this extension after download. kjail-doc has to be read first.

Edit: updated kjail-doc (corrected a horror in my English writing) and kjail.txz (all commands in jail now use exact path of the commands invoked).
 

Attachments

  • kinst.txt
    1.1 KB · Views: 40
  • kjail.txz.txt
    35 KB · Views: 8
  • kjail-doc.txt
    7.2 KB · Views: 13
Last edited:
Back
Top