I tried with a fresh install of ubuntu image thats shared by @numbqq above. Ran sudo apt-get update && sudo apt-get dist-upgrade -y
on the same and it worked fine.
I do remember a different issue though which I think might be the cause of the what you are experiencing. The issue was that when display goes to sleep and is then awoken by the user, gnome session used to get killed. I believe the same happened with you while you were either installing some package or while package update was in progress. This could have left the dpkg to be in inconsistent state, making dpkg to through errors on subsequent runs.
Can you try doing a fresh install and the implement the fix from the issue I linked above. I believe that would prevent you from facing same issue again.