Most web server administrators running Debian systems have encountered the error “gnutls_handshake() failed: Handshake failed” when trying to install and configure a web server. As an experienced system administrator, I have found that this error can be resolved simply by running uname
to determine the underlying issue.
What is uname
?
uname
is a Linux command used to determine a variety of system information, such as the processor type, the kernel architecture, and the server’s system name. In this case, we can use uname
to help us identify and address the underlying issue causing the gnutls_handshake()
error.
How to use uname
to fix the error
- Run the following command in your terminal:
uname -r
. This will return the current kernel version. - Check the output of
uname -r
against your currently installed kernel version. You can do this by runningdpkg -l | grep linux-image
. - If the version returned by
uname -r
is different from your currently installed version, your kernel needs to be updated. Runsudo apt-get upgrade linux-image
to update your kernel. - If the version returned by
uname -r
matches your installed version, then your kernel is up to date. The system is likely having issues because of a misconfigured TLS (Transport Layer Security). You can try to resolve the misconfiguration by runningsudo systemctl restart apache2
,sudo systemctl restart postfix
orsudo systemctl restart nginx
depending on which web server you’re running. - If that doesn’t fix the error, you’ll need to manually fix the misconfigured TLS. To do this, edit the appropriate configuration file. Default paths to configuration files would be
/etc/apache2/apache2.conf
,/etc/postfix/main.cf
or/etc/nginx/nginx.conf
, depending on which web server you’re running.
Conclusion
The error “gnutls_handshake() failed: Handshake failed” can be a challenge to the inexperienced administrator. However, by running the uname
command to check the underlying issue and performing the appropriate steps, the error can be easily resolved with minimal disruption to your web server.
I hope this article has been able to shed some light on how to troubleshoot this error and get your web server running smoothly again.