Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server starts on Pi with sqlite error #21

Open
LordAlderaan opened this issue Oct 23, 2023 · 18 comments
Open

Server starts on Pi with sqlite error #21

LordAlderaan opened this issue Oct 23, 2023 · 18 comments
Assignees
Labels
in progress Currently working on this to test Should be fixed, but needs proper testing

Comments

@LordAlderaan
Copy link

I can start the server but it gives the following error:
OpenJDK Server VM warning: You have loaded library /tmp/sqlite-3.36.0.3-b94651b7-61ab-40fe-9ec8-fb933b4d98b5-libsqlitejdbc.so which might have disabled stack guard. The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'. Failed to load native library:sqlite-3.36.0.3-b94651b7-61ab-40fe-9ec8-fb933b4d98b5-libsqlitejdbc.so. osinfo: Linux/aarch64 java.lang.UnsatisfiedLinkError: /tmp/sqlite-3.36.0.3-b94651b7-61ab-40fe-9ec8-fb933b4d98b5-libsqlitejdbc.so: /tmp/sqlite-3.36.0.3-b94651b7-61ab-40fe-9ec8-fb933b4d98b5-libsqlitejdbc.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch) Error opening connection java.lang.NullPointerException at de.champonthis.ghs.server.businesslogic.Manager.passwords(Manager.java:118) at de.champonthis.ghs.server.gui.MainFrame.auhtKeyTable(MainFrame.java:165) at de.champonthis.ghs.server.gui.MainFrame.afterSingletonsInstantiated(MainFrame.java:137) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:974) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164) at de.champonthis.ghs.server.Application.main(Application.java:40) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467)
pic02639

I can connect to it from the client. I can even use application.properties to change the port. But nothing is ever saved to the server and no ghs.sqlite is created in the ~/.ghs folder.

@Lurkars
Copy link
Owner

Lurkars commented Oct 24, 2023

Hey, this is not tested on Rasperry Pi, but I good several reports about people just running it fine. Researching for the error you got, I may found a solution. Can you test starting the jar with -Dorg.sqlite.osinfo.architecture=arm parameter added? (So complete command should be java -jar ghs-server-v0.79.2.jar -Dorg.sqlite.osinfo.architecture=arm)

@LordAlderaan
Copy link
Author

Hey, this is not tested on Rasperry Pi, but I good several reports about people just running it fine. Researching for the error you got, I may found a solution. Can you test starting the jar with -Dorg.sqlite.osinfo.architecture=arm parameter added? (So complete command should be java -jar ghs-server-v0.79.2.jar -Dorg.sqlite.osinfo.architecture=arm)

I tried it but no difference. I'm no expert but when looking at sqlite-jdbc can it be this feature to override the architecture was introduced in a more recent version sqlitejdbc (nov 2022-ish) then is used by the ghs-server (2021-08-30) or am I reading this wrong?

@Lurkars
Copy link
Owner

Lurkars commented Oct 25, 2023

Okay, I'll Update the dependency and then you can test again. Is raspberry pi capable to run java 17? I am thinking about upgrading to spring boot 3, which requires java 17.

Lurkars added a commit that referenced this issue Oct 25, 2023
@Lurkars
Copy link
Owner

Lurkars commented Oct 25, 2023

Okay, at first you can try now v0.79.5. I just updated the SQLite dependency...

@Lurkars Lurkars added the to test Should be fixed, but needs proper testing label Oct 25, 2023
@LordAlderaan
Copy link
Author

Yes it supports Java 17. I've set it as default and ran the 0.79.5 jar and got a new and different error. Still same end result though.

OpenJDK Client VM warning: You have loaded library /tmp/sqlite-3.43.2.1-807192a1-b823-4a23-99ea-03232df9e6b6-libsqlitejdbc.so which might have disabled stack guard. The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'. Error opening connection java.lang.NullPointerException: Cannot invoke "java.sql.Connection.createStatement()" because "this.connection" is null at de.champonthis.ghs.server.businesslogic.Manager.passwords(Manager.java:118) at de.champonthis.ghs.server.gui.MainFrame.auhtKeyTable(MainFrame.java:165) at de.champonthis.ghs.server.gui.MainFrame.afterSingletonsInstantiated(MainFrame.java:137) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:974) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164) at de.champonthis.ghs.server.Application.main(Application.java:40) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467)
log.txt

@Lurkars
Copy link
Owner

Lurkars commented Oct 26, 2023

Okay, can you check out spring-boot-3-test Release. This requires now Java 17! So check this before running. If this is not working, than we need to dig deeper somehow.

@LordAlderaan
Copy link
Author

Tried it but it kept showing the line that ends in osinfo: Linux/aarch64. After some googling I found that I had to do the -D before the -jar so:
java -Dorg.sqlite.osinfo.architecture=arm -jar ghs-server-v0.80.0.jar

Sadly I'm now getting the following error (see log6.txt):
Failed to load native library:sqlite-3.41.2.2-c7a722de-ff90-4fe4-ba07-6e3c47875d7f-libsqlitejdbc.so. osinfo: Linux/arm
java.lang.UnsatisfiedLinkError: /tmp/sqlite-3.41.2.2-c7a722de-ff90-4fe4-ba07-6e3c47875d7f-libsqlitejdbc.so: /tmp/sqlite-3.41.2.2-c7a722de-ff90-4fe4-ba07-6e3c47875d7f-libsqlitejdbc.so: cannot open shared object file: No such file or directory

While the ghs-server is still running I checked the /tmp folder and the so file is there though:
lordalderaan@laraspberrypi:~ $ ls /tmp/sqlite*
/tmp/sqlite-3.41.2.2-c7a722de-ff90-4fe4-ba07-6e3c47875d7f-libsqlitejdbc.so
/tmp/sqlite-3.41.2.2-c7a722de-ff90-4fe4-ba07-6e3c47875d7f-libsqlitejdbc.so.lck

After Quiting the server those files disappear.

@Lurkars
Copy link
Owner

Lurkars commented Oct 27, 2023

It looks to me that the server just can't load the DB file, which should be ~homefolder~/.ghs/ghs.sqlite. Can you check permissions on that or maybe if user.home is not set correctly, try adding -Duser.home=<path to users homefolder> to the java command and try again!

@Lurkars Lurkars self-assigned this Oct 27, 2023
@Lurkars Lurkars added the in progress Currently working on this label Oct 27, 2023
@LordAlderaan
Copy link
Author

LordAlderaan commented Oct 27, 2023

I don't think it's permissions in the home folder. The first error seems to be about the sqlite module not loading. And it has no problem creating the application.properties file. I can even download the client and browse to it.

Of course I did try running it with -Duser.home=/home/lordalderaan but no change.

I also double checked the permissions:
lordalderaan@laraspberrypi:~ $ ls -la .ghs*
total 24
drwxrwxrwx 3 lordalderaan lordalderaan 4096 Oct 27 20:27 .
drwxr-x--- 24 lordalderaan lordalderaan 4096 Oct 27 20:30 ..
-rw-rw-rw- 1 lordalderaan lordalderaan 41 Oct 27 20:21 application.properties
drwxr-xr-x 3 lordalderaan lordalderaan 12288 Oct 27 20:16 gloomhavensecretariat

And even when run using sudo it gives the same errors.

Seems to me no matter what we do sqlite-jdbc doesn't like Pi :(

@Lurkars
Copy link
Owner

Lurkars commented Oct 30, 2023

Really strange, as said, I know people running this on PI! I'll check out my self, should have a 3b lying around somewhere 😅

@Lurkars
Copy link
Owner

Lurkars commented Oct 30, 2023

image

Okay, this is what I get running v0.79.5 and trying to change a game state (it's staring fine, but just throws this error when change game state!). I was able to fix this locally and then it runs fine. (Issue is usage of getGeneratedKeys(), but one can get the last key with normal SQL statement too, seems to be connected with the old SQLite database, because see next:)

Anyways, the v0.80.0 is directly running fine out of the box for me:
image

So you may notice, the only difference: I am running PI without GUI and therefore use the headless option. You can try this too, but in general it seems a system specific issue with your Pi. (As said, I got a few people running this on Pi successfully, now you can add me to the list too!)

So: which Pi are you using? Which OS version? Maybe you're able to grab another SD and try out with a fresh (maybe also headless?) install as me...

@LordAlderaan
Copy link
Author

This is my Pi os info:

lordalderaan@laraspberrypi:~ $ uname -m
aarch64
lordalderaan@laraspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Maybe it's due to running the aarch64 64 bit architecture? Is your pi running ARMv3 to v7 or ARMv8/aarch64?

I don't have a spare SD card handy but might be able to get one to do some tests then.

Do you know if I can somehow overrule the sqlitejdbc module that is used?

@Lurkars
Copy link
Owner

Lurkars commented Oct 30, 2023

Ah okay, I'll used 32 version. I'll test with a 64 version, I think the Pi 3B is ArmV8

@Lurkars
Copy link
Owner

Lurkars commented Oct 30, 2023

Sad news for you, still seems to be really specific on your personal setup. 64 version is also working as fine as 32 for me:

lurkars@ghs-pi:~ $ uname -m
aarch64
lurkars@ghs-pi:~ $ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Which Pi are you using? As said, I only have 3B here. (And Zero W)

@LordAlderaan
Copy link
Author

Ok, really weird. I don't know what is different in my setup then.

I have a Raspberry Pi 4B - 8Gb.

I'll get back to you when I get my hands on another SD card.

@Lurkars
Copy link
Owner

Lurkars commented Oct 30, 2023

As said, I used Raspberry OS lite (so without GUI) and running with -Djava.awt.headless=true so you can try this first maybe!

@strikegun79
Copy link

strikegun79 commented Jan 19, 2024

Hi folks,
I run GHS also on a Pi3. Same OS like LordAlderaan.
And got now the problem like him.
Found a workaround. Edit the /boot/config.txt and add
arm_64bit=0
That will cause to run your OS as 32bit.
Reboot than your OS runs as armv7 -> Check with uname -m
Then I ran the java with this command:
java -Dorg.sqlite.osinfo.architecture=armv7 -jar ghs-server.jar
Works now, and I can read the database.

How much the change from 64 to 32bit affects your programs I don't know. but at least GHS runs, is that not the important thing? ;-)

@Lurkars
Copy link
Owner

Lurkars commented Jan 19, 2024

Thank you very much for trying and documenting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Currently working on this to test Should be fixed, but needs proper testing
Projects
None yet
Development

No branches or pull requests

3 participants