"Permission denied" in log from any command

Hi

Any certbot command I run, including certbot --version, as root gives no output on the command line, and ends with this in the log:

2022-04-19 15:28:28,150:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
  File "/snap/certbot/1952/bin/certbot", line 8, in <module>
    sys.exit(main())
  File "/snap/certbot/1952/lib/python3.8/site-packages/certbot/main.py", line 19, in main
    return internal_main.main(cli_args)
  File "/snap/certbot/1952/lib/python3.8/site-packages/certbot/_internal/main.py", line 1723, in main
    return config.func(config, plugins)
  File "/snap/certbot/1952/lib/python3.8/site-packages/certbot/_internal/main.py", line 1427, in run
    domains, certname = _find_domains_or_certname(config, installer)
  File "/snap/certbot/1952/lib/python3.8/site-packages/certbot/_internal/main.py", line 505, in _find_domains_or_certname
    domains = display_ops.choose_names(installer, question)
  File "/snap/certbot/1952/lib/python3.8/site-packages/certbot/display/ops.py", line 133, in choose_names
    code, names = _filter_names(names, question)
  File "/snap/certbot/1952/lib/python3.8/site-packages/certbot/display/ops.py", line 185, in _filter_names
    code, names = display_util.checklist(
  File "/snap/certbot/1952/lib/python3.8/site-packages/certbot/display/util.py", line 169, in checklist
    return obj.get_display().checklist(message, tags, default=default, cli_flag=cli_flag,
  File "/snap/certbot/1952/lib/python3.8/site-packages/certbot/_internal/display/obj.py", line 231, in checklist
    self._print_menu(message, tags)
  File "/snap/certbot/1952/lib/python3.8/site-packages/certbot/_internal/display/obj.py", line 374, in _print_menu
    self.outfile.flush()
PermissionError: [Errno 13] Permission denied
2022-04-19 15:28:28,154:ERROR:certbot._internal.log:An unexpected error occurred:
2022-04-19 15:28:28,200:ERROR:certbot._internal.log:PermissionError: [Errno 13] Permission denied

Anyone got a clue?
I have tried removing and reinstalling certbot (via snap).

I'm on:
Ubuntu 20.04.4
Nginx 1.18.0
Certbot 1.26.0

How are you running Certbot, using some kind of script? Or directly from the command line? Because it looks like Certbot isn't able to write text to the stdout, which is kinda weird..

1 Like

Directly from the command line...

Huh.. Weird. I'll leave this to @certbot-devs or other community volunteers as I have no idea what so ever..

1 Like

you did use --classic when installing it, right?

Yes.
And some more characters...

Show:
which certbot
history | grep -E 'snap|certbot|python'

? ? ? ?

1 Like

which certbot gives /usr/bin/certbot

History:

   46  add-apt-repository ppa:certbot/certbot
   51  apt-get install python-certbot-nginx
  278  certbot
  361  certbot renew
  369  apt-get remove certbot
  370  snap install --classic certbot
  376  certbot renew --dry-run
  377  snap refresh core
  378  snap install core
  379  snap refresh core
  380  snap refresh certbot
  381  snap remove certbot
  382  snap install --classic certbot
  383  certbot renew --dry-run
  393  certbot renew
  395  certbot renew  --nginx
  425  certbot
  431  snap remove certbot
  433  snap install certbot --classic
  464  snap run certbot
  475  certbot renew --dry-run
  497  certbot --version
  500  certbot
  503  which certbot
  504  history | grep -E 'snap|certbot|python'

Had to put in minimum 6 characters :slight_smile:

Are you using a web-based terminal by any chance? Like, are you typing these commands into a browser?

If you can try using a native SSH client (like ssh or PuTTY or whatever), that might help.

I've seen a couple of users run into this issue, we should look into what effect these terminals are having on the execution environment.

1 Like

No. I'm ssh'ing from an Ubuntu desktop.

That's bizarre. Doubly so if certbot --version doesn't print anything. I'm not sure. Could you please run:

snap run --strace="-s 1024" certbot --version 2>certbot.log

and post the resulting certbot.log file somewhere?

2 Likes

Maybe those weren't fully undone?

1 Like

https://dev.hmm.dk/certbot.log

1 Like

Could be. I have no idea where to look.

apt list --installed|grep cert:

ca-certificates/focal-updates,focal-security,now 20210119~20.04.2 all [installed]
python3-certifi/focal,now 2019.11.28-1 all [installed,automatic]
ssl-cert/focal,now 1.0.39 all [installed,automatic]

Thanks. Nothing really stands out.

Is this installation of Ubuntu running in a Proxmox/CT/LXD environment? I noticed the kernel is older than it should be for Ubuntu Focal.

I don't know how significant that is going to be, but snapd does rely heavily on kernel features. Running Focal on 4.13 instead of 5.x could be having an interaction with snapd.

I suggest giving the pip instructions a try instead, and seeing whether the issue persists with that method of installing Certbot.

3 Likes

Yes. I guess it's about time to get the host off that 17.10 anyway. I'll upgrade and see if that makes a difference.
Thanks so far!

1 Like

+9 months gives 19.04. A full three years ago. :smiley:

2 Likes

In six months it is five years! Guess I just sort of forgot about that machine as I never have to touch it :smiley:

2 Likes

Three years... since Canonical stopped supporting it. :smiley:

There are better distros for that. :smiley:

2 Likes

Now the host is on 20.4, and it works again.
Thank you @_az for the help!

1 Like