You are here

Pi MeshChat Error Sending Message

49 posts / 0 new
Last post
w7acw
Pi MeshChat Error Sending Message

We are trying to setup MeshChat on Raspberry Pi's and have 2 issues.
1: is the Error Sending Message: Could not get Lock.
2: We don't see chats from the same Zone as on the regular MeshChats

One of the Pi's is on a Pi2 and one is Pi3, both are running Jessie Stretch Desktop
Any help would appreciated

K5DLQ
K5DLQ's picture
You might try reaching out to

You might try reaching out to the author, K7FPV

kg7bz
Both Roger and I emailed him,

Both Roger and I emailed him, I guess he's real busy and referred Roger to the forum. 
Here's additional info, maybe someone can give me a hint where to look:

Meshchat was installed following the directions. Looks to have installed properly. In fact it's syncing with the other nodes on our network, populating it's database with all the texts from the other nodes just fine. Nothing make it to the Web interfact though. The problem is when we try to send a text we get the message Could not get Lock.

Looking in /var/log/apache2/error.log, I see many of:
touch : cannot touch '/tmp/meshchat/lock' : No such file or directory.
clould not get lock at /usr/lib/cgi-bin/meshchatlib.pm line 35

However the file does exist and if I delete it, it's instantly re-created. There is plenty of file activity in that directory as Meshchat syncs with the other nodes.
We're both running the latest version of Raspbian from the Raspberrypi.org site.

Any idea what's happening and what went wrong? I'm not a linux guru or even much of a programmer, but I've been playing with Linux since Linus released it when I had a 386SX/25 and had to install it from floppies.

 

K7FPV
Try these commands on your pi

Try these commands on your pi:

mkdir -p /tmp/meshchat
touch /tmp/meshchat/lock
chown -R www-data:www-data /tmp/meshchat
chown www-data:www-data /tmp/meshchat/lock

Wait a few mins and try, if still not working:

/etc/init.d/meshchatsync restart

kg7bz
OK, tried that. No change.

OK, tried that. No change. Both directory and file show owner/group as www-data. Everything is working with syncing with other nodes, MeshChat's database is getting all the text from other nodes, just can't display on web page.

I  thought I'd try an older version of OS, installed on a version of Jessie from 9/2016. WORKS right off! Something has changed in Raspbian.

w8awt
w8awt's picture
Have you found a fix? I'm

Have you found a fix? I'm having exactly the same problem. I cant see anything comming  from my nodes and I cant post anything using meshchat installed on the Pi.

73,
Augustine
W8AWT

kg7bz
I haven't had the time to

I haven't had the time to look into this further. Maybe sometime in the next month. Nobody else has responded and neither has the author of MeshChat.
August KG7BZ

w8erw
w8erw's picture
MeshChat Pi

I am also having the same issues with a Pi 3 and Raspbian Stretch.  I have had a couple of additional non related issues as well.  I am beginning to think this all may be a Pi 3/Stretch problem.  It appears that something(s) are lacking in this combination.  I have a battery backup hat that will not configure correctly, a real time clock which does the same and now MeshChat does not operate as intended.  I have kept up with th Pi upgrades thinking this may solve the problems which has not happened.
 
Jim W8ERW 

K5DLQ
K5DLQ's picture
looks like a permissions

looks like a permissions issue to me....

kg7bz
Works on older OS

Just so others who are having the same problem see it, MeshChat Pi works on a 9/2016 version of Jessie. Does not work on the newer Stretch from 2017.

AJ6GZ
Don't stretch it or you'll break it

Agreed... Did two clean installs and confirmed it works up to 7/5/2017 Jessie. Something in Stretch breaks it.

w6bi
w6bi's picture
Sounds like my problem.

My MeshChat nodes stopped working recently and I suspect that's the issue, as I believe they've all been upgraded to Stretch.  I'll check.

KS7P
KS7P's picture
Fix?

Has a fix for this problem been made?  I too am trying to setup a new node with MeshChat and get the 'Could not get Lock' message.  Running Raspian/stretch.

K5DLQ
K5DLQ's picture
downgrade to Jessie

downgrade to Jessie

KL7VK
Meshchat on RPI

New to BBHN and what is the advantage in running Meshchat on an RPI as opposed to running Meshchat on station radio as a "package?"
Kirby

KG6JEI
It is recommend to NEVER run

It is recommend to NEVER run add-on software on the mesh node. Add-on programs consume valuable limited resources on a mesh node that could be better served letting the node do what it is built to do which is route packets in a high speed manner.

In addition the AREDN team doesn't support unofficial packages, any adddon software will often be asked to be removed before any support is given for issues .

K5DLQ
K5DLQ's picture
And running it on a Pi you

And running it on a Pi you get additional features (automated actions) and MUCH more storage space to serve files.

AC7BR
AC7BR's picture
One way to fix this issue

I put a new Pi, based on Raspanian Stretch, on our local mesh yesterday and had the same issues outlined in this thread.  After some investigation, I have a fix for the issue.  Before I outline the fix, I should note that the problem isn't the MeshChat software, but rather it is in the systemd startup config for Apache.  The systemd startup config specifies that a private /tmp directory should be used for the Apache process.  Because of this, the Apache process cannot see the /tmp/meshchat directory, including the lock file in that directory.  This causes all the errors you see in the Apache log file.

To fix this issue, do the following:

  • Shutdown the Apache process via the command 'sudo systemctl stop apache2'
  • Copy the Apache2 startup config to the user systemd area.  The command is 'cp /lib/systemd/system/apache2.service /etc/systemd/system/apache2.service'
  • Using your favorite editor, modify /etc/systemd/system/apache2.service and change the PrivateTmp=true parameter to PrivateTmp=false
  • Restart the Apache process via the command 'sudo systemctl start apache2'

MeshChat on a Stretch based Raspberry Pi should work now.

An alternative fix is to change the MeshChat code to use a different path.  This can be done by changing the Perl $meshchat_path variable in /usr/lib/cgi-bin/meshchatconfig.pm.  I didn't go down this path because if you ever update the MeshChat package this change would be lost unless Trevor made a similar change in his code.

Enjoy!

Brad
AC7BR

AC7BR
AC7BR's picture
One other thing

One other thing I did is to change the permissions on the lock file as it was only read/write by root.  To do this, run the command

  • chmod 0666 /tmp/meshchat/lock

I did this prior to finding the fix I outline above.  I don't know if there is code in MeshChat to take care of the permissions but if the fix above doesn't work try this too.

Brad
AC7BR
 

KB5UGF
KB5UGF's picture
Those 2 fixes worked!

I tried both of your suggestions, both the  Apache2 config mod and the permissions change, and it worked like a charm. Thanks!

KM6IAU
KM6IAU's picture
 Thank you very much

yes Thank you very much

WH6GJL
I was still having problems

I was still having problems with apache not accessing the tmp folder

Seems that running

sudo systemctl daemon-reload

before

sudo systemctl start apache2


did the trick for me to reload the proper configuration before starting apache

AB4YY
Thanks Brad!  That fixed my

Thanks Brad!  That fixed my MeshChat problem and now after months (since I upgraded to Stretch), it is up and running again.  I did have to do the permissions change to get file uploading to work.  All seems well now!
73 - Mike ab4yy

AB8XA
Yet another...

I ran into this problem on a new 3B+ I bought from Newark at Hamvention this weekend to replace my 3B on Jesse. Then I came here.

Brad, you're my hero! Thank you!

AK6PW
MeshChat on a raspberry Pi - one way message sync.

I have just set up a meshchat node on a raspberry Pi.  It is on the 3B+

After doing a clean install on the Pi & installing meshchat, I followed the instructions by AC7BR
1 - changing the PrivateTmp=false
2 - ​chmod 0666 /tmp/meshchat/lock

I was able to clear the lock error and send a message.
I then jumped on another node and saw my message appear.- sending from my node works!!

The only problem I have left is how to get the sync working both ways.  My node sends messages but does not receive (When on the other node, I sent a message and it did not appear on my node).

Any thoughts on what I need to look at?

Regards,

Peter - AK6PW

K5DLQ
K5DLQ's picture
from memory, you need to

from memory, you need to install the meshchat_api packages on one of your local nodes and configure meshchat to use it.  That's how it determines what other meshchat services are available on the network.

AK6PW
MeshChat on a raspberry Pi - all functional

That was it - missed the step to install the api package on the node - once done and rebooted, messaging both ways kicked in

Thank you!!

K6CCC
K6CCC's picture
Don't forget to reinstall api after update.

And don't forget that if you update software on the AREDN node, you get to re-install the api package.  I missed that step.

I had installed the api several days ago, and confrmed that it was there.  Today installed the newest nightly build, and then spent a while getting MeshChat working on a RasPi here.  It was working only one way.  Finally checked for installed packages on the node and it was not there.  Re-installed the api and all of a sudden, MeshChat started syncing with other nodes.  Based on my testing, this is not an uncommon problem.
 

KX8U
Tried every suggestion here and still does not work

I have read through every post and tried all the suggestions and still get the lock error.
I did a fresh install of Buster from the Raspbian site. Did the upgrade/update. Installed Apache 2. Installed MeshChat 1.02. No matter what I've tried I can't past the lock error. Not sure where to get a older copy of Raspbian as suggested here however. Very frustrated as I am to demo this for a ham club next Monday. Any help I could get will be greatly appreciated.      

nc8q
nc8q's picture
where to get a older copy of Raspbian
KX8U
Thanks. I'll try that tonight

Thanks. I'll try that tonight.

KX8U
Tried every suggestion here and still does not work Part 2

Before I tried to move to an older OS I tried editing permissions on the meshchat files in ​/var/www/html/ using ​​(sudo chmod 0666 /var/www/html/) and I no longer have the lock error. When I send a message however it just disappears. It used to show up in the lower half of the screen in Messages but no longer does. 
Any suggestions? Thanks again for the help.

KJ6WEG
KJ6WEG's picture
Similar issues fixed on Raspbian Buster

Thanks to AC7BR for the fix in comment #18!! 
I spent many hours beating my head on this setup, on a new Raspberry Pi 4 running Raspbian Buster.  After solving several other issues, this last one stumped me, and these instructions finally resolved it.  Actually, it didn't work at first... I also had to reboot the Pi to get it to start showing the messages other nodes.  
Thanks AC7BR!

N5MXI
N5MXI's picture
ARRRRGG

I've tried every suggestion in this forum thread without any luck. New MeshChat install won't sync with other MeshChat nodes and I get the dreaded "Could not get lock error" Anyone want to share an image file of their working MeshChat on a Rpi? 

I have the API loaded on a MikroTik hap ac lite with the latest AREDN firmware. 
MeshChat is installed on a Rpi 3B+ running Stretch (could get Jessie to work with my HDMI display)

I'm open to all suggestions for fixing this thing.

Thanks, David-N5MXI

Image Attachments: 
nc8q
nc8q's picture
Anyone want to share...

Message #18 in this thread solved the - Could not get lock - error for me.
Please share
that meshchat_1.02_all.ipk is installed on the node.
that the node's [Advertised Services Name] matches the meshchatconfig.pm in the RPi;
Example config;
/usr/lib/cg--bin/meshchatconfig.pm: our $pi_zone = '[Advertised Service Name]';

I hope this helps, Chuck

AE6XE
AE6XE's picture
There appears to be something

There appears to be something going on in the firewall rules, currently under investigation.   Ref:  https://github.com/aredn/aredn_ar71xx/issues/522

Joe AE6XE

N5MXI
N5MXI's picture
What's the verdict?

Joe - I've been following the thread you mentioned in your last message.  https://github.com/aredn/aredn_ar71xx/issues/522 My brain cell started hurting when you all started talking about IPtables etc... I can't tell if a resolution has been found yet or not. If yes, is there a patch I can load or will installing the nightly build correct the problem?

I also have a MikroTik which is probably the reason my MeshChat won't work. If you need another MikroTik node to be a guinea pig for testing, mine is available. 

David

AE6XE
AE6XE's picture
David, we have 3 people,

David, we have 3 people, including myself, that have tested the changes with success.  Although I'm not entirely sure if the symptoms you have are new or the same (and same root cause).   I'll push through to get into the nightly build.    Look to upgrade tomorrow and retest to see if your symptoms go away too.

Joe AE6XE

N5MXI
N5MXI's picture
 Thanks will do.

yes Thanks will do.

K6CCC
K6CCC's picture
I see the Nightly Build for

I see the Nightly Build for this came out this morning.  Installed in all 12 of my nodes.  Tunnels are all working, and my MeshChat (on  Pi) is syncing just fine to other Meshchat nodes - although I had not experienced any issuess with that.
 

N5MXI
N5MXI's picture
Still no joy

Just completed the firmware update on my MikroTik hap ac with the nightly build that was just released. Update loaded fine however I still get the "can't get lock" error message on MeshChat. MeshChat doesn't sync with other nodes.
  

KC0EUW
So the procedure described above didn't work for you?

So the procedure described here/above doesn't work for you?  I suppose you could change the $meshchat_path to "/var/www/html/meshchat" in your /usr/lib/cgi-bin/meshchatconfig.pm file, which would eliminate using the /tmp directory altogether.

This issue typically results from how the Apache web server is configured to allow or deny use of the /tmp directory on Linux.  You'll usually see messages like this in /var/log/apache2/error.log -----   "cannot touch /tmp/meshchat/lock" which causes MeshChat to report that it "could not get a lock"  Either fix the permissions in Apache as described above & change the permissions on the lock file, or point MeshChat to a different $meshchat_path where it can put its lock file.

K6CCC
K6CCC's picture
Did not help.

I just tried the procedure in the link above for David, and it did not help. 
 

nc8q
nc8q's picture
Did you...re-

Did you...re-
install the API package
after the firmware upgrade?

 

K6CCC
K6CCC's picture
The can't lock message in

The can't lock message in MeshChat is something local to MeshChat, and I don't think has anything to do with the attached node at all.  That sounds like that is local to the MeshChat install.
 

K5DLQ
K5DLQ's picture
i recall the "lock" issue was

i recall the "lock" issue was something to do with the version of Raspbian.   I know this has been asked before, so, you may want to do a quick search.

nc8q
nc8q's picture
local to the MeshChat install.

+1
 

N5MXI
N5MXI's picture
Patiently waiting for MeshChat Fix

Still waiting for someone to discover how to fix the "Could not get Lock" error in MeshChat. I wish I knew how to do programing so I could troubleshoot the problem.

KC0EUW
Not a MeshChat issue

As mentioned above, the "Could not get a lock" issue is not a problem in the MeshChat code itself. The issue results from how the latest Apache web server is configured to allow or deny use of the /tmp directory. Either fix the permissions in Apache as described here & change the permissions on the lock file as described here (restart Apache afterward),    or point MeshChat to a different $meshchat_path where it can put its lock file such as "/var/www/html/meshchat" in your /usr/lib/cgi-bin/meshchatconfig.pm file which eliminates using the /tmp directory altogether (restart meshchatsync afterward).

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer