Ubuntu18.04安装QGIS3.4执行sudo apt-get update遇TLS握手错误求助
Hey there, let's break down the issue you're facing. From what you've shared, you followed the official QGIS install steps but hit a TLS handshake error when running sudo apt-get update. Let's start with the details you provided, then walk through possible causes and fixes.
Your Setup & Error Details
You updated /etc/apt/sources.list with the QGIS LTR sources:
deb https://qgis.org/ubuntu-ltr bionic main deb-src https://qgis.org/ubuntu-ltr bionic main
When running sudo apt-get update, you got this error:
ashj@ashj:~/Downloads/LAStools$ sudo apt-get update
[sudo] password for ashj:
Ign:1 https://qgis.org/ubuntu-ltr bionic InRelease
Err:2 https://qgis.org/ubuntu-ltr bionic Release
Could not handshake: An unexpected TLS packet was received. [IP: 10.4.21.120 8080]
Likely Causes & Fixes
1. Proxy Server Misconfiguration
First, the IP 10.4.21.120:8080 looks like an internal network proxy. Most often, this error happens when the proxy isn't handling HTTPS traffic correctly.
- Check current proxy settings: Run these commands to see if system-level proxies are set:
echo $http_proxy $https_proxy ls /etc/apt/apt.conf.d/ | grep proxy - Temporarily bypass proxy: If your network allows direct access, try running update without proxy:
sudo http_proxy= https_proxy= apt-get update - Fix proxy HTTPS support: If you need to use the proxy, configure APT to use it properly. Create/edit
/etc/apt/apt.conf.d/99proxywith:
Note that we useAcquire::http::Proxy "http://10.4.21.120:8080/"; Acquire::https::Proxy "http://10.4.21.120:8080/";http://for the HTTPS proxy—this is intentional, as the proxy itself uses HTTP to forward encrypted HTTPS traffic.
2. TLS Version Incompatibility
Ubuntu 18.04's APT might be using a TLS version that the QGIS server or your proxy doesn't support.
- Force compatible TLS versions: Edit
/etc/apt/apt.confand add these lines:
Then re-runAcquire::https::TLSv1.2 "true"; Acquire::https::TLSv1.3 "false";sudo apt-get update.
3. Network/Firewall Interference
Your internal firewall might be intercepting HTTPS traffic (e.g., with a man-in-the-middle certificate) or blocking the QGIS server entirely.
- Test the connection directly: Use
curlto diagnose the issue:
If you see certificate errors, you'll need to install your network's root CA certificate:curl -v https://qgis.org/ubuntu-ltr/dists/bionic/Releasesudo cp /path/to/your-ca-cert.pem /usr/local/share/ca-certificates/ sudo update-ca-certificates
4. Try a Different QGIS Source
Occasionally, the LTR source might have regional accessibility issues. Switch to the standard QGIS repo by updating /etc/apt/sources.list:
deb https://qgis.org/ubuntu bionic main deb-src https://qgis.org/ubuntu bionic main
Then run sudo apt-get update again.
内容的提问来源于stack exchange,提问作者Ashj

