Weathermap Plugin - WMEDIT01 despite user having access

Hi,
probably a stupid question, but I don’t understand it, so I thought I’d ask:

I run Weathermap on my system and it used to work fine. After six months or so I just accessed the editor again and was greeted with " The map config directory is not writable by the web server user. You will not be able to edit any files until this is corrected. [WMEDIT01]<p>"

Should be a simple fix, so I went and did a a+w on configs & output. This didn’t help though, so i checked more in depth.
I found that www-data is actually member of the librenms group so should have had full access in the first place (with 775 in place).
Still doesn’t work, so checked editor.php and edited a few debug prints.

Its running as www-data as expected and touching a file in configs did not work, so the is_writable test seems to be correct - just why?

I have this on both of my installations, so I think its a Librenms issue rather than a Weathermap issue…

Any ideas? Thanks:)

configs dir (ls -la configs):
-rwxrwxrwx 1 librenms librenms 33 Oct 29 2017 .htaccess
-rw-rw-rw- 1 librenms librenms 51 Jul 30 2018 index.php
-rw-rw-rw- 1 librenms librenms 817 Oct 1 2018 dummy.conf
-rw-rw-rw- 1 librenms librenms 647 Oct 5 2018 PORTTEMPL.config
drwxrwxrwx 2 librenms librenms 4096 Feb 9 22:32 .
-rw-rw-rw- 1 librenms librenms 5929 Apr 1 23:16 Backbone.conf
drwxrwxr-x 9 librenms librenms 4096 May 19 09:59 …

groups www-data
www-data : www-data librenms

grep mapdir editor.php
$mapdir=‘configs’;
if(! is_writable($mapdir))
if (touch($mapdir.‘/writetest.tmp’)) {
print (“touch(”.$mapdir.“/writetest.tmp) successful”);
print (“touch(”.$mapdir.“/writetest.tmp) failed”);
$mapfile = $mapdir.‘/’.$mapname;
$sourcemap = $mapdir.‘/’.$sourcemapname;
$check_base = realpath($mapdir);

./validate.php

Component Version
LibreNMS 1.51-59-gd6bb9f0
DB Schema 2019_02_10_220000_add_dates_to_fdb (132)
PHP 7.3.5-1+ubuntu16.04.1+deb.sury.org+1
MySQL 10.0.38-MariaDB-0ubuntu0.16.04.1
RRDTool 1.5.5
SNMP NET-SNMP 5.7.3
====================================

[OK] Composer Version: 1.8.5
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

I found that www-data is actually member of the librenms group

Try usermod -a -G librenms www-data

But the user is already member of the group librenms?
Do you think re-adding would change anything?

Maybe I didn’t read that correctly - you mean to say ‘id www-data’ lists librenms?

One bass ackward way you can check is to change www-data from /usr/sbin/nologin to /bin/bash and su to him and then touch some files to test. Change back when done.

id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data),999(librenms)

www-data@LibreNMS:/opt/librenms/html/plugins/Weathermap$ touch TESTFILE
www-data@LibreNMS:/opt/librenms/html/plugins/Weathermap$ ls -ltr TESTFILE
-rw-rw-r-- 1 www-data www-data 0 May 22 22:29 TESTFILE
www-data@LibreNMS:/opt/librenms/html/plugins/Weathermap$ cd configs/
www-data@LibreNMS:/opt/librenms/html/plugins/Weathermap/configs$ touch TESTFILE2
www-data@LibreNMS:/opt/librenms/html/plugins/Weathermap/configs$ ls -ltr|grep TEST
-rw-rw-r-- 1 www-data www-data 0 May 22 22:29 TESTFILE2

Hm, got a new error today,

Log says:
production.ERROR: Cannot declare class Weathermap, because the name is already in use {“userId”:1,“email”:“myEmail”,“exception”:"[object] (Symfony\Component\Debug\Exception\FatalErrorException(code: 1): Cannot declare class Weathermap, because the name is already in use at /opt/librenms/html/plugins/Weathermap/Weathermap.php:3)
[stacktrace]
#0 {main}
"}

Not sure why it would try to redeclare that, have not touched the system since my last post 2 days ago.

You’re not alone, there’s another thread on that topic I believe.

Thanks for pointing me over, happy to join in on that one:)

In absence of other acclaim: Thank you Murrant - what would we do with you?"

Indeed - thanks a mil @murrant :smile: