Unable to install frontail on fresh install OH 4

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

1 Like

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.

Hi,
I also lost Frontail during a fresh install of OH (4.1.1) on an RPi4B.
Installation and Restore seems OK (using Win 10 Notepad as a bad Frontail replacement).

Is Frontail removed permanently from openhabian as of OH 4.1.1 (openhabian1.8c-pi-raspios32-202402051947-git4f124c2-crc903d2975.img.xz) or by a mistake?
Will it return or will there be a replacement??
openhabian really needs a log viewer, so what is the thinking here?
Bjorn

It’s not removed. Use the openhabian-config 1X menu to set it up.

Thanks Markus,
I checked 1X but frontail is not mentioned on the 1X front page, so what number X relates to frontail?
I hesitate to run all 1X options to find out.
Bjorn

1x was off top of head

it’s 21

Markus,
Sorry, but 21 throws an error at me saying frontail not installed, which I know.
21 is about adding a log file not installing frontail so, how do I gain access to frontail was the initial question, and why not part of openhabian any more?
Bjorn

Hi,
I use Oliver2 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
	apt-get install --yes npm

Then openhabian-config (20 - Optional Components)

or You can install Openhabian 1.9 there is no problem with npm.

No, the first of those three “21” options will install frontail.
It was never “not part of openhabian”.
If that doesn’t work for you, set debugmode=maximum in openhabian.conf and go debug to find out.

Or reinstall using release v1.9 that’s about to get released anyway.

OK. I’ll wait for1.9 to be released.
Thanks,
Bjorn

I’ve finally installed 1.9 successfully and frontail is present. Thanks!

But, OH4 frontail now contains far more events.log entries than OH3.
One difference is that OH4 frontail now seems to enter parameter values that do not change, thereby building a longer events.log and causing frontail to display a shorter time span.
Is there an easy way to return to the OH3 frontail setup/configuration?

Depending on how you did it either during the upgrade you opted to keep your modified version of log4j2.xml and therefore didn’t get the latest version of the file or you restored your 3.x configs over the 4.x instance wiping out the changes to the logging configs.

You can edit the file and add the following two lines near the bottom:

                <Logger level="ERROR" name="openhab.event.ItemStateUpdatedEvent"/>
                <Logger level="ERROR" name="openhab.event.GroupStateUpdatedEvent"/>

Or you can set the level of these loggers to ERROR through the karaf console.