Announcement

Collapse
No announcement yet.

Seeking ideas with power outage prep and protection on multiple systems. NFS and Power settings

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Post-Install] Seeking ideas with power outage prep and protection on multiple systems. NFS and Power settings

    This will cover several different areas including power control and networking. This is about my office setup and three systems. First the story. It's a bit long so feel free to move on to another thread...

    I have a desktop PC running either KDEneon (for now) or Kubuntu 26.04, a media server running Ubuntu Server 24.04, and a Raspberry Pi running Raspbian 12 (bookworm). The Pi only runs a torrent server and uses NFSv4 to retrieve and store files on the media server. The desktop also has the servers NFS shares mounted.

    The desktop has a large UPS and the server and Pi share a smaller one. The server and desktop both shut themselves down after a few minutes of power loss. The Pi is not configured to do that. Also, two routers are on the same UPS as the server and Pi. The modem has its own UPS.

    This week there was a power outage at 4am and power was restored at 6:30am - I slept through it. My only indication that anything had happened was I sat down at my desk and discovered my PC was off. I normally leave it running unless I know I'm going to be gone for several days. At this point I still did not know the power had failed so I just assumed I shut it down the night before and had forgotten.

    Issue #1:
    When I powered up the desktop and logged in, it was lagging to the point of being barely usable but nothing in "top" looked out of place.. So first I rolled back to the previous days snapshot but the results were not different. Long story short: it was two NFS mounts causing the lag because the server was off and I hadn't noticed that yet. They were mounted with "hard" as one of the options and I assume systemd was continually re-attempting the mounts.

    I never turn off the server so that was my first clue that something larger had happened. Restoring power to the server "fixed" the desktop lag.

    Issue #2:
    Once the server was back up, using a browser on the desktop I logged into Transmission (a torrent server) that runs on the Pi and the page was all errors. So I ssh'd into the Pi and transmission was running but the NFS mounts were not available - obviously because the server had been off. So I manually remounted them and restarted Transmission and everything was running normally.

    Note that the Pi was still powered up and never shut down. I assume the UPS had more than enough battery to keep the Pi up and running for the 2.5 hours power was down.

    The goal:
    What I would like is to create a setup where these issues do not occur when a power outage happens. I believe it would require a sequential ending of some services and shutdown times for each of the devices, and I'm not sure where to start.

    I guess somehow triggering a shutdown of the Pi, then the desktop, then finally the server. This would eliminate the failing of Transmission and the NFS mounts causing problems. Re. the NFS mounts I did change "hard" to "soft" but I haven't tested to see it that helps the lagging issue.

    So I guess first thing is to figure out how to trigger the Pi to shutdown. I have ssh/rsh access from my desktop PC to the Pi so I can send a poweroff to the Pi with some trigger. Then power down the desktop before the server.

    All the UPSs a Cyberpower so I'll start there...

    Any suggestions are welcome.

    Please Read Me

    #2
    Very probably not what you want to hear: but why use UPSs at all if they are not sufficient for your situation?

    So I would
    1. determine the energy consumption of my connected devices
    2. take the longest power outage you have had in let's say the last ten years
    3. calculate the needed capacity of the UPSs to overcome such a long power outage and multiply it by 1,5 or 2
    4. buy new UPSs accordingly (if the wife goes along with it ).
    Last edited by Schwarzer Kater; May 21, 2026, 11:15 AM. Reason: typos
    Debian LXQt • Kubuntu • openSUSE KDE • Linux Mint • Windows • macOS
    Desktop: HP Elite SFF 805 G9 • Laptop: Apple MacBook Pro 13" • and others

    important things to do after installation (24/26.04)get rid of Snap script (20.04 +)
    install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04 +)

    Comment


      #3
      I have used mainly Cyberpower UPS myself.

      Cyberpower do have at least two Linux UPS utils. Though they may be overkill for most home use cases, they're still worth a look. Also look at NUT.

      Make that three:

      https://www.cyberpowersystems.com/pr...ersonal-linux/
      https://www.cyberpowersystems.com/pr...ersonal-linux/
      https://www.cyberpowersystems.com/pr...usiness-linux/

      I have used at least the last two, but only recall a little about the third (becasue GUI )
      One of these might be usefull.

      https://networkupstools.org/ of course is the open-source way, but can be is fiddly, but more powerful overall imo. It supports a ton of UPS devices. I think you can use on PC as the "master" if you will, and send shutdown commands to others, or something like that, or at least some way to get where you want to go without needing to configure each device completely separately.

      I have used NUT as well, but not to do much. It was a module available on my NAS, and I cannot remember how I had it configured, but I did have at least three computers, including the NAS using it.


      But I suspect that the Pi can run for many multiples of hours, if not days on even a small UPS, if it is the only thing running.
      Self-built: Asus PRIME B550M-K/Ryzen 5600GT/32Gb/Intel ARC B580 12Gb/KDE neon
      HP Elitedesk 800 G3 Mini: i5-7500T(35w)/32Gb/Kubuntu LTS
      HP Chromebook 14: i5-1135G7/8Gb/512Gb SSD/KDE Linux

      Comment


        #4
        Originally posted by Schwarzer Kater View Post
        Very probably not what you want to hear: but why use UPSs at all if they are not sufficient for your situation?

        So I would
        1. determine the energy consumption of my connected devices
        2. take the longest power outage you have had in let's say the last ten years
        3. calculate the needed capacity of the UPSs to overcome such a long power outage and multiply it by 1,5 or 2
        4. buy new UPSs accordingly (if the wife goes along with it ).
        I don't see where I stated my current UPSs were insufficient. This is a home networked system and 5-6 minutes to cleanly shut down is more than sufficient. My server UPS has 30+ minutes of capacity and the desktop 20+

        Please Read Me

        Comment


          #5
          Originally posted by claydoh View Post
          I have used mainly Cyberpower UPS myself.

          Cyberpower do have at least two Linux UPS utils. Though they may be overkill for most home use cases, they're still worth a look. Also look at NUT.

          Make that three:

          https://www.cyberpowersystems.com/pr...ersonal-linux/
          https://www.cyberpowersystems.com/pr...ersonal-linux/
          https://www.cyberpowersystems.com/pr...usiness-linux/

          I have used at least the last two, but only recall a little about the third (becasue GUI )
          One of these might be usefull.

          https://networkupstools.org/ of course is the open-source way, but can be is fiddly, but more powerful overall imo. It supports a ton of UPS devices. I think you can use on PC as the "master" if you will, and send shutdown commands to others, or something like that, or at least some way to get where you want to go without needing to configure each device completely separately.

          I have used NUT as well, but not to do much. It was a module available on my NAS, and I cannot remember how I had it configured, but I did have at least three computers, including the NAS using it.


          But I suspect that the Pi can run for many multiples of hours, if not days on even a small UPS, if it is the only thing running.
          I looked at nut years ago and decided it was way too complicated for my needs.

          After posting this, I basically decided all I need to do is shutdown Pi and Desktop, then shutdown Server while allowing enough enough time for Desktop and Pi to shutdown before Server does. This should prevent the issues with SSH and Transmission. All I have to do then is to power up Server first, then Pi and Desktop.

          The UPSs are USB connected to Server and Desktop, so I think all I have to do it have Desktop send a remote "poweroff" command to Pi as part of the shutdown script, and delay Server shutdown.

          So I set Desktop to shutdown 15 minutes after power fail, and Server 20 minutes. This allows five full minutes for Desktop and Pi to shutdown cleanly before Server does, and gives me 15 minutes to complete whatever I'm doing if I'm using Desktop. This should work as the Server has a longer run-time capacity on the UPS due to it being much lower power than Desktop.

          My task now is to figure out the best way to send "poweroff" from Desktop to Pi. I have ssh password-less (via secure-key) access as my user on Desktop, but not root. I verified pwrstat runs as root but I haven't figured out the correct way to send a command as me from a script running as root.

          Please Read Me

          Comment


            #6
            Well, I fiddled around for an hour or so and this seems to work at the end of the pwrstatd-powerfail.sh script:

            Code:
            # Power down Raspberry Pi
            ssh -p 2287 <hostname> sudo /usr/sbin/poweroff​
            I did copy the known_hosts and authorized_keys to the root user folder so not sure if that was required.

            Punch Line: The Pi case I have doesn't have a power-on button so I have to unplug and plug it back in! LOL

            I guess I'll have to move it's position in the rack to somewhere I can easily reach.

            Next will be pull the plugs and see what happens.

            Please Read Me

            Comment


              #7
              Originally posted by oshunluvr View Post
              I don't see where I stated my current UPSs were insufficient. This is a home networked system and 5-6 minutes to cleanly shut down is more than sufficient. My server UPS has 30+ minutes of capacity and the desktop 20+
              OK, sorry - this was clearly my take on things, not yours.
              So then the questions concern primarily the correct shutdown order, correct? Have you been able to test the effects of NFS hard/soft for your purpose in the meantime?
              Debian LXQt • Kubuntu • openSUSE KDE • Linux Mint • Windows • macOS
              Desktop: HP Elite SFF 805 G9 • Laptop: Apple MacBook Pro 13" • and others

              important things to do after installation (24/26.04)get rid of Snap script (20.04 +)
              install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04 +)

              Comment


                #8
                Originally posted by Schwarzer Kater View Post

                OK, sorry - this was clearly my take on things, not yours.
                So then the questions concern primarily the correct shutdown order, correct? Have you been able to test the effects of NFS hard/soft for your purpose in the meantime?
                No, I really haven't had time to test yet - I'm installing skylights in my house so my PC tinkering time is low, LOL. I got the Pi to shutdown remotely so the next test is shutting down the server to see if NFS behaves differently. Although, for my rather limited use-case, the shutdown timing should resolve my issues... we'll see very soon.

                Please Read Me

                Comment

                Users Viewing This Topic

                Collapse

                There are 0 users viewing this topic.

                Working...
                X