rmuser vmail Matching password entry: vmail:*:1002:1005::0:0:User &:/var/spool/virtual:/sbin/nologin Is this the entry you wish to remove? y Remove user's home directory (/var/spool/virtual)? n Removing user (vmail): passwdpw: entry inconsistent pw: pw_copy(): Invalid argument rmuser vmail Matching password entry: vmail:*:1002:1005::0:0:User &:/var/spool/virtual:/sbin/nologin Is this the entry you wish to remove? y Remove user's home directory (/var/spool/virtual)? y Removing user (vmail): home passwdpw: entry inconsistent pw: pw_copy(): Invalid argument
This indicates that the failing part of rmuser.sh is in rm_user(): 182 ! verbose && echo -n " passwd" 183 verbose && echo -n " from the system:" 184 ${PWCMD} userdel -n $login $pw_rswitch And the output of 'pw userdel -n vmail' (with or without additional -r) is: pw: entry inconsistent pw: pw_copy(): Invalid argument Both the warning and EINVAL come from libutil's pw_copy(), while the err() termination comes via the pw_update() in pw(8). The warning is produced if pw_equal() fails between the old_pw supplied to pw_copy() and the record of the same name parsed by pw_scan() out of /etc/master.passwd. pw_equal looks at pw_name, pw_uid, pw_gid, pw_class, pw_change, pw_expire, pw_gecos, pw_dir, and pw_shell. pw(8)'s old_pw comes from GETPWNAM(), which ... is PWF._getpwnam... which is just getpwnam(3) for non-relocated pw(8). getpwnam(3) goes through nsdispatch and looks at /etc/pwd.db (or /etc/spwd.db) directly. So it seems like your /etc/master.passwd is out of sync with your /etc/pwd.db.
If you have edited /etc/master.passwd by hand to add this user, that could cause this. /usr/sbin/pwd_mkdb -p -u vmail /etc/master.passwd regenerates the database entries for this user, while /usr/sbin/pwd_mkdb -p /etc/master.passwd regenerates the whole database from master.passwd.