Issue with attachments after recovery from a backup

If you use the Debian package you don’t need to do anything. But the owner of the files in /var/lib/xwiki/data is supposed to be tomcat user and since you copied those files yourself I guess you did not change the owner.

That’s really surprising as I can see various warnings in the code in case of problems with the configured permanent directory.

I just tried to configure a not writable permanent directory and I do get an error

2023-01-13 14:31:54,302 [main] INFO  iPropertiesConfigurationSource - Loading [xwiki.properties] from [file:/media/DATA/xwiki/test/xwiki-platform-distribution-flavor-jetty-hsqldb-14.10/webapps/xwiki/WEB-INF/xwiki.properties] 
2023-01-13 14:31:54,377 [main] ERROR o.x.e.i.ServletEnvironment     - Configured permanent directory [/media/DATA/xwiki/test/xwiki-platform-distribution-flavor-jetty-hsqldb-14.10/data] is not writable. 
2023-01-13 14:31:54,377 [main] WARN  o.x.e.i.ServletEnvironment     - Falling back on [/tmp/jetty-0_0_0_0-8080-xwiki-_xwiki-any-17667244892667511766] as the permanent directory. 
2023-01-13 14:31:54,377 [main] INFO  o.x.e.i.ServletEnvironment     - Using permanent directory [/tmp/jetty-0_0_0_0-8080-xwiki-_xwiki-any-17667244892667511766] 

I have change the ownership of /var/lib/xwiki/data (and sub-dirs) to the main user. Now I got:

jan 13 15:04:14 thehub tomcat9[742]: 2023-01-13 15:04:14,051 [main] WARN  o.e.j.u.s.S.config             - No Client EndPointIdentificationAlgorithm configured for Client@63be03c8[provider=null,keyStore=null,trustStore=null]
jan 13 15:04:14 thehub tomcat9[742]: 2023-01-13 15:04:14,122 [main] WARN  o.a.s.c.CoreContainer          - Not all security plugins configured!  authentication=disabled authorization=disabled.  Solr is only as secure as you make it. Consider configuring authentication/authorization before exposing Solr to users internal or external.  See https://s.apache.org/solrsecurity for more info
jan 13 15:04:16 thehub tomcat9[742]: 2023-01-13 15:04:16,693 [main] INFO  o.x.s.s.i.EmbeddedSolr         - Started embedded Solr server.
jan 13 15:04:18 thehub tomcat9[742]: 2023-01-13 15:04:18,217 [main] INFO  o.x.s.f.i.FilesystemStoreTools - Using filesystem store directory [/var/cache/tomcat9/Catalina/localhost/xwiki/store/file]

Those are “normal”, Solr is making it hard to disable this… (it’s not needed in our case where Solr is embedded and does not expose directly any API)

This went totally over my head. I thought you meant the user who set up tomcat, while it is literally user named tomcat. Now it works. Thank you @tmortagne so much for your help and patience!

Here are the steps I took so people struggling with similar issue have everything in one place.
Starting from a fresh system:

  1. Installed Java (apt-get install default-jdk gnupg2 -y)
  2. Installed Xwiki with Tomcat and MySQL (apt install xwiki-tomcat9-common xwiki-tomcat9-mariadb -y)
  3. Stoped both services (systemctl stop mariadb, systemctl stop tomcat9)
  4. Removed data dir from /var/lib/xwiki/
  5. Move data dir copied from the original xwiki to /var/lib/xwiki/
  6. Changed the owner of data (chown -R tomcat:tomcat data)
  7. Copied hibernate.cfg.xml , xwiki.cfg , xwiki.properties , logback.xml , observation to /etc/xwiki/ (with -r, observation is a dir)
  8. Restored the database
mysql -e "SET FOREIGN_KEY_CHECKS=0;"
mysql -e "DROP DATABASE xwiki;"
mysql -e "CREATE DATABASE IF NOT EXISTS xwiki DEFAULT CHARACTER SET utf8;"
mysql xwiki --user=root -p < xwiki_db.sql
mysql -e "SET FOREIGN_KEY_CHECKS=1;"
  1. Updated password
pass=$(cat /etc/xwiki/hibernate.cfg.xml | grep passw| head -1 | sed -e 's/^.*<prop.*password">//' | sed -e 's|</property>.*||')
mysql -e "SET PASSWORD FOR 'xwiki'@'localhost' = PASSWORD('$pass');"
  1. Rebooted system
  2. Opened wiki in a browser (http://127.0.0.1:8080/xwiki) - Here I’ve got a warning that the version I have installed is not valid
  3. Updated to the newest version by clicking a juicy “Update” button
1 Like