Need help to remove asterisk

NethServer Version: 7.5
Module: PBX


I wanted to try out free-pbx module. Installation worked perfect, however I do not like it (was to complicated for me). So I decided to keep my old PBX system for a while and to uninstall the module.

From software center an error occured during uninstallation (cant remember exact wording). However, Control module / web interface / janus seems to be removed, while asterisk itself seems to be still running: at least I get some emails from asterix@myserver.tld and - more problematic - my networks seems to be flood on SIP ports - my external phone system (Auerswald) does get any connect to external service providers any more.

How can I get rid of asterisk on nethserver?


@thorsten, please see:

Unclear atm.

This might help (but still could leave some config remnants):

That does not remove asterisk and all goodies around asterisk. Just FreePBX stuff is removed. Asterisk itself is AFTER removing the VoIP package via software center still present, active, configured and running.

I believe this is a serious flaw. Install is install, remove is remove, ALL of it what has been installed, inlcuding dependencies. And especially disable all related services.

Now when one uninstalles the VoIP package via software center just the FreePBX GUI is removed. The hart of it all, Asterisk, is still up and running, not even disabled.

Agreed, this is broken behavior. When you remove something using the software center, everything it installed (that isn’t needed by something else you’ve installed using the software center) should be removed. But how to make that happen? I think it’s easier said than done.

1 Like

Using yum undo
If you installed VoIP PBX module alone (as one transaction, without other modules) the following should do it:

yum history package asterisk13*  # find history's transaction ID
yum history undo 14    # where 14 should be replaced with the corresponding transaction ID. Carefully read the package list before giving confirmation.

Manually removing packages
Otherwise, you can try to remove packages manually, as before carefully reading the list of packages and dependencies that will be removed (here I’ve excluded some packages like the ones related to php, mysql/mariadb, whois…):

yum --setopt=remove_leaf_only=1 remove asterisk-sounds-extra-en-ulaw asterisk13-\* dahdi-\* dos2unix flac-libs freepbx freetds ghostscript ghostscript-fonts glib glib-networking glibmm24 gsettings-desktop-schemas gsm gssdp gstreamer gstreamer-tools gstreamer1 gupnp gupnp-igd icu jack-audio-connection-kit janus-gateway jbigkit-libs kmod-dahdi-linux lcms2 libICE libSM libXfont libXi libXt libXtst libao libasyncns libconfig libffado libfontenc libical libicu-devel libiec61883 libmicrohttpd libnice libogg libopenr2 libpri libraw1394 libresample libsamplerate libsigc++20 libsndfile libsoup libsrtp15 libss7 libtiff libtonezone libuv libvorbis libvpx libwebsockets libxml++ mpg123 mpg123-libs mysql-connector-odbc nethserver-{freepbx,janus,unixODBC} nodejs npm opus poppler-data portaudio postgresql-libs postgresql-odbc pulseaudio-libs radiusclient-ng sofia-sip sox spandsp speex sqlite2 t1lib tftp-server unixODBC urw-fonts wavpack xorg-x11-font-utils

Removing (hopefully most) leftovers
Removing files, directories, symbolic links, databases, e-smith db entries…:

  • As the test was done on a clean PBX install, without any configuration, there could be a few remnants.
  • Here we assume you don’t care about any related data.
  • Note a lot of directories are empty and do nothing.
  • Log files/dirs are excluded.
  • If some other program is using some of the files (odbc…), don’t remove it.
  • As always, when using rm with -f option, check the command as many times as needed to make sure there are no typos (better safe than sorry).
  • If copy-pasting note these are multi-line commands.
rm /etc/{amportal.conf,freepbx.conf,odbc.ini,odbcinst.ini.rpmsave} \
/root/.odbc.ini \
/usr/sbin/amportal \
/usr/sbin/fwconsole \
/etc/systemd/system/ \
/etc/rc.d/rc{0,1,2,3,4,5,6}.d/K60asterisk \
/var/spool/cron/asterisk \
/var/lib/systemd/linger/asterisk \
/var/lib/nethserver/secrets/JanusGateway \

rm -rf /etc/asterisk/ \
/etc/e-smith/events/nethserver-{freepbx-httpd-save,freepbx-update,janus-update,unixODBC-update} \
/etc/e-smith/templates.metadata/opt/janus/ \
/etc/e-smith/templates/etc/{asterisk,backup-data.d/freepbx.include,httpd/conf.d/freepbx.conf,odbc.ini,odbcinst.ini} \
/etc/httpd/fpbx-conf \
/etc/systemd/system/asterisk.service.d \
/usr/lib64/asterisk \
/var/lib/asterisk \
/var/www/html/freepbx \
/var/www/sofia-sip \
/var/spool/asterisk \
/var/lib/mysql/asteriskcdrdb \
/etc/e-smith/events/certificate-update/templates2expand/opt/janus \
/etc/e-smith/templates/opt/janus \
/opt/janus \

Removing databases:

DROP DATABASE asteriskcdr;

Removing e-smith db related entries:

db configuration delete httpd-fpbx
db configuration delete janus-gateway
db configuration delete asterisk
db configuration delete MySQL-asteriskcdrdb

Removing asterisk user (with its home folder and mail spool):

userdel -r asterisk

Just in case, reloading httpd

systemctl reload httpd

Agree with both of you (@LayLow and @danb35).


Thanks @dnutan for your time and effort. Unfortunately both methods (yum history and yum remove) still have a huge list of dependencies that will remove many critical packages or modules.

For now I will disable the asterisk service manually (config setprop asterisk status disabled).

I am considering borking this system, for I feel I am not in control of what has been done by the VoIP module. Makes me wonder how other modules behave when uninstalled.

Update: I simpy issued ‘yum remove asterisk13*’ and that uninstalled 7 asterisk packages. Obviously support libraries and packages are not uninstalled, but orphaned and inactive. Not ideal. For the rest as per above instructions of @dnutan remove the leftovers. NOT ideal.

Another way would be yum autoremove that removes unneeded packages.

I think the problem with removing packages is that both ways (undo and autoremove) may remove packages that may be still needed so you should check what is being removed. I am afraid that package requirements are not fully consistent.

So the actual software center remove process is an easy way to remove packages safely without user interaction.

Maybe we could add an autoremove button to the software center, show all autoremoved packages and let the user check packages that should be kept.

1 Like

Except it isn’t. As shown in this thread, sometimes it leaves services running that the user thought would be uninstalled (or, at a minimum, disabled). In many other cases, it removes far more than necessary (when I tell it to remove Roundcube, for example, this is what it wants to do):
It’s come up in a number of threads now–this is very badly broken behavior. There’s no reason that removing a webmail client should remove the mail server, and certainly no reason for it to remove all the other webmail clients.

I haven’t the foggiest idea how to fix this, but we can’t pretend that this behavior is anywhere close to acceptable. The software center works fine for installing things, but simply can’t be used to remove them.

1 Like

Just to be clear:
@thorsten imo @dnutan :+1: described the best possible solution.

This is because Roundcubemail (still) has the nethserver-mail package defined as mandatory in the repository comps group (see), However this particular misbehavior can be a middle ground to improve (not solve) the package removal. If packages exclusively known to belong to a module like nethserver-pbx are listed in the group they will be removed. This does not remove their children but i think it is doable (at least) to make sure a service is really shut down.

Agreed, they did for a virgin install (default NS + VoIP). The procedures do not work for a ‘dressed up’ NS install where multiple modules have been installed. (See comment from @danb35) and my own experience.

In my opinion there is a serious issue with dependencies of nethserver modules BOTH with install and remove via software center. The spec files pull in a lot of stuff wich are not consideren when removing stuff (dependencies) and dependencies between NS and modules are very mixed and some modules seem to have a ‘tunnel vision’.

In general I do not care about installing things, I am more focussed on being able to FIX things when something goes wrong. For this I need to understand the whole installation process. Quote: “Installing is useluss if you can’t fix it”, that would provide a false sence of capabilities. :slight_smile:

I do appreciate the discussion tho.

1 Like