0

I used to have squid installed. And I wanted to clean up to have the default config.

I did:

apt remove squid --auto-remove 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libecap3 libnetfilter-conntrack3 libpython3-dev libpython3.5-dev python3-dev python3-wheel python3.5-dev squid squid-common squid-langpack
0 upgraded, 0 newly installed, 10 to remove and 288 not upgraded.
After this operation, 65.1 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 161441 files and directories currently installed.)
Removing squid (3.5.12-1ubuntu7.10) ...
Removing libecap3:amd64 (1.0.1-3ubuntu3) ...
Removing libnetfilter-conntrack3:amd64 (1.0.5-1) ...
Removing python3-dev (3.5.1-3) ...
Removing libpython3-dev:amd64 (3.5.1-3) ...
Removing python3.5-dev (3.5.2-2ubuntu0~16.04.8) ...
Removing libpython3.5-dev:amd64 (3.5.2-2ubuntu0~16.04.8) ...
Removing python3-wheel (0.29.0-1) ...
Removing squid-common (3.5.12-1ubuntu7.10) ...
Removing squid-langpack (20150704-1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...

But then I noticed that /etc/squid/squid.conf still there, and I manually deleted it and tried to reinstall again

sudo apt install squid
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libecap3 libnetfilter-conntrack3 squid-common squid-langpack
Suggested packages:
  squidclient squid-cgi squid-purge smbclient winbindd
The following NEW packages will be installed:
  libecap3 libnetfilter-conntrack3 squid squid-common squid-langpack
0 upgraded, 5 newly installed, 0 to remove and 288 not upgraded.
Need to get 2,499 kB/2,698 kB of archives.
After this operation, 11.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main amd64 squid-common all 3.5.12-1ubuntu7.15 [176 kB]
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main amd64 squid amd64 3.5.12-1ubuntu7.15 [2,323 kB]
Fetched 2,499 kB in 0s (3,684 kB/s)
Selecting previously unselected package libecap3:amd64.
(Reading database ... 158955 files and directories currently installed.)
Preparing to unpack .../libecap3_1.0.1-3ubuntu3_amd64.deb ...
Unpacking libecap3:amd64 (1.0.1-3ubuntu3) ...
Selecting previously unselected package libnetfilter-conntrack3:amd64.
Preparing to unpack .../libnetfilter-conntrack3_1.0.5-1_amd64.deb ...
Unpacking libnetfilter-conntrack3:amd64 (1.0.5-1) ...
Selecting previously unselected package squid-langpack.
Preparing to unpack .../squid-langpack_20150704-1_all.deb ...
Unpacking squid-langpack (20150704-1) ...
Selecting previously unselected package squid-common.
Preparing to unpack .../squid-common_3.5.12-1ubuntu7.15_all.deb ...
Unpacking squid-common (3.5.12-1ubuntu7.15) ...
Selecting previously unselected package squid.
Preparing to unpack .../squid_3.5.12-1ubuntu7.15_amd64.deb ...
Unpacking squid (3.5.12-1ubuntu7.15) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.9) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libecap3:amd64 (1.0.1-3ubuntu3) ...
Setting up libnetfilter-conntrack3:amd64 (1.0.5-1) ...
Setting up squid-langpack (20150704-1) ...
Setting up squid-common (3.5.12-1ubuntu7.15) ...
Setting up squid (3.5.12-1ubuntu7.15) ...
Installing new version of config file /etc/resolvconf/update-libc.d/squid ...
insserv: warning: current start runlevel(s) (empty) of script `squid' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `squid' overrides LSB defaults (0 1 6).
insserv: can not symlink(../init.d/aegis, ../rc2.d/S03aegis): File exists
insserv: can not symlink(../init.d/aegis, ../rc3.d/S03aegis): File exists
insserv: can not symlink(../init.d/aegis, ../rc4.d/S03aegis): File exists
insserv: can not symlink(../init.d/aegis, ../rc5.d/S03aegis): File exists
Skipping profile in /etc/apparmor.d/disable: usr.sbin.squid
Processing triggers for libc-bin (2.23-0ubuntu10) ...

But then I noticed that at the very end of the output above, some files exist and I am not sure it was installed properly. Hence, I tried again to force an installation:

# apt-get --reinstall install squid
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 288 not upgraded.
Need to get 2,323 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main amd64 squid amd64 3.5.12-1ubuntu7.15 [2,323 kB]
Fetched 2,323 kB in 0s (5,468 kB/s)
(Reading database ... 161235 files and directories currently installed.)
Preparing to unpack .../squid_3.5.12-1ubuntu7.15_amd64.deb ...
Unpacking squid (3.5.12-1ubuntu7.15) over (3.5.12-1ubuntu7.15) ...
Processing triggers for systemd (229-4ubuntu21.9) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up squid (3.5.12-1ubuntu7.15) ...
insserv: warning: current start runlevel(s) (empty) of script `squid' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `squid' overrides LSB defaults (0 1 6).
Skipping profile in /etc/apparmor.d/disable: usr.sbin.squid

But it seems nothing is installed.

Then, I checked to make sure the package actually contains the file:

# apt-file list squid | grep conf
biosquid-dev: /usr/include/biosquid/squidconf.h
biosquid-dev: /usr/share/doc/biosquid-dev/examples/Testsuite/sqdconfig_main.c
lightsquid: /etc/apache2/conf-available/lightsquid.conf
squid: /etc/resolvconf/update-libc.d/squid
squid: /etc/squid/squid.conf
squid-cgi: /etc/squid/cachemgr.conf
squid-common: /usr/share/doc/squid-common/squid.conf.documented.gz
squid-common: /usr/share/squid/mime.conf
squid-deb-proxy: /etc/init/squid-deb-proxy.conf
squid-deb-proxy: /etc/resolvconf/update-libc.d/squid-deb-proxy
squid-deb-proxy: /etc/squid-deb-proxy/squid-deb-proxy.conf
squid-deb-proxy-client: /etc/apt/apt.conf.d/30autoproxy
squidguard: /etc/squidguard/squidGuard.conf.default
squidguard: /usr/share/doc/squidguard/examples/sample.conf
squidguard: /usr/share/doc/squidguard/examples/time-config.txt
squidguard-doc: /usr/share/doc/squidguard-doc/doc/configuration.txt.gz
squidguard-doc: /usr/share/doc/squidguard-doc/doc/configure.txt.gz
squidguard-doc: /usr/share/doc/squidguard-doc/html/configure.html
squidtaild: /etc/squidtaild/squidtaild.conf

It is in the package but not on my box:

# ll /etc/squid/squid.conf
ls: cannot access '/etc/squid/squid.conf': No such file or directory

Any idea how to fix this?

Thanks!

HCSF
  • 151
  • 1
    A few general remarks, without looking into your specific case: Many programs use configuration files, typically somewhere in /etc. If you remove a package with apt remove, those config files aren't removed. To remove them as well, use apt purge. Often there's not only one config file, but multiple, maybe a subdirectory in /etc. So if you reinstall a package with some config files still in place, the installation maybe assumes that all config files are still there, and refrain from create them. You may want to look into apt reinstall. – Henning Kockerbeck Feb 24 '21 at 10:28
  • @HenningKockerbeck that's the exactly the reason. Using apt purge not only removes the configuration files but also somehow tells apt install to actually reinstall the configuration files. Thanks! – HCSF Feb 24 '21 at 10:35

1 Answers1

0

What are the current permissions set on the directories and files in /etc/ and /etc/squid/ ?

You may want to do a purge first, followed by doing a full system search of anything related to squid. Terrible example from my own bad habits, but I'm a big fan of locate so, if you want to use a terrible example, do this:

# install locate
sudo apt update
sudo apt install mlocate
# update the locate database
sudo updatedb
# find squids
locate squid

Then, you can remove the files it shows. I have a pretty modified version of Ubuntu I use frequently (modified in that I have a crapload of random junk installed for testing purposes--so many apps are installed) and it has only three references to squid and they are all python-related stuff from Anaconda, so YMMV but I think this will help you clear the sludge.