Comments (7)
Interesting. Do I understand correctly that the wrong ip in the first case - IP of image? Can you show
cbsd imgpart mode=extract part=rcconf jname=/root/nginx.img |grep ^ip
from cbsd.
BTW, (this is not solution of your problem, just FYI). If you use ZFS-based system and prepare image as original for the newly created jail, you may be interested to use zfs_snapsrc params in jcreate / jconstruct-tui. , because, in contrast to jimport (with full copyinf of data) this operation is momentary: for example lets nginxsrc jail become to origin for any other new jail:
% cbsd jset ip4_addr=0 jname=nginxsrc ; (don't use any IP)
% cbsd jset astart=0 jname=nginxsrc ; ( no autostart )
% cbsd jsnapshot jname=nginxsrc mode=create snapname=20160419 ; ( create new snapshot with random name, e.g form of date as version )
% cbsd jsnapshot jname=nginxsrc mode=list
JNAME SNAPNAME CREATION USED
nginxsrc 20160419 2016-04-19__01:25 0
% zfs list -t snapshot (we need full ZFS snapshot name for zfs_snapsrc params):
NAME USED AVAIL REFER MOUNTPOINT
**zmirror/jails/nginxsrc@20160419** 0 - 64,3M -
Now all what you want - create template of new jail for jcreate with follow dynamic variable:
- ip4_addr (new ip address)
- zfs_snapsrc ( source snapshot - maybe you will update periodically source jail with fresh software )
- jname
- host_hostname
- path
- mount_fstab
- data
- rcconf
- ver and arch according to your system.
So, sample jcreate.conf ( e.g: /tmp/test1.jconf ):
# DO NOT EDIT THIS FILE. PLEASE USE INSTEAD:
# cbsd jconfig jname=nginx2
jname="nginx2";
path="/usr/jails/jails/nginx2";
host_hostname="nginx2.my.domain";
ip4_addr="172.23.0.5";
mount_devfs="1";
allow_mount="1";
allow_devfs="1";
allow_nullfs="1";
mount_fstab="/usr/jails/jails-fstab/fstab.nginx2";
arch="amd64";
mkhostsfile="1";
devfs_ruleset="4";
ver="11";
basename="";
baserw="0";
mount_src="0";
mount_obj="0";
mount_kernel="0";
mount_ports="1";
astart="1";
data="/usr/jails/jails-data/nginx2-data";
vnet="0";
applytpl="1";
mdsize="0";
rcconf="/usr/jails/jails-rcconf/rc.conf_nginx2";
floatresolv="1";
zfs_snapsrc="zmirror/jails/nginxsrc@20160419";
exec_poststart="0";
exec_poststop="";
exec_prestart="0";
exec_prestop="0";
exec_master_poststart="0";
exec_master_poststop="0";
exec_master_prestart="0";
exec_master_prestop="0";
pkg_bootstrap="1";
interface="auto"
jailskeldir="/usr/jails/share/FreeBSD-jail-skel"
jail_profile="default"
exec_start="/bin/sh /etc/rc"
exec_stop="/bin/sh /etc/rc.shutdown"
emulator="jail"
Use jcreate to create new jail via ZFS clone:
% cbsd jcreate jconf=/tmp/jail1.jconf
PS: if you use alternative workdir, some path need for correct. The best way to get template for jcreate - use cbsd jconstruct-tui, enter zfs_snapsrc params and answer 'no' on "Do you want to create jail immediately?" question - you get jconf sample for jcreate command.
PS2: keep in mind that the original snapshot can not be removed if there is created on the basis of its container.
from cbsd.
Hey,
Ok, i can confirm now, that this IP is original IP it had before exporting. I'm hitting this issue again today. Would it be possible to remove IP on the fly while exporting? With some additional export param perhaps? I understand that sometimes keeping the same IP is required. Or hmm, on import when newip was passed it should force it?
Those ZFS features are really cool, didn't knew about them, thank You, but above problem remains, because my current use case involves .img files which are transported thru CDN.
from cbsd.
Looks like it was logical error, sets of newip must be on this place: https://github.com/olevole/cbsd/blob/master/jailctl/jimport#L152
Can you test this? Just get last modification from jimport and apply it:
% fetch --no-verify-peer -o /usr/local/cbsd/jailctl/jimport https://raw.githubusercontent.com/olevole/cbsd/master/jailctl/jimport
% chmod +x /usr/local/cbsd/jailctl/jimport
% cbsd initenv
from cbsd.
For now, it seems it works fine. But i'm hitting another issue, hehe. How can i change jail hostname while importing from image? Like, i'm using some generic images (with nginx or php setup), and it seems the only way to do that now is to jimport + jrename (old=jail1 new=jail1_tmp + new hostname) + jrename (old=jail1_tmp new=jail1 - no way to change hostname without changing name, as it seems).
Btw. i think by default it should change jail FQDN to newJailName.current_host_hostname.
from cbsd.
Agreed with you about FQDN. I've rename newjname and newip to more relevant new_jname and new_ip4_addr and add optional new_host_hostname params:
Most likely this is what you need within this issue ;)
% cbsd jimport jname=/usr/jails/export/nginxsrc.img new_ip4_addr=0 new_jname=temp
IP sets to: 0
Hostname sets to: temp.my.domain
% cbsd jls display=jname,ip4_addr,host_hostname
JNAME IP4_ADDR HOST_HOSTNAME
..
temp 0 temp.my.domain
from cbsd.
feedback timeout, close
from cbsd.
Related Issues (20)
- Show all interfaces of VM HOT 2
- Rebuilding Sqlite DB Config File for Bhyve Jails. HOT 4
- byve-dsk: increasing disk size succeeded at failing HOT 2
- VNET and Access to the external network HOT 2
- Certbot requests to obtain or renew an SSL certificate fail if cbsdd is running. HOT 3
- jexec jname='*' висит HOT 5
- Jail Rebuilding Sqlite DB Config File
- Jail kernel "broken" after version bump HOT 3
- bhyve instance fails to start if hda audio is enabled HOT 1
- User-directories missing in jail after upgrade FreeBSD 13.1 to 13.2 HOT 3
- Also No Issue, Thanks, But.... HOT 1
- Can't start VM after restart HOT 1
- CBSD 13.2.6 does not create mount-point for /usr/home HOT 1
- Been Running cbsd for about 3 years now - I see hints there is a webui in development. HOT 1
- Debugging VM that doesn't start HOT 9
- Jails with baserw=0 upgrade 13.2 -> 14.0 issue: error while logging to jail HOT 4
- Module installation inside a jail HOT 1
- "unexpected operator" when executed in folder with space HOT 1
- Semi broken jail after base upgrade HOT 4
- Страница недосягаема кода использую префикс в настройках клетки HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cbsd.