How to disable autostart of iocage

hbauer

Dabbler
Joined
Aug 28, 2019
Messages
10
Hi to all,

is there a way to disable autostart of the iocage service on Truenas? In FreeBSD I can use the variable in rc.conf but this seems not to be used on Truenas

Regards
Hagen
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
You may be able to set the rc.conf variable as an rc.conf tunable...
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
If you disable autostart of all jails, iocage won't do anything on startup. There is no background "iocage service" that keeps running after the jails are started.

Second, you can definitely create a tunable as suggested by @sretalla.
Edit: this apparently does not work because in TN everything is started by middlewared and friends instead of rcng.
 
Last edited:

hbauer

Dabbler
Joined
Aug 28, 2019
Messages
10
This is what I put in as tuneable but iocage will still get started. I cant find my mistake
rc-tunable.png
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
OK, so the TrueNAS middleware calls iocage directly instead of relying on the FreeBSD rcng mechanism. Sorry for the misinformation.

For bulk disabling all of your jails you can use e.g.
Code:
iocage list -h | awk '{printf "iocage set boot=off %s\n", $2 }' | sh

And to re-enable
Code:
iocage list -h | awk '{printf "iocage set boot=on %s\n", $2 }' | sh


HTH,
Patrick
 

hbauer

Dabbler
Joined
Aug 28, 2019
Messages
10
Thank you very much. Unfortunately this will not solve my use case. The TN Server is acting as a cold standby for jails that are running on the "normal server". The jails are replicated to the cold standby. So the configuration of the individual jails is also replicated and cant be changed.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Then simply do not activate iocage on the pool if it is just the jails' structure and data you are after. You can create a dummy pool from a file if you have only one - unfortunately there is no deactivate command.

Move active pool to dummy:
Code:
root@freenas[~]# truncate -s 1g /mnt/hdd/1G
root@freenas[~]# zpool create dummy /mnt/hdd/1G
root@freenas[~]# iocage activate dummy
ZFS pool 'dummy' successfully activated.


Reactivate real jail pool:
Code:
root@freenas[~]# iocage activate ssd
ZFS pool 'ssd' successfully activated.
 

hbauer

Dabbler
Joined
Aug 28, 2019
Messages
10
So the result is achived but the process doesnt work that way. After
iocage activate dummy
and a restart the pool is gone.
The good news is the iocage cant start jails and I can activate the "right pool" via the GUI.

So I am happy. My jails can be replicate without getting started and in a cold standby activation situation I can activate the jails via the GUI :smile:
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
The dummy pool vanishing is to be expected. A more "official" way to achieve the same result without that hack - I just could not remember the name of the property from the top of my head when I wrote that post:
Code:
zfs set org.freebsd.ioc:active=no <pool name>
zfs set org.freebsd.ioc:active=yes <pool name>
 
Top