How to totally expunge FOG and everything it's touched
-
You misunderstand. I’m exploring a “nuke it from orbit” solution. I want to tear the server down to its bones then build it back without physical intervention.
For one particular server I used the following.
# Remove FOG services rm /etc/init.d/FOGImageReplicator rm /etc/init.d/FOGMulticastManager rm /etc/init.d/FOGScheduler # Delete FOG database mysql -u root -p <password> drop database fog; exit # Remove FOG files rm -rf /var/www/fog rm -rf /var/www/html/fog rm -rf /opt/fog rm -rf /opt/fog.old rm -rf /tftpboot rm -rf /opt/trunkgit rm -rf /opt/trunksvn # Delete FOG system user userdel fog userdel fogproject # Delete supportive systems yum -y remove php* yum -y remove httpd # Clean & Update the OS yum clean all rm -rf /var/tmp/yum-administrator-PudGB rm -rf /var/cache/yum yum list iostat yum makecache yum grouplist yum grouplist hidden yum update -y # Reboot to Commit reboot
-
@sudburr Why not re-install the whole system from scratch?
-
Re-installing FOG does not strip it from the server. It re-installs FOG.
It’s easy enough to yum remove virtually everything else. What about a solution for FOG and its tendrils?
-
@sudburr What I meant is re-installing the Linux OS!
-
The other method is to use most of the stuff but for removing packages, source in the .fogsettings file before you remove the /opt/fog/ folder. Then you can use
packagemanager-uninstallcmd $packages
Note this will simply remove the packages fog installs. All the other bits of service removal and what not should work as indicated.
I kind of side with @Sebastian-Roth however because removing all the installed packages can sometimes uninstall elements unexpectedly and out of “fogs” control. I’ve seen occasionally some like like installing python then uninstalling it breaking package manager tools like yum or apt
-
But I don’t want to re-install the OS by remote. Not yet at least.
-
@Tom-Elliott Okay, I’ll look into that.
Ultimately I’m looking for a best-effort recommended, second to last resort (reinstalling OS would be the last resort) solution that would tear down and pave over all that is FOG.
Sometimes tinkering, tweaking and forensic fixes just don’t do the job and you need other more drastic options in your troubleshooting arsenal; a FOG uninstaller.
-
@sudburr I can see that re-installing the OS in your situation is not easy if you with the server being remote. Before I get into the details, here is one word of caution: Be aware that purging the CA and certificate/key files will likely cause you a lot of trouble if you have clients that are pinned to this FOG server!! Make a backup of those files before you go ahead. As well this script will purge ALL IMAGES from the server.
I won’t be responsible for any trouble caused by this script!
I see four options:
- you have a proper server with iKVM - this way you can boot the server from a virtually mount ISO and install from scratch
- someone is at site to setup a iKVM box for you - similar to 1. but you’d need the box and someone setting it up at site
- someone is at site and can boot from DVD for you and type in grub boot parameters for VNC setup: https://cloudwrk.com/remote-server-installation-centos-7/
- Someone implements the
./installfog.sh --uninstall
option that was added as “Not yet supported” years ago but unfortunately was never finished
Don’t feel offended, I am just joking with some of what I said. Still re-installing the OS is the best option to have a clean start.
Other than that I might add some commands to your script:
source /opt/fog/.fogsettings # Remove FOG services for service in FOGMulticastManager.service FOGImageReplicator.service FOGScheduler.service FOGSnapinReplicator.service FOGSnapinHash.service FOGPingHosts.service FOGImageSize.service do systemctl stop $service systemctl disable $service rm -f /usr/lib/systemd/system/$service done # Delete FOG database mysql -u root -p<password> -e 'DROP DATABASE fog;' # Remove FOG files rm -rf /images rm -rf /var/www/fog rm -rf /var/www/html/fog rm -rf /opt/fog rm -rf /opt/fog.old rm -rf /tftpboot rm -rf /tftpboot.prev rm -rf /opt/trunkgit rm -rf /opt/trunksvn # Remove configs generated by the installer rm -rf /etc/dhcp/dhcpd.conf /etc/exports /etc/httpd/conf.d/fog.conf /etc/xinetd.d/tftp* /etc/vsftpd /etc/php-fpm.d/www.conf /etc/php.ini # Remove service data rm -rf /var/lib/dhcpd /var/lib/mysql /var/lib/rpcbind /var/lib/nfs /var/lib/php # Remove logs rm -rf /var/log/httpd /var/log/mariadb /var/log/php-fpm /var/log/xferlog /var/log/fog # Delete FOG system user userdel --force --remove fog userdel --force --remove fogproject rm -rf /home/fog* rm -rf /home/fogproject* # Delete packages installed by FOG installer sourced from .fogsettings uninstall=${packages//curl } uninstall=${uninstall//gzip } uninstall=${uninstall//tar } yum -y remove $uninstall # Remove extra repos rm -f /etc/yum.repos.d/epel* rm -f /etc/yum.repos.d/remi* # Clean & Update the OS yum clean all rm -rf /var/tmp/yum-administrator-PudGB rm -rf /var/cache/yum yum list iostat yum makecache yum grouplist yum grouplist hidden yum update -y # Reboot to Commit reboot
-
@sudburr said in How to totally expunge FOG and everything it's touched:
But I don’t want to re-install the OS by remote. Not yet at least.
I’d have already done it…
Side note: I rarely even install OSs at home anymore. I have clean VMs that I clone for making new VMs.
-
@sudburr Ok, I tested and updated my version of the script below (derived from yours).
Again, make sure you have backups of your /images and the certificate files before you run this script!! I won’t be responsible for any trouble caused by this script!