atareao/Touchpad-Indicator

PPA Package fails to uninstall with users added after installation

Closed this issue · 2 comments

When doing an uninstall of the Ubuntu-package for touchpad-indicator I get an error:

/usr/sbin/deluser: The user `backup' is not a member of group `input'.
dpkg: error processing package touchpad-indicator (--remove):
 installed touchpad-indicator package post-removal script subprocess returned error exit status 6

When looking at the postrm-file, it seems the script does not check that the user is actually part of the group when calling deluser:

for user in $(cat /etc/passwd | grep -v /bin/false | grep -v nologin | grep /home | cut -d : -f 1)
do
    deluser $user input

It should either check if the user is actually part of the group "input" or ignore return values when calling deluser, e.g.

for user in $(cat /etc/passwd | grep -v /bin/false | grep -v nologin | grep /home | cut -d : -f 1)
do
	if [ `grep -q "input:.*${user}.*" /etc/group` ]
	then
		deluser $user input

In my case the users were added via Ansible automation, which might explain why the users are not part of that group, but the postrm script should be more resilient against such cases in general.

HankB commented

I ran into the same issue with a single user (myself) which existed prior to the installation. In order to uninstall (dpkg --purge) I needed to add myself to group input. During the uninstall operation the user was removed.
This is on GalliumOS 3.0

Seems to have been fixed by 20a6992 and ad2a9ae