How to install CMake on Alpine Linux

Run

apk update

as root to update the list of available packages. Then, run

apk add cmake

to install CMake.

Posted by Uli Köhler in Alpine Linux

How to install Tailscale on Ubuntu in less than 1 minute

Just run this sequence of commands to install tailscale. This will automatically determine the correct Ubuntu version

#!/bin/bash
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/$(lsb_release -sc).gpg | sudo apt-key add -
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/$(lsb_release -sc).list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt-get update
sudo apt-get install tailscale

 

Posted by Uli Köhler in Networking, Wireguard

How to setup headscale server in 5 minutes using docker-compose

This headscale setup is using sqlite – with a much lighter memory & CPU footprint than PostgreSQL for simple usecases, I recommend this for almost any installation: Headscale doesn’t have to manage that many requests and using sqlite3 is fine for all but the most demanding setups.

First, create the directory where headscale and all the data will reside in (we use /opt/headscale in this example).

sudo mkdir -p /opt/headscale

Now run the following script in /opt/headscale to initialize the files and directories headscale requires:

#!/bin/bash
mkdir -p ./config
touch ./config/db.sqlite
curl https://raw.githubusercontent.com/juanfont/headscale/main/config-example.yaml -o ./config/config.yaml

docker-compose config

Now it’s time to create /opt/headscale/docker-compose.yml:

version: '3.5'
services:
  headscale:
    image: headscale/headscale:latest
    volumes:
      - ./config:/etc/headscale/
      - ./data:/var/lib/headscale
    ports:
      - 27896:8080
    command: headscale serve
    restart: unless-stopped

This will configure headscale to run its HTTP server on port 27896. You can reverse proxy this port to the domain of your choice.

Configuration

Now we should edit the server name in config/config.yaml:

server_url: https://headscale.mydomain.com

Autostart

Using the method described in our previous post Create a systemd service for your docker-compose project in 10 seconds we will now setup autostart on boot for headscale using systemd. This command will also start it immediately:

curl -fsSL https://techoverflow.net/scripts/create-docker-compose-service.sh | sudo bash /dev/stdin

How to view the logs

Use this command to view & follow the logs:

docker-compose logs -f

 

Example output

headscale_1  | [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
headscale_1  | 
headscale_1  | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
headscale_1  |  - using env:    export GIN_MODE=release
headscale_1  |  - using code:   gin.SetMode(gin.ReleaseMode)
headscale_1  | 
headscale_1  | [GIN-debug] GET    /metrics                  --> github.com/zsais/go-gin-prometheus.prometheusHandler.func1 (4 handlers)
headscale_1  | [GIN-debug] GET    /health                   --> github.com/juanfont/headscale.(*Headscale).Serve.func2 (4 handlers)
headscale_1  | [GIN-debug] GET    /key                      --> github.com/juanfont/headscale.(*Headscale).KeyHandler-fm (4 handlers)
headscale_1  | [GIN-debug] GET    /register                 --> github.com/juanfont/headscale.(*Headscale).RegisterWebAPI-fm (4 handlers)
headscale_1  | [GIN-debug] POST   /machine/:id/map          --> github.com/juanfont/headscale.(*Headscale).PollNetMapHandler-fm (4 handlers)
headscale_1  | [GIN-debug] POST   /machine/:id              --> github.com/juanfont/headscale.(*Headscale).RegistrationHandler-fm (4 handlers)
headscale_1  | [GIN-debug] GET    /oidc/register/:mkey      --> github.com/juanfont/headscale.(*Headscale).RegisterOIDC-fm (4 handlers)
headscale_1  | [GIN-debug] GET    /oidc/callback            --> github.com/juanfont/headscale.(*Headscale).OIDCCallback-fm (4 handlers)
headscale_1  | [GIN-debug] GET    /apple                    --> github.com/juanfont/headscale.(*Headscale).AppleMobileConfig-fm (4 handlers)
headscale_1  | [GIN-debug] GET    /apple/:platform          --> github.com/juanfont/headscale.(*Headscale).ApplePlatformConfig-fm (4 handlers)
headscale_1  | [GIN-debug] GET    /swagger                  --> github.com/juanfont/headscale.SwaggerUI (4 handlers)
headscale_1  | [GIN-debug] GET    /swagger/v1/openapiv2.json --> github.com/juanfont/headscale.SwaggerAPIv1 (4 handlers)
headscale_1  | [GIN-debug] GET    /api/v1/*any              --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
headscale_1  | [GIN-debug] POST   /api/v1/*any              --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
headscale_1  | [GIN-debug] PUT    /api/v1/*any              --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
headscale_1  | [GIN-debug] PATCH  /api/v1/*any              --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
headscale_1  | [GIN-debug] HEAD   /api/v1/*any              --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
headscale_1  | [GIN-debug] OPTIONS /api/v1/*any              --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
headscale_1  | [GIN-debug] DELETE /api/v1/*any              --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
headscale_1  | [GIN-debug] CONNECT /api/v1/*any              --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
headscale_1  | [GIN-debug] TRACE  /api/v1/*any              --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
headscale_1  | 2022-01-16T19:04:04Z WRN Listening without TLS but ServerURL does not start with http://
headscale_1  | 2022-01-16T19:04:04Z INF listening and serving (multiplexed HTTP and gRPC) on: 0.0.0.0:8080
headscale_1  | 2022-01-16T19:04:04Z INF Setting up a DERPMap update worker frequency=86400000

 

Posted by Uli Köhler in Networking, Wireguard

Traefik wildcard Lets Encrypt certificate reverse proxy example

The following example builds on our config from Simple Traefik docker-compose setup with Lets Encrypt Cloudflare DNS-01 & TLS-ALPN-01 & HTTP-01 challenges

This config (placed in /etc/traefik/conf/myservice.toml – which is mapped to ./conf/myservice.toml i.e. /opt/traefik/conf/myservice.toml in our docker-compose example) generates a wildcard certificate for *.mydomain.com (also including just mydomain.com) using the cloudflare certificate provider and uses said wildcard certificate for myservice.mydomain.com and any other *.mydomain.com backends you have configured.

This config will reverse proxy all traffic on myservice.mydomain.com to 192.168.178.233:8080

# Host
[http.routers.myservice]
rule = "Host(`myservice.mydomain.com`)"
service = "myservice"

# Backend
[http.services]
[http.services.myservice.loadBalancer]
[[http.services.myservice.loadBalancer.servers]]
url = "http://192.168.178.233:8080/"

# Certificates
[http.routers.myservice.tls]
certresolver = "cloudflare"
[[http.routers.myservice.tls.domains]]
main = "mydomain.com"
sans = ["*.mydomain.com"]

Note that cloudflare in certresolver = "cloudflare" refers to the provider configured using

--certificatesresolvers.cloudflare....

but you can choose any other name with the cloudflare method such as --certificatesresolvers.myprovider.acme.dnschallenge.provider=cloudflare in which case the provider will be referred to as myprovider !

Posted by Uli Köhler in Networking, Traefik

Simple Traefik docker-compose setup with Lets Encrypt Cloudflare DNS-01 & TLS-ALPN-01 & HTTP-01 challenges

This is my setup using docker-compose to start Traefik, supporting all major encryption providers. I recommend to create the /opt/traefikdirectory and save the following file as /opt/traefik/docker-compose.yml. This config has the fileand docker providers enabled by default.

version: "3.3"
services:
  traefik:
    image: "traefik:v2.5"
    network_mode: "host" 
    command:
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--providers.file.directory=/etc/traefik/conf"
      - "--providers.file.watch=true"
      - "--entrypoints.web.address=:80"
      - "--entryPoints.web.http.redirections.entryPoint.to=websecure"
      - "--entryPoints.web.http.redirections.entryPoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--log.level=info"
      - "--serversTransport.insecureSkipVerify=true"
#      - "--pilot.token=PILOT_TOKEN_HERE"
#
      - "--certificatesresolvers.cloudflare.acme.dnschallenge=true"
      - "--certificatesresolvers.cloudflare.acme.dnschallenge.provider=cloudflare"
      - "--certificatesresolvers.cloudflare.acme.dnschallenge.resolvers=1.1.1.1:53,1.0.0.1:53"
      - "--certificatesresolvers.cloudflare.acme.caserver=https://acme-v02.api.letsencrypt.org/directory"
      - "[email protected]in.com"
      - "--certificatesresolvers.cloudflare.acme.KeyType=EC256"
      - "--certificatesresolvers.cloudflare.acme.storage=/letsencrypt/acme.json"
#
      - "--certificatesresolvers.cloudflare-staging.acme.dnschallenge=true"
      - "--certificatesresolvers.cloudflare-staging.acme.dnschallenge.provider=cloudflare"
      - "--certificatesresolvers.cloudflare-staging.acme.dnschallenge.resolvers=1.1.1.1:53,1.0.0.1:53"
      - "--certificatesresolvers.cloudflare-staging.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
      - "--[email protected]mydomain.com"
      - "--certificatesresolvers.cloudflare-staging.acme.KeyType=EC256"
      - "--certificatesresolvers.cloudflare-staging.acme.storage=/letsencrypt/acme.json"
#
      - "--certificatesresolvers.alpn.acme.tlsChallenge=true"
      - "--certificatesresolvers.alpn.acme.caserver=https://acme-v02.api.letsencrypt.org/directory"
      - "[email protected]"
      - "--certificatesresolvers.alpn.acme.KeyType=EC256"
      - "--certificatesresolvers.alpn.acme.storage=/letsencrypt/acme.json"
#
      - "--certificatesresolvers.alpn-staging.acme.tlsChallenge=true"
      - "--certificatesresolvers.alpn-staging.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
      - "[email protected]main.com"
      - "--certificatesresolvers.alpn-staging.acme.KeyType=EC256"
      - "--certificatesresolvers.alpn-staging.acme.storage=/letsencrypt/acme.json"
    environment:
      - [email protected]
      - CLOUDFLARE_API_KEY=XYZABC123
    volumes:
      - "./letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./conf:/etc/traefik/conf:ro"

Replace [email protected] by the Email address to register certificates to. Also ensure to change

- [email protected]
- CLOUDFLARE_API_KEY=XYZABC123

Optionally, create a Pilot token and set it (don’t forget to un-comment the line) using

# - "--pilot.token=PILOT_TOKEN_HERE"

Now let’s make the service autostart on boot (and start it right now) using the method detailed in docker-compose systemd .service generator: Run the following in /opt/traefik

curl -fsSL https://techoverflow.net/scripts/create-docker-compose-service.sh | sudo bash /dev/stdin

We will detail how to get access to the Traefik API in followup posts.

 

 

Posted by Uli Köhler in Networking, Traefik

Oracle Cloud Always Free Tier ARM network ping

Also see: Oracle Cloud Always Free Tier ARM network speedtest

We tested Oracle Cloud free tier network performance on 2022-01-16 using:

  • Ubuntu 20.04
  • 3 cores, 23 GB memory => listed network bandwidth of 3 Gbps
  • We only tested Frankfurt AD2. In some less systematic tests using speedtest, AD2 performed significantly better in our speed tests

Ping to Cloudflare

[email protected]:~$ ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=62 time=0.920 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=62 time=1.03 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=62 time=0.901 ms
64 bytes from 1.1.1.1: icmp_seq=4 ttl=62 time=1.00 ms
64 bytes from 1.1.1.1: icmp_seq=5 ttl=62 time=1.00 ms

Ping to Google

[email protected]:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=122 time=0.826 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=122 time=0.829 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=122 time=0.801 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=122 time=0.996 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=122 time=0.842 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=122 time=0.840 ms

Traceroute to Cloudflare

[email protected]:~$ traceroute 1.1.1.1
traceroute to 1.1.1.1 (1.1.1.1), 30 hops max, 60 byte packets
 1  140.91.198.100 (140.91.198.100)  0.230 ms  0.175 ms 140.91.198.158 (140.91.198.158)  0.099 ms
 2  oracle-svc071177-lag003320.ip.twelve99-cust.net (213.248.69.249)  16.004 ms  50.135 ms  50.095 ms
 3  ffm-b11-link.ip.twelve99.net (213.248.69.248)  1.045 ms  1.132 ms  0.862 ms
 4  cloudflare-ic328337-ffm-b11.ip.twelve99-cust.net (62.115.144.199)  1.142 ms  7.372 ms  1.690 ms
 5  one.one.one.one (1.1.1.1)  0.733 ms  0.746 ms  0.724 ms

Traceroute to Google

[email protected]:~$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  140.91.198.103 (140.91.198.103)  0.268 ms 140.91.198.98 (140.91.198.98)  0.224 ms 140.91.198.103 (140.91.198.103)  0.214 ms
 2  ipv4.de-cix.fra.de.as31898.oracle.com (80.81.196.168)  0.412 ms  1.479 ms 185.1.102.135 (185.1.102.135)  0.574 ms
 3  ipv4.de-cix.fra.de.as15169.google.com (80.81.193.108)  0.714 ms 185.1.102.59 (185.1.102.59)  1.172 ms  1.132 ms
 4  108.170.251.129 (108.170.251.129)  0.688 ms 108.170.251.193 (108.170.251.193)  1.110 ms 108.170.251.129 (108.170.251.129)  0.705 ms
 5  142.251.64.183 (142.251.64.183)  0.812 ms 142.250.62.151 (142.250.62.151)  1.061 ms 142.250.214.201 (142.250.214.201)  0.708 ms
 6  dns.google (8.8.8.8)  0.918 ms  0.885 ms  0.716 ms

 

Posted by Uli Köhler in Networking

Oracle Cloud Always Free Tier ARM network speedtest

Also seeOracle Cloud Always Free Tier ARM network ping

We tested Oracle Cloud free tier network performance on 2022-01-16 using:

  • Ubuntu 20.04
  • 3 cores, 23 GB memory => listed network bandwidth of 3 Gbps
  • We only tested Frankfurt AD2. In some less systematic tests using speedtest, AD2 performed significantly better (900Mbps AD2 instead of around 600Mbps AD1&AD3).

Quick links:

Speedtest results

[email protected]:~$ speedtest
Retrieving speedtest.net configuration...
Testing from Oracle Corporation (141.144.237.76)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by teliko GmbH (Limburg) [50.94 km]: 2.456 ms
Testing download speed................................................................................
Download: 901.05 Mbit/s
Testing upload speed......................................................................................................
Upload: 918.25 Mbit/s

iperf egress results

[email protected]:~$ iperf3 -c speedtest.wtnet.de -p 5200 -P 10 -4
Connecting to host speedtest.wtnet.de, port 5200
[  5] local 10.0.0.130 port 45868 connected to 213.209.106.95 port 5200
[  7] local 10.0.0.130 port 45870 connected to 213.209.106.95 port 5200
[  9] local 10.0.0.130 port 45872 connected to 213.209.106.95 port 5200
[ 11] local 10.0.0.130 port 45874 connected to 213.209.106.95 port 5200
[ 13] local 10.0.0.130 port 45876 connected to 213.209.106.95 port 5200
[ 15] local 10.0.0.130 port 45878 connected to 213.209.106.95 port 5200
[ 17] local 10.0.0.130 port 45880 connected to 213.209.106.95 port 5200
[ 19] local 10.0.0.130 port 45882 connected to 213.209.106.95 port 5200
[ 21] local 10.0.0.130 port 45884 connected to 213.209.106.95 port 5200
[ 23] local 10.0.0.130 port 45886 connected to 213.209.106.95 port 5200
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  21.6 MBytes   181 Mbits/sec  1434    208 KBytes       
[  7]   0.00-1.00   sec  25.6 MBytes   214 Mbits/sec  2056   69.3 KBytes       
[  9]   0.00-1.00   sec  32.3 MBytes   271 Mbits/sec  2737    230 KBytes       
[ 11]   0.00-1.00   sec  13.1 MBytes   110 Mbits/sec  447   18.4 KBytes       
[ 13]   0.00-1.00   sec  24.4 MBytes   205 Mbits/sec  2349   65.0 KBytes       
[ 15]   0.00-1.00   sec  18.1 MBytes   152 Mbits/sec  1428   43.8 KBytes       
[ 17]   0.00-1.00   sec  17.3 MBytes   145 Mbits/sec  1146   77.8 KBytes       
[ 19]   0.00-1.00   sec  16.3 MBytes   136 Mbits/sec  1022   77.8 KBytes       
[ 21]   0.00-1.00   sec  18.1 MBytes   152 Mbits/sec  1260   79.2 KBytes       
[ 23]   0.00-1.00   sec  16.7 MBytes   140 Mbits/sec  1353   50.9 KBytes       
[SUM]   0.00-1.00   sec   203 MBytes  1.71 Gbits/sec  15232             
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   1.00-2.00   sec  21.2 MBytes   178 Mbits/sec   15    123 KBytes       
[  7]   1.00-2.00   sec  7.50 MBytes  62.9 Mbits/sec   30   38.2 KBytes       
[  9]   1.00-2.00   sec  18.8 MBytes   157 Mbits/sec   47    150 KBytes       
[ 11]   1.00-2.00   sec  6.25 MBytes  52.4 Mbits/sec  584   83.4 KBytes       
[ 13]   1.00-2.00   sec  8.75 MBytes  73.4 Mbits/sec   78   80.6 KBytes       
[ 15]   1.00-2.00   sec  11.2 MBytes  94.4 Mbits/sec   45   59.4 KBytes       
[ 17]   1.00-2.00   sec  10.0 MBytes  83.9 Mbits/sec   73   93.3 KBytes       
[ 19]   1.00-2.00   sec  8.75 MBytes  73.4 Mbits/sec   40   73.5 KBytes       
[ 21]   1.00-2.00   sec  15.0 MBytes   126 Mbits/sec   16    140 KBytes       
[ 23]   1.00-2.00   sec  8.75 MBytes  73.4 Mbits/sec   19   76.4 KBytes       
[SUM]   1.00-2.00   sec   116 MBytes   975 Mbits/sec  947             
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   2.00-3.00   sec  13.8 MBytes   115 Mbits/sec   37   99.0 KBytes       
[  7]   2.00-3.00   sec  8.75 MBytes  73.4 Mbits/sec   23   73.5 KBytes       
[  9]   2.00-3.00   sec  11.2 MBytes  94.4 Mbits/sec   28   74.9 KBytes       
[ 11]   2.00-3.00   sec  10.0 MBytes  83.9 Mbits/sec   44   65.0 KBytes       
[ 13]   2.00-3.00   sec  10.0 MBytes  83.9 Mbits/sec   53   65.0 KBytes       
[ 15]   2.00-3.00   sec  11.2 MBytes  94.4 Mbits/sec   21   90.5 KBytes       
[ 17]   2.00-3.00   sec  12.5 MBytes   105 Mbits/sec   24   79.2 KBytes       
[ 19]   2.00-3.00   sec  10.0 MBytes  83.9 Mbits/sec   30   84.8 KBytes       
[ 21]   2.00-3.00   sec  16.2 MBytes   136 Mbits/sec   55    105 KBytes       
[ 23]   2.00-3.00   sec  8.75 MBytes  73.4 Mbits/sec   26   69.3 KBytes       
[SUM]   2.00-3.00   sec   112 MBytes   944 Mbits/sec  341             
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   3.00-4.00   sec  12.5 MBytes   105 Mbits/sec   44   84.8 KBytes       
[  7]   3.00-4.00   sec  11.2 MBytes  94.4 Mbits/sec   25   76.4 KBytes       
[  9]   3.00-4.00   sec  12.5 MBytes   105 Mbits/sec   34   99.0 KBytes       
[ 11]   3.00-4.00   sec  10.0 MBytes  83.9 Mbits/sec   21   73.5 KBytes       
[ 13]   3.00-4.00   sec  10.0 MBytes  83.9 Mbits/sec   62   70.7 KBytes       
[ 15]   3.00-4.00   sec  13.8 MBytes   115 Mbits/sec   84    117 KBytes       
[ 17]   3.00-4.00   sec  13.8 MBytes   115 Mbits/sec   22    105 KBytes       
[ 19]   3.00-4.00   sec  11.2 MBytes  94.4 Mbits/sec   20    110 KBytes       
[ 21]   3.00-4.00   sec  12.5 MBytes   105 Mbits/sec   26   70.7 KBytes       
[ 23]   3.00-4.00   sec  10.0 MBytes  83.9 Mbits/sec   46   73.5 KBytes       
[SUM]   3.00-4.00   sec   118 MBytes   986 Mbits/sec  384             
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   4.00-5.00   sec  13.8 MBytes   115 Mbits/sec   10    105 KBytes       
[  7]   4.00-5.00   sec  11.2 MBytes  94.4 Mbits/sec   43    113 KBytes       
[  9]   4.00-5.00   sec  12.5 MBytes   105 Mbits/sec   34   63.6 KBytes       
[ 11]   4.00-5.00   sec  13.8 MBytes   115 Mbits/sec   34   96.2 KBytes       
[ 13]   4.00-5.00   sec  8.75 MBytes  73.4 Mbits/sec   58   69.3 KBytes       
[ 15]   4.00-5.00   sec  8.75 MBytes  73.4 Mbits/sec   61   45.2 KBytes       
[ 17]   4.00-5.00   sec  11.2 MBytes  94.4 Mbits/sec   30   67.9 KBytes       
[ 19]   4.00-5.00   sec  11.2 MBytes  94.4 Mbits/sec   73   74.9 KBytes       
[ 21]   4.00-5.00   sec  8.75 MBytes  73.4 Mbits/sec   25   63.6 KBytes       
[ 23]   4.00-5.00   sec  15.0 MBytes   126 Mbits/sec    1    123 KBytes       
[SUM]   4.00-5.00   sec   115 MBytes   965 Mbits/sec  369             
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   5.00-6.00   sec  15.0 MBytes   126 Mbits/sec   28    117 KBytes       
[  7]   5.00-6.00   sec  16.2 MBytes   136 Mbits/sec    4    170 KBytes       
[  9]   5.00-6.00   sec  10.0 MBytes  83.9 Mbits/sec   64   77.8 KBytes       
[ 11]   5.00-6.00   sec  11.2 MBytes  94.4 Mbits/sec   34   99.0 KBytes       
[ 13]   5.00-6.00   sec  10.0 MBytes  83.9 Mbits/sec   27   79.2 KBytes       
[ 15]   5.00-6.00   sec  8.75 MBytes  73.4 Mbits/sec   17   63.6 KBytes       
[ 17]   5.00-6.00   sec  11.2 MBytes  94.4 Mbits/sec   21   93.3 KBytes       
[ 19]   5.00-6.00   sec  8.75 MBytes  73.4 Mbits/sec   47   59.4 KBytes       
[ 21]   5.00-6.00   sec  8.75 MBytes  73.4 Mbits/sec   32   55.1 KBytes       
[ 23]   5.00-6.00   sec  15.0 MBytes   126 Mbits/sec   72   87.7 KBytes       
[SUM]   5.00-6.00   sec   115 MBytes   965 Mbits/sec  346             
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   6.00-7.00   sec  11.2 MBytes  94.4 Mbits/sec   78   73.5 KBytes       
[  7]   6.00-7.00   sec  16.2 MBytes   136 Mbits/sec   37    110 KBytes       
[  9]   6.00-7.00   sec  10.0 MBytes  83.9 Mbits/sec   53   39.6 KBytes       
[ 11]   6.00-7.00   sec  7.50 MBytes  62.9 Mbits/sec   43   53.7 KBytes       
[ 13]   6.00-7.00   sec  13.8 MBytes   115 Mbits/sec   16    106 KBytes       
[ 15]   6.00-7.00   sec  8.75 MBytes  73.4 Mbits/sec   20   59.4 KBytes       
[ 17]   6.00-7.00   sec  13.8 MBytes   115 Mbits/sec   34   72.1 KBytes       
[ 19]   6.00-7.00   sec  10.0 MBytes  83.9 Mbits/sec   45   46.7 KBytes       
[ 21]   6.00-7.00   sec  10.0 MBytes  83.9 Mbits/sec   32   74.9 KBytes       
[ 23]   6.00-7.00   sec  13.8 MBytes   115 Mbits/sec   15    154 KBytes       
[SUM]   6.00-7.00   sec   115 MBytes   965 Mbits/sec  373             
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   7.00-8.00   sec  8.75 MBytes  73.4 Mbits/sec   44   45.2 KBytes       
[  7]   7.00-8.00   sec  17.5 MBytes   147 Mbits/sec   38    165 KBytes       
[  9]   7.00-8.00   sec  7.50 MBytes  62.9 Mbits/sec   29   72.1 KBytes       
[ 11]   7.00-8.00   sec  11.2 MBytes  94.4 Mbits/sec   21   86.3 KBytes       
[ 13]   7.00-8.00   sec  12.5 MBytes   105 Mbits/sec   29   93.3 KBytes       
[ 15]   7.00-8.00   sec  10.0 MBytes  83.9 Mbits/sec   16   99.0 KBytes       
[ 17]   7.00-8.00   sec  11.2 MBytes  94.4 Mbits/sec   53   70.7 KBytes       
[ 19]   7.00-8.00   sec  7.50 MBytes  62.9 Mbits/sec   45   63.6 KBytes       
[ 21]   7.00-8.00   sec  10.0 MBytes  83.9 Mbits/sec   43   62.2 KBytes       
[ 23]   7.00-8.00   sec  18.8 MBytes   157 Mbits/sec   32    151 KBytes       
[SUM]   7.00-8.00   sec   115 MBytes   965 Mbits/sec  350             
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   8.00-9.00   sec  10.0 MBytes  83.9 Mbits/sec   25   80.6 KBytes       
[  7]   8.00-9.00   sec  18.8 MBytes   157 Mbits/sec   41    103 KBytes       
[  9]   8.00-9.00   sec  11.2 MBytes  94.4 Mbits/sec   34   72.1 KBytes       
[ 11]   8.00-9.00   sec  13.8 MBytes   115 Mbits/sec    5    158 KBytes       
[ 13]   8.00-9.00   sec  10.0 MBytes  83.9 Mbits/sec   68   67.9 KBytes       
[ 15]   8.00-9.00   sec  11.2 MBytes  94.4 Mbits/sec   58   65.0 KBytes       
[ 17]   8.00-9.00   sec  8.75 MBytes  73.4 Mbits/sec   33   65.0 KBytes       
[ 19]   8.00-9.00   sec  10.0 MBytes  83.9 Mbits/sec   19    105 KBytes       
[ 21]   8.00-9.00   sec  8.75 MBytes  73.4 Mbits/sec   30   58.0 KBytes       
[ 23]   8.00-9.00   sec  10.0 MBytes  83.9 Mbits/sec   40   76.4 KBytes       
[SUM]   8.00-9.00   sec   112 MBytes   944 Mbits/sec  353             
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   9.00-10.00  sec  12.5 MBytes   105 Mbits/sec   29    102 KBytes       
[  7]   9.00-10.00  sec  12.5 MBytes   105 Mbits/sec   57   89.1 KBytes       
[  9]   9.00-10.00  sec  10.0 MBytes  83.9 Mbits/sec   65   77.8 KBytes       
[ 11]   9.00-10.00  sec  13.8 MBytes   115 Mbits/sec   38   69.3 KBytes       
[ 13]   9.00-10.00  sec  12.5 MBytes   105 Mbits/sec   30   63.6 KBytes       
[ 15]   9.00-10.00  sec  10.0 MBytes  83.9 Mbits/sec   27   76.4 KBytes       
[ 17]   9.00-10.00  sec  10.0 MBytes  83.9 Mbits/sec   27    107 KBytes       
[ 19]   9.00-10.00  sec  16.2 MBytes   136 Mbits/sec   43    103 KBytes       
[ 21]   9.00-10.00  sec  10.0 MBytes  83.9 Mbits/sec   23   72.1 KBytes       
[ 23]   9.00-10.00  sec  10.0 MBytes  83.9 Mbits/sec   40   79.2 KBytes       
[SUM]   9.00-10.00  sec   118 MBytes   986 Mbits/sec  379             
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   140 MBytes   118 Mbits/sec  1744             sender
[  5]   0.00-10.01  sec   137 MBytes   115 Mbits/sec                  receiver
[  7]   0.00-10.00  sec   146 MBytes   122 Mbits/sec  2354             sender
[  7]   0.00-10.01  sec   142 MBytes   119 Mbits/sec                  receiver
[  9]   0.00-10.00  sec   136 MBytes   114 Mbits/sec  3125             sender
[  9]   0.00-10.01  sec   133 MBytes   112 Mbits/sec                  receiver
[ 11]   0.00-10.00  sec   111 MBytes  92.8 Mbits/sec  1271             sender
[ 11]   0.00-10.01  sec   107 MBytes  89.7 Mbits/sec                  receiver
[ 13]   0.00-10.00  sec   121 MBytes   101 Mbits/sec  2770             sender
[ 13]   0.00-10.01  sec   118 MBytes  98.7 Mbits/sec                  receiver
[ 15]   0.00-10.00  sec   112 MBytes  93.8 Mbits/sec  1777             sender
[ 15]   0.00-10.01  sec   109 MBytes  91.4 Mbits/sec                  receiver
[ 17]   0.00-10.00  sec   120 MBytes   101 Mbits/sec  1463             sender
[ 17]   0.00-10.01  sec   116 MBytes  97.4 Mbits/sec                  receiver
[ 19]   0.00-10.00  sec   110 MBytes  92.3 Mbits/sec  1384             sender
[ 19]   0.00-10.01  sec   107 MBytes  89.3 Mbits/sec                  receiver
[ 21]   0.00-10.00  sec   118 MBytes  99.0 Mbits/sec  1542             sender
[ 21]   0.00-10.01  sec   115 MBytes  96.1 Mbits/sec                  receiver
[ 23]   0.00-10.00  sec   127 MBytes   106 Mbits/sec  1644             sender
[ 23]   0.00-10.01  sec   124 MBytes   104 Mbits/sec                  receiver
[SUM]   0.00-10.00  sec  1.21 GBytes  1.04 Gbits/sec  19074             sender
[SUM]   0.00-10.01  sec  1.18 GBytes  1.01 Gbits/sec                  receiver

iperf Done.

iperf ingress results

[email protected]:~$ iperf3 -c speedtest.wtnet.de -p 5200 -P 10 -4 -R
Connecting to host speedtest.wtnet.de, port 5200
Reverse mode, remote host speedtest.wtnet.de is sending
[  5] local 10.0.0.130 port 45842 connected to 213.209.106.95 port 5200
[  7] local 10.0.0.130 port 45844 connected to 213.209.106.95 port 5200
[  9] local 10.0.0.130 port 45846 connected to 213.209.106.95 port 5200
[ 11] local 10.0.0.130 port 45848 connected to 213.209.106.95 port 5200
[ 13] local 10.0.0.130 port 45850 connected to 213.209.106.95 port 5200
[ 15] local 10.0.0.130 port 45852 connected to 213.209.106.95 port 5200
[ 17] local 10.0.0.130 port 45854 connected to 213.209.106.95 port 5200
[ 19] local 10.0.0.130 port 45856 connected to 213.209.106.95 port 5200
[ 21] local 10.0.0.130 port 45858 connected to 213.209.106.95 port 5200
[ 23] local 10.0.0.130 port 45860 connected to 213.209.106.95 port 5200
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   102 MBytes   854 Mbits/sec                  
[  7]   0.00-1.00   sec  17.3 MBytes   145 Mbits/sec                  
[  9]   0.00-1.00   sec  6.38 MBytes  53.5 Mbits/sec                  
[ 11]   0.00-1.00   sec  6.12 MBytes  51.3 Mbits/sec                  
[ 13]   0.00-1.00   sec  6.38 MBytes  53.5 Mbits/sec                  
[ 15]   0.00-1.00   sec  5.84 MBytes  49.0 Mbits/sec                  
[ 17]   0.00-1.00   sec  5.41 MBytes  45.4 Mbits/sec                  
[ 19]   0.00-1.00   sec  6.31 MBytes  52.9 Mbits/sec                  
[ 21]   0.00-1.00   sec  5.82 MBytes  48.8 Mbits/sec                  
[ 23]   0.00-1.00   sec  5.94 MBytes  49.8 Mbits/sec                  
[SUM]   0.00-1.00   sec   167 MBytes  1.40 Gbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   1.00-2.00   sec  14.3 MBytes   120 Mbits/sec                  
[  7]   1.00-2.00   sec  22.1 MBytes   185 Mbits/sec                  
[  9]   1.00-2.00   sec  11.5 MBytes  96.5 Mbits/sec                  
[ 11]   1.00-2.00   sec  9.54 MBytes  80.1 Mbits/sec                  
[ 13]   1.00-2.00   sec  9.46 MBytes  79.3 Mbits/sec                  
[ 15]   1.00-2.00   sec  7.94 MBytes  66.6 Mbits/sec                  
[ 17]   1.00-2.00   sec  7.42 MBytes  62.2 Mbits/sec                  
[ 19]   1.00-2.00   sec  9.59 MBytes  80.4 Mbits/sec                  
[ 21]   1.00-2.00   sec  13.2 MBytes   111 Mbits/sec                  
[ 23]   1.00-2.00   sec  9.74 MBytes  81.8 Mbits/sec                  
[SUM]   1.00-2.00   sec   115 MBytes   963 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   2.00-3.00   sec  8.18 MBytes  68.6 Mbits/sec                  
[  7]   2.00-3.00   sec  11.1 MBytes  92.8 Mbits/sec                  
[  9]   2.00-3.00   sec  14.9 MBytes   125 Mbits/sec                  
[ 11]   2.00-3.00   sec  15.1 MBytes   126 Mbits/sec                  
[ 13]   2.00-3.00   sec  10.8 MBytes  90.9 Mbits/sec                  
[ 15]   2.00-3.00   sec  8.65 MBytes  72.5 Mbits/sec                  
[ 17]   2.00-3.00   sec  10.9 MBytes  91.8 Mbits/sec                  
[ 19]   2.00-3.00   sec  11.5 MBytes  96.1 Mbits/sec                  
[ 21]   2.00-3.00   sec  13.2 MBytes   110 Mbits/sec                  
[ 23]   2.00-3.00   sec  10.5 MBytes  88.3 Mbits/sec                  
[SUM]   2.00-3.00   sec   115 MBytes   963 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   3.00-4.00   sec  12.1 MBytes   102 Mbits/sec                  
[  7]   3.00-4.00   sec  13.2 MBytes   110 Mbits/sec                  
[  9]   3.00-4.00   sec  11.0 MBytes  92.6 Mbits/sec                  
[ 11]   3.00-4.00   sec  13.0 MBytes   109 Mbits/sec                  
[ 13]   3.00-4.00   sec  11.6 MBytes  97.0 Mbits/sec                  
[ 15]   3.00-4.00   sec  10.2 MBytes  85.5 Mbits/sec                  
[ 17]   3.00-4.00   sec  10.4 MBytes  87.5 Mbits/sec                  
[ 19]   3.00-4.00   sec  8.71 MBytes  73.1 Mbits/sec                  
[ 21]   3.00-4.00   sec  14.7 MBytes   124 Mbits/sec                  
[ 23]   3.00-4.00   sec  9.66 MBytes  81.0 Mbits/sec                  
[SUM]   3.00-4.00   sec   115 MBytes   962 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   4.00-5.00   sec  13.8 MBytes   116 Mbits/sec                  
[  7]   4.00-5.00   sec  11.2 MBytes  94.0 Mbits/sec                  
[  9]   4.00-5.00   sec  8.76 MBytes  73.5 Mbits/sec                  
[ 11]   4.00-5.00   sec  11.6 MBytes  97.2 Mbits/sec                  
[ 13]   4.00-5.00   sec  14.9 MBytes   125 Mbits/sec                  
[ 15]   4.00-5.00   sec  9.05 MBytes  75.9 Mbits/sec                  
[ 17]   4.00-5.00   sec  12.4 MBytes   104 Mbits/sec                  
[ 19]   4.00-5.00   sec  9.99 MBytes  83.8 Mbits/sec                  
[ 21]   4.00-5.00   sec  13.8 MBytes   116 Mbits/sec                  
[ 23]   4.00-5.00   sec  10.3 MBytes  86.1 Mbits/sec                  
[SUM]   4.00-5.00   sec   116 MBytes   971 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   5.00-6.00   sec  13.3 MBytes   112 Mbits/sec                  
[  7]   5.00-6.00   sec  10.2 MBytes  85.5 Mbits/sec                  
[  9]   5.00-6.00   sec  12.2 MBytes   102 Mbits/sec                  
[ 11]   5.00-6.00   sec  11.2 MBytes  94.2 Mbits/sec                  
[ 13]   5.00-6.00   sec  16.0 MBytes   134 Mbits/sec                  
[ 15]   5.00-6.00   sec  8.12 MBytes  68.1 Mbits/sec                  
[ 17]   5.00-6.00   sec  10.1 MBytes  84.7 Mbits/sec                  
[ 19]   5.00-6.00   sec  11.7 MBytes  98.3 Mbits/sec                  
[ 21]   5.00-6.00   sec  11.4 MBytes  95.7 Mbits/sec                  
[ 23]   5.00-6.00   sec  10.9 MBytes  91.7 Mbits/sec                  
[SUM]   5.00-6.00   sec   115 MBytes   966 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   6.00-7.00   sec  16.5 MBytes   138 Mbits/sec                  
[  7]   6.00-7.00   sec  15.3 MBytes   128 Mbits/sec                  
[  9]   6.00-7.00   sec  10.8 MBytes  90.9 Mbits/sec                  
[ 11]   6.00-7.00   sec  7.67 MBytes  64.3 Mbits/sec                  
[ 13]   6.00-7.00   sec  8.88 MBytes  74.5 Mbits/sec                  
[ 15]   6.00-7.00   sec  9.65 MBytes  81.0 Mbits/sec                  
[ 17]   6.00-7.00   sec  8.26 MBytes  69.3 Mbits/sec                  
[ 19]   6.00-7.00   sec  12.8 MBytes   107 Mbits/sec                  
[ 21]   6.00-7.00   sec  15.8 MBytes   132 Mbits/sec                  
[ 23]   6.00-7.00   sec  8.70 MBytes  73.0 Mbits/sec                  
[SUM]   6.00-7.00   sec   114 MBytes   958 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   7.00-8.00   sec  8.85 MBytes  74.2 Mbits/sec                  
[  7]   7.00-8.00   sec  18.7 MBytes   157 Mbits/sec                  
[  9]   7.00-8.00   sec  7.53 MBytes  63.1 Mbits/sec                  
[ 11]   7.00-8.00   sec  9.67 MBytes  81.1 Mbits/sec                  
[ 13]   7.00-8.00   sec  5.62 MBytes  47.1 Mbits/sec                  
[ 15]   7.00-8.00   sec  14.6 MBytes   123 Mbits/sec                  
[ 17]   7.00-8.00   sec  10.7 MBytes  90.1 Mbits/sec                  
[ 19]   7.00-8.00   sec  10.6 MBytes  89.2 Mbits/sec                  
[ 21]   7.00-8.00   sec  22.3 MBytes   187 Mbits/sec                  
[ 23]   7.00-8.00   sec  6.36 MBytes  53.4 Mbits/sec                  
[SUM]   7.00-8.00   sec   115 MBytes   966 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   8.00-9.00   sec  13.8 MBytes   115 Mbits/sec                  
[  7]   8.00-9.00   sec  13.3 MBytes   111 Mbits/sec                  
[  9]   8.00-9.00   sec  9.93 MBytes  83.3 Mbits/sec                  
[ 11]   8.00-9.00   sec  13.6 MBytes   114 Mbits/sec                  
[ 13]   8.00-9.00   sec  8.48 MBytes  71.1 Mbits/sec                  
[ 15]   8.00-9.00   sec  13.7 MBytes   115 Mbits/sec                  
[ 17]   8.00-9.00   sec  12.6 MBytes   106 Mbits/sec                  
[ 19]   8.00-9.00   sec  8.90 MBytes  74.6 Mbits/sec                  
[ 21]   8.00-9.00   sec  11.4 MBytes  95.9 Mbits/sec                  
[ 23]   8.00-9.00   sec  10.1 MBytes  85.0 Mbits/sec                  
[SUM]   8.00-9.00   sec   116 MBytes   972 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   9.00-10.00  sec  15.4 MBytes   130 Mbits/sec                  
[  7]   9.00-10.00  sec  7.63 MBytes  64.0 Mbits/sec                  
[  9]   9.00-10.00  sec  9.52 MBytes  79.8 Mbits/sec                  
[ 11]   9.00-10.00  sec  18.8 MBytes   158 Mbits/sec                  
[ 13]   9.00-10.00  sec  16.5 MBytes   138 Mbits/sec                  
[ 15]   9.00-10.00  sec  8.81 MBytes  73.9 Mbits/sec                  
[ 17]   9.00-10.00  sec  8.84 MBytes  74.1 Mbits/sec                  
[ 19]   9.00-10.00  sec  10.9 MBytes  91.7 Mbits/sec                  
[ 21]   9.00-10.00  sec  7.89 MBytes  66.1 Mbits/sec                  
[ 23]   9.00-10.00  sec  9.79 MBytes  82.0 Mbits/sec                  
[SUM]   9.00-10.00  sec   114 MBytes   957 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.01  sec   221 MBytes   186 Mbits/sec  1160             sender
[  5]   0.00-10.00  sec   218 MBytes   183 Mbits/sec                  receiver
[  7]   0.00-10.01  sec   143 MBytes   119 Mbits/sec  990             sender
[  7]   0.00-10.00  sec   140 MBytes   117 Mbits/sec                  receiver
[  9]   0.00-10.01  sec   106 MBytes  88.5 Mbits/sec  430             sender
[  9]   0.00-10.00  sec   103 MBytes  86.0 Mbits/sec                  receiver
[ 11]   0.00-10.01  sec   120 MBytes   101 Mbits/sec  378             sender
[ 11]   0.00-10.00  sec   116 MBytes  97.6 Mbits/sec                  receiver
[ 13]   0.00-10.01  sec   112 MBytes  93.6 Mbits/sec  555             sender
[ 13]   0.00-10.00  sec   109 MBytes  91.1 Mbits/sec                  receiver
[ 15]   0.00-10.01  sec  99.5 MBytes  83.4 Mbits/sec  470             sender
[ 15]   0.00-10.00  sec  96.6 MBytes  81.1 Mbits/sec                  receiver
[ 17]   0.00-10.01  sec  99.7 MBytes  83.6 Mbits/sec  496             sender
[ 17]   0.00-10.00  sec  97.2 MBytes  81.5 Mbits/sec                  receiver
[ 19]   0.00-10.01  sec   103 MBytes  86.6 Mbits/sec  449             sender
[ 19]   0.00-10.00  sec   101 MBytes  84.7 Mbits/sec                  receiver
[ 21]   0.00-10.01  sec   133 MBytes   111 Mbits/sec  465             sender
[ 21]   0.00-10.00  sec   130 MBytes   109 Mbits/sec                  receiver
[ 23]   0.00-10.01  sec  94.1 MBytes  78.9 Mbits/sec  426             sender
[ 23]   0.00-10.00  sec  92.0 MBytes  77.2 Mbits/sec                  receiver
[SUM]   0.00-10.01  sec  1.20 GBytes  1.03 Gbits/sec  5819             sender
[SUM]   0.00-10.00  sec  1.17 GBytes  1.01 Gbits/sec                  receiver

iperf Done.
u

 

Posted by Uli Köhler in Networking

How to fix Oracle cloud Create Instance: Can’t select Ubuntu image

When I was trying to create a Oracle Cloud instance using Chrome, when I selected the Ubuntu image, the select image dialog closed and the image did not get selected.

However, the solution is simple: Use Firefox to create the instance. After that, you can continue to work with the instance using Chrome.

Posted by Uli Köhler in Cloud

LIRC Setup for Raspberry Pi (Receiver)

Quite simple. Just install it using

sudo apt-get install lirc

Update /boot/config.txt with dtoverlay=gpio-ir,gpio_pin=18

To use lirc in “default” mode (the default mode after installation is “devinput” mode) modify by sudo nano /etc/lirc/lirc_options.conf.

Change to driver = default

BTW: My first post on this blog 🙂

Posted by Tobias Gutmann in Raspberry Pi

NodeJS MQTT minimal subscribe example with JSON messages

const mqtt = require('mqtt')
const client = mqtt.connect('mqtt://user:[email protected]')

client.on('connect', () => {
  client.subscribe('mytopic');
})

client.on('message', (topic, message) => {
  console.log(topic, JSON.parse(message))
})

If required, you can install the mqtt library using

npm i --save mqtt

 

Posted by Uli Köhler in Javascript, MQTT, NodeJS

How to fix Homeassistant “403: forbidden” on login

When Homeassistant shows you 403: forbidden instead of the login prompt, the most likely cause is that your user got banned due to too many failed login attempts.

Edit configuration.yaml and set

login_attempts_threshold: 100

from the default 5, which should unban you. You might also need to configure the trusted_proxies to contain the IP of a reverse proxy server (typically running on 127.0.0.1). If that does not help, disable the IP ban entirely. This is a complete configuration.yml http section that works:

http:
  use_x_forwarded_for: true
  trusted_proxies:
  - 127.0.0.1
  ip_ban_enabled: false
  login_attempts_threshold: 500

 

Posted by Uli Köhler in Home-Assistant

How long does portMAX_DELAY actually wait in FreeRTOS?

Although portMAX_DELAY is listed as value for waiting indefinitely, it will only actually wait indefinitely if INCLUDE_vTaskSuspend is enabled in the FreeRTOS config.

portMAX_DELAY is typically defined as 0xFFFFFFFF i.e. 2^32-1:

#define portMAX_DELAY ( TickType_t ) 0xffffffffUL

(however if 16 bit ticks are enabled using configUSE_16_BIT_TICKS it will be defined as 0xFFFF (2^16-1).

In case INCLUDE_vTaskSuspend is enabled, this is treated as a special value and will actually wait indefinitely. If INCLUDE_vTaskSuspend is not defined, it will only wait for 0xFFFFFFFF ticks (assuming 32-bit system ticks.

In other words, this will wait for only about 7 weeks if FreeRTOS is defined to tick every millisecond.

Posted by Uli Köhler in Embedded, FreeRTOS

How to fix ArduinoJSON: error: ‘DynamicJSONDocument’ was not declared in this scope

Problem:

While trying to compile your project, you see an error message like

error: 'DynamicJSONDocument' was not declared in this scope

Solution:

The Json in DynamicJsonDocument must be spelled camel case: Json, not JSON! The correct spelling is DynamicJsonDocument.

If that does not help, ensure

#include <ArduinoJson.h>

is at the top of the file where the error occurs.

Posted by Uli Köhler in C/C++

How to fix PlatformIO ArduinoJSON .pio/libdeps/ESP32/ArduinoJson/src/ArduinoJson/Variant/ConverterImpl.hpp:43:5: error: static assertion failed: To use 64-bit integers with ArduinoJson, you must set ARDUINOJSON_USE_LONG_LONG to 1

Problem:

While trying to compile your PlatformIO project, you see an error message like

.pio/libdeps/ESP32/ArduinoJson/src/ArduinoJson/Variant/ConverterImpl.hpp:43:5: error: static assertion failed: To use 64-bit integers with ArduinoJson, you must set ARDUINOJSON_USE_LONG_LONG to 1. See https://arduinojson.org/v6/api/config/use_long_long/
     ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from .pio/libdeps/ESP32/ArduinoJson/src/ArduinoJson.hpp:30,
                 from .pio/libdeps/ESP32/ArduinoJson/src/ArduinoJson.h:9,
                 from include/MQTT/StatusMessage.hpp:2,
                 from src/MQTT/StatusMessage.cpp:1:
.pio/libdeps/ESP32/ArduinoJson/src/ArduinoJson/Variant/ConverterImpl.hpp: In instantiation of 'static void ArduinoJson6185_1::Converter<T, Enable>::toJson(const T&, ArduinoJson6185_1::VariantRef) [with T = long long int (*)(); Enable = void]':
.pio/libdeps/ESP32/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:98:27:   required from 'bool ArduinoJson6185_1::VariantRef::set(T*) const [with T = long long int()]'
.pio/libdeps/ESP32/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp:58:5:   required from 'ArduinoJson6185_1::MemberProxy<TParent, TStringRef>::this_type& ArduinoJson6185_1::MemberProxy<TParent, TStringRef>::operator=(TChar*) [with TChar = long long int(); TObject = ArduinoJson6185_1::JsonDocument&; TStringRef = const char*; ArduinoJson6185_1::MemberProxy<TParent, TStringRef>::this_type = ArduinoJson6185_1::MemberProxy<ArduinoJson6185_1::JsonDocument&, const char*>]'

Solution

Add -DARDUINOJSON_USE_LONG_LONG=1 to the build_flags in platformio.ini. If build_flags does not exist in platformio.ini, create it after [env:...]

build_flags = -DARDUINOJSON_USE_LONG_LONG=1

 

Posted by Uli Köhler in Arduino, Electronics, ESP8266/ESP32, PlatformIO

How I fixed docker panic: assertion failed: write: circular dependency occurred

Problem:

When starting docker on a VM that got suddenly turned off before during a power outage, the docker daemon failed to start up with the following error log:

Jan 05 15:15:14 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:14.946815577Z" level=info msg="Starting up" 
Jan 05 15:15:14 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:14.947842629Z" level=info msg="detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf" 
Jan 05 15:15:14 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:14.949500623Z" level=info msg="parsed scheme: \"unix\"" module=grpc
Jan 05 15:15:14 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:14.949617127Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Jan 05 15:15:14 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:14.949705114Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}" module=grpc
Jan 05 15:15:14 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:14.949776371Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Jan 05 15:15:14 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:14.950747679Z" level=info msg="parsed scheme: \"unix\"" module=grpc
Jan 05 15:15:14 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:14.950788173Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Jan 05 15:15:14 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:14.950806216Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}" module=grpc
Jan 05 15:15:14 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:14.950815090Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:15.012683899Z" level=info msg="[graphdriver] using prior storage driver: overlay2" 
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:15.027806434Z" level=warning msg="Docker could not enable SELinux on the host system" 
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:15.176098505Z" level=info msg="Loading containers: start." 
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: time="2022-01-05T15:15:15.728503609Z" level=info msg="Removing stale sandbox 22e03a9f65217fa0ce1603fa1d6326b7bf412777be94e930b02dbe6554549084 (154aa4bd403045e229b39cc4dda1d16a72b45d18671cab7c993bff4eaee9c2c9)" 
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: panic: assertion failed: write: circular dependency occurred
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: goroutine 1 [running]:
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/go.etcd.io/bbolt._assert(...)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/db.go:1172
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/go.etcd.io/bbolt.(*node).write(0xc0001e16c0, 0xc001381000)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/node.go:233 +0x3c5
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/go.etcd.io/bbolt.(*node).spill(0xc0001e16c0, 0xc0012da078, 0x1)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/node.go:374 +0x225
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/go.etcd.io/bbolt.(*node).spill(0xc0001e1650, 0xc000fefaa0, 0xc000d9dc50)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/node.go:346 +0xbc
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/go.etcd.io/bbolt.(*Bucket).spill(0xc000d6f180, 0xc000fefa00, 0xc000d9de40)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/bucket.go:570 +0x49a
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/go.etcd.io/bbolt.(*Bucket).spill(0xc000fca2b8, 0x310b759f, 0x55dfe7bf17e0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/bucket.go:537 +0x3f6
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/go.etcd.io/bbolt.(*Tx).Commit(0xc000fca2a0, 0x0, 0x0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/tx.go:160 +0xe8
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/go.etcd.io/bbolt.(*DB).Update(0xc000d6bc00, 0xc000d9e078, 0x0, 0x0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/db.go:701 +0x105
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/docker/libkv/store/boltdb.(*BoltDB).AtomicPut(0xc000a862d0, 0xc000fd32d0, 0x65, 0xc000d46300, 0x179, 0x180, 0xc000fef890, 0x0, 0x55dfe5407900, 0x0, ...)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/docker/libkv/store/boltdb/boltdb.go:371 +0x225
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/docker/libnetwork/datastore.(*datastore).PutObjectAtomic(0xc000c3bbc0, 0x55dfe6bd1398, 0xc000efad20, 0x0, 0x0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/docker/libnetwork/datastore/datastore.go:415 +0x3ca
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/docker/libnetwork/drivers/bridge.(*driver).storeUpdate(0xc0000c3c00, 0x55dfe6bd1398, 0xc000efad20, 0x0, 0x0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/docker/libnetwork/drivers/bridge/bridge_store.go:106 +0x6e
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/docker/libnetwork/drivers/bridge.(*driver).RevokeExternalConnectivity(0xc0000c3c00, 0xc000f19d80, 0x40, 0xc00111c300, 0x40, 0x0, 0x0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/docker/libnetwork/drivers/bridge/bridge.go:1405 +0x1f1
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/docker/libnetwork.(*endpoint).sbLeave(0xc000d41e40, 0xc000f63200, 0x1, 0x0, 0x0, 0x0, 0x0, 0xc001b91ce0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/docker/libnetwork/endpoint.go:751 +0x1326
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/docker/libnetwork.(*endpoint).Delete(0xc000d41b80, 0xc000f19d01, 0x0, 0x0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/docker/libnetwork/endpoint.go:842 +0x374
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/docker/libnetwork.(*sandbox).delete(0xc000f63200, 0x1, 0x55dfe61ee216, 0x1e)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/docker/libnetwork/sandbox.go:229 +0x191
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/docker/libnetwork.(*controller).sandboxCleanup(0xc000432a00, 0x0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/docker/libnetwork/sandbox_store.go:278 +0xdae
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/docker/libnetwork.New(0xc0000c3b80, 0x9, 0x10, 0xc000878090, 0xc001e69e60, 0xc0000c3b80, 0x9)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/docker/libnetwork/controller.go:248 +0x726
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/daemon.(*Daemon).initNetworkController(0xc00000c1e0, 0xc00021a000, 0xc001e69e60, 0xc000151270, 0xc00000c1e0, 0xc000686a10, 0xc001e69e60)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/daemon/daemon_unix.go:855 +0xac
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/daemon.(*Daemon).restore(0xc00000c1e0, 0xc00045c4c0, 0xc00023e2a0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/daemon/daemon.go:490 +0x52c
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/daemon.NewDaemon(0x55dfe6bad710, 0xc00045c4c0, 0xc00021a000, 0xc000878090, 0x0, 0x0, 0x0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/daemon/daemon.go:1150 +0x2c1d
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: main.(*DaemonCli).start(0xc000b62720, 0xc00009a8a0, 0x0, 0x0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/cmd/dockerd/daemon.go:195 +0x785
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: main.runDaemon(...)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/cmd/dockerd/docker_unix.go:13
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: main.newDaemonCommand.func1(0xc0000bc2c0, 0xc0000b2000, 0x0, 0xc, 0x0, 0x0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/cmd/dockerd/docker.go:34 +0x7d
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/spf13/cobra.(*Command).execute(0xc0000bc2c0, 0xc00011caa0, 0xc, 0xc, 0xc0000bc2c0, 0xc00011caa0)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:850 +0x472
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc0000bc2c0, 0x0, 0x0, 0x10)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:958 +0x375
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: github.com/docker/docker/vendor/github.com/spf13/cobra.(*Command).Execute(...)
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:895
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]: main.main()
Jan 05 15:15:15 CoreOS-Haar dockerd[5333]:         /builddir/build/BUILD/moby-20.10.11/src/github.com/docker/docker/cmd/dockerd/docker.go:97 +0x185
Jan 05 15:15:15 CoreOS-Haar systemd[1]: docker.service: Main process exited, code=exited, status=2/INVALIDARGUMENT

Solution:

First, try moving /var/lib/docker/network/files/local-kv.db:

sudo mv /var/lib/docker/network/files/local-kv.db /opt/old-docker-local-kv.db

and then restarting docker using e.g. sudo systemctl restart docker, which worked for many users on GitHub.

Only if that does not work, try the following brute-force method!

Move the /var/lib/docker directory to a new location for backup, after which docker was able to start up again:

sudo mv /var/lib/docker /opt/old-var-lib-docker

This is a pretty brute-force method of doing that but for me it worked totally fine since my setup did not use volumes but local directories. In case you are actively using volumes, you might need to restore the volumes from /opt/old-var-lib-docker manually!

 

Posted by Uli Köhler in Container, Docker

What 6-pin connector do NEMA23 stepper motors use?

There are multiple different types of connectors for NEMA23 stepper motors. This is one of them.

A typical connector for NEMA23 stepper motors such as the Nanotec SCA5618X2804-A is the JST B6P-VH (part number of the male connector on the motor, source: NanoTec datasheet).

The corresponding mating connector is the JST VHR-6N, the series of connectors is being called JST VH. The pitch is 3.96mm.

The crimp contacts part numbers are (source: datasheet):

  • SVH-21T-P1.1 for 0.33mm² to 0.88mm²
  • SVH-41T-P1.1 for 0.5mm² to 1.25mm²

Posted by Uli Köhler in 3D printing

How to encode UHD 4K video from camera for DaVinci Resolve input using ffmpeg

I use this command to convert the video from my phone (in UHD / 4K) for use as input Media in DaVinci Resolve using the DNxHR codec.

ffmpeg -i input.mp4 -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p -r 30000/1001 -profile:v dnxhr_hq output.mov

Note that the DNxHR files are huuuuuuge, around 10GB per minute even for some rather uncomplicated video! However, encoding is pretty fast (around 0.5x real-time on my computer) and you won’t really lose any significant amount of quality in this video type.

This shell script will batch-encode all .mp4 files in the current folder to DNxHR

for i in *.mp4 ; do ffmpeg -i $i -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p -r 30000/1001 -profile:v dnxhr_hq ${i}.mov ; done

 

Posted by Uli Köhler in Audio/Video