Score:0

ERROR 2002 (HY000): Can't connect to local MySQL server through socket after removing some packages

jp flag

So, my Security department requested me to remove some unused packages from a certain Ubuntu machine, as their presence is a security risk in case some intruder get access:

  • /usr/bin/g++
  • /usr/bin/gcc
  • /usr/bin/gdb
  • /usr/bin/make
  • /usr/bin/nc
  • /usr/bin/netcat
  • /usr/bin/perl

Right after their removal, access to MySQL server was lost. AT first the service wask masked, so I unmasked it and started agian. Tried restarting the service, and even uncommented the socket line in a cnf file to make sure the socket was created at /var/lib/mysql/mysql.sock ... but none of that worked.

I don't know if one of those packages was actually required by the mysql server or if this is a strange coincidence, but some advice on what to try would be great.

guiverc avatar
cn flag
How are we to help? You've not provided any Ubuntu product/release details; nor package details on what MySQL package you refer to, so are we to guess? Packages are built for specific releases (esp. *deb* packages) thus release really matters? or are you asking about *snap* packages (that are the same for all releases?).
Score:2
om flag

If you look at the dependencies of MySQL, Perl is listed. MySQL thus needs Perl according to the dependency tree of Ubuntu packagers.

Perl is a scripting language that traditionally has been used for a lot of stuff, so removing it is not a good idea.

If you used apt to remove perl, it should have complained about this.

<Rant>

I'd say this approach to security is cargo cult security at best. Removing the binaries listed will not make it a lot more difficult, unless you ensure every user writeable location is also noexec. Even then it's of minimal value; show me a working modern unix system without Python or a shell capable of control structures...

Removing netcat means that I'll have to spend thirty seconds to write a netcat implementation in python - which is a language you can't remove and have a working Ubuntu system.

</Rant>

uz flag
Jos
Hear hear. Writing a simple client-server system (which is basically what `netcat` is) is lesson 1 in network programming in any language. That would mean that every general-purpose language and shell ought to be removed from the system, rendering the system unmaintainable.
vidarlo avatar
om flag
@Jos - Yep. Removing that is cargo cult security because someone saw in a book that it can be used for nefarious purposes.
uz flag
Jos
If you remove `perl`, why wouldn't the apt system remove `mysql` as well?
vidarlo avatar
om flag
My guess is that he either didn't use `apt` to remove it (but just `rm`), or that MySQL is not installed via apt or a mechanism that checks dependencies.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.