WebControl on Raspberry PI running but can't access

Went to use my Maslow today for the first time in a few weeks and had to change the router bit so needed to reset my zero. I kept getting errors trying to move the Z axis so tried rebooting everything but after the reboot I couldn’t open the WebControl web page. Connected via SSH and finally figured out that the memory card was full. Traced it to the log.txt file in /home/pi/.WebControl being over 12GB in size so I deleted it and rebooted again but still no web page.
“sudo netstat -tl” doesn’t show anything listening on port 5000 but “sudo systemctl status webcontrol” shows the service to be running.

I’ve done some searching here and haven’t found any previous posts that match my issue. I did see some mentions of the log file being an issue and also the webcontrol.json being zeroed which mine is currently. Please tell me the zeroed json file isn’t all of my calibration data and I’ve lost it?!?

Any ideas on how to resolve this?

you need to delete these two files:

“/.WebControl/alog.txt”
“/.WebControl/log.txt”

This is a known problem with webcontrol, but the fix has not been pushed out as there are a number of other features added that weren’t quite right. With the release of M4, classic maslow files are not actively being updated. I have a script that i supposed to delete the files after they get too big, but it doesn’t quite work right. Needs more google-foo. I think right now every time it starts up it just deletes them.

To fix this, you need to mount the drive on a linux machine and delete those two files. With the system drive full, it won’t start in that condition and will hang, so a separate system is required.

1 Like

That is the same problem for many applications on linux. Ex, tomcat web server creates a catalina.log which can grow to GBs in size.

The solution doesn’t need the program/webapp “fixed” but to leverage the Linux system utility called logrotate.

Logrotate is with every linux distro. This config should work for WebControl and Raspberry Pi OS but likely needs specifics adjusted. Here’s an example that should work.

If you’re comfortable with the commandline, you can do the following:

sudo -i  # become the root user

vi /etc/logrotate.d/webcontrol

# if you don't know Vi, use what works for your root user edits like 'nano'
# paste in the following, then save & exit

/home/pi/.WebControl/alog.txt
{
  missingok
  notifempty
  copytruncate
  weekly
  maxage 30
  maxsize 100M
  rotate 4
  su pi pi
}

/home/pi/.WebControl/log.txt
{
  missingok
  notifempty
  copytruncate
  weekly
  maxage 30
  maxsize 100M
  rotate 4
  su pi pi
}

# /home/pi/.WebControl/param-examples
# {
#    missingok     # no error if missing
#    notifempty    # if empty no need to rotate
#    copytruncate  # maintain orig file if open by copying content to the 
#                  # rotated logthen zeros out orig file. could be a  
#                  # performance hit if WebControl is sensitive to hiccups
#                  # (due to weak Pi CPUs like OG Zero W with one core 
#                  # vs Zero 2 W or newer having 4 cores.)
#    weekly        # regardless of size, rotate weekly
#    maxage 30     # regardless of size, 30 days max each -- helpful if unused
#    maxsize 100M  # rotate once file reaches this size
#    rotate 4      # keep only 4 rotation
#    su pi pi      # not being root user owned, use the file's user and group
# }

Please adjust according as I have not used WebControl yet. The numbers will depend on the size of storage and log sizes created per CNC run.

I have deliberately left off compression as that creates a CPU load burst which could cause hiccups for the CNC operation. Seeing folks are dealing with GB sized files, the maxsize & rotate count will suffice. I wouldn’t use maxsize 1G with rotate 4 as you have two log rotating yielding 8G of space used. It would be better to use maxsize 100M and adjust your rotate count for more.

Check for typos and errors:

logrotate -d /etc/logrotate.d/webcontrol

If good, when logrotates crontab entry kicks in, it will do what it does best. But being the root user, you can run it early.

logrotate -v /etc/logrotate.d/webcontrol 
# using -v verbose to see all the gritty details

My plug for Alpine Linux (& PostmarketOS) vs Raspberry Pi OS

I’ll likely try to get WebControl working on Alpine Linux for myself with a similar logrotate config. It’s been a moment since I’ve run Raspberry Pi OS.

Alpine Linux is super small (100MB’s base install), very lightweight (no systemd & extra services in the background, no GUI by default), and security focused. That should mean less hiccups for even the “Potato” Pi (OG Zero, RPi 1 & 2) running WebControl – I wouldn’t though as I’ll want 4 cores in a Zero 2 W or better.

If I have a cycle I might even create a post on how to setup Alpine Linux for Pi with WebControl once I’ve refined it.

If curious, there’s even another Alpine-based distro that is “user friendly” focused call PostmarketOS having a lightweight Desktop UI for those folks using a display - Raspberry Pi - postmarketOS . Again, being headless, PostmarketOS would be best for you to tryout Alpine in a friendly way.

2 Likes

Vote for wiki entry:

“logrotate” keeps webcontrol raspberry pi log file size in check to avoid drive filling

I’d double like your post if I could.

1 Like