Im not responsible if you destroyed your computer or data by following these steps. Deleting things in linux maybe a long and complicated processes if you really wnat to remove all traces of an app existing.

How to uninstall an application completely
###########################################

Imagine that app is munin, which installs itself all over the system

Before removing and app, close it down (ALSO DO A SYSTEM BACKUP IF YOU CAN, OR SNAPSHOT YOU CAN REVER TO! IM NOT RESPONSIBLE IF AFTER THIS YOUR SYSTEM WONT LOAD OR IMPORTANT DATA IS LOST)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# ps aux | grep munin
# ps aux | grep munin
# ps aux | grep munin

Look at the pids, example 543 and 234

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# kill 543
# kill 234
# kill 543 # kill 234
# kill 543 
# kill 234

Double check its closed by repeating the “ps aux” command

You might need to “kill -9” the processes

So after its closed lets delete

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# apt-get remove munin
# apt-get remove munin
# apt-get remove munin

but better:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# apt-get purge munin
# apt-get purge munin
# apt-get purge munin

clean up:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# apt-get autoremove
# apt-get install -f
# apt-get autoremove # apt-get install -f
# apt-get autoremove
# apt-get install -f

if the last 2 steps removed an app/package you need just “apt-get install” it

Also double check what other software you can get rid of:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dpkg -l | grep "munin"
# dpkg -l | grep "munin"
# dpkg -l | grep "munin"

Lets say you find this:

munin-common
and
munin-node

So then I can delete those

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# apt-get purge munin-common
# apt-get purge munin-node
# apt-get purge munin-common # apt-get purge munin-node
# apt-get purge munin-common
# apt-get purge munin-node

clean up:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# apt-get autoremove
# apt-get install -f
# apt-get autoremove # apt-get install -f
# apt-get autoremove
# apt-get install -f

NOTE: check out my article on power deleting apps (be careful with that) HOW TO MASS REMOVE AN APP

Now we are going to work at deleting files and folders that werent removed:

Removing Files and Folders
#############################

now look for files that werent removed

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cd /
# find / -type f -iwholename "*munin*"
# cd / # find / -type f -iwholename "*munin*"
# cd /
# find / -type f -iwholename "*munin*"

Or if you have multiple filesystems

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# find / -xdev -type f -iwholename "*munin*"
# find / -mount -type f -iwholename "*munin*"
# find / -xdev -type f -iwholename "*munin*" # find / -mount -type f -iwholename "*munin*"
# find / -xdev -type f -iwholename "*munin*"
# find / -mount -type f -iwholename "*munin*"

For the above -xdev/-mount method: You might need to start the search in other locations as / will only look thru the / root filesystem, but what if you had stuff installed in the /home filesystem as well:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# find /home -xdev -type f -iwholename "*munin*"
# find /home -mount -type f -iwholename "*munin*"
# find /home -xdev -type f -iwholename "*munin*" # find /home -mount -type f -iwholename "*munin*"
# find /home -xdev -type f -iwholename "*munin*"
# find /home -mount -type f -iwholename "*munin*"

NOTE: I show that -xdev and -mount are the same thats why i put it there twice

There is lots of ways to do above commands

What to do with the findings:

Then remove any directories that have munin

Example:
/var/cache/munin/www
so i would remove

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# rm -rf /var/cache/munin
# rm -rf /var/cache/munin
# rm -rf /var/cache/munin

Which would remove just the munin folder in /var/cache (but not /var/cache). It would also remove the www folder in munin
However DONT DO THIS:
lets say it found
/etc/munin.conf
Dont delete /etc obviously just delete the munin.conf file

To help with not removing the wrong folders, just look for folders that have word munin in it, and not files:

Look for directories that werent removed as well and remove the directories

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# find / -xdev -type d -iwholename "*munin*"
# find / -mount -type d -iwholename "*munin*"
# find / -xdev -type d -iwholename "*munin*" # find / -mount -type d -iwholename "*munin*"
# find / -xdev -type d -iwholename "*munin*"
# find / -mount -type d -iwholename "*munin*"

Example I see it found

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# /var/log/munin
# rm -rf /var/log/munin
# /var/log/munin # rm -rf /var/log/munin
# /var/log/munin
# rm -rf /var/log/munin

Now not all files are truely cleaned up, some files are shared with other files, so lets clean up the insides of files.

Example: /etc/apach2/apache2.conf
What if you edited somethings there for munin, now you need to remove those edits

Insides of files
###############

Finally lets find all of the config files that mention munin

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cd /etc
# egrep -ir "munin" *
# cd /etc # egrep -ir "munin" *
# cd /etc
# egrep -ir "munin" *

 

All of the files and folders will be listed.

Go into each file and remove the lines (or sections of lines, or just parts of line) that have munin in it
Becareful you must understand how that setting files worked

Sometimes you will need to remove just part of a line that mentiones munin
Then other times you are safe to delete the whole line that mentions munin
Then there is whole sections that need to be deleted

DELETING MUNIN WORDS IN A LINE
===============================

Some config files munin will be mentioned but you can delete the whole line.
Example: /etc/init.d/.depend.start and /etc/init.d/.depend.sttop

Lets look at /etc/init.d/.depend.start notice munin on the top line

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
TARGETS = rsyslog motd killprocs bootlogs binfmt-support apache2 munin single mysql atd dbus sendmail cron ssh rsync saned rmnologin rc.local
INTERACTIVE = apache2
apache2: rsyslog
single: killprocs motd bootlogs
mysql: rsyslog
atd: rsyslog
dbus: rsyslog
sendmail: rsyslog
cron: rsyslog
ssh: rsyslog
rsync: rsyslog
saned: rsyslog dbus
rmnologin: apache2 rsyslog mysql atd saned dbus sendmail motd bootlogs binfmt-support cron ssh rsync
rc.local: apache2 rsyslog mysql atd saned dbus sendmail motd bootlogs binfmt-support cron ssh rsync
TARGETS = rsyslog motd killprocs bootlogs binfmt-support apache2 munin single mysql atd dbus sendmail cron ssh rsync saned rmnologin rc.local INTERACTIVE = apache2 apache2: rsyslog single: killprocs motd bootlogs mysql: rsyslog atd: rsyslog dbus: rsyslog sendmail: rsyslog cron: rsyslog ssh: rsyslog rsync: rsyslog saned: rsyslog dbus rmnologin: apache2 rsyslog mysql atd saned dbus sendmail motd bootlogs binfmt-support cron ssh rsync rc.local: apache2 rsyslog mysql atd saned dbus sendmail motd bootlogs binfmt-support cron ssh rsync
TARGETS = rsyslog motd killprocs bootlogs binfmt-support apache2 munin single mysql atd dbus sendmail cron ssh rsync saned rmnologin rc.local
INTERACTIVE = apache2
apache2: rsyslog
single: killprocs motd bootlogs
mysql: rsyslog
atd: rsyslog
dbus: rsyslog
sendmail: rsyslog
cron: rsyslog
ssh: rsyslog
rsync: rsyslog
saned: rsyslog dbus
rmnologin: apache2 rsyslog mysql atd saned dbus sendmail motd bootlogs binfmt-support cron ssh rsync
rc.local: apache2 rsyslog mysql atd saned dbus sendmail motd bootlogs binfmt-support cron ssh rsync

 

NOTE: the above config file is just made up, i grabbed mine and added in munin where I think it will be

Notice we cant just delete the line where munin is, it will delete that whole line

So go in with vi and delete munin from that line

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi /etc/init.d/.depend.start
# vi /etc/init.d/.depend.start
# vi /etc/init.d/.depend.start

Scroll with arrow keys to the “m” in munin and press “x” until its gone and you only have 1 space between “apache2” and “single” so that it says this after:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
TARGETS = rsyslog motd killprocs bootlogs binfmt-support apache2 single mysql atd dbus sendmail cron ssh rsync saned rmnologin rc.local
TARGETS = rsyslog motd killprocs bootlogs binfmt-support apache2 single mysql atd dbus sendmail cron ssh rsync saned rmnologin rc.local
TARGETS = rsyslog motd killprocs bootlogs binfmt-support apache2 single mysql atd dbus sendmail cron ssh rsync saned rmnologin rc.local

 

Then save and exit “:wq!”

Another alternative is to use sed (only use this on config files were your certain deleting the word munin out of each line will be okay):

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sed -i 's/munin //g' /etc/init.d/.depend.start
# sed -i 's/munin //g' /etc/init.d/.depend.start
# sed -i 's/munin //g' /etc/init.d/.depend.start

 

this will also work on:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sed -i 's/munin //g' /etc/init.d/.depend.stop
# sed -i 's/munin //g' /etc/init.d/.depend.stop
# sed -i 's/munin //g' /etc/init.d/.depend.stop

NOTE: I use a sed search and replace to replace “munin ” (munin and a space sign) with nothingness (the same thing as a delete). Why the extra space? so that I dont get double space between “apache2” and “single” after words

NOTE: I dont think my /etc/init.d/.depend.boot file had anything mentioned about munin, thats why its not mentioned in this example
DELETING MUNIN LINES
=====================

Delete a line example:
/etc/shadow found this line that had munin in it

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
munin:*:16086:0:99999:7:::
munin:*:16086:0:99999:7:::
munin:*:16086:0:99999:7:::

We can

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi /etc/shadow
# vi /etc/shadow
# vi /etc/shadow

And scroll down with arrow keys to that line and press “dd” to delete that line then save and exit “:wq!”

Here is a shortcut to delete munin lines (becareful only delete the line if your certain it can go):
I wouldnt use this on config files that have munin “sections” or munin in parts of line. As it only deletes the line. it wont delete the surrounding sections.
So this will be save on files like /etc/shadow and /etc/gshadow and /etc/passwd and /etc/group

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sed -i "/munin/d" /etc/shadow
# sed -i "/munin/d" /etc/shadow
# sed -i "/munin/d" /etc/shadow

that says delete the line that has munin in the shadow file and save it (-i meaning inline, meaning save, with out -i it will jsut show you the result on the output)

DELETING MUNIN SECTIONS
=========================

Deleting sections of munin will not be as easy as above to becuase the sections could be like this

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<Directory /munin>
stuff
stuff
stuff
stuff
<Directory />
<Directory /munin> stuff stuff stuff stuff <Directory />
<Directory /munin>
stuff
stuff
stuff
stuff
<Directory />

Notice that munin is only mentioned on the top line, but that whole section has to do with it. So we cant jsut delete the line talking about munin, and we cant just talk about the directory

In this case go in with vi and delete all of those 6 lines

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi /whateverfile
# vi /whateverfile
# vi /whateverfile

Find the top line of the section talking about munin, scroll down to it and press “dd” as many times until that section is gone, then save and exit “:wq!”

Final steps, other config files and dead links
================================================

This method only covers files that talk about munin in clear text. What bout binary files etc. Hopefully the apt-get got rid of all of those.

By now we are almost done some dead links might still exist just double check to get all files:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# find / -iwhole "*munin*"
# find / -iwhole "*munin*"
# find / -iwhole "*munin*"

Then if its just some links you dont care about just do this:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# find / -iwhole "*munin*" --delete
# find / -iwhole "*munin*" --delete
# find / -iwhole "*munin*" --delete

The end
=========

Just reboot the system and hopefully it comes up 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *