It worked yesterday. I got to a screen that had Ok on it, but could not figure out how to proceed.
Logging out did not help.
sudo apt-get install ubuntu-restricted-extras
[sudo] password for andy:
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 60204 (apt-get)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
I get that once in a while because Apt check sometimes runs in the background. Do not kill the other dpkg manually, it will muck up your system. To stop this from happening turn off auto updates in Software & Updates
'Unattended upgrades' also run in the background. That will do the same thing. I don't recommend it for everyone, you have to be diligent about uprgading every day if you do, but I usually remove it the first time it gives me trouble shutting down. It reminds me to much of Windoze forced updates.
I agree with others, in that unattended upgrades can often get in the way (it does for many of us, myself included), but I'll suggest also checking your other terminals (both graphic & text for me), as I often find I've started something in a different workspace etc, then promptly forgot about due to other distraction... (ie. I've locked myself out)
Two questions . The first requires a little understanding: Linux (and its forerunner, Unix) is possibly the most stable operating system extant today, but my experience has been that no OS is infallible. I will typically do a restart on my systems (all of them, not just Linux) every 15-20 days or so. Even though there are maintenance jobs that run unattended, cruft has a tendency to accumulate (temp files, etc.) and a restart simply puts everything back into smooth, proper order.
I like my server running 24x7x365, but having a short 5-10 minute down time periodically I think makes things just run more smoothly. I just reboot when I don't think I'll be needing my resources for a while.
As for your terminal commands, that might be part of your 'history' setting. Take a look at your ~/.bashrc to see if you have key bindings set. Then, check to see if you don't invoke key bindings that overwrite them. Also, you can probably use Ctrl-R to search your command history. Lastly, you can set your history for the number of commands it remembers. If you type history at the command prompt, you'll see what it contains.