Re: Bootstrap in chroot

Markus Rexhepi-Lindberg <[email protected]> Wed, 22 May 2024 04:20:06 -0700 (PDT)
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
Thanks for suggestion Bas. I unfortunately get the same result when running 
with the suggested options.

--
Markus

On Tuesday, May 21, 2024 at 5:20:17 PM UTC+2 Bas van der Vlies wrote:

> Markus,
>
> I also bootstrap cfengine when a host has been provisioned. Only my 
> options are different. Do no run policy.
> ```
> /var/cfengine/bin/cf-agent --bootstrap="${IMAGESERVER}" 
> --skip-bootstrap-policy-run
> # I have a def.json setup with diferent json files. That is why I need this
> /var/cfengine/bin/cf-agent -KI -f update.cf
> ```
>
> When the server boots it wil run cfengne and everything is fine for use.
>
>
> > On 20 May 2024, at 11:58, Markus Rexhepi-Lindberg <[email protected]> 
> wrote:
> > 
> > Is it possible to bootstrap a host running in a chroot?
> > 
> > I want to bootstrap a host during its provisioning stage were it 
> currently runs in a chroot environment. While bootstrapping cf-agent 
> complains that the cf-execd daemon is not running, which seems to be the 
> case since cfengine3.service is not allowed to start in a chroot 
> environment.
> > 
> > ```
> > # chroot /target cf-agent -B <cfehub>
> > notice: Bootstrap mode: implicitly trusting server, use 
> --trust-server=no if server trust is already established
> > notice: Trusting new key: MD5=<redacted>
> > R: Bootstrapping from host '<redacted>' via built-in policy 
> '/var/cfengine/inputs/failsafe.cf'
> > R: This autonomous node assumes the role of voluntary client
> > R: Updated local policy from policy server
> > R: Triggered an initial run of the policy
> > R: Restarted systemd unit cfengine3
> > error: Bootstrapping failed, cf-execd is not running
> > notice: Bootstrap mode: implicitly trusting server, use 
> --trust-server=no if server trust is already established
> > ```
> > 
> > I managed to workaround this by first trying to bootstrap, which fails, 
> then manually start cf-execd in the chroot and finally try to bootstrap 
> again which succeeds.
> > 
> > ```
> > # chroot /traget cf-execd
> > # chroot /target cf-agent -B <cfehub>
> > R: Bootstrapping from host '<redacted>' via built-in policy 
> '/var/cfengine/inputs/failsafe.cf'
> > R: This autonomous node assumes the role of voluntary client
> > R: Updated local policy from policy server
> > R: Triggered an initial run of the policy
> > notice: Bootstrap to '<redacted>' completed successfully!
> > ```
> > 
> > This works but feels like a hack. Is there another way this could be 
> done?
> > 
> > --
> > Markus
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "help-cfengine" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected].
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/help-cfengine/e6e87828-d8aa-4040-9352-ef9e6f4a1f9bn%40googlegroups.com
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/f4f250c1-d132-40fa-9736-8586dd07f922n%40googlegroups.com.