Score:0

Getting error while configuring dpkg

et flag

While trying to execute the command to install mysql, getting below error while executing sudo dpkg --configure -a.

Setting up mysql-community-server (5.7.42-1ubuntu18.04) ...
AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 7: Could not open 'abstractions/mysql'
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sat 2023-05-20 01:00:43 IST; 9ms ago
dpkg: error processing package mysql-community-server (--configure):
 installed mysql-community-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-community-server (= 5.7.42-1ubuntu18.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-community-server
 mysql-server

How can this be resolved ?

Also when tried executing sudo apt-get update && sudo apt-get upgrade, got the following error.

Hit:1 http://repo.mysql.com/apt/ubuntu bionic InRelease
Ign:2 http://dl.google.com/linux/chrome-remote-desktop/deb stable InRelease                                                                                                             
Hit:3 https://brave-browser-apt-release.s3.brave.com stable InRelease                                                                                                                   
Hit:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease                                                                                                                   
Hit:5 http://in.archive.ubuntu.com/ubuntu bionic InRelease                                                                                                                              
Hit:6 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                                                            
Hit:7 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                                                                                       
Hit:8 http://dl.google.com/linux/chrome-remote-desktop/deb stable Release                                                                                                               
Hit:9 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                                                                      
Hit:10 https://deb.nodesource.com/node_14.x bionic InRelease                                                                                                                            
Hit:11 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                                                                   
Hit:12 https://apt.corretto.aws stable InRelease                                                                                                                        
Hit:13 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease                                                     
Hit:15 https://scala.jfrog.io/artifactory/debian all InRelease                                   
Ign:16 https://scala.jfrog.io/artifactory/debian  InRelease
Hit:17 https://scala.jfrog.io/artifactory/debian  Release
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  chrome-remote-desktop scala
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up mysql-community-server (5.7.42-1ubuntu18.04) ...
AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 7: Could not open 'abstractions/mysql'
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sat 2023-05-20 00:57:17 IST; 8ms ago
  Process: 19521 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
  Process: 19453 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
dpkg: error processing package mysql-community-server (--configure):
 installed mysql-community-server package post-installation script subprocess returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-community-server (= 5.7.42-1ubuntu18.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-community-server
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Also attaching output of sudo journalctl -n 50 -u mysql.service

systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
systemd[1]: mysql.service: Scheduled restart job, restart counter is at 768.
systemd[1]: Stopped MySQL Community Server.
systemd[1]: Starting MySQL Community Server...
mysql-systemd-start[16963]: AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 7: Could not open 'a
mysqld[17021]: Initialization of mysqld failed: 0
systemd[1]: mysql.service: Control process exited, code=exited status=1
systemd[1]: mysql.service: Failed with result 'exit-code'.
systemd[1]: Failed to start MySQL Community Server.

ru flag
Can you include the output of `sudo journalctl -n 50 -u mysql.service` please? Might include more information about the failure case.
Vipul avatar
et flag
@ThomasWard Have put the requested info in the question.
ru flag
Looks like there's more on that one line than is visible. But it looks like an apparmor rule that got installed is not functional and broken, that's causing a problem with you starting mysql. And it looks like this is a problem with the MySQL APT repository and something they would have to fix, so you would have to contact MySQL about this error. Is there a reason you didn't use the `mysql-server` that's just in the Ubuntu repositories? (Also note 18.04 reaches End of Standard Support in just 12 days, at which point it will be offtopic here, so you should consider upgrading to 20.04)
hr flag
The file it's complaining about (`in /etc/apparmor.d/usr.sbin.mysqld at line 7: Could not open 'abstractions/mysql'`) is part of the apparmor package itself, so perhaps try re-installing that?
ru flag
Yes, this looks like an oversight on the system's part. Run `sudo apt install --reinstall apparmor` to see if it reproduces the abstractions. If it does not, then there's some other issue going on. Keep in mind that Ubuntu 18.04 is going to lose standard support in 12 days, so it's *worth* upgrading to 20.04 or later to get continued support (and maybe some bugfixes)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.