I broke Ubuntu while installing neofetch, error code keeps appearing in terminal failed to start OpenAFS client

sudo apt install neofetch
[sudo] password for gh: 
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 
gh@gh-Lenovo-Z580:~$ sudo dpkg --configure -a
Setting up openafs-modules-dkms (1.8.4~pre1-1ubuntu2.1) ...
Loading new openafs-1.8.4pre1 DKMS files...
Building for 5.8.0-59-generic
Building initial module for 5.8.0-59-generic
Secure Boot not enabled on this system.
Done.

openafs.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.8.0-59-generic/updates/dkms/

depmod...........

DKMS: install completed.
Setting up openafs-client (1.8.4~pre1-1ubuntu2.1) ...
update-alternatives: using /usr/bin/pagsh.openafs to provide /usr/bin/pagsh (pagsh) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/openafs-client.service → /lib/systemd/system/openafs-client.service.
Created symlink /etc/systemd/system/remote-fs.target.wants/openafs-client.service → /lib/systemd/system/openafs-client.service.
Job for openafs-client.service failed because the control process exited with error code.
See "systemctl status openafs-client.service" and "journalctl -xe" for details.
invoke-rc.d: initscript openafs-client, action "start" failed.
● openafs-client.service - OpenAFS client
     Loaded: loaded (/lib/systemd/system/openafs-client.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2021-07-05 00:48:14 BST; 10ms ago
    Process: 86158 ExecStartPre=/usr/share/openafs/openafs-client-precheck (code=exited, status=0/SUCCESS)
    Process: 86173 ExecStart=/sbin/afsd $AFSD_ARGS (code=exited, status=1/FAILURE)
    Process: 86178 ExecStopPost=/sbin/rmmod $KMOD (code=exited, status=0/SUCCESS)

Jul 05 00:48:14 gh-Lenovo-Z580 systemd[1]: Starting OpenAFS client...
Jul 05 00:48:14 gh-Lenovo-Z580 afsd[86173]: afsd: some file missing or bad in /etc/openafs/
Jul 05 00:48:14 gh-Lenovo-Z580 systemd[1]: openafs-client.service: Control process exited, code=exited, status=1/FAILURE
Jul 05 00:48:14 gh-Lenovo-Z580 systemd[1]: openafs-client.service: Failed with result 'exit-code'.
Jul 05 00:48:14 gh-Lenovo-Z580 systemd[1]: Failed to start OpenAFS client.
dpkg: error processing package openafs-client (--configure):
 installed openafs-client package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.7) ...
Errors were encountered while processing:
 openafs-client

What have I done wrong?


Solution 1:

It seems that you have shut down your machine when unattended upgrades was run or killed APT processes manually.

To start from scratch you can remove all OpenAFS packages by:

sudo apt-get autopurge '*openafs*'

if above fails, then use lower level:

sudo dpkg -P --force-all $(dpkg -l | grep -i openafs | awk '{print $2}')

Then resume other packages installation by

sudo dpkg --configure -a
sudo apt-get install -f

and finally install neofetch and OpenAFS client back by

sudo apt-get install neofetch openafs-client