Purge of maas-common packages sometimes fails due to process using maas user

Bug #1789469 reported by Jason Hobbs
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Andres Rodriguez

Bug Description

When attempting to purge maas-common, we sometimes hit an error like:

"userdel: user maas is currently used by process 20707"

We hit this even though we stop all maas services before starting the purge.

http://paste.ubuntu.com/p/W78wPSFhPJ/

Related branches

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Hey Jason,

I'm unable to reproduce. Any chance you can gather the output of:

ps faux | grep rackd
ps faux | grep regiond

Also, sudo service maas-rackd status & sudo service maas-regiond status if possible.

Changed in maas:
status: New → Incomplete
milestone: none → 2.5.0beta1
Changed in maas:
milestone: 2.5.0beta1 → 2.5.0beta2
Revision history for this message
Andres Rodriguez (andreserl) wrote :

I was able to reproduce this. It seems its because MAAS leaves linguering processes that still run under the 'maas' user causing this:

Purging configuration files for libipmiconsole2 (1.4.11-1.1ubuntu4.1) ...
Purging configuration files for maas-common (2.5.0~beta2-7253-gbf4047776-0ubuntu1~18.04.1) ...
Removing user `maas' ...
Warning: group `maas' has no more members.
userdel: user maas is currently used by process 7083
/usr/sbin/deluser: `/usr/sbin/userdel maas' returned error code 8. Exiting.
/usr/sbin/delgroup: `maas' still has `maas' as their primary group!
userdel: user maas is currently used by process 7083
/usr/sbin/deluser: `/usr/sbin/userdel maas' returned error code 8. Exiting.
/usr/sbin/delgroup: `maas' still has `maas' as their primary group!
dpkg: error processing package maas-common (--purge):
 installed maas-common package post-removal script subprocess returned error exit status 128
Errors were encountered while processing:
 maas-common
E: Sub-process /usr/bin/dpkg returned an error code (1)
ubuntu@maas00:~$ ps faux | grep maas
ubuntu 28095 0.0 0.0 13136 1040 pts/1 S+ 18:46 0:00 | \_ grep --color=auto maas
ubuntu 16674 0.0 0.0 6212 836 pts/3 S+ Sep19 0:04 | \_ tail -f /var/log/maas/rackd.log
maas 7083 0.0 0.0 581136 10156 ? Ssl 14:41 0:07 /usr/sbin/rsyslogd -n -f /var/lib/maas/rsyslog.conf -i /var/lib/maas/rsyslog.pid
maas 7246 0.0 0.0 4628 740 ? Ss 14:41 0:00 /bin/sh -c exec /usr/sbin/rackd 2>&1 | tee -a $LOGFILE
maas 7248 1.4 0.5 719460 88916 ? Sl 14:41 3:26 \_ /usr/bin/python3 /usr/sbin/rackd
maas 7537 0.1 0.3 139880 51448 ? S 14:41 0:27 | \_ /usr/bin/python3 /usr/lib/maas/maas-common observe-beacons eno1
root 7791 0.0 0.0 64104 3564 ? S 14:41 0:00 | | \_ sudo -n /usr/lib/maas/beacon-monitor eno1
maas 7540 0.1 0.3 139880 51412 ? S 14:41 0:23 | \_ /usr/bin/python3 /usr/lib/maas/maas-common observe-beacons usb0
root 7793 0.0 0.0 64104 3628 ? S 14:41 0:00 | | \_ sudo -n /usr/lib/maas/beacon-monitor usb0
maas 7890 0.0 0.3 139624 51440 ? S 14:41 0:03 | \_ /usr/bin/python3 /usr/lib/maas/maas-common observe-arp eno1
root 7917 0.0 0.0 64104 3632 ? S 14:41 0:00 | | \_ sudo -n /usr/lib/maas/network-monitor eno1
maas 7891 0.0 0.3 139624 51324 ? S 14:41 0:01 | \_ /usr/bin/python3 /usr/lib/maas/maas-common observe-arp usb0
root 7921 0.0 0.0 64104 3568 ? S 14:41 0:00 | | \_ sudo -n /usr/lib/maas/network-monitor usb0
maas 7892 0.0 0.3 139624 51296 ? S 14:41 0:01 | \_ /usr/bin/python3 /usr/lib/maas/maas-common observe-mdns
maas 7916 0.0 0.0 35180 2952 ? S 14:41 0:00 | | \_ /usr/bin/avahi-browse --all --resolve --no-db-lookup --parsable --no-fail
maas 7249 0.0 0.0 6180 604 ? S 14:41 0:00 \_ tee -a /var/log/maas/rackd.log

Changed in maas:
importance: Undecided → High
status: Incomplete → Confirmed
assignee: nobody → Mike Pontillo (mpontillo)
Revision history for this message
Andres Rodriguez (andreserl) wrote :

ubuntu@maas00:~$ dpkg -l | grep maas-rack-controller
ubuntu@maas00:~$ sudo service maas-regiond stop
Failed to stop maas-regiond.service: Unit maas-regiond.service not loaded.

Revision history for this message
Andres Rodriguez (andreserl) wrote :

to provide more context, seems that maas-rack-controller is being purged first:

Please, remove /var/spool/squid yourself.
Purging configuration files for bind9 (1:9.11.3+dfsg-1ubuntu1.2) ...
dpkg: warning: while removing bind9, directory '/var/cache/bind' not empty so not removed
dpkg: warning: while removing bind9, directory '/etc/bind' not empty so not removed
Purging configuration files for maas-region-controller (2.5.0~beta2-7253-gbf4047776-0ubuntu1~18.04.1) ...
Purging configuration files for maas-rack-controller (2.5.0~beta2-7253-gbf4047776-0ubuntu1~18.04.1) ...
nginx.service is a disabled or a static unit, not starting it.
dpkg: warning: while removing maas-rack-controller, directory '/var/log/maas/http' not empty so not removed
dpkg: warning: while removing maas-rack-controller, directory '/var/lib/maas/http' not empty so not removed
Purging configuration files for avahi-daemon (0.7-3.1ubuntu1.1) ...
rmdir: failed to remove '/var/run/avahi-daemon': Directory not empty
Purging configuration files for python3-twisted (17.9.0-2) ...
Purging configuration files for freeipmi-common (1.4.11-1.1ubuntu4.1) ...
Purging configuration files for isc-dhcp-server (4.3.5-3ubuntu7) ...
Purging configuration files for libvirt-clients (4.0.0-1ubuntu8.5) ...
dpkg: warning: while removing libvirt-clients, directory '/etc/libvirt' not empty so not removed
Purging configuration files for dbconfig-common (2.0.9) ...
dpkg: warning: while removing dbconfig-common, directory '/var/log/dbconfig-common' not empty so not removed
dpkg: warning: while removing dbconfig-common, directory '/etc/dbconfig-common' not empty so not removed
Purging configuration files for libipmiconsole2 (1.4.11-1.1ubuntu4.1) ...
Purging configuration files for maas-common (2.5.0~beta2-7253-gbf4047776-0ubuntu1~18.04.1) ...

This should stop all services

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Ok, from the looks of it, systemd may not be killing the processes or something in MAAS is preventing from that being the case:

https://pastebin.ubuntu.com/p/svfgrQDCSf/

Changed in maas:
assignee: Mike Pontillo (mpontillo) → nobody
Changed in maas:
assignee: nobody → Andres Rodriguez (andreserl)
status: Confirmed → Incomplete
status: Incomplete → In Progress
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.