User Removal Error: postgresql Related (with suggestions)

When going to:
Virtualmin -> Choose a domain from the dropdown. -> Edit Users -> Choose a user from the list. -> Click Delete -> Click Delete Now.

The user is removed but the following message shows up:
Failed to save mailbox : DBI connect failed : could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

PostgreSQL is not running on the system, though we did install the client libraries.
When a user is removed it looks like it looks for all "useradmin_delete_user" subroutines and runs them against the user being removed.
Within postgresql there is a useradmin_update.pl script with such a subroutine.

However it neglects to test if PostgreSQL is:
(1) Installed.
(2) Setup to run on the system.
(3) Setup for the Virtual Server for which the user being deleted is attached.
(4) Checking to see if PostgreSQL is actively running, and if it should be but is not it should probably try to start it to finalize the process or keep track for reference in some sort of cache for when the server comes back up. Of course this also means that if the same username is re-added the same cache will have to keep track of that as well.

Instead of giving an error message where the user is removed but claiming the user failed to remove it would be better if it lists each area the user was attempted to be removed from and the status of each.
For example:
User: john@example.com
apache: Removed Successfully
cron: Removed Successfully (Click here for saved copy of deleted cron job for user.)
mysql: Removed Successfully
postgresql: Removal Cached (Server not running.)
sshd: Removed Successfully

Status: 
Active

Comments

Not sure what approach the Webmin/Virtualmin team wants to take on this otherwise I would do a quick patch to the postgresql -> useradmin_update.pl myself.

Howdy -- I believe Jamie is traveling at the moment, so it might be a bit before he can respond about any sort of change or fix.

However, I can offer that Postgres should always be installed by default, that's surprising that it isn't in your case. You're right though, it certainly shouldn't be trying to interact with Postgres if it isn't there.

Are you looking to use Postgres though?

If not, one way to handle that issue would be to disable Virtualmin's Postgres support. To do that, you can look in System Settings -> Features and Plugins, and there, you can disable the Postgres feature.

The only way I can see this happening is if PostgreSQL was stopped or un-installed after Virtualmin was installed.

@andreychek - PostgreSQL was already turned off.
@JamieCameron - You are correct it was installed and I had to turn it off for a variety of reasons.

Let me know if there is anything I can do on my end or if it is just a waiting game and working around it for now.

Thanks.

The proper fix is to configure Virtualmin to stop using PostgreSQL, by un-checking it on the System Settings -> Features and Plugins page.

The feature is already unchecked and disabled. However, the default checkbox is still checked. I did try adding and removing another user and had the same message.

I tried to re-enable the PostgreSQL plugin, so I can uncheck the default checkbox, but it would not re-enable as virtualmin does not believe it is installed. I tried to figure out what config file (assuming webmin/virtual-server/config) had the setting in it but was unable to determine the actual item to add/change in the config file.

Is it plausible that just having the default checkbox checked with PostgreSQL disabled at the same time that the issue would happen?

The 'default' checkbox does nothing if the box in the first column isn't checked.

I wonder if maybe one of your domains still have PostgreSQL enabled, even though it is globally disabled? Try running :

grep postgres=1 /etc/webmin/virtual-server/domains/*

for any files found, you can change the line to postgres=0

Found "limit_postgres=1" in one of the files and removed the line.
Still had the error on removing/deleting a user.

Tried restarting webmin.
Same error again.

Found "postgres-user=username" in 3 of the domain files.
Removed those lines and restarted webmin.
Same error again.

Went through and removed the server from every "Cluster *" area and restarted webmin.
Same error again.

Are there any other configs that should be checked?

Try going to Webmin -> Servers -> PosgreSQL Database -> PostgreSQL Users, and turning off all the sync options.

Ok, based on the information Jamie gave (which I could not follow with PostgreSQL being down or not installed)...

Edited /etc/webmin/postgresql/config

Changed
sync_delete=1
sync_modify=1

To
sync_delete=0
sync_modify=0

Looks like this clears it up.

Great, thanks for letting us know how you fixed it -- and we're glad to hear it's working now!