Switching to non devmode gives java.net.UnknownHostException Temporary failure in name resolution

Hi,

I am developing my very first snap (mysnap). It exposes a binary which uses java. The binary works fine when snap is installed using ‘–devmode’ flag. But when I try to install it using ‘–dangerous’, which I need to test before pushing to snap store, it throws java.net.UnknownHostException ‘Temporary failure in name resolution’ error.

ERROR StatusLogger Could not determine local host name
 java.net.UnknownHostException: averma-omen: averma-omen: Temporary failure in name resolution
        at java.base/java.net.InetAddress.getLocalHost(InetAddress.java:1656)
        at org.apache.logging.log4j.core.util.NetUtils.getLocalHostname(NetUtils.java:54)
        at org.apache.logging.log4j.core.LoggerContext.lambda$setConfiguration$0(LoggerContext.java:615)
        at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
        at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:615)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:694)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:711)
        at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:253)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:245)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
        at org.apache.logging.log4j.LogManager.getContext(LogManager.java:176)
        at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:666)
        at org.apache.logging.log4j.LogManager.getRootLogger(LogManager.java:700)

Same setup, just installing the same snap using --dangerous flag. What am I missing?

install the snappy-debug snap and run snappy-debug in a second terminal while executing your app, that will suggest what interfaces you need to add to your app to make it run under strict confinement

1 Like

As @ogra mentions, running snappy-debug in parallel would produce useful hints onto what is going on, at first hunch the application entry might be missing the network interface

1 Like