rhyeal / aws-rotate-iam-keys

Rotate your IAM Keys to be in compliance with security best practices
GNU General Public License v3.0
339 stars 132 forks source link

Unable to remove pkg from Ubuntu 20.04 #59

Closed roccomuscaritolo-okta closed 3 years ago

roccomuscaritolo-okta commented 3 years ago

Getting errors when trying to uninstall this package on Ubuntu 20.04 "Focal"

# /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
username@hostname:~ $ sudo apt remove aws-rotate-iam-keys
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  aws-rotate-iam-keys
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 21.5 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 198016 files and directories currently installed.)
Removing aws-rotate-iam-keys (0.9.8.3) ...
Trying to find a user name for the cron job
ps: root
logname: username
whoami: root
id: root
USER: root
SUDO_USER: username
The user username cannot use this program (crontab)
The user username cannot use this program (crontab)
grep: unrecognized option '--profile'
Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.
The user username cannot use this program (crontab)
dpkg: error processing package aws-rotate-iam-keys (--remove):
 installed aws-rotate-iam-keys package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Trying to find a user name for the cron job
ps: root
logname: username
whoami: root
id: root
USER: root
SUDO_USER: username
The user username cannot use this program (crontab)
The user username cannot use this program (crontab)
The user username cannot use this program (crontab)
dpkg: error while cleaning up:
 installed aws-rotate-iam-keys package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 aws-rotate-iam-keys
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
roccomuscaritolo-okta commented 3 years ago

Follow-up root cause was someone configured an empty /etc/cron.allow file on our systems which will deny every user.

username@host:~ $ crontab -l
/etc/cron.allow: Permission denied
You (username) are not allowed to use this program (crontab)
See crontab(1) for more information

Removing the empty file resolved my issue.

username@host:~ $ sudo rm /etc/cron.allow