Xwiki.start from snap wont work

Hi evreyone,

I installed recently xwiki on Red Hat via snap, but when i do “sudo xwiki.start”, I have this message

[root@srv-xwiki-test ~]# sudo xwiki.startup
sudo: xwiki.startup : command unknown

What did I do wrong ?

Here is the list of the command I made

sudo yum install snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
sudo snap install xwiki
sudo xwiki.start

I’ve followed those instructions from here :
https://snapcraft.io/install/xwiki/rhel
XWiki Snap Guide - XWiki and

When I go in the folder /var/snap/xwiki/current/ and start xwiki with " sh start_xwiki.sh", it works, but it’s not the good way.

Thank you for your help

Best regards

Maybe you have an idea @Pol.

hey @cbouchet ,
The command for starting the xwiki snap is

sudo xwiki.start

you seemed to have used xwiki.startup :wink:

Oh yes, sorry ! I copied the wrong command, but this command doesn’t work too :frowning:
image

can you paste the output of the following command

snap list --all

Sure, here :

[root@srv-xwiki-test current]# snap list --all
Name Version Rev Tracking Publisher Notes
core18 20230530 2785 latest/stable canonical✓ base
snapd 2.59.5 19457 latest/stable canonical✓ snapd
xwiki 14.10.13 69 latest/stable xwikiorg -

Hi Pol,

Sorry for my late answer. Do you have an idea of where the problem could be ?

Regards,

hey @cbouchet ,
sorry totally forgot about your question.
But it seems like its a problem with your environment variables

can you paste the output of your env

env

also, try installing and running the hello-world snap. To see if there is a problem with all the snap or XWiki snap in particular : )

Thank you @Pol

Here is for “env” :

[root@srv-xwiki-test ~]# env
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=01;36:.au=01;36:.flac=01;36:.m4a=01;36:.mid=01;36:.midi=01;36:.mka=01;36:.mp3=01;36:.mpc=01;36:.ogg=01;36:.ra=01;36:.wav=01;36:.oga=01;36:.opus=01;36:.spx=01;36:*.xspf=01;36:
SSH_CONNECTION=172.x.x.x 53607 172.x.x.x 22
LANG=fr_FR.UTF-8
HISTCONTROL=ignoredups
HOSTNAME=srv-xwiki-test
which_declare=declare -f
XDG_SESSION_ID=17
USER=root
SELINUX_ROLE_REQUESTED=
PWD=/root
HOME=/root
SSH_CLIENT=172.x.x.x 53607 22
SELINUX_LEVEL_REQUESTED=
https_proxy=http://proxy.local:3128
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
http_proxy=http://proxy.local:3128
SSH_TTY=/dev/pts/0
MAIL=/var/spool/mail/root
TERM=xterm
SHELL=/bin/bash
SELINUX_USE_CURRENT_RANGE=
SHLVL=1
LOGNAME=root
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus
XDG_RUNTIME_DIR=/run/user/0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/lib/snapd/snap/bin:/root/bin
HISTSIZE=1000
LESSOPEN=||/usr/bin/lesspipe.sh %s
BASH_FUNC_which%%=() { ( alias;
eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
}
_=/usr/bin/env

And for the snap Hello-world

[root@srv-xwiki-test ~]# snap install hello-world
hello-world 6.4 from Canonical✓ installed
[root@srv-xwiki-test ~]# hello-world
Hello World!
[root@srv-xwiki-test ~]#

Thank you again

Hello @cbouchet,

The snap appears to be functioning properly on Debian-based distributions.

The issue seems to be related to Red Hat security (SELinux). You have two options to resolve it:

  1. I advise against this option, but you can disable SELinux on Red Hat by following this guide. Afterward, you should reinstall snapd and xwiki.snap.

  2. Alternatively, you can solve the problem by adding /var/snap/xwiki/current/ to your PATH and executing sh start_xwiki.sh whenever you wish to run the Xwiki snap.

I will continue investigating this matter until then.

Thank you, I will look for this.

I tried, this morning, to run xwiki with the following command, but I had a different message

[root@srv-xwiki-test current]# xwiki.start
java.nio.file.NoSuchFileException: /tmp/start_291489999898403813.properties
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
at java.base/java.nio.file.Files.createFile(Files.java:648)
at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:137)
at java.base/java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:160)
at java.base/java.nio.file.Files.createTempFile(Files.java:913)
at org.eclipse.jetty.start.StartArgs.getMainArgs(StartArgs.java:786)
at org.eclipse.jetty.start.Main.invokeMain(Main.java:218)
at org.eclipse.jetty.start.Main.start(Main.java:512)
at org.eclipse.jetty.start.Main.main(Main.java:74)
java.nio.file.NoSuchFileException: /tmp/start_291489999898403813.properties
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
at java.base/java.nio.file.Files.createFile(Files.java:648)
at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:137)
at java.base/java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:160)
at java.base/java.nio.file.Files.createTempFile(Files.java:913)
at org.eclipse.jetty.start.StartArgs.getMainArgs(StartArgs.java:786)
at org.eclipse.jetty.start.Main.invokeMain(Main.java:218)
at org.eclipse.jetty.start.Main.start(Main.java:512)
at org.eclipse.jetty.start.Main.main(Main.java:74)
Usage: java -jar $JETTY_HOME/start.jar [options] [properties] [configs]
java -jar $JETTY_HOME/start.jar --help # for more information
[root@srv-xwiki-test current]#

try giving it elevated privileges

sudo xwiki.start

see if that works now

Hello,

so I’ve put the PATH viariable and it did’nt worked.

[root@srv-xwiki-test ~]# sudo xwiki.start
sudo: xwiki.start : commande introuvable
[root@srv-xwiki-test ~]# xwiki.start
java.nio.file.NoSuchFileException: /tmp/start_10842251950731598944.properties
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
at java.base/java.nio.file.Files.createFile(Files.java:648)
at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:137)
at java.base/java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:160)
at java.base/java.nio.file.Files.createTempFile(Files.java:913)
at org.eclipse.jetty.start.StartArgs.getMainArgs(StartArgs.java:786)
at org.eclipse.jetty.start.Main.invokeMain(Main.java:218)
at org.eclipse.jetty.start.Main.start(Main.java:512)
at org.eclipse.jetty.start.Main.main(Main.java:74)
java.nio.file.NoSuchFileException: /tmp/start_10842251950731598944.properties
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
at java.base/java.nio.file.Files.createFile(Files.java:648)
at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:137)
at java.base/java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:160)
at java.base/java.nio.file.Files.createTempFile(Files.java:913)
at org.eclipse.jetty.start.StartArgs.getMainArgs(StartArgs.java:786)
at org.eclipse.jetty.start.Main.invokeMain(Main.java:218)
at org.eclipse.jetty.start.Main.start(Main.java:512)
at org.eclipse.jetty.start.Main.main(Main.java:74)
Usage: java -jar $JETTY_HOME/start.jar [options] [properties] [configs]
java -jar $JETTY_HOME/start.jar --help # for more information
[root@srv-xwiki-test ~]#

And it still did’nt work. Maybe I should reinstall it from scracth and see if I’ve the same problem…
I’ll try to reinstall snapd first and wiki, and I’ll do from scracth if it’s the same.

I’ll tell you :slight_smile:
Thanks again

Hi,

I’ve reinstalled snapd and xwiki.
xwiki.start works but not with sudo.
Also, when xwiki starts, it start like a demo version. So when I close my ssh connexion, xwiki stop.

Is it “normal” ? Must I configure something ?

Thank you again

I made a new server and installed it on Ubuntu making the simple command

sudo apt install xwiki-tomcat9-mysql

Everything works fine now.