Uninstalling PostgreSQL?

I’ve installed Webmin and Virtualmin GPL into a VirtualBox Ubuntu 10.04.2 using the automatic installation script.
After the installation, I noticed that PostgreSQL had been installed and is running.
According to the instructions for manual install, PostgreSQL should be optional (I intend to only use MySQL), but apt says it is a dependency of webmin-base. Thus, it seems impossible to remove it.
Is it possible to uninstall PostgreSQL? How would I do that?
I’ve tried uninstallation via webmin and via console:

Failed to uninstall postgresql :

dpkg: dependency problems prevent removal of postgresql:
virtualmin-base depends on postgresql; however:
Package postgresql is to be removed.
dpkg: error processing postgresql (–remove):
dependency problems - not removing
Errors were encountered while processing:
postgresql

Failed to uninstall postgresql-8.4 :

dpkg: dependency problems prevent removal of postgresql-8.4:
postgresql depends on postgresql-8.4.
dpkg: error processing postgresql-8.4 (–remove):
dependency problems - not removing
Errors were encountered while processing:
postgresql-8.4

Failed to uninstall postgresql-client-8.4 :

dpkg: dependency problems prevent removal of postgresql-client-8.4:
postgresql-8.4 depends on postgresql-client-8.4.
virtualmin-base depends on postgresql-client; however:
Package postgresql-client is not installed.
Package postgresql-client-8.4 which provides postgresql-client is to be removed.
dpkg: error processing postgresql-client-8.4 (–remove):
dependency problems - not removing
Errors were encountered while processing:
postgresql-client-8.4

Failed to uninstall postgresql-client-common :

dpkg: dependency problems prevent removal of postgresql-client-common:
postgresql-common depends on postgresql-client-common (>= 106ubuntu1).
postgresql-client-8.4 depends on postgresql-client-common (>= 104~).
dpkg: error processing postgresql-client-common (–remove):
dependency problems - not removing
Errors were encountered while processing:
postgresql-client-common

Failed to uninstall postgresql-common :

dpkg: dependency problems prevent removal of postgresql-common:
postgresql-8.4 depends on postgresql-common (>= 104~).
dpkg: error processing postgresql-common (–remove):
dependency problems - not removing
Errors were encountered while processing:
postgresql-common

root@super:/# apt-get -s remove postgresql Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: apache2-suexec-custom pwgen bind9 sasl2-bin db4.8-util irb1.8 libapache2-svn libnet-daemon-perl re2c clamav webmin-virtual-server bind9utils webmin-virtualmin-awstats php5 libmail-spf-perl clamav-freshclam awstats dovecot-imapd manpages-dev libhtml-template-perl libdbi-perl mysql-client-core-5.1 libdbd-mysql-perl libdbd-pg-perl libc-dev-bin libsocket6-perl mysql-server-5.1 libfile-copy-recursive-perl libgomp1 rdoc mysql-client-5.1 libnet-xwhois-perl ri liberror-perl libnetaddr-ip-perl clamav-base subversion postgresql-client-8.4 linux-libc-dev libclamav6 spamassassin gcc-4.4 libplrpc-perl libapache2-mod-fcgid apache2 procmail libsvn1 clamav-testfiles spamc mysql-server-core-5.1 dovecot-pop3d php-pear webmin-virtualmin-mailman webmin-virtualmin-htpasswd gcc mailman scponly webmin-security-updates libpg-perl mysql-server irb clamav-daemon update-inetd clamav-docs libnet-ip-perl openbsd-inetd libio-socket-inet6-perl libnet-dns-perl rdoc1.8 procmail-wrapper webalizer webmin-virtual-server-theme webmin-virtualmin-dav proftpd-basic postgresql-client-common libc6-dev apache2-doc libdb4.7 libpq5 libtommath0 usermin-virtual-server-theme libdigest-hmac-perl binutils libreadline-ruby1.8 libreadline5 postgresql-common dovecot-common postgresql-8.4 webmin-virtualmin-svn libsys-hostname-long-perl libneon27-gnutls ri1.8 libltdl7 libdigest-sha1-perl Use 'apt-get autoremove' to remove them. The following packages will be REMOVED: postgresql virtualmin-base 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. Remv virtualmin-base [1.0-29] Remv postgresql [8.4.7-0ubuntu0.10.04] root@super:/# aptitude why postgresql id virtualmin-base Depends postgresql

Note: Since I am a Linux n00b, it may just be something I am doing wrong with the package managers. Please forgive me :slight_smile:

Howdy,

Yeah, I wouldn’t recommend removing Postgres – it’s setup as a dependency of Virtualmin (at least at the moment, in the future it’ll be simpler to remove).

Instead of removing it, you can always just disable it, so that it’s not running. At that point, all it’s doing is taking up a few MB’s of space :slight_smile:

To do that, you can first make sure Virtualmin isn’t using it by going into System Settings -> Features and Plugins, and uncheck “PostgreSQL database”.

Next, you can prevent Postgres from loading on startup by going into Webmin -> System -> Bootup and Shutdown, and set “At Boot” to “No” for the Posgres service.

-Eric

Well I’m glad I was on the right track; I had uninstalled the module and stopped the Postgres itself.
Thanks for the hint about the startup, I hadn’t thought about that :slight_smile:

Hmmm… disabling startup is not trivial either.
I guess I’ll just have to be a bit less obsessive-compulsive about postgres :smiley:

The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'S99mysql' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'network-interface' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'hwclock' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (0 6) of script `umountroot' overwrites defaults (empty).
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'plymouth-stop' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'apport' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (6) of script `reboot' overwrites defaults (empty).
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'udev-finish' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'procps' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'irqbalance' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'udevmonitor' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'mysql' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'plymouth-splash' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'rsyslog' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'screen-cleanup' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'console-setup' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (0 6) of script `umountfs' overwrites defaults (empty).
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'ufw' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'cron' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'plymouth-log' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'plymouth' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'dmesg' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'udevtrigger' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'hwclock-save' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'atd' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'udev' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (0 6) of script `wpa-ifupdown' overwrites defaults (empty).
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'hostname' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (0) of script `halt' overwrites defaults (empty).
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'network-interface-security' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (0 6) of script `sendsigs' overwrites defaults (empty).
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'module-init-tools' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (0 6) of script `umountnfs.sh' overwrites defaults (empty).
insserv: warning: current start runlevel(s) (0 6) of script `networking' overwrites defaults (empty).
insserv: There is a loop between service rsyslog and apache2 if stopped
insserv:  loop involving service apache2 at depth 3
insserv:  loop involving service rsyslog at depth 2
insserv:  loop involving service udev at depth 1
insserv: There is a loop between service apache2 and rsyslog if stopped
insserv: exiting now without changing boot order!

From the terminal (as root), execute:

update-rc.d -f postgresql-8.4 remove

I believe that service name is correct. If not, I’m sure you can figure it out :slight_smile: (ls /etc/init.d | grep postgressql).

Thanks! The service name was correct (the ls/grep had a typo though: too many sses in postgres :wink: )
Postgres is not started anymore when I reboot the server.

Changing startup settings via the “Bootup and Shutdown” module does not seem to work, but that is for another thread.

Ha - well spotted. I have much more against PostgreSQL than the spelling of its ridiculous name, trust me. :). Glad you’ve managed to eradicate it from your startup sequence.

To keep this thread complete:
I noticed something about Postgres in the auth.log ( Successful su for postgres by root)and found out that it is from the monitor.pl script that is run from Cron.
I found https://www.virtualmin.com/node/11194 which helped me remove the Postgres server monitor.

Eric,

Have you removed the dependency on postgresql so we can remove it?

When I try apt-get -s remove postgresql, I still get:

The following packages will be REMOVED:
postgresql virtualmin-base
2 to remove

Thx!

Howdy,

Current versions of virtualmin-base should not depend on postgres, along with most other dependencies.

However, if you performed the install awhile ago, and upgraded to a newer Virtualmin, it’s possible that you have an older virtualmin-base installed that still relies on that dependency.

-Eric