在 Ubuntu 云服务器镜像中,apt 更新/升级是从不同的服务执行的,从而导致锁定问题。
我如何才能知道究竟是什么调用了 apt-daily?
Aps aux --forest
没有说明其父级是什么:
root 0000 0.0 0.0 0000 000 ? Ss 00:00 0:00 /bin/sh /usr/lib/apt/apt.systemd.daily install
root 0000 0.0 0.0 0000 0000 ? S 00:00 0:00 \_ /bin/sh /usr/lib/apt/apt.systemd.daily lock_is_held install
root 0000 0.0 00.0 000000 000000 ? Sl 00:00 0:00 \_ /usr/bin/python3 /usr/bin/unattended-upgrade
除了跟踪父进程/调用进程的困难之外,令我感到困惑的是,这台机器禁用了所有看似相关的服务:
systemctl disable apt-daily-upgrade.timer
systemctl disable apt-daily.timer
systemctl disable cloud-init
systemctl disable cron
systemctl disable unattended-upgrades
即使重新启动,我仍然会遇到锁定问题。
我如何才能找出是什么在调用 apt-daily?我可以随意更改所有内容,例如,我可以修改/usr/lib/apt/apt.systemd.daily
以执行任何操作。
输出systemctl list-timers
:
NEXT LEFT LAST PASSED UNIT ACTIVATES
Tue 2020-02-18 11:38:11 UTC 11min left n/a n/a motd-news.timer motd-news.service
Tue 2020-02-18 11:41:34 UTC 14min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Wed 2020-02-19 01:08:41 UTC 13h left n/a n/a apt-daily.timer apt-daily.service
Wed 2020-02-19 06:13:55 UTC 18h left n/a n/a apt-daily-upgrade.timer apt-daily-upgrade.service
Mon 2020-02-24 00:00:00 UTC 5 days left n/a n/a fstrim.timer fstrim.service
5 timers listed.
Pass --all to see loaded but inactive timers, too.