rpi4, FreeBSD 13.0, puppetserver won't start

tonyalbers

New Member

Reaction score: 1
Messages: 10

Hiya,

I'm trying to get my Raspberry Pi 4 to be my puppet master. So far I've:

1. Installed FreeBSD 13.0 (releng/13.0-n244733-ea31abc261f) on a 16GB microSD.
2. Configured hostname, ntpd, network etc.
3. Run: pkg update
4. Run: pkg install puppetserver7 (no complains)
puppet7-7.5.0
puppetserver7-7.1.0
5. Put these in /etc/fstab:
Code:
  fdesc   /dev/fd         fdescfs         rw      0       0
  proc    /proc           procfs          rw      0       0
6. Put these in /etc/rc.conf:
Code:
  puppet_enable="YES"
  puppetserver_enable="yes"
  ntpd_enable="YES"
  ntpd_sync_on_start="YES"
  powerd_enable="YES

But puppetserver won't run. In /var/log/puppetserver/puppetserver.log I get:

Code:
2021-06-09T07:13:22.917+02:00 ERROR [clojure-agent-send-pool-0] [p.t.internal] shutdown-on-error triggered because of ex
ception!
java.lang.IllegalStateException: There was a problem adding a JRubyInstance to the pool.
        at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34364$add_instance__34369$fn__34373.invoke(jruby
_agents.clj:58)
        at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34364$add_instance__34369.invoke(jruby_agents.cl
j:47)
        at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34391$prime_pool_BANG___34396$fn__34400.invoke(j
ruby_agents.clj:76)
        at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34391$prime_pool_BANG___34396.invoke(jruby_agent
s.clj:61)
        at puppetlabs.services.jruby_pool_manager.impl.instance_pool$fn__34953$fn__34954.invoke(instance_pool.clj:16)
        at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invokeStatic(internal.clj:403)
        at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invoke(internal.clj:378)
        at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invokeStatic(internal.clj:388)
        at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invoke(internal.clj:378)
        at puppetlabs.trapperkeeper.internal$fn__14876$shutdown_service__14881$fn$reify__14883$service_fnk__5001__auto__
_positional$reify__14888.shutdown_on_error(internal.clj:448)
        at puppetlabs.trapperkeeper.internal$fn__14806$G__14802__14814.invoke(internal.clj:411)
        at puppetlabs.trapperkeeper.internal$fn__14806$G__14801__14823.invoke(internal.clj:411)
        at clojure.core$partial$fn__5839.invoke(core.clj:2625)
        at clojure.core$partial$fn__5839.invoke(core.clj:2624)
at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34338$send_agent__34343$fn__34344$agent_fn__3434
5.invoke(jruby_agents.clj:41)
        at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2033)
        at clojure.lang.AFn.applyToHelper(AFn.java:154)
        at clojure.lang.RestFn.applyTo(RestFn.java:132)
        at clojure.lang.Agent$Action.doRun(Agent.java:114)
        at clojure.lang.Agent$Action.run(Agent.java:163)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.jruby.embed.EvalFailedException: (Error) Cannot determine basic system flavour
        at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:131)
        at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1295)
        at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:167)
        at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:102)
        at puppetlabs.services.jruby.jruby_puppet_core$fn__36172$get_initialize_pool_instance_fn__36177$fn__36178$fn__36179.invoke(jruby_puppet_core.clj:118)
        at puppetlabs.services.jruby_pool_manager.impl.jruby_internal$fn__33946$create_pool_instance_BANG___33955$fn__33958.invoke(jruby_internal.clj:256)
        at puppetlabs.services.jruby_pool_manager.impl.jruby_internal$fn__33946$create_pool_instance_BANG___33955.invoke(jruby_internal.clj:225)
        at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34364$add_instance__34369$fn__34373.invoke(jruby_agents.clj:52)
        ... 22 common frames omitted
Caused by: org.jruby.exceptions.RuntimeError: (Error) Cannot determine basic system flavour

I have no real clue about this, and searching the web has only led me to this: check the perms on /tmp, which are correct I believe:
drwxrwxrwt 7 root wheel 384 Jun 9 07:34 tmp

Any ideas?

/tony
 
OP
T

tonyalbers

New Member

Reaction score: 1
Messages: 10

Ok, I just installed the exact same way in a VM in VirtualBox, here puppetserver7 works without issues.
So maybe it's related to the arm64/rpi port of puppetserver?

/tony
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,559
Messages: 37,878

So maybe it's related to the arm64/rpi port of puppetserver?
Appears that way:
Code:
Caused by: org.jruby.exceptions.RuntimeError: (Error) Cannot determine basic system flavour

The latest puppetserver7 runs fine on amd64.
 

acheron

Aspiring Daemon
Developer

Reaction score: 318
Messages: 768

sigh...:
Code:
unzip -l /usr/local/share/puppetserver/puppet-server-release.jar | egrep "libjffi-1.2.so"
   138344  09-13-12 21:50   jni/x86_64-SunOS/libjffi-1.2.so
    91704  10-30-18 17:19   jni/arm-Linux/libjffi-1.2.so
    80909  09-13-12 05:04   jni/i386-Linux/libjffi-1.2.so
    92947  05-16-17 13:30   jni/sparcv9-Linux/libjffi-1.2.so
    93328  10-27-19 13:24   jni/x86_64-DragonFlyBSD/libjffi-1.2.so
   132742  11-06-14 08:59   jni/ppc64-Linux/libjffi-1.2.so
   116541  11-06-14 06:41   jni/ppc64le-Linux/libjffi-1.2.so
    90382  09-13-12 05:38   jni/x86_64-Linux/libjffi-1.2.so
   509169  11-23-16 08:29   jni/x86_64-OpenBSD/libjffi-1.2.so
    55724  09-13-12 21:44   jni/i386-SunOS/libjffi-1.2.so
    94386  09-22-16 09:15   jni/aarch64-Linux/libjffi-1.2.so
   115104  09-25-19 01:36   jni/mips64el-Linux/libjffi-1.2.so
    83762  08-04-12 04:16   jni/x86_64-FreeBSD/libjffi-1.2.so
    63184  09-18-12 10:45   jni/sparcv9-SunOS/libjffi-1.2.so
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,559
Messages: 37,878

Oh, that thing again.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,559
Messages: 37,878

This needs to be fixed upstream though.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,559
Messages: 37,878

Often the maintainer will liaise with upstream to get it working, just wait and see what happens. But it might mean it's going to take a while until this is fixed.
 

acheron

Aspiring Daemon
Developer

Reaction score: 318
Messages: 768

I think I got it to work Puppet Server has successfully started and is now ready to handle requests
I'll try to write the instructions tomorrow (jruby, jnr-ffi and jffi need to be recompiled, puppet-server-release.jar needs to be recreated)
 

acheron

Aspiring Daemon
Developer

Reaction score: 318
Messages: 768

Here are the missing aarch64 bits missing in /usr/local/share/puppetserver/puppet-server-release.jar ( tar tf puppet-server-release.jar to see the content):
Code:
puppet-server-release/jnr/ffi/provider/jffi/platform/aarch64/freebsd/TypeAliases.class
puppet-server-release/jni/aarch64-FreeBSD/libjffi-1.2.so
puppet-server-release/META-INF/jruby.home/lib/ruby/stdlib/ffi/platform/aarch64-freebsd/syslog.rb

Instructions to build the missing pieces:

  • TypeAliases.class: comes from jnr-ffi,the resulting file will be in target/classes/jnr/ffi/provider/jffi/platform/aarch64/freebsd/TypeAliases.class
    Code:
    cd ~
    pkg install git maven
    git clone https://github.com/jnr/jnr-ffi.git
    cd jnr-ffi
    fetch -o src/main/java/jnr/ffi/provider/jffi/platform/aarch64/freebsd/TypeAliases.java https://raw.githubusercontent.com/jnr/jnr-ffi/b22c4db47570352136621de0d1380e0c5a24a01d/src/main/java/jnr/ffi/provider/jffi/platform/aarch64/freebsd/TypeAliases.java
    mvn compile

  • libjffi-1.2.so: comes from jffi, the resulting file will be in build/jni/libjffi-1.2.so
    Code:
    cd ~
    pkg install apache-ant
    git clone https://github.com/jnr/jffi.git
    cd jffi
    ant jar
  • syslog.rb: is just a copy / paste from the amd64 file: META-INF/jruby.home/lib/ruby/stdlib/ffi/platform/x86_64-freebsd/syslog.rb
Once you have built TypeAliases.class and libjffi-1.2.so, you can do the following:
Code:
cd /usr/local/share/puppetserver
mkdir puppet-server-release
tar xf puppet-server-release.jar -C puppet-server-release
cd puppet-server-release
cp ~/jnr-ffi/target/classes/jnr/ffi/provider/jffi/platform/aarch64/freebsd/TypeAliases.class jnr/ffi/provider/jffi/platform/aarch64/freebsd/TypeAliases.class
cp  ~/jffi/build/jni/libjffi-1.2.so jni/aarch64-FreeBSD/libjffi-1.2.so
mkdir META-INF/jruby.home/lib/ruby/stdlib/ffi/platform/aarch64-freebsd
cp META-INF/jruby.home/lib/ruby/stdlib/ffi/platform/x86_64-freebsd/syslog.rb META-INF/jruby.home/lib/ruby/stdlib/ffi/platform/aarch64-freebsd
jar cf /usr/local/share/puppetserver/puppet-server-release.jar .

puppetserver should work after that.
 

acheron

Aspiring Daemon
Developer

Reaction score: 318
Messages: 768

acheron

Aspiring Daemon
Developer

Reaction score: 318
Messages: 768

OP
T

tonyalbers

New Member

Reaction score: 1
Messages: 10

Thanks for all your help. I'll give it a good try once I'm done trying to come to terms with our latest organisational changes at work... ;)
 
OP
T

tonyalbers

New Member

Reaction score: 1
Messages: 10

On a side node, I've ported the 'server' mode of openjdk8 on aarch64, you'll have better performance with it. It's not in the ports tree as of today, you can find my patches here:
put openjdk8-aarch64-d4a6b63.tar.xz in /usr/ports/distfiles
I don't suppose you have OpenJDK11 in 'server' mode too, do you?

/tony
 
Top