3.2 Release Build - Permission Denied Error on client console

Not sure if this is the correct board for bug reports.
Just installed 3.2 Release build and working in the console (by openhab-cli console OR by ssh it is the same)

Password:
**/var/lib/openhab/tmp/jansi-2.4.0-34b1e19254185a22-libjansi.so.lck (Permission denied)**

                           _   _     _     ____
   ___   ___   ___   ___  | | | |   / \   | __ )
  / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \
 | (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )
  \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/
       |_|       3.2.0 - Release Build

Use '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
To exit, use '<ctrl-d>' or 'logout'.

**Error in initialization script: /var/lib/openhab/etc/shell.init.script: /var/lib/openhab/etc/shell.init.script**
openhab>

It does not seem to be an actual permission issue…

admin@flcozy:~$ ls -l /var/lib/openhab
total 40
drwxr-xr-x 3 openhab openhab 4096 Dec 22 11:50 cache
drwxr-xr-x 5 openhab openhab 4096 Dec 22 15:47 config
drwxr-xr-x 3 openhab openhab 4096 Dec 22 16:40 etc
drwxr-xr-x 3 openhab openhab 4096 Dec 22 14:26 jsondb
drwxr-xr-x 3 openhab openhab 4096 Dec 22 13:36 marketplace
drwxr-xr-x 2 openhab openhab 4096 Dec 22 11:50 pax-web-jsp
drwxr-xr-x 5 openhab openhab 4096 Dec 22 11:44 persistence
drwxr-xr-x 2 openhab openhab 4096 Dec 22 11:50 secrets
drwxrwxr-x 9 openhab openhab 4096 Dec 22 15:47 tmp
drwxr-xr-x 2 openhab openhab 4096 Dec 23 10:18 zwave

Here are some details:

openhab> shell:info
Karaf
  Karaf version               4.3.4
  Karaf home                  /usr/share/openhab/runtime
  Karaf base                  /var/lib/openhab
  OSGi Framework              org.eclipse.osgi-3.16.300.v20210525-1715

JVM
  Java Virtual Machine        OpenJDK 64-Bit Server VM version 11.0.13+8-LTS
  Version                     11.0.13
  Vendor                      Azul Systems, Inc.
  Pid                         14487
  Uptime                      19 hours 5 minutes
  Process CPU time            10 minutes
  Process CPU load            0.00
  System CPU load             0.00
  Open file descriptors       1,945
  Max file descriptors        102,642
  Total compile time          2 minutes
Threads
  Live threads                142
  Daemon threads              90
  Peak                        221
  Total started               11096
Memory
  Current heap size           118,460 kbytes
  Maximum heap size           2,009,088 kbytes
  Committed heap size         261,120 kbytes
  Pending objects             0
  Garbage collector           Name = 'G1 Young Generation', Collections = 73, Time = 1.073 seconds
  Garbage collector           Name = 'G1 Old Generation', Collections = 0, Time = 0.000 seconds
Classes
  Current classes loaded      19,004
  Total classes loaded        19,571
  Total classes unloaded      567
Operating system
  Name                        Linux version 5.11.0-43-generic
  Architecture                amd64
  Processors                  4
openhab> shell:exec whoami
openhab
openhab>
admin@flcozy:~$ sudo ps aux  | grep openhab
openhab    14487  0.9  6.9 5968340 558640 ?      Ssl  Dec22  10:55 /usr/bin/java -XX:-UsePerfData -Dopenhab.home=/usr/share/openhab -Dopenhab.conf=/etc/openhab -Dopenhab.runtime=/usr/share/openhab/runtime -Dopenhab.userdata=/var/lib/openhab -Dopenhab.logdir=/var/log/openhab -Dfelix.cm.dir=/var/lib/openhab/config -Djava.library.path=/var/lib/openhab/tmp/lib -Djetty.host=0.0.0.0 -Djetty.http.compliance=RFC2616 -Dnashorn.args=--no-deprecation-warning -Dorg.apache.cxf.osgi.http.transport.disable=true -Dorg.ops4j.pax.web.listening.addresses=0.0.0.0 -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Djava.awt.headless=true -Dfile.encoding=UTF-8 -XX:+UseG1GC --add-reads=java.xml=java.logging --add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED --patch-module java.base=/usr/share/openhab/runtime/lib/endorsed/org.apache.karaf.specs.locator-4.3.4.jar --patch-module java.xml=/usr/share/openhab/runtime/lib/endorsed/org.apache.karaf.specs.java.xml-4.3.4.jar --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.file=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=java.base/sun.net.www.content.text=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED --add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED --add-exports=java.security.sasl/com.sun.security.sasl=ALL-UNNAMED -Dkaraf.instances=/var/lib/openhab/tmp/instances -Dkaraf.home=/usr/share/openhab/runtime -Dkaraf.base=/var/lib/openhab -Dkaraf.data=/var/lib/openhab -Dkaraf.etc=/var/lib/openhab/etc -Dkaraf.log=/var/log/openhab -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/var/lib/openhab/tmp -Djava.util.logging.config.file=/var/lib/openhab/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /usr/share/openhab/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.3.4.jar:/usr/share/openhab/runtime/lib/boot/org.apache.karaf.jaas.boot-4.3.4.jar:/usr/share/openhab/runtime/lib/boot/org.apache.karaf.main-4.3.4.jar:/usr/share/openhab/runtime/lib/boot/org.apache.karaf.specs.activator-4.3.4.jar:/usr/share/openhab/runtime/lib/boot/osgi.core-7.0.0.jar:/usr/share/openhab/runtime/lib/jdk9plus/istack-commons-runtime-3.0.10.jar:/usr/share/openhab/runtime/lib/jdk9plus/jakarta.xml.bind-api-2.3.3.jar:/usr/share/openhab/runtime/lib/jdk9plus/javax.annotation-api-1.3.2.jar:/usr/share/openhab/runtime/lib/jdk9plus/jaxb-runtime-2.3.3.jar:/usr/share/openhab/runtime/lib/jdk9plus/org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:/usr/share/openhab/runtime/lib/jdk9plus/txw2-2.3.3.jar org.apache.karaf.main.Main
admin@flcozy:~$ /usr/bin/java --version
openjdk 11.0.13 2021-10-19 LTS
OpenJDK Runtime Environment Zulu11.52+13-CA (build 11.0.13+8-LTS)
OpenJDK 64-Bit Server VM Zulu11.52+13-CA (build 11.0.13+8-LTS, mixed mode)
admin@flcozy:~$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Apr 24  2021 /usr/bin/java -> /etc/alternatives/java
admin@flcozy:~$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 28 Nov 27 10:06 /etc/alternatives/java -> /usr/lib/jvm/zulu11/bin/java

it is a permission issue.
If a user that not belongs to the group openhab opens the console the message pops up because the
file jansi-2.4.0-28b7e6d22bbf392b-libjansi.so and jansi-2.4.0-28b7e6d22bbf392b-libjansi.so.lck cannot created in tmp directory with that users/groups permission.
For a trial a added group and others write access to the directory and the they are created without an error message:

ls -lt
total 40
-rwxr--r-- 1 openhabian openhab 12236 Dec 23 17:18 jansi-2.4.0-28b7e6d22bbf392b-libjansi.so
-rw-r--r-- 1 openhabian openhab     0 Dec 23 17:18 jansi-2.4.0-28b7e6d22bbf392b-libjansi.so.lck

it is a permission issue.

Fair enough for libjansi. My assumption was that the permission error was the Error indicated on the console.

**Error in initialization script: /var/lib/openhab/etc/shell.init.script: /var/lib/openhab/etc/shell.init.script**

However, ssh still shows an Error which is not in the openhab.log. It is also strange that one does not need to be a member of openhab group to run openhab-cli, but openhab-cli requires permissions from the user. Should not openhab-cli console work the same as ssh?

admin@flcozy:~$ ssh -p 8101 nockknock@localhost
Password authentication
Password:

                           _   _     _     ____
   ___   ___   ___   ___  | | | |   / \   | __ )
  / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \
 | (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )
  \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/
       |_|       3.2.0 - Release Build

Use '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
To exit, use '<ctrl-d>' or 'logout'.

Error in initialization script: /var/lib/openhab/etc/shell.init.script: /var/lib/openhab/etc/shell.init.script
                                                                                                              openhab>

Upon further investigation, shell.ini.script doesn’t exist…

admin@flcozy:~$ sudo cat /var/lib/openhab/etc/shell.init.script
cat: /var/lib/openhab/etc/shell.init.script: No such file or directory

Similar issue reported here:

On a new created OH3.2 (out of the box on RPi 4) I observed the following.
So I’m a bit confused.

When logging in to the console via “openhab-cli console”, I see the following screen

hab3@oh3ssd:~ $ openhab-cli console

Logging in as openhab
Password:
/var/lib/openhab/tmp/jansi-2.4.0-46267f898534500d-libjansi.so.lck (Keine Berechtigung)

                           _   _     _     ____
   ___   ___   ___   ___  | | | |   / \   | __ )
  / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \
 | (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )
  \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/
       |_|       3.2.0 - Release Build

Use '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
To exit, use '<ctrl-d>' or 'logout'.

openhab>

In the Directory “/var/lib/openhab/tmp/” I can’t see a file “…jansi…”

hab3@oh3ssd:~ $ ls -alF /var/lib/openhab/tmp/
insgesamt 36
drwxr-xr-x  7 openhab openhab 4096 11. Jan 15:28 ./
drwxrwxr-x 12 openhab openhab 4096  6. Jan 23:53 ../
drwxr-xr-x  2 openhab openhab 4096  6. Jan 23:53 bundles/
drwxr-xr-x  2 openhab openhab 4096 11. Jan 00:09 fileinstall--2475176659883930839/
drwxr-xr-x  2 openhab openhab 4096  6. Jan 23:53 instances/
drwxr-xr-x  3 openhab openhab 4096  6. Jan 23:53 kar/
-rw-r--r--  1 openhab openhab    5 11. Jan 00:09 karaf.pid
-rw-r--r--  1 openhab openhab    0  6. Jan 23:53 lock
drwxr-xr-x  2 openhab openhab 4096 11. Jan 00:09 .paxweb13352526328310569991/
-rw-r--r--  1 openhab openhab    5 11. Jan 00:09 port
hab3@oh3ssd:~ $

But this seems not to be an error ???

When logging in via shell ssh…

hab3@oh3ssd:~ $ ssh -p 8101 openhab@localhost
Password authentication
Password:

                           _   _     _     ____
   ___   ___   ___   ___  | | | |   / \   | __ )
  / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \
 | (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )
  \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/
       |_|       3.2.0 - Release Build

Use '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
To exit, use '<ctrl-d>' or 'logout'.

openhab>

…without information and no file “jansi…” in the “var/lib/openhab/tmp/”-Directory (as above).

But when logging in as “sudo”:

openhab> logout
Connection to localhost closed.
hab3@oh3ssd:~ $ sudo openhab-cli console
[sudo] Passwort für hab3:

Logging in as openhab
Password:

                           _   _     _     ____
   ___   ___   ___   ___  | | | |   / \   | __ )
  / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \
 | (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )
  \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/
       |_|       3.2.0 - Release Build

Use '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
To exit, use '<ctrl-d>' or 'logout'.

openhab>

No information about the “jansi-file” in the karaf-console.

But the Directory now shows(the jansi-files):

hab3@oh3ssd:~ $ ls -alF /var/lib/openhab/tmp/
insgesamt 48
drwxr-xr-x  7 openhab openhab  4096 11. Jan 15:43 ./
drwxrwxr-x 12 openhab openhab  4096  6. Jan 23:53 ../
drwxr-xr-x  2 openhab openhab  4096  6. Jan 23:53 bundles/
drwxr-xr-x  2 openhab openhab  4096 11. Jan 00:09 fileinstall--2475176659883930839/
drwxr-xr-x  2 openhab openhab  4096  6. Jan 23:53 instances/
-rwxr--r--  1 root    root    12236 11. Jan 15:43 jansi-2.4.0-24e9a16c73ace8b5-libjansi.so*
-rw-r--r--  1 root    root        0 11. Jan 15:43 jansi-2.4.0-24e9a16c73ace8b5-libjansi.so.lck
drwxr-xr-x  3 openhab openhab  4096  6. Jan 23:53 kar/
-rw-r--r--  1 openhab openhab     5 11. Jan 00:09 karaf.pid
-rw-r--r--  1 openhab openhab     0  6. Jan 23:53 lock
drwxr-xr-x  2 openhab openhab  4096 11. Jan 00:09 .paxweb13352526328310569991/
-rw-r--r--  1 openhab openhab     5 11. Jan 00:09 port
hab3@oh3ssd:~ $

I even have a running Version of OH2.5.12 and an older Version of OH3.2(upgraded from OH3.0). But I’d never seen that information (I won’t say error, in my case) in those systems before, and still do not observe now.

Is this a bug or what have I done wrong in my installation and do you have an idea what to do to correct the mistake.

I think the jansi-2.4.0-<this-part-changes-everytime> file is only put into the directory when the karaf console is opened using the openhab-cli console approach ( this part uses a java ssh client ).
Using sudo you can see the file and there is no warning message because the process runs with root privileges and thus the file and the lock file can be generated ( root has all privileges ).
Using the system’s native client the file is not generated thus you can’t see it.
Using any user ( apart of root ) that is not the openhab user has no write permissions and will get the warning message.
I just used the openhabian user and also saw the message. After adding write permissions for group openhab ( which openhabian belongs to ) the warning message disappeared.

I also see this warning message depending on the user using the openhab-cli console as I do not see any problem I would ignore the warning message.
You could open/add the directory’s file permission by running chmod ugo+w on the tmp directory. But this may also not be wanted as everyone would be able to write to the directory.

Thx for your answer. But what I do not understand is, when I use the command “openhab-cli console” I am asked for the password of the user “openhab” to log in.

It’s a bit mysterious for me, as in the past everything went better :wink:

But the client runs with your users permissions resp. root when you use sudo.
You can check that by using the ps command to check for privileges of the running process.
E.g. if you use ssh ( openhab-cli console is the same ) on client site the process runs with your users permissions. In case you do ssh user2@server then on @ server you login as user user2 and that shell process runs with that user’s permissions.
Today it behaves different because something in the software was changed.

1 Like

today i realized the same message when logging in console:

openhabian@openhab3:~ $ openhab-cli console

Logging in as openhab
Password:
/var/lib/openhab/tmp/jansi-2.4.0-e625d22899ee84a1-libjansi.so.lck (Keine Berechtigung)

i could solve this starting
sudo openhabian-config
and then
10 apply improvements
and
14 fix permissions

4 Likes

Thanks! It works for me too :+1:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.