Deleting virtual server should also remove all the relevant files on the system

Deleting virtual server should also remove all the relevant files on the system as otherwise they are just needlessly taking space on the drive. For example, if you delete a virtual server then it's access and error log files remain intact in /var/log/virtualmin directory. On one of our Virtualmin servers that was strugling because of storage space insufficiency, I was surprised to find lots of access and error log files for the virtual systems that were gone long time before. Luckily I was able to easily identify them, because they all belonged to digital users like 503, 661, etc. instead of actual usernames (because their respective users were deleted) and remove them from the disk. It would be really nice if Virtualmin cleaned up ALL the files and settings related to the virtual server that is deleted from the system.

Status: 
Active

Comments

That's odd, the deletion process should already be removing all Apache logs.

What were the names of the log files that were left over exactly?

Since it was a while ago I don't remember the log files initially reported, but I have something new popped up today that is relevant to the subject matter.

I couldn't create a virtual server for no reason as Virtualmin would get stuck giving the error:

Failed to create domain : Failed to lock file /etc/webmin/virtual-server/names/domainname.com after 5 minutes. Last error was :

You can imagine how much I was surprised to find in the /etc/webmin/virtual-server/names/ directory a really long list of domain names which had been deleted long time ago all with .lock suffixes in their names.

Those .lock files are supposed to prevent creation of multiple domains with the same name at the same time. Does the /etc/webmin/virtual-server/names/domainname.com.lock file contain a PID, and if so what process is the PID file?

I don't know, Jamie, as I have already deleted them all. But it really doesn't matter what they contained. What matters is that they have to get removed at the same time and together with the domain names.

Just think: why PID would matter if the system is going to delete a domain? Well, I accept it matters to get also respective process killed. However, regardless if the system succeeds killing the relevant process or does not, the domain name actually gets removed, so why leave the .lock file?

And I am telling you the directory contained the domain names that had been deleted long time ago. I am pretty sure that server had been rebooted many times since then, so all the relevant processes were killed anyway. So don't ask questions hinting the lock files are bound to processes - they are not! And even if they were you can't leave them so the next time users want to create same domains we run into this trouble - not being able to create domains.

Those locks should actually be deleted at domain creation time. However, I just discovered a bug that prevents this from working properly :-(

It will be fixed in the 5.06 Virtualmin release. The short-term work-around is just to delete everything in that directory /etc/webmin/virtual-server/names

Good that you heard me. Glad the bug is detected and fixed.