5082 ERROR_STARTUP_ERROR (unable to write to applicationPath /media/pwm)

755 views
Skip to first unread message

djeva...@gmail.com

unread,
Apr 3, 2020, 10:42:12 AM4/3/20
to pwm-general

Hi


I have installed PWM 1.9.1 on Ubuntu 18.04.2

Tomcat manager works fine. I have installed pwm and created the config in /etc/default/tomcat9 to let it know where pwm_applicationpath is. I get the following error.

5082 ERROR_STARTUP_ERROR (unable to write to applicationPath /media/pwm)

An error occurred while starting the application. Check the log files for information


I have chown the directory to tomcat and even for testing chmod 777 /media/pwm but still get the same message?


Any advice please?

Jason Rivard

unread,
Apr 3, 2020, 3:24:40 PM4/3/20
to pwm-general
There's not much to this from the PWM side.  You can try looking through tomcat logs for more clues.  Make sure all child directories under /media/pwm are also owned by the correct user.  Make sure the java process running tomcat is actually the user you think it is...

edel...@qbit.com.ar

unread,
May 12, 2020, 9:25:12 AM5/12/20
to pwm-general
I had the same problem, and the solution was to create the application directory.
mkdir /home/tomcat
mkdir /home/tomcat/pwm
chown tomcat: tomcat /home/tomcat/pwm
#open the /etc/default/tomcat9 file
nano /etc/default /tomcat9
#add the next line
PWM_APPLICATIONPATH = /home/tomcat/pwm
Greeting

Bruce Wood

unread,
Jul 23, 2020, 9:40:55 PM7/23/20
to pwm-general
Hi,
Just thought I would update this with some additional information.
PWM version: 1.91
OS: UBUNTU 20.04 LTS, but probably applies to any Debian-based distribution...
Installation of tomcat9 from distribution (apt install ...) then follow the instructions in the guide: "Installation on Ubuntu Server 16.04 LTS" from the pwm github wiki.

There are a number of issues with following this:

When you install Tomcat on Ubuntu 20.04 using apt install ..., the resulting tomcat9 instance is sandboxed by systemd. From the README.debian:

* Tomcat is sandboxed by systemd and only has write access to the following directories:
- /var/lib/tomcat9/conf/Catalina (actually /etc/tomcat9/Catalina) 
- /var/lib/tomcat9/logs (actually /var/log/tomcat9) 
- /var/lib/tomcat9/webapps 
- /var/lib/tomcat9/work (actually /var/cache/tomcat9) 
If write access to other directories is required the service settings have to be overridden. 
This is done by creating an override.conf file in /etc/systemd/system/tomcat9.service.d/ containing: 
[Service] ReadWritePaths=/path/to/the/directory/ 
The service has to be restarted afterward with: 
systemctl daemon-reload 
systemctl restart tomcat9

For Ubuntu, this isn't actually correct. Ubuntu puts the systemd *.service files in /lib/systemd/system.

To sort out this mess and get pwm working on a fresh install of Ubuntu 20.04 LTS, I did the following:
Update the tomcat9.service file:

sudo nano /lib/systemd/system/tomcat9.service

under 
[Service]
# Configuration
 add:

ENVIRONMENT="PWM_APPLICATIONPATH=/media/pwm"

under
[Service]
# Security
add:

ReadWritePaths=/media/pwm

Write Out the file, then Exit

Note: the pwm application path could be any existing directory with the required permissions (chmod 755 on the directory /media/pwm works here...), just substitute your choice for "/media/pwm" in the above instructions. I think the previous solution (placing the application path in the /home/tomcat/pwm directory may work because users always have r-w access to their /home/<user> tree...?

Reload the systemd daemon:
sudo systemctl daemon-reload
Re-enable the tomcat9 service:
sudo systemctl  enable --now tomcat9

Note: a restart might have been as effective...

Probably best to re-boot the VM after these changes, one of the systemctl commands seems to hang...

After the re-boot, you should be good to go.

Note: I'm not particularly skilled with Linux system administration, so there may be better ways to do this. My approach is the result of a significant amount of research (Google is your friend).
Using the override approach suggested in the Debian readme might work, but there were enough differences between the instructions and the actual set-up on Ubuntu 20.04, that I wasn't keen to try them and possibly go down another rabbit hole....

A real Linux sysadmin could probably do better. Feel free to update / respond. I'm not precious about the approach, it just worked for me... 

sriramsundar sm

unread,
Jul 25, 2020, 12:31:02 PM7/25/20
to pwm-general
I assume your tomcat path shall /opt/tomcat/webapps/pwm.

You can find web.xml file inside the /opt/tomcat/webapps/pwm/WEB-INF/web.xml

Inside the web.xml you set your application path as /media/pwm

andre...@gmail.com

unread,
Oct 21, 2020, 6:04:26 PM10/21/20
to pwm-general
Bruce you are a master!!! I solved it doing exactly you explained here. Thanks a million

Ruben de Groot

unread,
May 29, 2022, 4:26:08 PM5/29/22
to pwm-general
Thanks Bruce, you helped me fix the problem.
Btw, the "sysadmin" way to automatically create an override file, which works on ubuntu is the command

systemctl edit tomcat9.service

This will edit or create the override file in the right place.
Reply all
Reply to author
Forward
0 new messages