ZRAM install fails

Tags: #<Tag:0x00007f616dc34670>
  • Platform information:
    • Hardware: Raspberry Pi4 4GB SD:16GB
    • Openhabian 1.6-alpha (openhabian-pi-raspios32-202007302224-git0290f04-crcd2852e99.img.xz)
  • Flashed the zip file onto the SD
  • Enabled WiFi
  • Started the Pi4 with the SD
  • Logon using SSH
  • Install seems to have been successful except for the ZRAM.
    (first-boot.log ends with First time setup successfully finished. OpenHAB is running, installed some bindings (Z-Wave, …), Z-Wave controller is online).
  • I tried to enable ZRAM using openhabian-config:
    select 30 (system settings)
    select 38 (use ZRAM)
    results in error:
	 There was an error or interruption during the execution of:                  │
   │   "30 | System Settings"                                                     │
   │                                                                              │
   │ Please try again. If the error persists, please read                         │
   │ /opt/openhabian/docs/openhabian-DEBUG.md or                                  │
   │ https://github.com/openhab/openhabian/blob/master/docs/openhabian-DEBUG.md   │
   │ how to proceed.

However, I noticed some failures in first-boot.log (extracts below):

...
2020-09-10_13:08:40_BST [openHABian] Updating repositories and upgrading installed packages... 2020-09-10_13:08:42_BST [openHABian] Installing git package... FAILED
2020-09-10_13:08:42_BST [openHABian] Updating myself from https://github.com/openhab/openhabian, stable branch... FAILED
2020-09-10_13:08:42_BST [openHABian] The git repository on the public internet is not reachable.
2020-09-10_13:08:43_BST [openHABian] We will continue trying to get your system installed, but this is not guaranteed to work.
2020-09-10_13:08:43_BST [openHABian] Starting execution of 'openhabian-config unattended'... OK
...
2020-09-10_14:21:17_CEST [openHABian] Installing ZRAM... FAILED
...
2020-09-10_14:21:41_CEST [openHABian] Execution of 'openhabian-config unattended' completed.
...
2020-09-10_14:21:41_CEST [openHABian] First time setup successfully finished. Rebooting your system!

I ran dmesg and also noticed some errors there (extracts below):

simple-framebuffer: probe of 0.framebuffer failed with error -12
vc_vchi_sm_init: failed to open VCHI service (-1)
[vc_sm_connected_init]: failed to initialize shared memory service
mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
...
some more 'failed to open VCHI service (-1)' occur
...
brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt failed with error -2
bcmgenet: Skipping UMAC reset
brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Mar 23 2020 02:19:54 version 7.45.206 (r725000 CY) FWID 01-88ee44ea
brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
usb usb2-port1: Cannot enable. Maybe the USB cable is bad?
ICMPv6: process `dhcpcd' is using deprecated sysctl (syscall) net.ipv6.neigh.wlan0.retrans_time - use net.ipv6.neigh.wlan0.retrans_time_ms instead

My knowledge of Linux is only basic so I can’t tell if any of these errors are significant. Neither do I know how to proceed - or get more info why the ZRAM install fails.

What openHAB version? ZRAM does not currently work with OH3 as far as I am aware.

1.6-alpha installed OpenHAB2 version 2.5.8.
That is also what I preferred since I started experimenting with OpenHAB some months ago on my Windows PC and I am using that version there as well.
Since I am very pleased with the functionality and operation of OH, I decided to give OH its own platform, the RPi4 and plan to move the Windows try-out there.
According to the documentation this alpha should have enabled ZRAM by default upon installation (this can can also be seen in the first-boot log where it tries to install it but fails)

No internet no ZRAM code download.
Fix your Internet and reinstall, then if that does not work move on with the debug guide.

I could connect my Windows PC with the RPi (using WiFi) during the installation. Of course, this is the local web, but I assume that when my router assigned the Rpi an IP address, it also allows it to connect to the internet.
I now tried to ping a website with the RPi and that responded normally.

I also looked around a bit and found the log file /var/log/daemon.log. In that file I found some more details:

Sep 10 13:21:30 openhab systemd[1]: Starting zram-config...
Sep 10 13:21:30 openhab systemd[15610]: zram-config.service: Executable /usr/local/sbin/zramsync missing, skipping: No such file or directory
Sep 10 13:21:30 openhab systemd[15611]: zram-config.service: Failed to execute command: No such file or directory
Sep 10 13:21:30 openhab systemd[15611]: zram-config.service: Failed at step EXEC spawning /usr/local/sbin/zram-config: No such file or directory
Sep 10 13:21:30 openhab systemd[1]: zram-config.service: Main process exited, code=exited, status=203/EXEC
Sep 10 13:21:30 openhab systemd[1]: zram-config.service: Failed with result 'exit-code'.
Sep 10 13:21:30 openhab systemd[1]: Failed to start zram-config.
Sep 10 13:21:30 openhab first-boot.bash[556]: 2020-09-10_14:21:17_CEST [openHABian] Installing ZRAM... FAILED

The missing file can be related to a failing internet access, but I didn’t do anything to get the ‘ping’ working. The only thing I can think of is that the router took some time to allow the new RPi access to the internet

But in first-boot.log I see:
2020-05-27_08:25:58_BST [openHABian] Setting up Wi-Fi connection… OK
2020-05-27_08:26:03_BST [openHABian] Ensuring network connectivity… OK
and almost one minute later:
2020-05-27_08:26:44_BST [openHABian] Waiting for dpkg/apt to get ready… OK
2020-09-10_13:08:40_BST [openHABian] Updating repositories and upgrading installed packages… 2020-09-10_13:08:42_BST [openHABian] Installing git package… FAILED
and at that moment it also has updated the the timestamp in the log, I assume it got the correct date/time from internet? And almost one minute should be enough for the router to allow the RPi access to the internet?

I can try to re-install but prefer to be reasonably sure before spending time doing so.
With this extra information, do you still think the internet connection is probably causing it?

Yes. More specifically I assume a DNS related problem.
Can you also ping hostnames ?

See also [ Solved ] Openhabian : Won't install .. git repository on the public internet is not reachable

I only have basic knowledge about networks, so it took some time to further investigate the problem.
My local network has about a dozen of devices (PC, phones, tablet, NAS, AV receiver, TV, …) and all of them can update and/or access the network without problems. I didn’t have to do anything at my router to get them working, just connect the ethernet cable or connect with the Wifi password.
I can’t even change anything when the router is configured as WAN: Auto (DHCP). I only can change it to static IP and then I can set the individual fields, but my provider does not issue a static IP.
The solution using the Google DNS in the forum link is therefore no option for me (I wouldn’t want it anyway since I try to keep Google out of my systems as much as possible).

So, I suspect the RPi OS or the installation procedure to have a problem. Trying to pinpoint the problem I did following steps before attempting a fresh installation:

I checked /etc/resolv.conf:

# Generated by resolvconf
search telenet.be
nameserver 192.168.71.1				-> my local DNS server (router)
nameserver 2a02:1810:2d07:9b00::1	-> my IPv6 DNS server (router)

I can ping any website, I can ping my local devices using their hostname.local, I can ssh from my PC using openhab.local : none of these indicate a DNS problem.

I installed dnsutils (sudo apt-get install dnsutils) -> install OK

‘dig github.com’ result:

;; ANSWER SECTION:
github.com.             51      IN      A       140.82.121.3

;; Query time: 143 msec
;; SERVER: 192.168.71.1#53(192.168.71.1)	-> my router IPv4 DNS
;; WHEN: Mon Sep 14 12:41:35 CEST 2020
;; MSG SIZE  rcvd: 55

‘dig @2a02:1810:2d07:9b00::1 github.com’ result (using the IPv6 router DNS):

github.com.             36      IN      A       140.82.121.4

;; Query time: 20 msec
;; SERVER: 2a02:1810:2d07:9b00::1#53(2a02:1810:2d07:9b00::1)
;; WHEN: Mon Sep 14 12:45:50 CEST 2020
;; MSG SIZE  rcvd: 55

I tried a website which I am certain is not in the cache, which gave the result (I list only the relevant lines below):
‘dig +trace www.gent.be’

.                       29431   IN      NS      f.root-servers.net.
be.                     172800  IN      NS      a.ns.dns.be.
gent.be.                86400   IN      NS      ns3.european-server.com.
www.gent.be.            3600    IN      CNAME   erebus.gent.be.
erebus.gent.be.         3600    IN      A       212.123.24.4
;; Received 77 bytes from 83.217.73.172#53(ns3.european-server.com) in 21 ms

The command
wget -O ./test https://github.com/openhab/openhabian.git
also downloads the file from the web.
Lots of packages that are needed get downloaded too.
So the only problem seems to be the access to the git/github server. All other internet accesses load normally.
I did a fresh install, this time with debug on.
I do notice that the failing access is shortly after a reboot and a little later after the failing access a router advertisement follows, as can be seen in this part of the first-boot.log file

May 27 08:26:34 openhab systemd[1]: Startup finished in 1.015s (kernel) + 17.157s (userspace) = 18.173s.
May 27 08:26:39 openhab first-boot.bash[554]: 2020-05-27_08:26:39_BST [openHABian] Starting the openHABian initial setup.
May 27 08:26:39 openhab dhcpcd[552]: wlan0: fe80::f227:45ff:fe03:b331 is reachable again
May 27 08:26:39 openhab dhcpcd[552]: wlan0: fe80::f227:45ff:fe03:b331 is reachable again
May 27 08:26:39 openhab first-boot.bash[554]: 2020-05-27_08:26:39_BST [openHABian] Storing configuration... OK
May 27 08:26:44 openhab first-boot.bash[554]: 2020-05-27_08:26:39_BST [openHABian] Starting webserver with installation log... OK
May 27 08:26:44 openhab first-boot.bash[554]: 2020-05-27_08:26:44_BST [openHABian] Changing default username and password... SKIPPED
May 27 08:26:48 openhab first-boot.bash[554]: 2020-05-27_08:26:44_BST [openHABian] Setting up Wi-Fi connection... OK
May 27 08:26:49 openhab first-boot.bash[554]: executing ping -c1 www.example.com &> /dev/null || curl --silent --head http://www.exa
mple.com |& grep -qs 'HTTP/1.1 200 OK' #033[39;49;00m
May 27 08:26:49 openhab first-boot.bash[554]: OK
May 27 08:26:50 openhab systemd[1]: systemd-fsckd.service: Succeeded.
Sep 14 15:42:22 openhab systemd[1]: Starting Daily man-db regeneration...
Sep 14 15:42:22 openhab systemd[1]: Starting Rotate log files...
Sep 14 15:42:22 openhab systemd[1]: Starting Daily apt download activities...
Sep 14 15:42:23 openhab systemd[1]: logrotate.service: Succeeded.
Sep 14 15:42:23 openhab systemd[1]: Started Rotate log files.
Sep 14 15:42:25 openhab systemd[1]: man-db.service: Succeeded.
Sep 14 15:42:25 openhab systemd[1]: Started Daily man-db regeneration.
Sep 14 15:42:26 openhab first-boot.bash[554]: 2020-05-27_08:26:49_BST [openHABian] Waiting for dpkg/apt to get ready... OK
Sep 14 15:42:29 openhab first-boot.bash[554]: 2020-09-14_15:42:26_BST [openHABian] Updating repositories and upgrading installed packages... 2020-09-14_15:42:29_BST [openHABian] Installing git package... FAILED
Sep 14 15:42:29 openhab first-boot.bash[554]: 2020-09-14_15:42:29_BST [openHABian] Updating myself from https://github.com/openhab/openhabian, stable branch... FAILED
Sep 14 15:42:29 openhab first-boot.bash[554]: 2020-09-14_15:42:29_BST [openHABian] The git repository on the public internet is not reachable.
Sep 14 15:42:29 openhab first-boot.bash[554]: 2020-09-14_15:42:29_BST [openHABian] We will continue trying to get your system installed, but this is not guaranteed to work.
Sep 14 15:42:29 openhab first-boot.bash[554]: 2020-09-14_15:42:29_BST [openHABian] Starting execution of 'openhabian-config unattended'... OK
Sep 14 15:42:29 openhab systemd[1]: systemd-hostnamed.service: Succeeded.
Sep 14 15:42:30 openhab systemd[1]: apt-daily.service: Succeeded.
Sep 14 15:42:30 openhab systemd[1]: Started Daily apt download activities.
Sep 14 15:42:30 openhab systemd[1]: Starting Daily apt upgrade and clean activities...
Sep 14 15:42:30 openhab first-boot.bash[554]: 2020-09-14_15:42:30_BST [openHABian] Checking for root privileges... OK
Sep 14 15:42:33 openhab systemd[1]: apt-daily-upgrade.service: Succeeded.
Sep 14 15:42:33 openhab systemd[1]: Started Daily apt upgrade and clean activities.
Sep 14 15:42:35 openhab dhcpcd[552]: wlan0: Router Advertisement from fe80::f227:45ff:fe03:b331

After that, not one internet access fails anymore. Could it be that the Wifi was not yet fully functional at the time of the failing access?
Another thing I noticed is that my router logs a tracking protection block for the RPi (but I cannot see details). I wouldn’t think that git or github has a tracker that is flagged as unwanted by security companies (I have a router from F-Secure)

Are there any logs I can check to get more information on what precisely happens with the github access?

set debugmode=maximum as per debug guide.
You can also edit /boot/first-boot.bash and insert some diagnostics there.

Did you try to boot with Ethernet connected ? If that worked it could be about WiFi being “too late”.
Either way you should go with Ethernet long term anyway for sake of reliability.

I did some more digging into the code and noticed some errors in the first-boot.bash file.

In the next statements (line 181) the return code is incorrectly handled (success returns 0)

if ! dpkg -s 'git' &> /dev/null; then
  echo -n "$(timestamp) [openHABian] Installing git package... "
  if apt-get install --yes git &> /dev/null; then echo "OK"; else echo "FAILED"; fi
fi

If dpkg returns 0 (success, git exists), the if statements are executed
Then apt-get also installs git and if it succeeds it returns zero and will indicate FAILED.
If no dpkg git exists, git will not be installed with the code above and there will be no success/failed indication.
The code should probably be:

if dpkg -s 'git' &> /dev/null; then
  echo -n "$(timestamp) [openHABian] Installing git package... "
  if ! apt-get install --yes git &> /dev/null; then echo "OK"; else echo "FAILED"; fi
fi

so that the apt-get only gets executed if git is not yet installed with dpkg (I assume that is the intention)
but when a git install is needed and apt-get succeeds (returns 0) it should certainly echo OK

Likewise the following code also has the same problem (line 188): if openhabian_update succeeds it returns 0 and prints executes the FAILED message

type openhabian_update &> /dev/null && if ! openhabian_update &> /dev/null; then
  echo "FAILED"
  echo "$(timestamp) [openHABian] The git repository on the public internet is not reachable."
  echo "$(timestamp) [openHABian] We will continue trying to get your system installed, but this is not guaranteed to work."
else
  echo "OK"
fi

The correct code should be (to avoid confusion using the indentation shown and I would also suggest to run the function call with no redirection so that the echoes in there end up in the log):

type openhabian_update &> /dev/null && \
  if openhabian_update; then
    echo "FAILED"
    echo "$(timestamp) [openHABian] The git repository on the public internet is not reachable."
    echo "$(timestamp) [openHABian] We will continue trying to get your system installed, but this is not guaranteed to work."
  else
    echo "OK"
  fi

Now when openhabian_update returns 0 (success), it will print OK.
Note that when the openhabian_update function is not present nothing at all happens or is printed since the if statement will not be executed at all.

Returning to my original ZRAM problem, the only way I can have received FAILED on both parts in the erroneous first-boot.bash code is when dpkg returned zero (git was already installed) and the openhabian_update function was present and after execution returned success (0).
So actually git was present, openhabian_update succeeded and the install was largely successful, except for the problem with the ZRAM installation.

The first-boot.log file shows that the modules get loaded but the service ‘zram-config.service’ could not be started.

2020-09-14_16:55:17_CEST [openHABian] Installing ZRAM code... 
e[90;01m$ mkdir -p /opt/zram e[39;49;00m

e[90;01m$ git clone https://github.com/kmxz/overlayfs-tools /opt/zram/overlayfs-tools e[39;49;00m
Cloning into '/opt/zram/overlayfs-tools'...

e[90;01m$ git clone https://github.com/mstormi/openhabian-zram /opt/zram/openhabian-zram e[39;49;00m
Cloning into '/opt/zram/openhabian-zram'...
OK
2020-09-14_16:55:20_CEST [openHABian] Setting up OverlayFS... 
e[90;01m$ make --always-make --directory=/opt/zram/overlayfs-tools e[39;49;00m
make: Entering directory '/opt/zram/overlayfs-tools'
gcc -Wall -std=c99 -c main.c
gcc -Wall -std=c99 -c logic.c
gcc -Wall -std=c99 -c sh.c
gcc -lm main.o logic.o sh.o -o overlay
make: Leaving directory '/opt/zram/overlayfs-tools'

e[90;01m$ install -m 755 /opt/zram/overlayfs-tools/overlay /usr/local/lib/zram-config/overlay e[39;49;00m
OK
2020-09-14_16:55:23_CEST [openHABian] Setting up ZRAM... 
e[90;01m$ install -m 644 /opt/openhabian/includes/ztab /etc/ztab e[39;49;00m

e[90;01m$ install -m 644 /opt/zram/openhabian-zram/ro-root.sh /usr/local/share/zram-config/ro-root.sh e[39;49;00m

e[90;01m$ install -m 644 /opt/zram/openhabian-zram/zram-config.logrotate /etc/logrotate.d/zram-config e[39;49;00m
OK
2020-09-14_16:55:23_CEST [openHABian] Setting up ZRAM service... 
e[90;01m$ install -m 644 /opt/zram/openhabian-zram/zram-config.service /etc/systemd/system/zram-config.service e[39;49;00m

e[90;01m$ systemctl enable zram-config.service e[39;49;00m
Created symlink /etc/systemd/system/basic.target.wants/zram-config.service → /etc/systemd/system/zram-config.service.

e[90;01m$ systemctl restart zram-config.service e[39;49;00m
Job for zram-config.service failed because the control process exited with error code.
See "systemctl status zram-config.service" and "journalctl -xe" for details.
FAILED (restart service)
FAILED

Looking into the daemon.log file more info is revealed:

Sep 14 15:55:17 openhab first-boot.bash[554]: 2020-09-14_16:55:17_CEST [openHABian] Installing ZRAM code...
Sep 14 15:55:17 openhab first-boot.bash[554]: #033[90;01m$ mkdir -p /opt/zram #033[39;49;00m
Sep 14 15:55:17 openhab first-boot.bash[554]: #033[90;01m$ git clone https://github.com/kmxz/overlayfs-tools /opt/zram/overlayfs-tools #033[39;49;00m
Sep 14 15:55:17 openhab first-boot.bash[554]: Cloning into '/opt/zram/overlayfs-tools'...
Sep 14 15:55:19 openhab first-boot.bash[554]: #033[90;01m$ git clone https://github.com/mstormi/openhabian-zram /opt/zram/openhabian-zram #033[39;49;00m
Sep 14 15:55:19 openhab first-boot.bash[554]: Cloning into '/opt/zram/openhabian-zram'...
Sep 14 15:55:20 openhab first-boot.bash[554]: OK
Sep 14 15:55:20 openhab first-boot.bash[554]: 2020-09-14_16:55:20_CEST [openHABian] Setting up OverlayFS...
Sep 14 15:55:20 openhab first-boot.bash[554]: #033[90;01m$ make --always-make --directory=/opt/zram/overlayfs-tools #033[39;49;00m
Sep 14 15:55:20 openhab first-boot.bash[554]: make: Entering directory '/opt/zram/overlayfs-tools'
Sep 14 15:55:20 openhab first-boot.bash[554]: gcc -Wall -std=c99 -c main.c
Sep 14 15:55:22 openhab first-boot.bash[554]: gcc -Wall -std=c99 -c logic.c
Sep 14 15:55:23 openhab first-boot.bash[554]: gcc -Wall -std=c99 -c sh.c
Sep 14 15:55:23 openhab first-boot.bash[554]: gcc -lm main.o logic.o sh.o -o overlay
Sep 14 15:55:23 openhab first-boot.bash[554]: make: Leaving directory '/opt/zram/overlayfs-tools'
Sep 14 15:55:23 openhab first-boot.bash[554]: #033[90;01m$ install -m 755 /opt/zram/overlayfs-tools/overlay /usr/local/lib/zram-config/overlay #033[39;49;00m
Sep 14 15:55:23 openhab first-boot.bash[554]: OK
Sep 14 15:55:23 openhab first-boot.bash[554]: 2020-09-14_16:55:23_CEST [openHABian] Setting up ZRAM...
Sep 14 15:55:23 openhab first-boot.bash[554]: #033[90;01m$ install -m 644 /opt/openhabian/includes/ztab /etc/ztab #033[39;49;00m
Sep 14 15:55:23 openhab first-boot.bash[554]: #033[90;01m$ install -m 644 /opt/zram/openhabian-zram/ro-root.sh /usr/local/share/zram-config/ro-root.sh #033[39;49;00m
Sep 14 15:55:23 openhab first-boot.bash[554]: #033[90;01m$ install -m 644 /opt/zram/openhabian-zram/zram-config.logrotate /etc/logrotate.d/zram-config #033[39;49;00m
Sep 14 15:55:23 openhab first-boot.bash[554]: OK
Sep 14 15:55:23 openhab first-boot.bash[554]: 2020-09-14_16:55:23_CEST [openHABian] Setting up ZRAM service...
Sep 14 15:55:23 openhab first-boot.bash[554]: #033[90;01m$ install -m 644 /opt/zram/openhabian-zram/zram-config.service /etc/systemd/system/zram-config.service #033[39;49;00m
Sep 14 15:55:23 openhab first-boot.bash[554]: #033[90;01m$ systemctl enable zram-config.service #033[39;49;00m
Sep 14 15:55:23 openhab first-boot.bash[554]: Created symlink /etc/systemd/system/basic.target.wants/zram-config.service → /etc/systemd/system/zram-config.service.
Sep 14 15:55:23 openhab systemd[1]: Reloading.
Sep 14 15:55:23 openhab systemd[1]: /lib/systemd/system/smbd.service:9: PIDFile= references path below legacy directory /var/run/, updating /var/run/samba/smbd.pid → /run/samba/smbd.pid; please update the unit file accordingly.
Sep 14 15:55:23 openhab systemd[1]: /lib/systemd/system/nmbd.service:9: PIDFile= references path below legacy directory /var/run/, updating /var/run/samba/nmbd.pid → /run/samba/nmbd.pid; please update the unit file accordingly.
Sep 14 15:55:24 openhab first-boot.bash[554]: #033[90;01m$ systemctl restart zram-config.service #033[39;49;00m
Sep 14 15:55:24 openhab systemd[1]: Starting zram-config...
Sep 14 15:55:24 openhab systemd[15531]: zram-config.service: Executable /usr/local/sbin/zramsync missing, skipping: No such file or directory
Sep 14 15:55:24 openhab systemd[15532]: zram-config.service: Failed to execute command: No such file or directory
Sep 14 15:55:24 openhab systemd[15532]: zram-config.service: Failed at step EXEC spawning /usr/local/sbin/zram-config: No such file or directory
Sep 14 15:55:24 openhab systemd[1]: zram-config.service: Main process exited, code=exited, status=203/EXEC
Sep 14 15:55:24 openhab systemd[1]: zram-config.service: Failed with result 'exit-code'.
Sep 14 15:55:24 openhab systemd[1]: Failed to start zram-config.
Sep 14 15:55:24 openhab first-boot.bash[554]: Job for zram-config.service failed because the control process exited with error code.
Sep 14 15:55:24 openhab first-boot.bash[554]: See "systemctl status zram-config.service" and "journalctl -xe" for details.
Sep 14 15:55:24 openhab first-boot.bash[554]: FAILED (restart service)
Sep 14 15:55:24 openhab first-boot.bash[554]: FAILED

this indicates that the executable /usr/local/sbin/zramsync is missing
A file search on my system showed that a file with that name is present in:
‘./opt/zram/openhabian-zram/zramsync’
so maybe there is an erroneous directory in some file or a copy statement forgotten in some script/program?

I don’t think so. Mind the ‘!’.

[17:43:26] openhabian@devpi:~/openhabian$ which git
/usr/bin/git
[17:43:31] openhabian@devpi:~/openhabian$ if ! dpkg -s 'git'&>/dev/null;then echo "installing git"; else echo "already installed";fi
already installed
[17:43:31] openhabian@devpi:~/openhabian$ 

I’m not sure what’s going on, but quite some of the code that you show is old.
As openHABian quite at the beginning updates itself from the repo to have the latest code and that obviously failed, it’s likely because internet access still didn’t work during your install.

Did you try Ethernet or ping hostnames as I asked you to ?

If yes can you please try a more recent build such as this one here.

The code is ok.
Exit code 0 in a shell is not like a logic 0.
Exit code 0 is like a logic true.
Try e.g. this in a shell:

if ! dpkg -s 'git' &>/dev/null; then echo not installed; fi

You also may try something like this:

echo ShowThis || echo ButNotThis

and

echo ShowThis && echo AndThis

Sorry, my mistake. In my own code I usually use return code 0 for success as well, but in the languages I use I have to test for false. Bash indeed treats 0 as true, so it had me fooled! :sweat_smile:
I’ll have to investigate again to what really causes the fails on my install in that part of the code…

@Markus:
Pinging hostnames works fine.
I will try the build from the link you supplied.
I previously downloaded the code from the link in the openhabian doc page which indeed is an older version. I noticed it uses the ‘clonebranch=stable’ branch in openhabian.config, which may be why it didn’t update as it is probably the latest version on that branch. The newly downloaded code from your link uses the master branch, so that will follow the latest version I suppose

I don’t think my newer code will solve your problem as that problem wasn’t present in the old code.
Find out why git install or git clone does not work (you can login and try interactively).
Try Ethernet as I requested you to.

The new code successfully installed from the first time, still using Wifi. When I checked the /var/log/daemon.log it appears somewhat cleaner than in the old version where it looks as if Wifi was restarted a few times (dhcpcd module messages).
I don’t have any free Ethernet ports left on the router, so I will keep using the wireless connection for some time (not sure if the Raspberry will end up close to the router neither).
Thanks a lot for your help.

That’s not recommended for a home automation server

OK, thanks for the advice.
I just started up an openHAB system a few months ago, currently all z-wave devices. That is largely independent from the network. Of course, I will be adding more things - and become more depending on the network.
So I added an internet switch to my to-do list to be able to connect using ethernet instead of wifi.