Unable to install frontail on fresh install OH 4

  • Platform information:
    • Hardware: Raspi 4
    • OS: Linux openhabian 6.1.21
    • Java Runtime Environment: openjdk version “17.0.9” 2023-10-17
      OpenJDK Runtime Environment (build 17.0.9+9-Raspbian-1deb11u1rpt1)
      OpenJDK Client VM (build 17.0.9+9-Raspbian-1deb11u1rpt1, mixed mode, emulated-client)
    • openHAB version: 4.1.1 - release build
  • Issue of the topic:
    I did perform a fresh setup to migrate to OH4. Used a new SD card with the following image:
    openhabian-pi-raspios32-202402051947-git4f124c2-crc903d2975.img.xz
    Nothing changed there, performed initial setup, when OH was up and running installed successfully Phoscon, Mosquitto, Samba and loaded the previous config from OH 3.3.
    System runs - I’,m quite happy. There are a few things which are annoying - I probably need to setup different Topics (easiest was already solved).
    Facing Problems because I’m not able to install frontail. Did read various topics - btw i had also problems when installing OH 3.3 a few years ago and solved it more or less by accidently repeating various approaches. As this is a fresh install - it is obviously something fundamental.
    Needless to say that the frontail service is quite important when changing/configuring my system - it helps a lot.

Any hint?
Cheers Frank

 sudo openhabian-config
2024-02-08_18:58:05_CET [openHABian] Checking for root privileges... OK
2024-02-08_18:58:05_CET [openHABian] Loading configuration file '/etc/openhabian.conf'... OK
2024-02-08_18:58:05_CET [openHABian] openHABian configuration tool version: [openHAB]{2024-02-06T16:24:27+01:00}(a497e54)
2024-02-08_18:58:05_CET [openHABian] Checking for changes in origin branch openHAB... OK
2024-02-08_18:58:06_CET [openHABian] Switching to branch openHAB... OK
2024-02-08_18:58:06_CET [openHABian] Checking openHAB Signing Key expiry.
2024-02-08_18:58:06_CET [openHABian] Checking expiry date of apt keys... OK
2024-02-08_18:58:06_CET [openHABian] Installing prerequsites for openhab_rules_tools for JS Scripting (NodeJS)...
$ nodejs_setup
2024-02-08_18:58:06_CET [openHABian] Adding required keys to apt... OK
2024-02-08_18:58:06_CET [openHABian] Adding NodeSource repository to apt...
$ apt-get update
Reading package lists... Done
E: Could not get lock /var/lib/apt/lists/lock. It is held by process 27578 (apt-get)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to lock directory /var/lib/apt/lists/
FAILED (update apt lists)
FAILED
2024-02-08_19:01:20_CET [openHABian] Updating Linux package information... OK
2024-02-08_19:01:20_CET [openHABian] Installing Frontail prerequsites (NodeJS)...
$ nodejs_setup
2024-02-08_19:01:20_CET [openHABian] Adding required keys to apt... OK
2024-02-08_19:01:20_CET [openHABian] Adding NodeSource repository to apt...
$ apt-get update
Hit:1 http://davesteele.github.io/comitup/repo comitup InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Hit:3 http://phoscon.de/apt/deconz generic InRelease
Hit:4 https://deb.nodesource.com/node_18.x bullseye InRelease
Hit:5 http://archive.raspberrypi.org/debian bullseye InRelease
Hit:6 https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable InRelease
Reading package lists... Done
OK
2024-02-08_19:01:24_CET [openHABian] Installing NodeJS...
$ apt-get install --yes -o DPkg::Lock::Timeout= nodejs npm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libnode72 : Conflicts: nodejs-legacy
 nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages.
FAILED
FAILED
2024-02-08_19:01:31_CET [openHABian] Checking for default openHABian username:password combination... FAILED
2024-02-08_19:01:34_CET [openHABian] We hope you got what you came for! See you again soon ;)

You already have apt-get running in another terminal or a previous run of apt-get crashed without cleaning up after itself.

Probably a restart of the machine should clear up the lock.

That’s one I don’t know how to fix best. I looks like nodejs-legacy is installed but Frontail wants a newer Node?

Sadly maintaining something like openHABian is an always moving target. I recommend filing an issue.

In the mean time, you can use the following commands to see your logs in real time through an ssh terminal.

tail -f /var/log/openhab/openhab.log
tail -f /var/log/openhab/events.log

Run each in a different terminal or add an & to the end of the first line to run that in the background and you’ll see the logs from both files as they are made onm the same terminal.

Thanks for your quick reply. Indeed there was obviously something hanging - did reboot as you suggested and it looks a bit smoother now. Nevertheless no success.
Should I just file an issue - and if so where? Or someone else has a comment here.
Thanks and Cheers

 sudo openhabian-config
[sudo] password for openhabian:
2024-02-08_19:39:08_CET [openHABian] Checking for root privileges... OK
2024-02-08_19:39:08_CET [openHABian] Loading configuration file '/etc/openhabian                                                      .conf'... OK
2024-02-08_19:39:10_CET [openHABian] openHABian configuration tool version: [ope                                                      nHAB]{2024-02-06T16:24:27+01:00}(a497e54)
2024-02-08_19:39:10_CET [openHABian] Checking for changes in origin branch openH                                                      AB... OK
2024-02-08_19:39:11_CET [openHABian] Switching to branch openHAB... OK
2024-02-08_19:39:11_CET [openHABian] Checking openHAB Signing Key expiry.
2024-02-08_19:39:11_CET [openHABian] Checking expiry date of apt keys... OK
2024-02-08_19:39:11_CET [openHABian] Installing prerequsites for openhab_rules_t                                                      ools for JS Scripting (NodeJS)...
$ nodejs_setup
2024-02-08_19:39:12_CET [openHABian] Adding required keys to apt... OK
2024-02-08_19:39:12_CET [openHABian] Adding NodeSource repository to apt...
$ apt-get update
Hit:1 http://phoscon.de/apt/deconz generic InRelease
Hit:2 http://davesteele.github.io/comitup/repo comitup InRelease
Hit:3 http://archive.raspberrypi.org/debian bullseye InRelease
Hit:4 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Hit:5 https://deb.nodesource.com/node_18.x bullseye InRelease
Hit:6 https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable InRelease
Reading package lists... Done
OK
2024-02-08_19:39:16_CET [openHABian] Installing NodeJS...
$ apt-get install --yes -o DPkg::Lock::Timeout= nodejs npm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libnode72 : Conflicts: nodejs-legacy
 nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages.
FAILED
FAILED
2024-02-08_19:39:23_CET [openHABian] Updating Linux package information... OK
2024-02-08_19:39:23_CET [openHABian] Installing Frontail prerequsites (NodeJS)...
$ nodejs_setup
2024-02-08_19:39:23_CET [openHABian] Adding required keys to apt... OK
2024-02-08_19:39:23_CET [openHABian] Adding NodeSource repository to apt...
$ apt-get update
Hit:1 http://archive.raspberrypi.org/debian bullseye InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Hit:3 http://davesteele.github.io/comitup/repo comitup InRelease
Hit:4 http://phoscon.de/apt/deconz generic InRelease
Hit:5 https://deb.nodesource.com/node_18.x bullseye InRelease
Hit:6 https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable InRelease
Reading package lists... Done
OK
2024-02-08_19:39:28_CET [openHABian] Installing NodeJS...
$ apt-get install --yes -o DPkg::Lock::Timeout= nodejs npm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libnode72 : Conflicts: nodejs-legacy
 nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages.
FAILED
FAILED
2024-02-08_19:39:34_CET [openHABian] Checking for default openHABian username:password combination... FAILED
2024-02-08_19:39:35_CET [openHABian] We hope you got what you came for! See you again soon ;)
openhabian@openhabian:~ $

Ooops I thought by mistake pasted the code twice but it is indeed repeating. i just pressed once the install button …

Yes, file an issue. Be sure to include the version of openHABian installed and all the information you can gather. The repo is GitHub - openhab/openhabian: openHABian - empowering the smart home, for Raspberry Pi and Debian systems.

I am wondering how/why nodejs AND npm packages are to be installed.
In the current version of openhabian-config they are to be installed together. In earlier version just nodejs package was to be installed.
Looking into nodejs info which apt show nodejs I get:

Package: nodejs
Version: 18.17.1-deb-1nodesource1
Priority: optional
Section: web
Maintainer: Operations Nodesource <operations@nodesource.com>
Installed-Size: 177 MB
Provides: nodejs-dev, nodejs-doc, nodejs-legacy, npm
Depends: libc6 (>= 2.28), libatomic1 (>= 4.8), libgcc1 (>= 1:3.5), libstdc++6 (>= 5.2), python3-minimal, ca-certificates
Conflicts: nodejs-dev, nodejs-doc, nodejs-legacy, npm
Replaces: nodejs-dev (<= 0.8.22), nodejs-legacy, npm (<= 1.2.14)
Homepage: https://nodejs.org
Download-Size: 25.9 MB
APT-Manual-Installed: yes
APT-Sources: https://deb.nodesource.com/node_18.x bookworm/main armhf Packages
Description: Node.js event-based server-side javascript engine
 Node.js is similar in design to and influenced by systems like
 Ruby's Event Machine or Python's Twisted.
 .
 It takes the event model a bit further - it presents the event
 loop as a language construct instead of as a library.
 .
 Node.js is bundled with several useful libraries to handle server tasks :
 System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX,
 HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings.

It states that nodejs and npm are conflicting packages.
This is on bookworm but also on bullseye.

Same problem with a fresh OH 4 card. I tried to uninstall both nodejs and npm and found neither installed. So I installed nodejs and Frontail installed okay.

If I remember correctly, npm installs nodejs anyway

I did report it on github https://github.com/openhab/openhabian/issues/1841 and the issue was closed there (It’s a Debian upstream problem we cannot fix in openHABian.)
Really struggling now - shall I go back to OH 3 or can someone guide me through a manual installation.
Cheers

Use this script:

	curl -fsSL "https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key" | gpg --dearmor > /usr/share/keyrings/nodesource.gpg
	echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" > /etc/apt/sources.list.d/nodesource.list
	apt-get install --yes nodejs

	#NPM
	apt-get install --yes npm

	#FRONTAIL
	useradd --groups *yourUserHere*,openhab -s /bin/bash -d /var/tmp frontail
	mkdir -p /usr/local/lib/node_modules/frontail
	git clone https://github.com/Interstellar0verdrive/frontail_AEM.git /usr/local/lib/node_modules/frontail
	cd /usr/local/lib/node_modules/frontail
	npm audit fix --omit=dev
	npm update --audit=false --omit=dev
	cp frontail.service /etc/systemd/system/frontail.service
	chmod 644 /etc/systemd/system/frontail.service

file frontail.service:

[Unit]
Description=Frontail openHAB instance, reachable at http://%H:9001
Documentation=https://github.com/mthenw/frontail
After=openhab.service
PartOf=openhab.service

[Service]
Type=simple
ExecStart=/usr/local/lib/node_modules/frontail/bin/frontail --disable-usage-stats --ui-highlight --ui-highlight-preset /usr/local/lib/node_modules/frontail/preset/openhab_AEM.json --theme openhab_AEM --lines 2000 --number 200 /var/log/openhab/openhab.log /var/log/openhab/events.log
Restart=always
User=frontail
Group=openhab
Environment=PATH=/usr/local/bin:/usr/bin/
Environment=NODE_ENV=production
WorkingDirectory=/usr/bin/

[Install]
WantedBy=multi-user.target

Make sure you uninstall all components before

Would yourUserHere be frontail (as in the frontail.service file)?

#FRONTAIL
	useradd --groups *yourUserHere*,openhab -s /bin/bash -d /var/tmp frontail

so finally

useradd --groups frontail,openhab -s /bin/bash -d /var/tmp frontail

??

no, your openhabian account name. If you haven‘t provided a different name during startup, choose openhabian.

Hi there,
success although not 100% like proposed.
Did run the script,

sudo sh myscript.sh
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
N: Ignoring file 'nodesource.list
   ' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
E: Unable to locate package nodejs
: not found: 4:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
N: Ignoring file 'nodesource.list
   ' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
E: Unable to locate package npm
: not found: 7:
'seradd: invalid user name 'frontail
fatal: destination path '/usr/local/lib/node_modules/frontail?' already exists and is not an empty directory.
myscript.sh: 13: npm: not found
myscript.sh: 14: npm: not found
cp: cannot stat 'frontail.service': No such file or directory
chmod: cannot access '/etc/systemd/system/frontail.service'$'\r': No such file or directory

there were some issues (probably I should have copied frontail.service upfront) but there were other things as well as I understood the output. Therefore tried step by step and installed
manually nodejs as proposed earlier in the thread

 sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 25.9 MB of archives.
After this operation, 177 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_18.x bullseye/main armhf nodejs armhf 18.17.1-deb-1nodesource1 [25.9 MB]
Fetched 25.9 MB in 3s (7,973 kB/s)
N: Ignoring file 'nodesource.list
   ' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
Selecting previously unselected package nodejs.
(Reading database ... 64909 files and directories currently installed.)
Preparing to unpack .../nodejs_18.17.1-deb-1nodesource1_armhf.deb ...
Unpacking nodejs (18.17.1-deb-1nodesource1) ...
Setting up nodejs (18.17.1-deb-1nodesource1) ...
Processing triggers for man-db (2.9.4-2) ...
Updating FireMotD available updates count ...
N: Ignoring file 'nodesource.list
   ' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension

and afterwards went again to openhabian-config option 21.

Now it works. Thanks a lot for your help and patience. Its really hard for “non Linux guys” to deal with that “basic” stuff.

the problem was that you probably used Windows to create the script file. Windows eol characters are different from unix. Simply open the script with a Linux editor and convert it or save it under linux character set would have done the job.
But glad it is working now for you.