How to upgrade a jail?

Status
Not open for further replies.

Alvin

Explorer
Joined
Aug 12, 2013
Messages
65
How can one upgrade a jail?
I'm not talking about the ports, packages or plugins in a jail, but about the base system in the jail itself.

There are 2 possible reasons for wanting this:
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
There's another thread on this, but basically: you don't.

Create a new jail and recreate your setup. If it's running fine for you, there's no reason to.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
And in that case you would need to recreate the jail to take advantage of the fix
 

Alvin

Explorer
Joined
Aug 12, 2013
Messages
65
I don't believe you. The standard jail template does not contain security fixes.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
This doesn't need to be about belief. I'm not stating it does contain specific fixes. If there's any thing that needs to be fixed in the template you can file a ticket at bugs.freenas.org
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I don't believe you. The standard jail template does not contain security fixes.

Umm... you don't have to believe us.

The CTO of iXsystems, Jordan Hubbard, is one of the founders of FreeBSD and he and I discussed this a few weeks ago. He said you shouldn't be updating jails unless you have a specific security patch to fix. In the cases where you do you aren't looking to "update the jail" but are looking to "update to solve that one security patch". Jails themselves really have no good feature to upgrade them, which is one of many reasons why jails are considered an advanced feature and should only be handled by those that have experience with jails.

All that being said, if you feel that you need to update your jails, the solution is to destroy the jail, make the new jail using the new template, and then install any fixes you deem necessary. But there is no one-stop tool where you run a program and it scans the jail and updates it accordingly.

https://forums.freenas.org/index.php?threads/update-jail-base-system.26610/
 

Alvin

Explorer
Joined
Aug 12, 2013
Messages
65
Ok, I've filed a ticket for the security fixes as bug 7639

I was hoping for something like ezjail-admin update or iocage update, but for warden. Reinstalling and reconfiguring is a lot of work. I do have 8 jails, and they are all from around 9.1-RELEASE.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Reinstalling and reconfiguring is a lot of work. I do have 8 jails, and they are all from around 9.1-RELEASE.

I'm in the same boat. But considering the comments came straight from one of the FreeBSD founders, I don't have high hopes of that ticket going anywhere. From what he told me there are no good options at all.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
It looks like Jordan has screened this ticket for FUTURE, but focused on the alert / upgrade mechanism without commenting on rolling new jail templates. It may be desirable to open a separate ticket that specifically requests new templates to address specific security concerns.
 
J

jkh

Guest
Let me just jump in here since there has been some discussion about this.

The most important fact first: Jails in FreeNAS are a hack. I get that they're useful to a lot of people, but the way they were implemented in FreeNAS (and this goes way back) was really quick-and-dirty and certainly wouldn't have been approved as a feature if I'd been on the approval chain back when they were first proposed. It's too late to put the genie back in the bottle, but if I had my way with the current implementation, it would simply be ripped out entirely until a properly architected solution could be put in its place. What's there is not architected at all, it's just a band-aid.

The second fact: Templates are created outside of the release engineering process using dark and arcane magic involving poultry sacrifice. This makes them hard to update, and even once they're updated, there is no way for existing jails to benefit from this due to the reasons outlined above. Every template is nothing more or less than a dumb tarball which is extracted for the first time into jails of that (template) type and then never referenced again. On the plus side, of course, we did make the template system extensible so if you want to create your own tarball of an up-to-date FreeBSD distribution and then use that on your box as a starting point for all future jails, you can certainly do so. It won't help you with updating, but you'll at least start from a better spot.

The third fact: Jails themselves require VIMAGE to be properly isolated from the host (FreeNAS) networking environment, and that comes with its own issues. There are only so many things you can do from a VIMAGE jail without panicking your box, because VIMAGE as a feature still is not finished (don't combine it with pf, for example - that's an instant panic). If you don't use VIMAGE, then any and all networking ports you use from the jail are now unavailable to the host machine because everything is sharing a common network stack, and jails can also easily collide with one another.

Basically, jails as a FreeBSD feature were never meant to be the light-weight virtualization solution people are making them out to be. They're just really thin security boundaries that come with a host of limitations. The most reasonable way forward for FreeNAS 10 is going to be to use bhyve (which may also require improvements to make it fully suitable for the purpose, but it's at least moving in the right direction) and create genuinely virtual environments, both FreeBSD and Linux, that can then be updated using whatever OS-dependent tools are best suited to the purpose (freebsd-update, apt-get, whatever).

This is also why I am predisposed to close most jail-related enhancement requests or put them in the "far distant future" bucket - there's just little point in investing additional time and resources into a mechanism that is always going to be a bit too fragile, and unsufficiently isolated, from the FreeNAS host system to meet the needs of what people really want to do. Processors are also steadily increasing in power, RAM and disk storage is going up, and it's already the case that even reasonably-powered machines can run multiple VM instances without undue overhead. Unlike jails, those VMs can also be properly paused, snapshotted, resumed, and so on, and they can run "foreign" operating systems with full fidelity, unlike Linux jails which were such a fragile hack that the FreeNAS project promptly removed them 2 releases after adding them as a bad idea (they failed to work for a lot more things than they did work for).

All that said, if there is an easy way of making templates "fresher" or otherwise making them a less voodoo-intensive part of the release engineering process, I'm willing to look into that since jails are going to be around, hated by their implementors or not, for awhile. I'm discussing that with the team.

Thanks.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Thanks for providing the clear and detailed answer. :)
 
J

jkh

Guest
One last comment, however: If the jail is a freebsd jail, you can always try the freebsd-update command (as well as any pertinent pkg update commands, should you have packages installed). This may or may not work, but is always worth a try! Take a snapshot first though. :)
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Hei, thanks a lot for responding so thoroughly. I appreciate the insight as well as the road forward. I've heard a lot of rumblings about bhyve that makes it sound rather nice. I look forward to recreating my jails as bhyve guests.

Is there any documentation on the template creation process (tarring, VIMAGE setup, etc.)? The more crazy of us might be interested in trying this out.
 
J

jkh

Guest
Is there any documentation on the template creation process (tarring, VIMAGE setup, etc.)? The more crazy of us might be interested in trying this out.
There's really nothing to document. It's just a tarball of everything you want in the jail, no more, no less. Seriously. Grab one of the existing templates and check it out.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
OK, the content about VIMAGE isolation made me think there are some cryptic invocations required to build one.

Thanks for the clarification.
 

Alvin

Explorer
Joined
Aug 12, 2013
Messages
65
bhyve sounds great, but I do believe jails have their place too. I'm running 8 jails now. I won't be running 8 full virtual machines on that same hardware. Things like not being able to run pf(4) on a jail that uses VIMAGE are just bugs waiting to be solved. They don't affect everyone.
It seems to me the only big problem is warden missing a way to run freebsd-update(8). Currently, this doesn't work from within the jail. I can't remember how PC-BSD does jail upgrades with it. I actually liked warden because the ZFS integration and the possibility to create .wdn files, but I wouldn't mind having to switch to another jail management system at some point.

A book on jail management is coming: "FreeBSD Mastery: Jails". It's by Michael Lucas, and thus bound to be fine literature on the subject.
 

airflow

Contributor
Joined
May 29, 2014
Messages
111
bhyve sounds great, but I do believe jails have their place too. I'm running 8 jails now. I won't be running 8 full virtual machines on that same hardware. Things like not being able to run pf(4) on a jail that uses VIMAGE are just bugs waiting to be solved. They don't affect everyone.
It seems to me the only big problem is warden missing a way to run freebsd-update(8). Currently, this doesn't work from within the jail. I can't remember how PC-BSD does jail upgrades with it. I actually liked warden because the ZFS integration and the possibility to create .wdn files, but I wouldn't mind having to switch to another jail management system at some point.

A book on jail management is coming: "FreeBSD Mastery: Jails". It's by Michael Lucas, and thus bound to be fine literature on the subject.

I second that. I basically wrote the same today in this thread. I think jails are light-weight, though powerful. This doesn't mean that I don't like the idea of real virtualization, too.
 
Status
Not open for further replies.
Top