Sometimes, sudo dpkg --configure -a itself fails. You might see additional errors like Cannot write to lock file or Sub-process /usr/bin/dpkg returned an error code . When that happens, use the following advanced fixes.
The recommended solution to resolve the "dpkg was interrupted" error is to manually run the command: Sometimes, sudo dpkg --configure -a itself fails
sudo dpkg --configure -a
—usually due to a power failure, a lost internet connection, or the user manually closing the terminal while a process was running. a lost internet connection