Woke up to: OSError: [Errno 40] Too many levels of symbolic links: '/home/user-data/ssl/ssl_certificate.pem'

This led to my mail server not responding and Roundcube was showing error “Connection to storage server failed.”

What could have caused this? Trying to find the root cause to avoid such errors in the future.

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/root/mailinabox/management/status_checks.py", line 386, in run_domain_checks_on_domain
    check_primary_hostname_dns(domain, env, output, dns_domains, dns_zonefiles)
  File "/root/mailinabox/management/status_checks.py", line 479, in check_primary_hostname_dns
    tlsa25_expected = build_tlsa_record(env)
  File "/root/mailinabox/management/dns_update.py", line 412, in build_tlsa_record
    cert = load_pem(load_cert_chain(fn)[0])
  File "/root/mailinabox/management/ssl_certificates.py", line 627, in load_cert_chain
    with open(pemfile, "rb") as f:
OSError: [Errno 40] Too many levels of symbolic links: '/home/user-data/ssl/ssl_certificate.pem'
"""

You must have a symbolic link loop. Have you made any changes to that file or directory?

Don’t remember making any changes. I tried downloading them to load them in my computer in hopes that certificate warning will go away which it didn’t.

ssl_certificates.pem should be a symbolic link to a pem file, for example, box.example.com-20250512-6995dfd3.pem. You’ll need to look in that directory to see what’s going on.

If you want, you can post the long version of the directory listing here using ls -l.

Yes it is a symbolic link and was a symbolic before. I will double check next time and report back if this happens again.