Re: Bootstrap in chroot

"'Bas van der Vlies' via help-cfengine" <[email protected]> Wed, 22 May 2024 13:31:50 +0200
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
It also fails if you only do:
  * /var/cfengine/bin/cf-agent --bootstrap="${IMAGESERVER}" 
--skip-bootstrap-policy-run

like Vratislav suggested. At our place we only use the cfengine library 
not the whole framework. Slowly be more inline with it.


On 22/05/2024 13:20, Markus Rexhepi-Lindberg wrote:
> 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 <http://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 <http://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 <http://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 <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] 
> <mailto:[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 <https://groups.google.com/d/msgid/help-cfengine/f4f250c1-d132-40fa-9736-8586dd07f922n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
--
Bas van der Vlies
| High Performance Computing & Visualization | SURF| Science Park 140 | 
1098 XG  Amsterdam
| T +31 (0) 20 800 1300  | [email protected] | www.surf.nl |

-- 
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/3e66cd04-1290-4e42-a8fe-563457bfca4a%40surf.nl.
smime.p7s (application/pkcs7-signature, 4.7 KB) - not displayed