Remote or automatic restart?

Hello! Does anyone know any way how I can restart freedombox server remotely with an android phone when it hangs or how to make it restart itself when a key service stops? It’s very annoying when it hangs and I’m not home to hard restart it. The problem is that when it hangs, I lose all connection with it such as ddns, respectively vpn, etc.

Digging for a solution, I came across the software watchdog program for Linux. Has anyone tried it if it works properly on freedombox?

Hello @johnny

An idea ! you could install Tor on your freedombox and then install Tor Browser from app store on your android phone. So when you loose the connection to your freedombox, try to connect to it over the Tor network with your Tor browser on your phone. If you can connect to your freedombox over Tor network just login and reboot it.

I have not tried the above but it sounds OK

Regards: peter

1 Like

Thank you for the idea! I am not sure when it hangs, will Tor be available too, but it’s worth trying. Now i installed Watchdog program and configured it to ping the router IP adress of Freedombox. The expected result is to restart the server if the connection is failed, but i’m still not sure if it’s working.

I tested it and it’s working. I unplugged the internet cable for one minute and the server restarts automaticly. Now i am more than satisfied. I hope it will work in future.

1 Like

@johnny Have you found the reason for the “hanging”? If so many services stop working simultanously it could also be a hardware issue. In that case watchdog could also malfunction.

No, I did not find the reason for the hangings, but a lot of people with a pioneer edition have reported the same issues and have not found the reason too, so it may be a hardware issue. Yes you are right, watchdog could also malfunction, but if it functions properly It shouldn’t.

Sorry to hear that but tbh it sounded a lot llike it.

1 Like

Yes, and I’m sorry to say it. There must be some hardware incompatibility. I really like freedombox and I’m thinking to continue using it. Only if it wasn’t these random crashes… When it was with Buster, it worked flawlessly, but couldn’t get along with Bulseye. It may be a better idea to change the hardware if I want to continue to use it. Maybe Rasberry Pi works better with it… My last idea was to buy an old Thinkstation (for no more than 30$) and try Yunohost for home server. I was surprised that they have images for Olinuxino lime 2. I may try it on the Pioneer with another SD card, but for sure i will keep my Freedombox.

1 Like

I have ejabberd, postfix/dovecot, openvpn, quassel, radicale and syncthing working. Which apps are you using?

Did you check things like disk space and run fsck/btrfs check on the micro SD card? I once had something broken on my fs that made the pioneer fail backup and in some cases crash.

I am very happy with my Pioneer but I recently switched to one with SSD and moved everything except /boot to the SSD, to have more space and perhaps better reliability.

1 Like

My Pioneer Edition Freedombox with a 500GB SSD (running OpenVPN, Samba, WordPress, and the Apache web server) draws more current than the provided power supply can provide when there is lots of demand on the server like when my students are accessing a video stored on my Freedombox. The voltage drops and errors start to happen with the hardware. I replaced the meager 2A supply with a 5A supply and crash/freeze events have gone from every 2 or three days to perhaps one every 2 months. Hope this helps.
David

1 Like

I’m using bepasty, calibre, matrix, wireguard and wordpress. I check the disk space but have never run fsck/btrfs check. I will do it next time. I hadn’t thought that the problem might be in the SD card. In this case, SSD is a good idea. Thank you!

Thank you! I had not put the power supply in doubt. I will also change it.

I never had power supply problems with only the SD card but I had exactly a similar experience like @doliver10 with an external disk.

I have two Rasperry Pi (4B and 3B+) running FreedomBox flawlessly. I would recommend it if it weren’t for the current price increase…

1 Like

I installed watchdog on my Pioneer, and it’s working. If someone is still suffering from random hangings when he is away from home, it is a good solution. Here are the steps I followed to configure it:

I used sunxi_wdt module for my Pioneer edition

It depends on the hardware. With modern enough Linux kernel and intel CPU you should be able to do following if you run Ubuntu or some other Debian variant:

  1. sudo apt install watchdog
  2. sudo nano -w /etc/default/watchdog and define correct module, such as watchdog_module="iTCO_wdt" (note that the correct driver name depends on your hardware but this should be good enough for intel CPUs manufactured during the last 10 years). When the watchdog service is started, it will load this kernel module which will make /dev/watchdog device to appear in the system.
  3. sudo nano -w /etc/watchdog.conf uncomment the line watchdog-device = /dev/watchdog or just add that line as extra line to that file. The end result should match this:
 $ grep -vE '^(#|$)' /etc/watchdog.conf
 watchdog-device = /dev/watchdog
 realtime        = yes
 priority        = 1
  1. sudo systemctl enable --now watchdog

All the possible watchdog driver modules can be listed with command

ls "/lib/modules/$(uname -r)/kernel/drivers/watchdog"

and if you don’t have a clue which one to use, you can try testing those one by one. For example, to test driver sp5100_tco.ko simply run sudo modprobe sp5100_tco and then run sudo wd_identify to tell if your hardware is supported by that driver. If it didn’t work, remove the driver with sudo modprobe -r sp5100_tco and retry with another. Note that wd_identify cannot be used if watchdog process is already connected to the hardware so you cannot use that after enabling the watchdog.

To test the watchdog hardware you can cause artificial failure by simply opening the device and never writing anything to it. For example, before enabling the watchdog service in last step, you can simply run sudo cat /dev/watchdog and the system will automatically reset in about 60 seconds. This works because the watchdog driver works by starting the watchdog timer when the file is opened and the only way to reset the timer is to write something to the driver device. Closing the file will also stop the timer instead of causing a reboot (unless your kernel has been compiled with non-default flags which cause reset even if nobody is using watchdog device anymore after it has been used at all after boot). When you run cat on the driver file, the file will be opened and the cat process will stall trying to read the file and hardware reset will be done when the timer expires (which should be 60 seconds by default). It’s a good idea to save all work and sync the filesystem before attempting this!

For details about the kernel watchdog driver, see the official kernel documentation.

Share

Improve this answer

Follow

edited Aug 16, 2022 at 11:06

answered Aug 16, 2022 at 10:39


Mikko Rantalainen's user avatar

Mikko Rantalainen

3,75911 gold badge2323 silver badges31

Do you think 4A would be also good?

I changed the power supply with 4A, bought from olimex, and nothing changed. The crashes are daily…sometimes twice a day. The only thing that keeps the box from being smashed with a hammer is the watchdog. The way I check is by following the server uptime after the last watchdog reboot. So the problem is not the power supply.