我在 Ubuntu 服务器 20.04 上,使用 php7.4-fpm 运行 LAMP。
我刚刚执行了最新的更新/升级并确认一切正常:
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-08-26 00:50:45 CST; 7min ago
Docs: man:php-fpm7.4(8)
Main PID: 120871 (php-fpm7.4)
Status: "Processes active: 0, idle: 2, Requests: 24, slow: 0, Traffic: 0.1req/sec"
Tasks: 3 (limit: 4380)
Memory: 80.8M
CGroup: /system.slice/php7.4-fpm.service
├─120871 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
├─120892 php-fpm: pool www
└─120893 php-fpm: pool www
然后几分钟后......我的 Nextcloud 安装突然停止同步,所以我重新检查 php-fpm 的状态,我得到:
● php7.4-fpm.service
Loaded: masked (Reason: Unit php7.4-fpm.service is masked.)
Active: inactive (dead) since Fri 2022-08-26 01:07:14 CST; 5min ago
Main PID: 120871 (code=exited, status=0/SUCCESS)
Status: "Processes active: 0, idle: 2, Requests: 44, slow: 0, Traffic: 0req/sec"
Aug 26 01:07:14 admin.example.com systemd[1]: Stopping The PHP 7.4 FastCGI Process Manager...
Aug 26 01:07:14 admin.example.com systemd[1]: php7.4-fpm.service: Succeeded.
Aug 26 01:07:14 admin.example.com systemd[1]: Stopped The PHP 7.4 FastCGI Process Manager.
Warning: journal has been rotated since unit was started, output may be incomplete.`
而且,毫不夸张地说,/lib/systemd/system/php7.4-fpm.service
不再存在
# stat /lib/systemd/system/php7.4-fpm.service
stat: cannot stat '/lib/systemd/system/php7.4-fpm.service': No such file or directory
我检查了syslog
根据时间戳屏蔽服务时发生的情况...日志中根本没有任何内容可以解释发生的情况:
Aug 26 01:07:14 admin systemd[1]: Stopped The PHP 7.4 FastCGI Process Manager.
Aug 26 01:07:14 admin systemd[1]: php7.4-fpm.service: Succeeded.
Aug 26 01:07:14 admin systemd[1]: Stopping The PHP 7.4 FastCGI Process Manager...
Aug 26 01:07:14 admin systemd[1]: Configuration file /etc/systemd/system/gitea.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
Aug 26 01:07:14 admin systemd[1]: Reloading.
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module readline for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module pspell for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module ctype for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module redis for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module dom for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module soap for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module iconv for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module apcu_bc for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module phar for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module mysqlnd for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module imap for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module xsl for PHP 7.4 fpm sapi
Aug 26 01:07:14 admin php7.4-fpm: php_invoke prerm: Disabled module sysvshm for PHP 7.4 fpm sapi
我尝试解决这个问题的事情:
当我尝试使用 解密 php7.4-fpm 时systemctl unmask php7.4-fpm
,会发生两件事:
/etc/systemd/system/php7.4-fpm.service
已移除。/etc/systemd/system/php7.4-fpm.service
是 /dev/null 的符号链接php7.4-fpm.service 启动使用
init.d
● php7.4-fpm.service - LSB: starts php7.4-fpm
Loaded: loaded (/etc/init.d/php7.4-fpm; generated)
Active: active (exited) since Fri 2022-08-26 09:09:10 CST; 6min ago
Docs: man:systemd-sysv-generator(8)
Tasks: 0 (limit: 4380)
Memory: 0B
CGroup: /system.slice/php7.4-fpm.service
如果我尝试使用重新安装 php7.4fpmapt-get install --reinstall php7.4-fpm
我得到:
root@admin:~# apt-get install --reinstall php7.4-fpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php7.4-fpm : Depends: php7.4-common (= 7.4.3-4ubuntu2.12) but 7.4.3-4ubuntu2.13 is to be installed
E: Unable to correct problems, you have held broken packages.
以上所有步骤均基于这篇文章: https://askubuntu.com/questions/804946/systemctl-how-to-unmask
我目前被破损的包裹困住了
是的,我已经尝试过:
apt install -f
dpkg --configure -a
没有任何帮助..有人知道如何重新安装 PHP 吗?
答案1
这个问题从根本上来说似乎是上游 ubuntu 存储库的打包问题,维护者可能需要一些时间来解决。
The following packages have unmet dependencies:
php7.4-fpm : Depends: php7.4-common (= 7.4.3-4ubuntu2.12) but 7.4.3-4ubuntu2.13 is to be installed
E: Unable to correct problems, you have held broken packages.
与此同时,解决这个问题的唯一方法似乎是-前-您执行最新的 php 更新...确保您的计算机上安装了此存储库:
sudo add-apt-repository ppa:ondrej/php
如果在更新之前安装此存储库,您可以避免上面的噩梦。