freebsd / iocage

A FreeBSD jail manager
Other
19 stars 8 forks source link

iocage rename command not work well #25

Open amutu opened 1 week ago

amutu commented 1 week ago

Make sure to follow and check these boxes before submitting an issue! Thank you.

iocage -v Version 1.2

iocage rename tmp_3 tmp3 Jail: tmp_3 renamed to tmp3

iocage console tmp3 root@tmp-3:~ # hostname tmp-3-----here and /etc/rc.conf should change to tmp3?

cat /zroot/iocage/jails/tmp3/config.json { "basejail": 1, "cloned_release": "13.3-RELEASE", "host_hostname": "tmp-3",------here,should be tmp3? "host_hostuuid": "tmp3", "jail_zfs_dataset": "iocage/jails/tmp3/data", "last_started": "2024-09-08 05:58:27", "release": "13.3-RELEASE-p4" }

should iocage change the config.json and the hostname of jail?

dgeo commented 1 week ago

Hi, Jail name is not jail's hostname, you can have jail1 with hostname machine.example.org, change hostname without renaming the jail (even without access to host, this may be another discussion)

That said, I have to check what is done when changing hostname with iocage set, it may lack /etc/rc.conf part...

Defenso-QTH commented 1 week ago

That would not make sense in the cases of an empty or a Linux jail though.

amutu commented 1 week ago

Should rename be consistent with create new jail? My use case is create jail with -B -c 5 -n tmp to create 5 base jails named tmp_{1..5} for spare as create jail take minutes to complete. When I really use a jail ,I will rename it to some meaningfull name such as nginx. But it is annoy when I should edit the config.json and rc.conf and restart jail.

dgeo commented 6 days ago

Historically, jail's 'name' were UUID's (hence the host_hostuuid field), and still are if you don't name them explicitely. Jail's hostname is initialized from that, but not enforced by default (allow_set_hostname defaults to 1).

Link beetween hostname and jail name(uuid) is not bijective, hostname only defaults to uuid if not explicitely given: I think we can't change hostname if not explicitely asked for (with iocage set host_hostname=…)