Zram problems OH3 on fresh Openhabian install

Platform information:
Hardware: Raspberry Pi4 4GB SD:32GB
Openhabian 1.6-alpha (openhabian-pi-raspios32-202201271414-git08bc4ff-crcdd86375a.img.xz)
Decided to move from OH2.5 to OH3 - seems that a fresh install would be the best way to go, but ran into a problem.

I encountered this problem so started over a second time with the same result.

  • Flashed the zip file onto a brand new sanDisk micro SD
  • No modifications made to the flashed card
  • Inserted into the Pi4 connected to my router via cable
  • and started the Pi4
  • Install seems to have been successful except for the ZRAM.

openHABIP:8080 up and running: create a login page
openHAB log viewer also up and running

From my PC logon using SSH
Result of cat /boot/first-boot.log:

2022-02-19_12:36:15_GMT [openHABian] Starting the openHABian initial setup.
2022-02-19_12:36:15_GMT [openHABian] Storing configuration... OK
2022-02-19_12:36:15_GMT [openHABian] Starting webserver with installation log... OK
2022-02-19_12:36:21_GMT [openHABian] Changing default username and password... OK
2022-02-19_12:36:21_GMT [openHABian] Setting up Ethernet connection... OK
2022-02-19_12:38:40_GMT [openHABian] Ensuring network connectivity... OK
2022-02-19_12:38:40_GMT [openHABian] Waiting for dpkg/apt to get ready... OK
2022-02-19_12:38:56_GMT [openHABian] Updating repositories and upgrading installed packages... OK
2022-02-19_12:39:37_GMT [openHABian] Installing git package... OK
2022-02-19_12:39:47_GMT [openHABian] Updating myself from https://github.com/openhab/openhabian, openHAB3 branch... OK
2022-02-19_12:39:59_GMT [openHABian] Starting execution of 'openhabian-config unattended'... OK
2022-02-19_12:39:59_GMT [openHABian] Checking for root privileges... OK
2022-02-19_12:39:59_GMT [openHABian] Updating Linux package information... OK
2022-02-19_12:40:15_GMT [openHABian] Loading configuration file '/etc/openhabian.conf'... OK
2022-02-19_12:40:15_GMT [openHABian] Adjusting swap size to 7677 MB... OK (reboot required)
2022-02-19_12:40:16_GMT [openHABian] Setting timezone based on openhabian.conf... OK (Europe/Berlin)
2022-02-19_13:40:16_CET [openHABian] Enabling time synchronization using NTP... OK
2022-02-19_13:40:16_CET [openHABian] Setting locale based on openhabian.conf... OK (reboot required)
2022-02-19_13:40:53_CET [openHABian] Setting hostname of the base system based on openhabian.conf... OK
2022-02-19_13:40:53_CET [openHABian] Setting the GPU memory split down to 16MB for headless system... OK
2022-02-19_13:40:53_CET [openHABian] Enabling Audio output... OK
2022-02-19_13:40:53_CET [openHABian] Installing basic can't-be-wrong packages (screen, vim, ...)... OK
2022-02-19_13:41:47_CET [openHABian] Installing additional needed packages... OK
2022-02-19_13:42:23_CET [openHABian] Installing python3 serial package... OK
2022-02-19_13:42:37_CET [openHABian] Installing pigpio package... OK
2022-02-19_13:42:51_CET [openHABian] Installing additional bluetooth packages... OK
2022-02-19_13:43:06_CET [openHABian] Adding slightly tuned bash configuration files to system... OK
2022-02-19_13:43:06_CET [openHABian] Adding slightly tuned vim configuration file to system... OK
2022-02-19_13:43:06_CET [openHABian] tailscale VPN installation... SKIPPED (no preauthkey defined)
2022-02-19_13:43:06_CET [openHABian] Applying miscellaneous system settings... OK
2022-02-19_13:43:06_CET [openHABian] Downloading FireMotD... OK
2022-02-19_13:43:08_CET [openHABian] Installing FireMotD... OK
2022-02-19_13:43:08_CET [openHABian] Generating FireMotD theme... OK
2022-02-19_13:43:36_CET [openHABian] Setting up FireMotD apt updates count service... OK
2022-02-19_13:43:48_CET [openHABian] Fetching OpenJDK 11... OK
2022-02-19_13:43:50_CET [openHABian] Installing OpenJDK 11... OK
2022-02-19_13:44:17_CET [openHABian] Beginning install of latest openhab release (stable)... OK
2022-02-19_13:44:17_CET [openHABian] Adding required keys to apt... 
2022-02-19_13:44:28_CET [openHABian] Installing selected openHAB3 version... OK
2022-02-19_13:45:06_CET [openHABian] Setting up openHAB service... OK
2022-02-19_13:45:06_CET [openHABian] Optimizing openHAB to run on low memory single board computers... OK
2022-02-19_13:45:06_CET [openHABian] Setting openHAB HTTP/HTTPS ports... OK
2022-02-19_13:45:06_CET [openHABian] Creating dependencies to jointly start services that depend on each other... OK
2022-02-19_13:45:07_CET [openHABian] Adding an openHAB dashboard tile for 'openhabiandocs'... OK
2022-02-19_13:45:07_CET [openHABian] Restarting openHAB service to play it safe... OK
2022-02-19_13:45:07_CET [openHABian] Getting initial openHAB configuration... SKIPPED (backup not found at /boot/initial.zip)
2022-02-19_13:45:07_CET [openHABian] Activating the openHAB console on all interfaces... OK
2022-02-19_13:45:07_CET [openHABian] Adding openHAB syntax to vim editor... OK
2022-02-19_13:45:28_CET [openHABian] Adding openHAB syntax to nano editor... OK
2022-02-19_13:45:28_CET [openHABian] Adding openHAB scheme to multitail... OK
2022-02-19_13:45:29_CET [openHABian] Preparing openHAB folder mounts under '/srv/openhab-*'... OK
2022-02-19_13:45:35_CET [openHABian] Installing Samba... OK
2022-02-19_13:46:34_CET [openHABian] Setting up Samba network shares... OK
2022-02-19_13:46:35_CET [openHABian] Setting up Samba service... OK
2022-02-19_13:46:38_CET [openHABian] Installing Frontail prerequsites (NodeJS)...  OK
2022-02-19_13:47:33_CET [openHABian] Installing openHAB Log Viewer (frontail)... OK
2022-02-19_13:48:14_CET [openHABian] Setting up openHAB Log Viewer (frontail) service... OK
2022-02-19_13:48:16_CET [openHABian] Adding an openHAB dashboard tile for 'frontail'... OK
2022-02-19_13:48:16_CET [openHABian] Installing zram... FAILED
2022-02-19_13:48:32_CET [openHABian] Beginning Mail Transfer Agent setup... CANCELED (no configuration provided)
2022-02-19_13:48:32_CET [openHABian] Applying file permissions recommendations... OK
2022-02-19_13:48:32_CET [openHABian] Setting up automated SD mirroring and backup... SKIPPED (no configuration provided)
2022-02-19_13:48:33_CET [openHABian] Cleaning up... OK
2022-02-19_13:48:48_CET [openHABian] Execution of 'openhabian-config unattended' completed.
2022-02-19_13:48:48_CET [openHABian] First time setup successfully finished. Rebooting your system!
2022-02-19_13:48:48_CET [openHABian] After rebooting the openHAB dashboard will be available at: http://openhabian:8080
2022-02-19_13:48:48_CET [openHABian] After rebooting to gain access to a console, simply reconnect using ssh.

I tried several times used openhabian-config to enable ZRAM:
select 30 (system settings)
select 38 (use ZRAM)
but it 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/main/docs/openhabian-DEBUG.md how │
 │ to proceed.                                                                  │

and the command line on exiting openHABian config says:

[sudo] password for openhabian:
2022-02-19_15:03:37_CET [openHABian] Checking for root privileges... OK
2022-02-19_15:03:37_CET [openHABian] Loading configuration file '/etc/openhabian.conf'... OK
2022-02-19_15:03:37_CET [openHABian] openHABian configuration tool version: [openHAB3]{2022-01-28T11:18:18+01:00}(aaf8aca)
2022-02-19_15:03:37_CET [openHABian] Checking for changes in origin branch openHAB3... OK
2022-02-19_15:04:29_CET [openHABian] Switching to branch openHAB3... OK
2022-02-19_15:04:30_CET [openHABian] Adding slightly tuned bash configuration files to system... OK
2022-02-19_15:04:41_CET [openHABian] Updating Linux package information... OK
2022-02-19_15:04:41_CET [openHABian] Updating zram service... OK
2022-02-19_15:04:43_CET [openHABian] Updating OverlayFS... OK
2022-02-19_15:04:44_CET [openHABian] Updating zram... FAILED (logrotate)
2022-02-19_15:04:50_CET [openHABian] Checking for default openHABian username:password combination... OK
2022-02-19_15:04:50_CET [openHABian] We hope you got what you came for! See you again soon ;)

So it appears that zram can’t be enabled because of something to do with logrotate.

With the openHABian logging set to maximum, I get this further information (I have the complete log but its rather long to include here unless its needed):

+ cond_redirect mkdir -p /usr/local/share/zram-config/log
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ mkdir -p /usr/local/share/zram-config/log \033[39;49;00m'

$ mkdir -p /usr/local/share/zram-config/log
+ mkdir -p /usr/local/share/zram-config/log
+ return 0
+ [[ -h /var/log/zram-config ]]
+ cond_redirect install -m 644 /opt/zram/zram-config/zram-config.logrotate /etc/logrotate.d/zram-config
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ install -m 644 /opt/zram/zram-config/zram-config.logrotate /etc/logrotate.d/zram-config \033[39;49;00m'

$ install -m 644 /opt/zram/zram-config/zram-config.logrotate /etc/logrotate.d/zram-config
+ install -m 644 /opt/zram/zram-config/zram-config.logrotate /etc/logrotate.d/zram-config
install: cannot stat '/opt/zram/zram-config/zram-config.logrotate': No such file or directory
+ return 1
+ echo 'FAILED (logrotate)'
FAILED (logrotate)
openhabian@openhabian:/etc $ ls logrotate*
logrotate.conf

logrotate.d:
alternatives  apt  btmp  dpkg  rsyslog  samba  unattended-upgrades  wtmp

Any help with where to go from here, pretty sure I can’t just create the missing directory?

Missing directory ?
The command

install -m 644 /opt/zram/zram-config/zram-config.logrotate /etc/logrotate.d/zram-config

should install the file zram-config.logrotate as file zram-config in directory /etc/logrotate.d.
As you do have the target directory the question is do you have the source file ( zram-config ) ?

You mentioned which openhabian image you installed but you did not tell anything about if resent updates for openhabian were installed. Version information can be found on the dialogbox header.

Thanks for getting back to me Wolfgang_S :grinning:

Did you mean this data from the SSH terminal:

Linux openhabian 5.10.92-v7l+ #1514 SMP Mon Jan 17 17:38:03 GMT 2022 armv7l
openHAB 3.2.0 - Release Build

or perhaps this from the openhabian config tool

openHABian Configuration Tool — [openHAB3]{2022-01-28T11:18:18+01:00}(aaf8aca)

I have since run menu 10 | Apply improvements,
sub menu
11 | Packages
13 | System Tweaks

11 appears to install fine but 13 fails and that looks to be related to zram also
Tried to enable zram agian still no joy

+ echo -e '\n\033[90;01m$ systemctl restart zram-config.service \033[39;49;00m'

$ systemctl restart zram-config.service
+ systemctl restart zram-config.service
Failed to restart zram-config.service: Unit zram-config.service not found.
+ return 5
+ echo FAILED
FAILED

Source directory, no: zram-config.logrotate

openhabian@openhabian:/opt/zram/zram-config $ ls
CONTRIBUTING.md  install.bash  LICENSE.md  overlayfs-tools  README.md  service  tests  uninstall.bash  update.bash  zram-config  ztab

Thanks for any further help you can give.

I did not dig deeper into the problem.
@ndye Is this a problem of openhabian-config …?
Looking into github you can find the missing file at https://raw.githubusercontent.com/ecdye/zram-config/main/service/zram-config.logrotate
I think you can download the file manually and then try again if enabling works.

Thanks for your help, getting closer to the problem I feel. :grinning:
But I’m still struggling with it.

I’m able to recreate the missing source file:

openhabian@openhabian:/opt/zram/zram-config $ sudo nano zram-config.logrotate

And add the file content from the quoted link.
The file permissions are correct also.

-rw-r--r-- 1 root root   119 Feb 21 12:06 zram-config.logrotate

But when I run the openHABian config tool option 38, I get the exact same error and it appears that the directory is overwritten during the zram install.

I confirmed this by touching another file in the directory and executing option 38 again.

Looking through openHABian config log it appears that the script https://github.com/ecdye/zram-config replaces the directory: mkdir -p /opt/zram and then updates it from the git repository: update_git_repo /opt/zram/zram-config openHAB

2022-02-19_15:16:24_CET [openHABian] Updating zram service... + cond_redirect zram-config stop
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ zram-config stop \033[39;49;00m'

$ zram-config stop
+ zram-config stop
zram-config stop 2022-02-19-15:16:24
Stop: zram-config not running. Exiting!
+ return 0
+ cond_redirect install_zram_code /opt/zram
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ install_zram_code /opt/zram \033[39;49;00m'

$ install_zram_code /opt/zram
+ install_zram_code /opt/zram
+ local zramGit=https://github.com/ecdye/zram-config
++ timestamp
++ date +%F_%T_%Z
+ echo -n '2022-02-19_15:16:24_CET [openHABian] Installing zram code... '
2022-02-19_15:16:24_CET [openHABian] Installing zram code... + cond_redirect mkdir -p /opt/zram
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ mkdir -p /opt/zram \033[39;49;00m'

$ mkdir -p /opt/zram
+ mkdir -p /opt/zram
+ return 0
+ [[ -d /opt/zram/zram-config ]]
+ cond_redirect update_git_repo /opt/zram/zram-config openHAB
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ update_git_repo /opt/zram/zram-config openHAB \033[39;49;00m'

$ update_git_repo /opt/zram/zram-config openHAB
+ update_git_repo /opt/zram/zram-config openHAB

The content of /opt/zram/zram-config on my Raspi after the failed zram install is:

openhabian@openhabian:/opt/zram/zram-config $ ls -l
total 64
-rw-r--r-- 1 root root  3593 Feb 19 15:04 CONTRIBUTING.md
-rwxr-xr-x 1 root root  3570 Feb 19 15:04 install.bash
-rw-r--r-- 1 root root  1140 Feb 19 15:04 LICENSE.md
drwxrwxr-x 2 root root  4096 Feb 21 12:27 overlayfs-tools
-rw-r--r-- 1 root root 11470 Feb 19 15:04 README.md
drwxrwxr-x 4 root root  4096 Feb 19 15:04 service
drwxrwxr-x 2 root root  4096 Feb 19 15:04 tests
-rwxr-xr-x 1 root root  1370 Feb 19 15:04 uninstall.bash
-rwxr-xr-x 1 root root  3374 Feb 19 15:04 update.bash
-rwxr-xr-x 1 root root 14049 Feb 19 15:04 zram-config
-rw-r--r-- 1 root root  2610 Feb 19 15:04 ztab

It looks to me like the zram-config.logrotate is in the wrong directory on the repo and consequently on my RasPi

openhabian@openhabian:/opt/zram/zram-config/service $ ls -l
total 12
drwxrwxr-x 2 root root 4096 Feb 19 15:04 OpenRC
drwxrwxr-x 2 root root 4096 Feb 19 15:04 SystemD
-rw-r--r-- 1 root root  119 Feb 19 15:04 zram-config.logrotate

I also noticed while comparing with another working installation that zram-config.service appears to be missing also.

So I think these needs to be fixed in the repository.
If that is the next step, I don’t use git / github, so help to raise an issue will be much appreciated.

According to

indeed exactly this was changed in main branch.
Click on the above link and you can see the differences.

Issue should be fixed on the openHAB3 and main branches now. Sorry about that I forgot that I needed to forward the changes in order for the majority of users to have the issue fixed.

1 Like

Thanks Ethan

Moved onto the openHABian main branch, but
OpenHABian option 38 only worked after running the uninstall script,

sudo /opt/zram/zram-config/uninstall.bash

due to a problem with stopping the zram-config.service, as it was not running.

+ echo -n '2022-02-25_12:30:11_CET [openHABian] Updating zram service... '
2022-02-25_12:30:11_CET [openHABian] Updating zram service... + cond_redirect systemctl stop zram-config.service
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ systemctl stop zram-config.service \033[39;49;00m'

$ systemctl stop zram-config.service
+ systemctl stop zram-config.service
Failed to stop zram-config.service: Unit zram-config.service not loaded.
+ return 5
+ echo 'FAILED (stop zram)'
FAILED (stop zram)
+ return 1
+ '[' 1 -ne 0 ']'
+ whiptail --msgbox 'There was an error or interruption during the execution of:\n  "30 | System Settings"\n\nPlease try again. If the error persists, please read /opt/openhabian/docs/openhabian-DEBUG.md or https://github.com/openhab/openhabian/blob/main/docs/openhabian-DEBUG.md how to proceed.' 14 80

All looks to be good now thanks

openhabian@openhabian:/opt/zram/zram-config $ zramctl
NAME       ALGORITHM DISKSIZE  DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram2 zstd            1G  652K    8K  328K       4 /opt/zram/zram2
/dev/zram1 zstd          750M  508K  6.1K  256K       4 /opt/zram/zram1
/dev/zram0 lzo-rle         1G    4K   87B    4K       4 [SWAP]