Unable to update my ssl certificate: generates this error. Traceback (most recent call last): File "/snap/certbot/4412/bin/certbot", line 8, in <module> sys.exit(main())

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:jsid.edu.et

I ran this command:

It produced this output:root@etisp:~# sudo certbot --apache -d www.jsid.edu.et -d jsid.edu.et
Traceback (most recent call last):
File "/snap/certbot/4412/bin/certbot", line 8, in
sys.exit(main())
^^^^^^
File "/snap/certbot/4412/lib/python3.12/site-packages/certbot/main.py", line 19, in main
return internal_main.main(cli_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/certbot/4412/lib/python3.12/site-packages/certbot/_internal/main.py", line 1838, in main
log.pre_arg_parse_setup()
File "/snap/certbot/4412/lib/python3.12/site-packages/certbot/_internal/log.py", line 71, in pre_arg_parse_setup
temp_handler = TempHandler()
^^^^^^^^^^^^^
File "/snap/certbot/4412/lib/python3.12/site-packages/certbot/_internal/log.py", line 270, in init
self._workdir = tempfile.mkdtemp(prefix="certbot-log-")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/certbot/4412/usr/lib/python3.12/tempfile.py", line 512, in mkdtemp
prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/certbot/4412/usr/lib/python3.12/tempfile.py", line 265, in _sanitize_params
dir = gettempdir()
^^^^^^^^^^^^
File "/snap/certbot/4412/usr/lib/python3.12/tempfile.py", line 454, in gettempdir
return _os.fsdecode(_gettempdir())
^^^^^^^^^^^^^
File "/snap/certbot/4412/usr/lib/python3.12/tempfile.py", line 447, in _gettempdir
tempdir = _get_default_tempdir()
^^^^^^^^^^^^^^^^^^^^^^
File "/snap/certbot/4412/usr/lib/python3.12/tempfile.py", line 362, in _get_default_tempdir
raise FileNotFoundError(_errno.ENOENT,
FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/root']
root@etisp:~# certbot --version
Traceback (most recent call last):
File "/snap/certbot/4412/bin/certbot", line 8, in
sys.exit(main())
^^^^^^
File "/snap/certbot/4412/lib/python3.12/site-packages/certbot/main.py", line 19, in main
return internal_main.main(cli_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/certbot/4412/lib/python3.12/site-packages/certbot/_internal/main.py", line 1838, in main
log.pre_arg_parse_setup()
File "/snap/certbot/4412/lib/python3.12/site-packages/certbot/_internal/log.py", line 71, in pre_arg_parse_setup
temp_handler = TempHandler()
^^^^^^^^^^^^^
File "/snap/certbot/4412/lib/python3.12/site-packages/certbot/_internal/log.py", line 270, in init
self._workdir = tempfile.mkdtemp(prefix="certbot-log-")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/certbot/4412/usr/lib/python3.12/tempfile.py", line 512, in mkdtemp
prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/certbot/4412/usr/lib/python3.12/tempfile.py", line 265, in _sanitize_params
dir = gettempdir()
^^^^^^^^^^^^
File "/snap/certbot/4412/usr/lib/python3.12/tempfile.py", line 454, in gettempdir
return _os.fsdecode(_gettempdir())
^^^^^^^^^^^^^
File "/snap/certbot/4412/usr/lib/python3.12/tempfile.py", line 447, in _gettempdir
tempdir = _get_default_tempdir()
^^^^^^^^^^^^^^^^^^^^^^
File "/snap/certbot/4412/usr/lib/python3.12/tempfile.py", line 362, in _get_default_tempdir
raise FileNotFoundError(_errno.ENOENT,
FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/root']

My web server is (include version): apache

The operating system my web server runs on is (include version): ubuntu 18.04
My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don't know): yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): yes webmin

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot version is 3.2 but cant display now

I tried to read relate posts a lot, but didn't find the solution please help.

Your Certbot installation cannot access any of the 4 temporary directories it expects to access. That is weird, because you are running it as root, and ubuntu should have all of those.

I suggest checking to see if the directories exist, have the correct permissions and owners. Perhaps something on your system messed up the settings or ownership:

ls -l /tmp
ls -l /var/tmp
ls -l /usr/tmp
ls -l /root

If it doesn't look like there is a permissions error, I would try using the snapd commands to reinstall Certbot. I am not very familiar with snapd, but the general process is something like:

sudo snap remove certbot  # remove certbot
sudo snap saved  # find the id the settings were saved into
sudo snap install certbot  # reinstall certbot
sudo snap restore {{ID}}  # enter the id from above to restore the settings

I hope one of those ideas can get you back up and running.

2 Likes

Thank you for your support. Indeed I have checked the files/directories using above code. here is the output. It seems all other directories are available except /usr/tmp
please help i am in critical need.
root@etisp:~# ls -l var/tmp
ls: cannot access 'var/tmp': No such file or directory
root@etisp:~# ls -l /var/tmp
total 12
drwx------ 3 root root 4096 Aug 25 2024 systemd-private-b496e78ad091410c921d2751958a6386-apache2.service-I50IMF
drwx------ 3 root root 4096 Jun 13 2024 systemd-private-b496e78ad091410c921d2751958a6386-systemd-resolved.service-RQhVoK
drwx------ 3 root root 4096 Jun 13 2024 systemd-private-b496e78ad091410c921d2751958a6386-systemd-timesyncd.service-cGya4N
root@etisp:~# ls -l /usr/tmp
ls: cannot access '/usr/tmp': No such file or directory
root@etisp:~# ls -l /var/tmp
total 12
drwx------ 3 root root 4096 Aug 25 2024 systemd-private-b496e78ad091410c921d2751958a6386-apache2.service-I50IMF
drwx------ 3 root root 4096 Jun 13 2024 systemd-private-b496e78ad091410c921d2751958a6386-systemd-resolved.service-RQhVoK
drwx------ 3 root root 4096 Jun 13 2024 systemd-private-b496e78ad091410c921d2751958a6386-systemd-timesyncd.service-cGya4N
root@etisp:~# ls -l /usr/tmp
ls: cannot access '/usr/tmp': No such file or directory
root@etisp:~# ls -l /root
total 41708
-rw-r--r-- 1 root mail 385836 May 25 2024 dead.letter
-rw-r--r-- 1 root root 42308883 Oct 27 2023 ojs-3.2.1-4.tar.gz
drwx------ 3 root root 4096 Oct 17 2023 snap
root@etisp:~# sudo snap remove certbot
error: cannot communicate with server: Post "http://localhost/v2/snaps/certbot": dial unix /run/snapd.socket: connect: connection refused
root@etisp:~# sudo snap saved
error: cannot communicate with server: Get "http://localhost/v2/snapshots": dial unix /run/snapd.socket: connect: connection refused

And, what about this one

sudo ls -l /tmp

and this (you might have to wait a minute or more for the output)

sudo snap list
2 Likes