Score:0

Cant install certbot using snap return: Run configure hook of "certbot" snap if present

bm flag

I want to install certbot using snap, but when I tried Official instruction:

sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot

but returns:

error: cannot perform the following tasks:

  • Run configure hook of "certbot" snap if present (run hook "configure": /var/lib not root-owned 1000:1000)

Previously, I uninstalled certbot(from apt) by using the below command:

sudo apt-get remove -y certbot python3-certbot-apache

What happened? I am using ubuntu 18.04 Bionic

From the error, looks like I need to change owner of /var/lib to root user. But I changed and still got the same error. Should I change to root recursively to that folder?

here is ls to the /var/lib:

drwxr-xr-x  4 myuser       myuser       4.0K Mar 10  2020 AccountsService
drwxr-xr-x  5 myuser       myuser       4.0K Mar 24  2020 apache2
drwxr-xr-x  5 myuser       myuser       4.0K Oct  4 02:36 apt
drwxr-xr-x  2 root      root      4.0K Sep  8 02:03 binfmts
drwxr-xr-x  2 myuser       myuser       4.0K May  5  2018 command-not-found
drwxr-xr-x  2 myuser       myuser       4.0K Mar 10  2020 dbus
drwxr-xr-x  2 myuser       myuser       4.0K Apr 16  2018 dhcp
drwxr-xr-x  3 myuser       myuser       4.0K Mar 10  2020 dictionaries-common
drwxr-xr-x  7 myuser       myuser       4.0K Oct  4 02:36 dpkg
drwxr-xr-x  2 myuser       myuser       4.0K Dec  9  2019 git
drwxr-xr-x  3 myuser       myuser       4.0K Mar 10  2020 grub
drwxr-xr-x  2 myuser       myuser       4.0K Oct  3 14:52 initramfs-tools
drwxr-xr-x  2 landscape landscape 4.0K Mar 10  2020 landscape
drwxr-xr-x  4 myuser       myuser       4.0K Oct  4 02:34 letsencrypt
drwxr-xr-x  3 myuser       myuser       4.0K Mar 10  2020 locales
drwxr-xr-x  2 myuser       myuser       4.0K Oct  3 06:25 logrotate
drwxr-xr-x  2 root      root         0 Oct  4 02:56 lxcfs
drwxr-xr-x  2 lxd       nogroup   4.0K Jun 16 00:42 lxd
drwxr-xr-x  2 myuser       myuser       4.0K Mar 10  2020 man-db
drwxr-xr-x  2 myuser       myuser       4.0K Apr 24  2018 misc
drwxr-xr-x  2 myuser       myuser       4.0K Oct  3 06:25 mlocate
drwx------ 35 mysql     mysql     4.0K Oct  3 14:51 mysql
drwx------  2 mysql     mysql     4.0K Mar 24  2020 mysql-files
drwx------  2 mysql     mysql     4.0K Mar 24  2020 mysql-keyring
drwxr-xr-x  2 root      root      4.0K Jan 21  2020 mysql-upgrade
drwxr-xr-x  2 myuser       myuser       4.0K Oct  3 14:50 pam
drwxr-xr-x  4 myuser       myuser       4.0K Mar 24  2020 php
drwxr-xr-x  2 myuser       myuser       4.0K Apr  4  2019 plymouth
drwx------  3 myuser       myuser       4.0K Mar 10  2020 polkit-1
drwxr-xr-x  6 postgres  postgres  4.0K Oct  3 14:50 postgresql
drwx------  3 myuser       myuser       4.0K Mar 10  2020 private
drwxr-xr-x  2 myuser       myuser       4.0K Mar 24  2020 python
drwxr-x---  2 redis     redis     4.0K Feb 24  2021 redis
drwxr-xr-x 21 myuser       myuser       4.0K Oct  4 02:46 snapd
drwxr-xr-x  3 myuser       myuser       4.0K Mar 10  2020 sudo
drwxr-xr-x  7 root      root      4.0K Oct  4 02:36 systemd
drwxr-xr-x  3 root      root      4.0K Jun 27 13:26 ubuntu-advantage
drwxr-xr-x  2 myuser       myuser       4.0K Oct  3 14:53 ubuntu-release-upgrader
drwxr-xr-x  3 myuser       myuser       4.0K Oct  3 14:52 ucf
drwxr-xr-x  2 myuser       myuser       4.0K Nov 25  2019 unattended-upgrades
drwxr-xr-x  2 myuser       myuser       4.0K Mar 10  2020 update-manager
drwxr-xr-x  4 myuser       myuser       4.0K Oct  4 02:44 update-notifier
drwxr-xr-x  3 myuser       myuser       4.0K Mar 10  2020 ureadahead
drwxr-xr-x  2 myuser       myuser       4.0K Mar 10  2020 usbutils
drwxr-xr-x  3 myuser       myuser       4.0K Mar 10  2020 vim
Score:0
bm flag

I just need to change /var/lib/snapd folder to root user using bellow command:

chown root:root -R /var/lib/snapd/

In other server, /var/lib folder and the inside is owned by root. I don't exactly know why the user of the folder on this server is not root, after changed it now I can install certbot and use it.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.