无法在 Debian 上安装 Squid:由于超出超时,squid.service 作业失败

无法在 Debian 上安装 Squid:由于超出超时,squid.service 作业失败

我正在尝试安装 squid 但 apt 无法完成安装,并返回以下错误:

After this operation, 7,263 kB of additional disk space will be used.
Selecting previously unselected package squid.
(Reading database ... 156110 files and directories currently installed.)
Preparing to unpack .../squid_3.5.23-5+deb9u1_amd64.deb ...
Unpacking squid (3.5.23-5+deb9u1) ...
Setting up squid (3.5.23-5+deb9u1) ...
Setcap worked! /usr/lib/squid/pinger is not suid!
Job for squid.service failed because a timeout was exceeded.
See "systemctl status squid.service" and "journalctl -xe" for details.
invoke-rc.d: initscript squid, action "restart" failed.
● squid.service - LSB: Squid HTTP Proxy version 3.x
   Loaded: loaded (/etc/init.d/squid; generated; vendor preset: enabled)
   Active: failed (Result: timeout) since Wed 2020-04-22 11:54:36 CDT; 7ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1888 ExecStart=/etc/init.d/squid start (code=exited, status=0/SUCCESS)
    Tasks: 24 (limit: 4915)
   CGroup: /system.slice/squid.service
           ├─  338 /usr/sbin/squid -YC -f /etc/squid/squid.conf
           ├─  340 (squid-1) -YC -f /etc/squid/squid.conf
           ├─  341 (logfile-daemon) /var/log/squid/access.log
           ├─  342 (pinger)
           ├─  950 /usr/sbin/squid -YC -f /etc/squid/squid.conf
           ├─  952 (squid-1) -YC -f /etc/squid/squid.conf
           ├─  953 (logfile-daemon) /var/log/squid/access.log
           ├─  954 (pinger)
           ├─ 1926 /usr/sbin/squid -YC -f /etc/squid/squid.conf
           ├─ 1928 (squid-1) -YC -f /etc/squid/squid.conf
           ├─ 1929 (logfile-daemon) /var/log/squid/access.log
           ├─ 1930 (pinger)
           ├─31261 /usr/sbin/squid -YC -f /etc/squid/squid.conf
           ├─31263 (squid-1) -YC -f /etc/squid/squid.conf
           ├─31264 (logfile-daemon) /var/log/squid/access.log
           ├─31265 (pinger)
           ├─31597 /usr/sbin/squid -YC -f /etc/squid/squid.conf
           ├─31599 (squid-1) -YC -f /etc/squid/squid.conf
           ├─31600 (logfile-daemon) /var/log/squid/access.log
           ├─31601 (pinger)
           ├─31949 /usr/sbin/squid -YC -f /etc/squid/squid.conf
           ├─31951 (squid-1) -YC -f /etc/squid/squid.conf
           ├─31952 (logfile-daemon) /var/log/squid/access.log
           └─31953 (pinger)

Apr 22 11:49:36 backgroundserver systemd[1]: Starting LSB: Squid HTTP Proxy version 3.x...
Apr 22 11:49:36 backgroundserver squid[1926]: Squid Parent: will start 1 kids
Apr 22 11:49:36 backgroundserver squid[1888]: Starting Squid HTTP Proxy: squid.
Apr 22 11:49:36 backgroundserver systemd[1]: squid.service: PID file /var/run/squid.pid not readable (yet?) after start: No such file or directory
Apr 22 11:49:36 backgroundserver squid[1926]: Squid Parent: (squid-1) process 1928 started
Apr 22 11:54:36 backgroundserver systemd[1]: squid.service: Start operation timed out. Terminating.
Apr 22 11:54:36 backgroundserver systemd[1]: Failed to start LSB: Squid HTTP Proxy version 3.x.
Apr 22 11:54:36 backgroundserver systemd[1]: squid.service: Unit entered failed state.
Apr 22 11:54:36 backgroundserver systemd[1]: squid.service: Failed with result 'timeout'.
dpkg: error processing package squid (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for systemd (232-25+deb9u12) ...
Processing triggers for man-db (2.7.6.1-2) ...
Errors were encountered while processing:
 squid
E: Sub-process /usr/bin/dpkg returned an error code (1)

我不知道该怎么办。

答案1

打开终端并运行:

清除(以前的版本):

sudo apt -y purge squid* &> /dev/null
sudo rm -rf /var/spool/squid/* /var/log/squid/* /etc/squid3 /dev/shm/* &> /dev/null

安装:

sudo apt -y install squid squid-langpack
if [ ! -d /var/log/squid ]; then sudo mkdir -p /var/log/squid && sudo touch /var/log/squid/{access,cache}.log && sudo chown -R proxy:proxy /var/log/squid; fi

Crontab(可选):

sudo crontab -l | { cat; echo "@weekly squid -k rotate"; } | sudo crontab -

PD:在 Ubuntu 20.04 上测试(不是 Debian)

相关内容