I'm not too familiar with ubuntu but this can happen in Fedora when packagekit is running an update check and you try to use yum or add/remove software.
It may have been that another process was blocking you from using apt-get, and it may have even hung which would have required you to identify the process ID and kill it.
Again, I'm not an ubuntu person but e.g.
# ps -eaf | grep apt-get
(get the PID)
# kill <PID>
# apt-get mycoolprogram