No internet connection
  1. Home
  2. Technical Support

502 bad gateway after failed software update

By @nougatmachine
    2023-05-06 05:58:52.704Zassigned to
    • @david

    Tried to update the tinypilot software. Something went wrong during the process and now I can't login to the web interface. I have SSH enabled and can get in to that, but I don't know what to do once I'm in. Help!

    Solved in post #3, click to view
    • 5 replies
    1. A
      @Alt0
        2023-05-07 17:40:01.022Z

        Possibly in recovery / emergency mode which mine experienced before. I’d open it up and connect a screen via microHDMI to HDMI cable and keyboard. If it says it’s in Emergency Mode due to a failed disk check, I have commands that can get you through it.

        You could also try to blindly test if it is, if when you plug in a keyboard to the TP and press Ctrl + D, it will do a 1 time boot, but likely will get back into this same stuck state on next power loss and require that hotkey again, or some special fsck commands.

        Had this happened all the time before until reflashing entirely from scratch

        Also a recent thread here sounding similar
        Failed Upgrade

        1. In reply tonougatmachine:
          David @david2023-05-08 11:57:29.767Z

          Hi @nougatmachine, I'm sorry that you're running into this 502 error.

          Like @alt0 has mentioned, this is usually a symptom of a larger issue (often filesystem corruption). During software updates, there's more reading and writing to disk compared to normal usage which can reveal this kind of filesystem issue.

          In this case, I would suggest that you re-flash your SD card to get back up and running. I don't recommend making any changes via SSH since we don't know how extensive the corruption is - chances are you'd need to re-flash anyway. If you can't re-flash your SD card, another option is to boot from USB.

          Once you're back up and running, enabling the read-only filesystem is a good idea since it helps prolong the life of your SD card.

          Hope that helps! Please let me know if you have any other questions.

          ReplySolution
          1. N@nougatmachine
              2023-05-08 12:39:17.307Z

              I had a reader handy so I was able to re-flash the card. tinypilot.local gave an error the first time I tried to use after that, but I am guessing that was just the first-boot process taking longer than I remembered, because a refresh about a minute later had it up and running :)

              It looks like things are good to go now, but are there any checks or diagnostics I can do to ensure it was only a software issue that the re-flash has fixed? Also, since I am here - if I turn off SSH once my setup is fully finalized, will changes to the SSH credentials persist if I were to temporarily re-enable it again later, or would they revert to the defaults?

              I will probably take your advice on enabling read-only mode once I'm sure I'm done configuring everything.

              1. David @david2023-05-08 13:02:35.543Z

                Great! I'm glad you're back up and running. The initial boot can take a little while, so I recommend waiting about 5 minutes for the full boot process to finish running in these situations.

                are there any checks or diagnostics I can do to ensure it was only a software issue that the re-flash has fixed?

                I'm not sure if I understand exactly what you mean. I'm pretty confident that this was a filesystem corruption issue rather than anything else because of the symptoms and your description. Being able to access the TinyPilot web interface is enough to know that the re-flash worked. The re-flash is a clean install that completely wipes your SD card and then re-installs the operating system and TinyPilot software.

                if I turn off SSH once my setup is fully finalized, will changes to the SSH credentials persist if I were to temporarily re-enable it again later, or would they revert to the defaults?

                The changes you make to credentials persist, so toggling SSH on and off doesn't revert to the defaults.

                Hope that has helped. Please let me know if you have any other questions.

                1. N@nougatmachine
                    2023-05-08 14:03:51.128Z

                    Sounds good to me, thanks for your help and reassurance.