Copilot error at startup - File not found for "lshal"

I’ve gotten the stacktrace below from our Operations team.

CopilotIndexHtmlLoader.serviceInit:

  • it calls CopilotStatus.isEnabled, and this returns true by default?
  • Unless Copilot is specifically disabled you always create an instance of AnalyticsClient
  • This ends up calling oshi.driver.linux.Lshal.queryUUID, which logs the error.
  • That method says: // if lshal command available (HAL deprecated in newer linuxes)

So, Vaadin, you are doing some Copilot initialization even in prod mode and to avoid it I have to specifically disable Copilot?

java.io.IOException: error=2, No such file or directory
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:314)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:244)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
	at java.base/java.lang.Runtime.exec(Runtime.java:594)
	at java.base/java.lang.Runtime.exec(Runtime.java:496)
	at deployment.ptsmc.ear//oshi.util.ExecutingCommand.runNative(ExecutingCommand.java:86)
	at deployment.ptsmc.ear//oshi.util.ExecutingCommand.runNative(ExecutingCommand.java:68)
	at deployment.ptsmc.ear//oshi.util.ExecutingCommand.runNative(ExecutingCommand.java:55)
	at deployment.ptsmc.ear//oshi.driver.linux.Lshal.queryUUID(Lshal.java:44)
	at deployment.ptsmc.ear//oshi.hardware.platform.linux.LinuxComputerSystem.queryUUID(LinuxComputerSystem.java:96)
	at deployment.ptsmc.ear//oshi.util.Memoizer$1.get(Memoizer.java:61)
	at deployment.ptsmc.ear//oshi.hardware.platform.linux.LinuxComputerSystem.getHardwareUUID(LinuxComputerSystem.java:54)
	at deployment.ptsmc.ear//com.vaadin.pro.licensechecker.MachineId.getComputerId(MachineId.java:49)
	at deployment.ptsmc.ear//com.vaadin.pro.licensechecker.MachineId.get(MachineId.java:34)
	at deployment.ptsmc.ear//com.vaadin.copilot.analytics.AnalyticsClient.<init>(AnalyticsClient.java:45)
	at deployment.ptsmc.ear//com.vaadin.copilot.analytics.AnalyticsClient.getInstance(AnalyticsClient.java:65)
	at deployment.ptsmc.ear//com.vaadin.copilot.CopilotIndexHtmlLoader.serviceInit(CopilotIndexHtmlLoader.java:45)
	at deployment.ptsmc.ear//com.vaadin.flow.server.VaadinService.lambda$init$0(VaadinService.java:271)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at deployment.ptsmc.ear//com.vaadin.flow.server.VaadinService.lambda$init$1(VaadinService.java:271)
	at deployment.ptsmc.ear//com.vaadin.flow.server.VaadinService.runWithServiceContext(VaadinService.java:2472)
	at deployment.ptsmc.ear//com.vaadin.flow.server.VaadinService.init(VaadinService.java:269)
	at deployment.ptsmc.ear//com.vaadin.flow.server.VaadinServlet.createServletService(VaadinServlet.java:355)
	at deployment.ptsmc.ear//com.vaadin.flow.server.VaadinServlet.createServletService(VaadinServlet.java:336)
	at deployment.ptsmc.ear//com.vaadin.flow.server.VaadinServlet.init(VaadinServlet.java:132)
	at io.undertow.servlet@2.3.18.Final//io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
	...

Vaadin 24.7.0
Some sort of linux container…

Did your production build exclude the vaadin-dev artifact?
Copilot is a transitive dependency of that module, so excluding it should prevent the posted error.

I believed so, but it is harder to exclude something than I thought.
Using mvn dependency:tree I found all transitive vaadin-dev dependencies.

The final one was from 3rd party dependency vaadin-maps-leaflet-flow.
It, obviously, depends on vaadin-core, which depends on vaadin-dev?

This means that for any vaadin addon I include, I have to add the same exclude?

Usually, add-ons should use provided scope for Vaadin dependencies, to prevent these kind of issues

However, defining the exclusion in vaadin-core in your project, should be enough, unless the add-on directly depends on vaadin-dev (or some other dev artifact)

            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-core</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-dev</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>