How to Force Restart FreeNAS Web UI (Lighttpd) via SSH/Shell When Frozen


8 views

When the FreeNAS web interface becomes unresponsive, you'll typically observe:

  • Browser shows "Connecting..." indefinitely
  • Partial UI elements load but remain non-functional
  • HTTP 504 Gateway Timeout errors
  • Failed authentication attempts despite correct credentials

First ensure SSH access is enabled:

  1. Navigate to Services > SSH in the working Web UI
  2. Check "Enable" and configure permitted authentication methods
  3. Alternatively use physical console access if available

Once logged in via SSH (or local shell), execute these commands sequentially:

# Check current status
sudo service lighttpd status

# Graceful restart attempt
sudo service lighttpd restart

# Forceful restart if needed
sudo service lighttpd forcestop
sudo service lighttpd start

For persistent issues, consider these diagnostic steps:

# Check for hanging processes
ps aux | grep lighttpd

# Examine error logs
tail -n 50 /var/log/lighttpd/error.log

# Verify network configuration
ifconfig | grep inet
netstat -tuln | grep 80

Create a watchdog script (/usr/local/bin/check_lighttpd.sh):

#!/bin/sh
if ! curl -s -I http://localhost >/dev/null; then
    logger "FreeNAS Web UI down - restarting lighttpd"
    service lighttpd restart
fi

Add to cron (crontab -e):

*/5 * * * * /usr/local/bin/check_lighttpd.sh

Common performance tweaks in /etc/local/lighttpd/lighttpd.conf:

server.max-keep-alive-requests = 100
server.max-keep-alive-idle = 5
server.max-fds = 2048
server.max-connections = 1024

The FreeNAS web interface running on lighttpd (light HTTP daemon) may occasionally freeze due to:

  • Memory leaks in the middleware
  • Stalled PHP-FPM processes
  • Resource exhaustion during heavy operations

Before attempting service restart, ensure you have:

# Login via SSH (replace 'root' with admin username if different)
ssh root@freenas.local
# Or use IP address
ssh root@192.168.1.100

Three reliable methods to restart the web interface:

# Method 1: Direct service control
service lighttpd restart

# Method 2: Using the middleware (recommended)
midclt call service.restart 'lighttpd'

# Method 3: Full restart sequence
/usr/local/etc/rc.d/lighttpd onerestart

If standard restarts don't work, try these diagnostic steps:

# Check for running processes
ps aux | grep lighttpd

# Verify service status
service lighttpd status

# Force kill and restart (use cautiously)
pkill -9 lighttpd
service lighttpd start

Create a watchdog script (/root/webui_watchdog.sh):

#!/bin/sh
if ! curl -s http://localhost/ui/login | grep -q "login"; then
    logger "FreeNAS Web UI down - restarting"
    service lighttpd restart
fi

Add to cron (crontab -e):

*/5 * * * * /root/webui_watchdog.sh
  • Monitor system resources: midclt call alert.list
  • Keep FreeNAS updated: midclt call update.check_available
  • Increase PHP memory limit in /usr/local/etc/php.ini