It turns out the issue is down to a previous problem during Magento updates and a flaky Connect Manager. What's happening is that Connect Manager is bugging out at the first unexpected issue, leaving the site in such an inconsistent state it doesn't know what to do next.
The root cause appears to be a bug to do with long file names in the archive processing introduced in 1.7.x and still there. A bit ironic that Magento has a bug dealing with long names given it's impressive folder depths! See this for details and fix: Long file names and Magento Connect extension packager
This has resulted in many instances of Magento saving what should be a file as a folder. To track these down I ran:
find . -type d -name "*.*" -print
Review this results to see where a previous upgrade has gone wrong. To fix I downloaded a fresh copy of the Magento release we are on (1.9.2.1), deleted the problem files and replaced with fresh copies. For example, there were problems in app/code/core/Mage/ConfigurableSwatches so I deleted and replaced the entire ConfigurableSwatches folder. We had problems in 4 locations.
Then tried a small upgrade from 1.9.2.1 to 1.9.2.2 by upgrading just Mage_All_Latest. Before doing this, I cleared pkginfo/Mage_All_Latest.txt (could be a file or folder). That worked, mostly! For some reason it still bugs out clearing the cache/sessions and still leaves certain file permissions at 666 preventing the site from loading. That can be fixed with:
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod 550 mage
It also still resulted in a pkginfo/Mage_All_Latest.txt folder. No idea why but deleting it fixes. Next tried going to 1.9.3.0 and that worked, aside from permissions. Then to 1.9.3.3, again ok'ish. Before each upgrade, I removed the faulty Mage_All_Latest.txt folder.
So if you're encountering this, fix the Archive/tar.php file, find/replace any corrupted "files became folders" and remove pkginfo/Mage_All_Latest.txt before each upgrade. Then upgrade the Mage_All_Latest package and fix the file permissions.
Worked for us!
Best Answer
This is the SQL way of unlocking a Magento admin account:
Replace the
<username>
with the target account's username.