IO Error when enabling https for Nextcloud with Let's Encrypt

Ubuntu 18.04 snap package
as root
letsencrypt is installed

command:
root@DELLXEON:~# nextcloud.enable-https lets-encrypt
In order for Letā€™s Encrypt to verify that you actually own the
domain(s) for which youā€™re requesting a certificate, there are a
number of requirements of which you need to be aware:

  1. In order to register with the Letā€™s Encrypt ACME server, you must
    agree to the currently-in-effect Subscriber Agreement located
    here:

    https://letsencrypt.org/repository/
    

    By continuing to use this tool you agree to these terms. Please
    cancel now if otherwise.

  2. You must have the domain name(s) for which you want certificates
    pointing at the external IP address of this machine.

  3. Both ports 80 and 443 on the external IP address of this machine
    must point to this machine (e.g. port forwarding might need to be
    setup on your router).

Have you met these requirements? (y/n) y
Please enter an email address (for urgent notices or key recovery): editedout@example.com
Please enter your domain name(s) (space-separated): example.com
Attempting to obtain certificatesā€¦ error running certbot:

An unexpected error occurred:
IOError: [Errno 13] Permission denied: ā€˜/etc/letsencrypt/cli.iniā€™
Please see the logfile ā€˜/tmp/tmpyo06LUā€™ for more details.
root@DELLXEON:~#

strace did not lend any clues.

write(1, ā€œAttempting to obtain certificateā€ā€¦, 37Attempting to obtain certificatesā€¦ ) = 37
pipe([3, 4]) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f1e852c29d0) = 7482
close(4) = 0
read(3, ā€œAn unexpected error occurred:\nIOā€ā€¦, 128) = 128
read(3, ā€œmltkzcā€™ for more details.\nā€, 128) = 26
read(3, ā€œā€, 128) = 0
ā€” SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=7482, si_uid=0, si_status=1, si_utime=0, si_stime=0} ā€”
rt_sigreturn({mask=[]}) = 0
close(3) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 7482
fcntl(1, F_DUPFD, 10) = 11
close(1) = 0
fcntl(11, F_SETFD, FD_CLOEXEC) = 0
dup2(2, 1) = 1
write(1, ā€œerror running certbot:\nā€, 23error running certbot:
) = 23
dup2(11, 1) = 1
close(11) = 0
fcntl(1, F_DUPFD, 10) = 11
close(1) = 0
fcntl(11, F_SETFD, FD_CLOEXEC) = 0
dup2(2, 1) = 1
write(1, ā€œ\nā€, 1
) = 1
dup2(11, 1) = 1
close(11) = 0
fcntl(1, F_DUPFD, 10) = 11
close(1) = 0
fcntl(11, F_SETFD, FD_CLOEXEC) = 0
dup2(2, 1) = 1
write(1, ā€œAn unexpected error occurred:\nIOā€ā€¦, 154An unexpected error occurred:
IOError: [Errno 13] Permission denied: ā€˜/etc/letsencrypt/cli.iniā€™
Please see the logfile ā€˜/tmp/tmpmltkzcā€™ for more details.
) = 154
dup2(11, 1) = 1
close(11) = 0
exit_group(1) = ?
+++ exited with 1 +++

Log file is empty

what are the file permissions for /etc/letsencrypt/cli.in?

root@DELLXEON:~# ls -ld /etc/letsencrypt/
drwxr-xr-x 2 root root 4096 May 24 10:50 /etc/letsencrypt/
root@DELLXEON:~# ls -l /etc/letsencrypt/
total 4
-rw-rā€“r-- 1 root root 121 May 24 11:02 cli.ini
root@DELLXEON:~# touch /etc/letsencrypt/cli.ini
root@DELLXEON:~# ls -l /etc/letsencrypt/
total 4
-rw-rā€“r-- 1 root root 121 May 24 11:46 cli.ini
root@DELLXEON:~#

As far as I have seen in your posting /etc/letsencrypt/cli.ini didnā€™t exit, you created it with ā€˜touchā€™. So you should communicate with the people who created your snap-package.

If I understand your post correctly (there seems to be a typo)
did you mean to say: exist?

You may have missed that I used ls to list the file first
and that it has a size of 121 bytes not 0.
I would be size 0 if touch had created it.

in any case I checked the contents.

root@DELLXEON:~# cat /etc/letsencrypt/cli.ini
# Because we are using logrotate for greater flexibility, disable the
# internal certbot logrotation.

max-log-backups = 0

Letsencrypt was installed via apt

Just an fyiā€¦
I am new to these snap packages and being new it seems I made a mistake.
I didnā€™t realize that the snap packages contained there own root filesystem
and the particular

I checked, was from the host filesystem not the snap package filesystem.
I have since removed the snap package and installed nextcloud package
via the nextcloud ubuntu repository.
That seemed to go well at first but has ultimately failed as well.

Thanks for the help Peteman52