How to Fix a Stuck apt-daily.service and Update FASTPANEL

[SOLVED] FASTPANEL Update Issue – Stuck apt-daily.service and APT Lock Error

If you cannot update FASTPANEL because the APT package manager is locked, the apt-daily.service may be stuck running in the background.

You may encounter an error similar to:

bash

E: Could not get lock /var/lib/apt/lists/lock.
It is held by process XXXX (apt-get)

Follow these steps to fix the issue.

1. Stop the Stuck Automatic Update Service

Stop the apt-daily.service:

bash

systemctl stop apt-daily.service

Check whether the service has stopped:

bash

systemctl status apt-daily.service

2. Repair and Refresh the APT Package Manager

Once the stuck process has stopped, run:

bash

dpkg --configure -a
apt clean
apt update

3. Check the Available FASTPANEL Version

Check the currently installed and available FASTPANEL versions:

bash

apt-cache policy fastpanel2

4. Update FASTPANEL

Finally, run:

bash

apt install --only-upgrade fastpanel2

This will upgrade FASTPANEL if a newer version is available in the configured APT repository.

Important: Do not manually delete APT lock files. Make sure the stuck process has stopped and the package manager has released its locks before proceeding.

Result: In my case, apt-daily.service had been stuck for several days, preventing APT from performing package operations. Stopping the service and refreshing the APT package manager resolved the issue, and I was able to update FASTPANEL successfully.