I had the same problem. It turns out it was mysql_upgrade exiting with an 'Error occurred: The mysql.session exists but is not correctly configured. The mysql.session needs SELECT privileges in the performance_schema database and the mysql.db table and also SUPER privileges.'
The way mysql_upgrade tries to check this requirement is with the query 'SELECT SUM(count)=3 FROM ( SELECT COUNT(*) as count FROM mysql.tables_priv WHERE Table_priv='Select' and User='mysql.session' and Db='mysql' and Table_name='user' UNION ALL SELECT COUNT(*) as count FROM mysql.db WHERE Select_priv='Y' and User='mysql.session' and Db='performance_schema' UNION ALL SELECT COUNT(*) as count FROM mysql.user WHERE Super_priv='Y' and User='mysql.session') as user_priv' which is quite a stupid way to do that. And this failed in my case because i have 2 mysql.session users, one on localhost and one with '%' as host, so even tho my users were set up _exactly_ as mysql_upgrade demanded, it didn't warn me about the multiple users. Great check... Deleting one caused mysql_upgrade to pass and the dpkg system to return to normal (with an apt-get install -f) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1726656 Title: package mysql-server-5.7 5.7.20-0ubuntu0.16.04.1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 1 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1726656/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs