Eradicating a Package deal on Debian with Excessive Prejudice

apt slaps on the drawback; dpkg solves it.Preserve that in thoughts as you be taught of my current expertise attempting to uninstall MariadB.  After enjoying with and repeatedly reconfiguring a Galera cluster, I made a decision I needed to begin over with a clear slate.Naturally, I did this:apt -y take away mariadb-server
apt -y purge mariadb-serverBut then I found many recordsdata remaining in /and many others/mysql after doing this.Right here’s what the apt-get(8) man web page says:take away
take away is an identical to put in besides that packages are eliminated as a substitute of put in.
Notice that eradicating a bundle leaves its configuration recordsdata on the system. If a plus
signal is appended to the bundle title (with no intervening house), the recognized bundle
will likely be put in as a substitute of eliminated.

purge
purge is an identical to take away besides that packages are eliminated and purged (any
configuration recordsdata are deleted too).Now think about the next state of affairs:Freshly-installed debian 11You set up mariadb-server however don’t contact any config recordsdata and instantly shut it downYou apt take away and apt purge all MariaDB/MySQL-related packages on the boxHaving learn that man web page excerpt, wouldn’t you conclude that with these steps, all MariaDB-related config recordsdata on the system can be eliminated?Not so.Even worse, after doing a easy rm -rf on /and many others/mysql after which doing an apt-install mariadb-server, many necessary config recordsdata in /and many others/mysql have been lacking and the occasion wouldn’t begin.  I used to be anticipating that my take away/purge/set up instructions would return me to a time when the world was new, however no – I ended up in a damaged universe.So find out how to fully take away a bundle such that apt understands you’re standing on empty floor and it ought to set up the config recordsdata on a reinstall?  In my expertise, apt shouldn’t be sufficient and you must name within the Heavy Thunder.Right here’s the journey – or simply skip to the half in pink in order for you the reply.We Begin on the Genesis MomentOr not less than my first login as root.  I’m utilizing a Vultr server (you would possibly have the ability to get one totally free) and naturally, the Summit of All Operation Techniques, Debian.  I ought to caveat that it’s a Vultr template and suppliers do screwy issues generally however the apt settings are regular.So actually my first command on this freshly put in VM:# dpkg -l | grep mariadb
#As anticipated, simply ensuring.  Now:# apt replace
<yadda yadda>
# cat /and many others/debian_version
11.6Yes, I’m ready for bookworm at this level, although I’ve tried simply doing a s/bullseye/bookworm/g and after a reboot to choose up the brand new kernel it labored high-quality.  I haven’t extensively examined it.Again to this.  Vultr does an apt improve at first boot so no want for that.  Continuing to MariaDB:# apt -y set up mariadb-server
<the same old>
# ls -l /and many others/mysql/
whole 24
drwxr-xr-x 2 root root 4096 Mar 18 19:51 conf.d
-rw——- 1 root root 544 Mar 18 19:51 debian.cnf
-rwxr-xr-x 1 root root 1731 Feb 18 2022 debian-start
-rw-r–r– 1 root root 1126 Feb 18 2022 mariadb.cnf
drwxr-xr-x 2 root root 4096 Mar 18 19:51 mariadb.conf.d
lrwxrwxrwx 1 root root 24 Mar 18 19:51 my.cnf -> /and many others/options/my.cnf
-rw-r–r– 1 root root 839 Feb 8 2021 my.cnf.fallbackSo these are the config recordsdata at time of set up.  mariadb is mechanically began.  I favor debian defaulted to disabled.  There are methods to stop this habits utilizing systemd presets, however we’ll go away that for one more day.  Right here we’ll simply:systemctl cease mariadbSo what’s put in package-wise?# dpkg -l | grep maria
ii libdbd-mariadb-perl 1.21-3 amd64 Perl5 database interface to the MariaDB/MySQL databases
ii libmariadb3:amd64 1:10.5.18-0+deb11u1 amd64 MariaDB database consumer library
ii mariadb-client-10.5 1:10.5.18-0+deb11u1 amd64 MariaDB database consumer binaries
ii mariadb-client-core-10.5 1:10.5.18-0+deb11u1 amd64 MariaDB database core consumer binaries
ii mariadb-common 1:10.5.18-0+deb11u1 all MariaDB widespread configuration recordsdata
ii mariadb-server 1:10.5.18-0+deb11u1 all MariaDB database server (metapackage relying on the most recent model)
ii mariadb-server-10.5 1:10.5.18-0+deb11u1 amd64 MariaDB database server binaries
ii mariadb-server-core-10.5 1:10.5.18-0+deb11u1 amd64 MariaDB database core server recordsdata
# dpkg -l | grep mysql
ii mysql-common 5.8+1.0.7 all MySQL database widespread recordsdata, e.g. /and many others/mysql/my.cnfAll proper, let’s go scorched Earth:apt -y take away mariadb-server mariadb-client mariadb-common mysql-common
apt -y purge mariadb-server mariadb-client mariadb-common mysql-commonSo we’re clear as a mountain stream now, proper?  Eliminated and purged?  We by no means touched a config file.We’ve Been Tricked, Bamboozled, and Hornswoggled# ls -l /and many others/mysql/
whole 12
-rw——- 1 root root 544 Mar 18 19:51 debian.cnf
-rwxr-xr-x 1 root root 1731 Feb 18 2022 debian-start
drwxr-xr-x 2 root root 4096 Mar 18 19:51 mariadb.conf.dSo it retained some config recordsdata? dpkg says:# dpkg -l | grep maria
rc mariadb-client-10.5 1:10.5.18-0+deb11u1 amd64 MariaDB database consumer binaries
rc mariadb-server-10.5 1:10.5.18-0+deb11u1 amd64 MariaDB database server binaries
# dpkg -l | grep mysql
#rc = “eliminated however config recordsdata linger”.So there’s purge after which there’s purge apparently.  apt slaps on the drawback; dpkg solves it.# dpkg –purge mariadb-server-10.5Oh, it’s getting actual now…In fact, it will take away your database recordsdata, so take note of that should you care about them.Notice that with dpkg you want to use the total bundle title with model (“mariadb-server-10.5”).And to be thorough:# dpkg –purge mariadb-client-10.5And now:# ls -l /and many others/mysql
ls: can’t entry ‘/and many others/mysql’: No such file or listing
# ls -l /var/lib/mysql
ls: can’t entry ‘/var/lib/mysql’: No such file or listing
# apt -y set up mariadb-server
<yeah, yeah, we have seen it>
# ls -l /and many others/mysql
whole 24
drwxr-xr-x 2 root root 4096 Mar 18 20:00 conf.d
-rw——- 1 root root 544 Mar 18 20:00 debian.cnf
-rwxr-xr-x 1 root root 1731 Feb 18 2022 debian-start
-rw-r–r– 1 root root 1126 Feb 18 2022 mariadb.cnf
drwxr-xr-x 2 root root 4096 Mar 18 20:00 mariadb.conf.d
lrwxrwxrwx 1 root root 24 Mar 18 20:00 my.cnf -> /and many others/options/my.cnf
-rw-r–r– 1 root root 839 Feb 8 2021 my.cnf.fallback
I do not know why issues are this manner, however there you could have the total nuke’em. Dread Lord of LowEnd Content material at LowEndBoxI’m raindog308, techno polymath and long-time LowEndTalk group Administrator. My technical pursuits embody all issues Unix, perl, python, golang, shell scripting, classic working programs corresponding to MVS, and relational database programs corresponding to Oracle, PostgreSQL, and MySQL.I additionally take pleasure in utilizing LEBs! I’ve an empire of little guys for VPNs, bigger guys for apps, and large guys for databases and storage. After I’m not in entrance a display screen I am into German Shepherd canines, high quality knives, goal taking pictures, theology, tabletop roleplaying video games, and forest mountaineering.I take pleasure in writing technical articles right here on LowEndBox to assist individuals get extra out of their programs. Yow will discover me on LowEndTalk @raindog308Latest posts by raindog308 (see all)

🔥 Hot and trending web hostings deals 🔥

HostingsCoupons.com - Web Hostings Coupons, Sales, Deals and Discounts
Logo