openhab / openhab-docker

Repository for building Docker containers for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
212 stars 128 forks source link

RPi4 resolution issue #245

Closed esticle closed 5 years ago

esticle commented 5 years ago

Hi, I just got a RPI4 running Raspbian Buster (docker-ce docker-ce 5:19.03.1~3) and thought I'll give Openhab a go in a docker container instead and running into a resolution issue.

Kicking it off:

$ docker rm openhab ; rm -rf /docker/openhab ; mkdir -p /docker/openhab/conf /docker/openhab/userdata /docker/openhab/addons  /docker/openhab/.java ; chown -R openhab:openhab /docker/openhab ; id openhab ; docker run --name openhab --net host -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro -v /docker/openhab/conf:/openhab/conf -v /docker/openhab/userdata:/openhab/userdata -v /docker/openhab/addons:/openhab/addons -v /docker/openhab/.java:/openhab/.java --restart=always openhab/openhab:2.4.0-armhf-debian
uid=999(openhab) gid=994(openhab) groups=994(openhab)
++ test -t 0
++ echo false
+ interactive=false
+ set -euo pipefail
+ IFS='
        '
+ '[' limited = unlimited ']'
+ rm -f /openhab/runtime/instances/instance.properties
+ rm -f /openhab/userdata/tmp/instances/instance.properties
+ NEW_USER_ID=9001
+ NEW_GROUP_ID=9001
+ echo 'Starting with openhab user id: 9001 and group id: 9001'

All looking good, last end of the startup:

...
++ echo gosu openhab tini -s ./start.sh
+ '[' 'gosu openhab tini -s ./start.sh' == 'gosu openhab tini -s ./start.sh' ']'
+ command=($@ server)
+ exec gosu openhab tini -s ./start.sh server
Launching the openHAB runtime...
org.apache.karaf.features.internal.util.MultiException: Error:
        Error downloading mvn:org.openhab.core/org.openhab.ui.paperui/2.4.0
        at org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader.<init>(MavenDownloadManager.java:91)
        at org.apache.karaf.features.internal.download.impl.MavenDownloadManager.createDownloader(MavenDownloadManager.java:72)
        at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:457)
        at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:452)
        at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:224)
        at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388)
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        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)
        Suppressed: java.io.IOException: Error downloading mvn:org.openhab.core/org.openhab.ui.paperui/2.4.0
                at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:77)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
                at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
                ... 3 more
        Caused by: java.io.IOException: Error resolving artifact org.openhab.core:org.openhab.ui.paperui:jar:2.4.0: [Could not transfer artifact org.openhab.core:org.openhab.ui.paperui:jar:2.4.0 from/to openhab (https://dl.bintray.com/openhab/mvn/online-repo/2.4/): dl.bintray.com: Name or service not known]
                at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:720)
                at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:659)
                at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:600)
                at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:567)
                at org.apache.karaf.features.internal.download.impl.MavenDownloadTask.download(MavenDownloadTask.java:47)
                at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:60)
                ... 7 more
                Suppressed: shaded.org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.openhab.core:org.openhab.ui.paperui:jar:2.4.0 from/to openhab (https://dl.bintray.com/openhab/mvn/online-repo/2.4/): dl.bintray.com: Name or service not known
                        at shaded.org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43)
                        at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
                        at shaded.org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
                        at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
                        at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
                        at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
                        at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
                        at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
                        at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
                        at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
                        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:705)
                        ... 12 more
                Caused by: shaded.org.apache.maven.wagon.TransferFailedException: dl.bintray.com: Name or service not known
                        at shaded.org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1085)
                        at shaded.org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:977)
                        at shaded.org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
                        at shaded.org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
                        at shaded.org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
                        at shaded.org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run(WagonTransporter.java:560)
                        at shaded.org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:427)
                        at shaded.org.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTransporter.java:404)
                        at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:447)
                        at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350)
                        ... 21 more
                Caused by: java.net.UnknownHostException: dl.bintray.com: Name or service not known
                        at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
                        at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
                        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
                        at java.net.InetAddress.getAllByName0(InetAddress.java:1277)
                        at java.net.InetAddress.getAllByName(InetAddress.java:1193)
                        at java.net.InetAddress.getAllByName(InetAddress.java:1127)
                        at shaded.org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:44)
                        at shaded.org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:102)
                        at shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:319)
                        at shaded.org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
                        at shaded.org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
                        at shaded.org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
                        at shaded.org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
                        at shaded.org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
                        at shaded.org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
                        at shaded.org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
                        at org.ops4j.pax.url.mvn.internal.wagon.ConfigurableHttpWagon.execute(ConfigurableHttpWagon.java:149)
                        at shaded.org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1000)
                        ... 30 more
        Caused by: shaded.org.eclipse.aether.resolution.ArtifactResolutionException: Error resolving artifact org.openhab.core:org.openhab.ui.paperui:jar:2.4.0
                at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
                at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
                at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
                at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
                at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:705)
                ... 12 more

But, DNS Works:

root@pitest:/docker# docker exec -it 5199a07aca17 /bin/bash
root@pitest:/openhab# getent ahosts google.com
2a00:1450:4009:819::200e STREAM google.com
2a00:1450:4009:819::200e DGRAM
2a00:1450:4009:819::200e RAW
172.217.169.78  STREAM
172.217.169.78  DGRAM
172.217.169.78  RAW

And the above URL it tried definitely works from within the container:

root@pitest:/openhab# curl --insecure https://dl.bintray.com/openhab/mvn/online-repo/2.4/
<html>
<head>
<script>
//1565962866548
function navi(e){
        location.href = e.target.href.replace('/:','/'); e.preventDefault();
}
</script>
</head>
<body>
<pre><a onclick="navi(event)" href=":com/" rel="nofollow">com/</a></pre>
<pre><a onclick="navi(event)" href=":mysql/" rel="nofollow">mysql/</a></pre>
<pre><a onclick="navi(event)" href=":net/" rel="nofollow">net/</a></pre>
<pre><a onclick="navi(event)" href=":org/" rel="nofollow">org/</a></pre>
</body>
</html>
root@pitest:/openhab#

There is 'something' wrong with DNS though in the container as even 'apt-get' fails however I can resolve and get to the URLs it uses:

root@pitest:/openhab# apt-get update
Err:1 http://deb.debian.org/debian buster InRelease
  Failed to init resolver - res_init (116: Stale file handle) Could not resolve 'deb.debian.org'
Err:2 http://security.debian.org buster/updates InRelease
  Failed to init resolver - res_init (116: Stale file handle) Could not resolve 'security.debian.org'
Err:3 http://deb.debian.org/debian buster-updates InRelease
  Failed to init resolver - res_init (116: Stale file handle) Could not resolve 'deb.debian.org'
Reading package lists... Done
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease  Failed to init resolver - res_init (116: Stale file handle) Could not resolve 'deb.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease  Failed to init resolver - res_init (116: Stale file handle) Could not resolve 'deb.debian.org'
W: Failed to fetch http://security.debian.org/dists/buster/updates/InRelease  Failed to init resolver - res_init (116: Stale file handle) Could not resolve 'security.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
root@pitest:/openhab# getent hosts deb.debian.org
2001:41c8:1000:21::21:4 static.debian.org deb.debian.org
2001:4f8:1:c::15 static.debian.org deb.debian.org
2001:67c:2564:a119::148:14 static.debian.org deb.debian.org
root@pitest:/openhab# curl --insecure https://deb.debian.org | wc -l
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2108  100  2108    0     0   4447      0 --:--:-- --:--:-- --:--:--  4447
68
root@pitest:/openhab# cat /etc/resolv.conf
# Generated by resolvconf
domain lan.com
nameserver 192.168.1.1

Any ideas?

wborn commented 5 years ago

Probably the Debian repos were down yesterday because apt update also didn't work for me. It does work today.

Installing add-ons from Bintray did work for me yesterday and it still does today. So it looks like you have a local DNS issue. Does installing add-ons from Bintray work when you configure a secondary DNS?

esticle commented 5 years ago

Thanks for the advice. I went down a bit of a rabbit hole but solved it - not related to DNS.

I did not mention it as it "appeared" unrelated but I looked a bit more into the 'Stale file handle' issue logged above.

This host is netbooting and thus everything is served off NFS, it turns out that having it is OK in general but containers over NFS (I assume because it is mounted within another layer in the docker container) can act flakey about stale file handles.

I re-pointed my /var/lib/docker/containers first to a SD card and verified it worked, and then to the same location but served over SMB and confirmed that works fine too.

Thanks for the help!

wborn commented 5 years ago

Great that you've found the root cause! I can imagine the kernel may have troubles when mounting upon other mounts.