No internet connection
  1. Home
  2. Technical Support

Can't Connect Via Browser - Can Connect Via SSH - sudo nginx -t Shows Error

By @bjs169
    2023-08-07 00:38:56.897Zassigned to
    • @david

    Hi,

    Things were working fine for the last 10+ days since I got the device. Today I powered down so I could move around the cabling. When I powered it back up I couldn't connect using the browser. I get a connection refused error. I can connect via SSH. I noted in another similar issue that it was indicated that nginx would not start. Knowing enough to check the config, I ran the following command:

    sudo nginx -t

    This returns an error, which means that nginx isn't going to start.

    The error is:

    nginx: [emerg] SSL_CTX_use_PrivateKey("/etc/ssl/private/tinypilot-nginx.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)
    nginx: configuration file /etc/nginx/nginx.conf test failed

    Any thoughts on how to fix this error?

    • 7 replies
    1. David @david2023-08-07 11:42:16.204Z

      Hi @bjs169, I'm sorry you can't connect to your TinyPilot's web interface.

      Since you have SSH access, can you share a TinyPilot log by logging in and running the following command?

      sudo /opt/tinypilot-privileged/collect-debug-logs
      

      The command will gather your TinyPilot's logs, but it won't upload them to the log server until you consent to a prompt. Once you've uploaded the log, can you share the URL in your reply?

      1. B@bjs169
          2023-08-07 14:35:15.727Z

          Hi David,

          Here is the log file URL:

          http://logs.tinypilotkvm.com/P0yX49pG

          1. David @david2023-08-07 18:01:00.347Z

            Thanks for sharing that log, @bjs169. Beyond the SSL key error, I can't see any other issues.

            Have you replaced TinyPilot's default TLS keys or made any config changes to your TinyPilot?

            1. B@bjs169
                2023-08-07 18:20:59.267Z

                No. Yesterday was the first time I logged into SSH. I only did that once I started having issues with the web UI not showing up. All other changes were made through the UI. For example, I changed the host name, streaming mode, and updated to the latest version of software. Most of that was done in the first few days. It had been running fine since I got it, survived through several graceful power-down events, and one ungraceful power down. Issue started yesterday after a graceful power down event so that I could reorganize the cables. Powered back up and then the issue appeared.

                The public key and corresponding private key don't seem to match. I think that is the issue.

                Based on my reading, the output of these commands is supposed to match:

                Is there a way to copy over or generate new public and private keys?

                1. David @david2023-08-07 18:50:49.180Z

                  Thanks for confirming! When changing the hostname, TinyPilot generates new keys - so I'm wondering if there was an issue when your TinyPilot tried to generate the keys?

                  Can you SSH into your TinyPilot and run the following command to re-generate the keys and reboot?

                  sudo /opt/tinypilot/scripts/cycle-nginx-tls-keys && \
                    sudo reboot
                  

                  Please let me know if that fixes this issue.

                  1. B@bjs169
                      2023-08-07 23:07:23.455Z

                      So that did fix the nginx issue. I was able to get the web UI "shell" to come up. But where the screen is usually visible all I got was a placeholder image icon that you get when an image can't be loaded. I looked in the logs and there were errors about being unable to connect to 127.0.0.1 on ports 8001, 8002, and 8003. When I did a netstat -an | grep LISTEN I found that nothing was listening on those ports. To me the device seemed to be "hosed" so I decided to follow your device reset instructions and flashed the card. Then I changed the IP address, host name, and video settings. Powered down and powered back up just to make sure everything "stuck" and, at this point, things are operational. I will come back if the lack of stability returns.

                      1. David @david2023-08-08 11:14:48.604Z

                        Thanks for the update! I'm glad you're back up and running after a factory reset.

                        It's interesting that there were other issues after fixing nginx's key problem. It sounds like there were also issues with your TinyPilot's streaming service. I'm not sure what the underlying cause could have been. There's a chance these issues were related to filesystem corruption - but I couldn't see any of the typical signs in your logs.

                        Feel free to reach out again if you have other issues, and please let me know if you have any other questions.