Cannot install mysql on Ubuntu 17.10 Gnome 3.26.2

Asked by prabhat

Trying to install mysql, I always get the following error:

> Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

See in full below:

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Suggested packages:
      mailx tinyca
    The following NEW packages will be installed:
      mysql-server-5.7
    0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
    Need to get 0 B/3,184 kB of archives.
    After this operation, 48.3 MB of additional disk space will be used.
    Preconfiguring packages ...
    (Reading database ... 283762 files and directories currently installed.)
    Preparing to unpack .../mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb ...
    Failed to stop mysql.service: Unit mysql.service not loaded.
    invoke-rc.d: initscript mysql, action "stop" failed.
    invoke-rc.d returned 5
    There is a MySQL server running, but we failed in our attempts to stop it.
    Stop it yourself and try again!
    dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb (--unpack):
     subprocess new pre-installation script returned error exit status 1
    Errors were encountered while processing:
     /var/cache/apt/archives/mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
[I have tried this solution][1]
as well as almost every solution available on stackoverflow but it doesn't solve my problem
Even mysql server is not entirely removed by `sudo apt-get remove --purge mysql-server`. I've to remove it by using synaptic manager

  [1]: https://ubuntuforums.org/showthread.php?t=2322637

The outpout of package manager troubleshooting
prabhat@prabhat-HP-Pavilion-Notebook:~$ ubuntu-support-status
Support status summary of 'prabhat-HP-Pavilion-Notebook':

You have 1838 packages (86.9%) supported until July 2018 (Canonical - 9m)

You have 2 packages (0.1%) that can not/no-longer be downloaded
You have 276 packages (13.0%) that are unsupported

Run with --show-unsupported, --show-supported or --show-all to see more details
prabhat@prabhat-HP-Pavilion-Notebook:~$ cat /etc/dpkg/dpkg.cfg.d/multiarch
cat: /etc/dpkg/dpkg.cfg.d/multiarch: No such file or directory
prabhat@prabhat-HP-Pavilion-Notebook:~$ dpkg --print-foreign-architectures
i386
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo grep -R roxy /etc/apt/*
[sudo] password for prabhat:
prabhat@prabhat-HP-Pavilion-Notebook:~$ grep roxy /etc/environment
prabhat@prabhat-HP-Pavilion-Notebook:~$ echo $http_proxy

prabhat@prabhat-HP-Pavilion-Notebook:~$ echo $ftp_prox

prabhat@prabhat-HP-Pavilion-Notebook:~$ grep roxy /etc/bash.bashrc
prabhat@prabhat-HP-Pavilion-Notebook:~$ grep roxy ~/.bashrc
prabhat@prabhat-HP-Pavilion-Notebook:~$ cat /etc/apt/apt.conf
cat: /etc/apt/apt.conf: No such file or directory
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo fuser -vvv /var/lib/dpkg/lock
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo fuser -vvv /var/cache/apt/archives/lock
prabhat@prabhat-HP-Pavilion-Notebook:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.10
DISTRIB_CODENAME=artful
DISTRIB_DESCRIPTION="Ubuntu 17.10"
prabhat@prabhat-HP-Pavilion-Notebook:~$ uname -a
Linux prabhat-HP-Pavilion-Notebook 4.13.0-36-generic #40-Ubuntu SMP Fri Feb 16 20:07:48 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo rm /var/lib/apt/lists/lock
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo rm /var/cache/apt/archives/lock
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo rm /var/lib/dpkg/lock
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status || sudo cp /var/backups/apt.extended_states.0 /var/lib/dpkg/status
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo mv /var/lib/dpkg/available /var/lib/dpkg/available-bad
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
cp: cannot stat '/var/lib/dpkg/available-old': No such file or directory
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo rm -rf /var/lib/dpkg/updates/*
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo rm -rf /var/lib/apt/lists
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo rm /var/cache/apt/*.bin
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo mkdir /var/lib/apt/lists
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo mkdir /var/lib/apt/lists/partial
prabhat@prabhat-HP-Pavilion-Notebook:~$ LANG=C;sudo apt-get clean
prabhat@prabhat-HP-Pavilion-Notebook:~$ LANG=C;sudo apt-get autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo dpkg --configure -a
Setting up gnome-accessibility-themes (3.22.3-1ubuntu2) ...
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for install-info (6.4.90.dfsg.1-1build1) ...
Setting up grub-common (2.02~beta3-4ubuntu7.2) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Processing triggers for systemd (234-2ubuntu12.1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up grub-efi-amd64-bin (2.02~beta3-4ubuntu7.2) ...
Setting up grub2-common (2.02~beta3-4ubuntu7.2) ...
Setting up grub-efi-amd64 (2.02~beta3-4ubuntu7.2) ...
Installing for x86_64-efi platform.
Installation finished. No error reported.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.13.0-36-generic
Found initrd image: /boot/initrd.img-4.13.0-36-generic
Found linux image: /boot/vmlinuz-4.13.0-32-generic
Found initrd image: /boot/initrd.img-4.13.0-32-generic
Found linux image: /boot/vmlinuz-4.13.0-31-generic
Found initrd image: /boot/initrd.img-4.13.0-31-generic
Found linux image: /boot/vmlinuz-4.13.0-17-generic
Found initrd image: /boot/initrd.img-4.13.0-17-generic
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
Setting up grub-efi-amd64-signed (1.85.2+2.02~beta3-4ubuntu7.2) ...
Installing for x86_64-efi platform.
Installation finished. No error reported.
Processing triggers for shim-signed (1.33.1~17.10.1+13-0ubuntu2) ...
No DKMS packages installed: not changing Secure Boot validation state.
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo dpkg --clear-avail
prabhat@prabhat-HP-Pavilion-Notebook:~$ LANG=C;sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
prabhat@prabhat-HP-Pavilion-Notebook:~$ LANG=C;sudo apt-get --fix-missing install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
prabhat@prabhat-HP-Pavilion-Notebook:~$ LANG=C;sudo apt-get --purge autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
prabhat@prabhat-HP-Pavilion-Notebook:~$ LANG=C;sudo apt-get --fix-missing update -o APT::Cache-Limit=100000000
Ign:1 cdrom://Ubuntu 17.10 _Artful Aardvark_ - Release amd64 (20171018) artful InRelease
Err:2 cdrom://Ubuntu 17.10 _Artful Aardvark_ - Release amd64 (20171018) artful Release
  Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
Ign:3 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu artful InRelease
Get:4 http://archive.ubuntu.com/ubuntu artful InRelease [237 kB]
Get:5 http://archive.canonical.com/ubuntu artful InRelease [10.2 kB]
Get:6 http://packages.microsoft.com/repos/vscode stable InRelease [2801 B]
Err:7 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu artful Release
  404 Not Found
Get:8 http://archive.canonical.com/ubuntu artful/partner i386 Packages [1620 B]
Get:9 http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial InRelease [3874 B]
Get:10 http://packages.microsoft.com/repos/vscode stable/main amd64 Packages [42.1 kB]
Get:11 http://archive.canonical.com/ubuntu artful/partner amd64 Packages [1620 B]
Get:12 http://archive.canonical.com/ubuntu artful/partner Translation-en [708 B]
Get:13 https://download.sublimetext.com apt/stable/ InRelease [2562 B]
Get:14 http://archive.ubuntu.com/ubuntu artful-updates InRelease [78.6 kB]
Get:15 http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial/main i386 Packages [9364 B]
Get:16 http://archive.ubuntu.com/ubuntu artful-backports InRelease [72.2 kB]
Get:17 https://download.sublimetext.com apt/stable/ Packages [729 B]
Get:18 http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial/main ppc64el Packages [9386 B]
Get:19 http://archive.ubuntu.com/ubuntu artful-security InRelease [78.6 kB]
Get:20 http://archive.ubuntu.com/ubuntu artful/main i386 Packages [1067 kB]
Get:21 http://archive.ubuntu.com/ubuntu artful/main amd64 Packages [1071 kB]
Get:22 http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial/main amd64 Packages [9419 B]
Get:23 http://archive.ubuntu.com/ubuntu artful/main Translation-en [542 kB]
Get:24 http://archive.ubuntu.com/ubuntu artful/main amd64 DEP-11 Metadata [397 kB]
Get:25 http://archive.ubuntu.com/ubuntu artful/main DEP-11 64x64 Icons [263 kB]
Get:26 http://archive.ubuntu.com/ubuntu artful/restricted i386 Packages [8876 B]
Get:27 http://archive.ubuntu.com/ubuntu artful/restricted amd64 Packages [8852 B]
Get:28 http://archive.ubuntu.com/ubuntu artful/restricted Translation-en [2788 B]
Get:29 http://archive.ubuntu.com/ubuntu artful/universe i386 Packages [8066 kB]
Get:30 http://archive.ubuntu.com/ubuntu artful/universe amd64 Packages [8103 kB]
Get:31 http://archive.ubuntu.com/ubuntu artful/universe Translation-en [4789 kB]
Get:32 http://archive.ubuntu.com/ubuntu artful/universe amd64 DEP-11 Metadata [2845 kB]
Get:33 http://archive.ubuntu.com/ubuntu artful/universe DEP-11 64x64 Icons [7915 kB]
Get:34 http://archive.ubuntu.com/ubuntu artful/multiverse amd64 Packages [150 kB]
Get:35 http://archive.ubuntu.com/ubuntu artful/multiverse i386 Packages [143 kB]
Get:36 http://archive.ubuntu.com/ubuntu artful/multiverse Translation-en [108 kB]
Get:37 http://archive.ubuntu.com/ubuntu artful/multiverse amd64 DEP-11 Metadata [43.8 kB]
Get:38 http://archive.ubuntu.com/ubuntu artful/multiverse DEP-11 64x64 Icons [207 kB]
Get:39 http://archive.ubuntu.com/ubuntu artful-updates/main i386 Packages [218 kB]
Get:40 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 Packages [222 kB]
Get:41 http://archive.ubuntu.com/ubuntu artful-updates/main Translation-en [98.8 kB]
Get:42 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 DEP-11 Metadata [83.3 kB]
Get:43 http://archive.ubuntu.com/ubuntu artful-updates/main DEP-11 64x64 Icons [54.1 kB]
Get:44 http://archive.ubuntu.com/ubuntu artful-updates/restricted i386 Packages [2180 B]
Get:45 http://archive.ubuntu.com/ubuntu artful-updates/restricted amd64 Packages [2192 B]
Get:46 http://archive.ubuntu.com/ubuntu artful-updates/restricted Translation-en [1284 B]
Get:47 http://archive.ubuntu.com/ubuntu artful-updates/universe amd64 Packages [90.7 kB]
Get:48 http://archive.ubuntu.com/ubuntu artful-updates/universe i386 Packages [89.7 kB]
Get:49 http://archive.ubuntu.com/ubuntu artful-updates/universe Translation-en [51.9 kB]
Get:50 http://archive.ubuntu.com/ubuntu artful-updates/universe amd64 DEP-11 Metadata [49.3 kB]
Get:51 http://archive.ubuntu.com/ubuntu artful-updates/universe DEP-11 64x64 Icons [55.3 kB]
Get:52 http://archive.ubuntu.com/ubuntu artful-updates/multiverse amd64 Packages [1828 B]
Get:53 http://archive.ubuntu.com/ubuntu artful-updates/multiverse i386 Packages [1980 B]
Get:54 http://archive.ubuntu.com/ubuntu artful-updates/multiverse Translation-en [1124 B]
Get:55 http://archive.ubuntu.com/ubuntu artful-backports/main i386 Packages [1512 B]
Get:56 http://archive.ubuntu.com/ubuntu artful-backports/main amd64 Packages [1516 B]
Get:57 http://archive.ubuntu.com/ubuntu artful-backports/main Translation-en [668 B]
Get:58 http://archive.ubuntu.com/ubuntu artful-backports/universe amd64 Packages [3412 B]
Get:59 http://archive.ubuntu.com/ubuntu artful-backports/universe i386 Packages [3392 B]
Get:60 http://archive.ubuntu.com/ubuntu artful-backports/universe Translation-en [1880 B]
Get:61 http://archive.ubuntu.com/ubuntu artful-backports/universe amd64 DEP-11 Metadata [4700 B]
Get:62 http://archive.ubuntu.com/ubuntu artful-backports/universe DEP-11 64x64 Icons [2717 B]
Get:63 http://archive.ubuntu.com/ubuntu artful-security/main i386 Packages [133 kB]
Get:64 http://archive.ubuntu.com/ubuntu artful-security/main amd64 Packages [136 kB]
Get:65 http://archive.ubuntu.com/ubuntu artful-security/main Translation-en [59.5 kB]
Get:66 http://archive.ubuntu.com/ubuntu artful-security/main amd64 DEP-11 Metadata [17.2 kB]
Get:67 http://archive.ubuntu.com/ubuntu artful-security/main DEP-11 64x64 Icons [27.5 kB]
Get:68 http://archive.ubuntu.com/ubuntu artful-security/restricted amd64 Packages [2192 B]
Get:69 http://archive.ubuntu.com/ubuntu artful-security/restricted i386 Packages [2180 B]
Get:70 http://archive.ubuntu.com/ubuntu artful-security/restricted Translation-en [1284 B]
Get:71 http://archive.ubuntu.com/ubuntu artful-security/universe i386 Packages [45.6 kB]
Get:72 http://archive.ubuntu.com/ubuntu artful-security/universe amd64 Packages [46.1 kB]
Get:73 http://archive.ubuntu.com/ubuntu artful-security/universe Translation-en [29.3 kB]
Get:74 http://archive.ubuntu.com/ubuntu artful-security/universe amd64 DEP-11 Metadata [10.6 kB]
Get:75 http://archive.ubuntu.com/ubuntu artful-security/universe DEP-11 64x64 Icons [10.1 kB]
Get:76 http://archive.ubuntu.com/ubuntu artful-security/multiverse amd64 Packages [1828 B]
Get:77 http://archive.ubuntu.com/ubuntu artful-security/multiverse i386 Packages [1980 B]
Get:78 http://archive.ubuntu.com/ubuntu artful-security/multiverse Translation-en [1124 B]
Reading package lists... Done
E: The repository 'cdrom://Ubuntu 17.10 _Artful Aardvark_ - Release amd64 (20171018) artful Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu artful Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
prabhat@prabhat-HP-Pavilion-Notebook:~$ LANG=C;sudo apt-get update -o APT::Cache-Limit=100000000 && sudo apt-get dist-upgrade
Ign:1 cdrom://Ubuntu 17.10 _Artful Aardvark_ - Release amd64 (20171018) artful InRelease
Err:2 cdrom://Ubuntu 17.10 _Artful Aardvark_ - Release amd64 (20171018) artful Release
  Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
Ign:3 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu artful InRelease
Hit:4 http://archive.canonical.com/ubuntu artful InRelease
Hit:5 http://archive.ubuntu.com/ubuntu artful InRelease
Hit:6 http://packages.microsoft.com/repos/vscode stable InRelease
Hit:7 http://archive.ubuntu.com/ubuntu artful-updates InRelease
Hit:8 http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial InRelease
Err:9 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu artful Release
  404 Not Found
Hit:10 http://archive.ubuntu.com/ubuntu artful-backports InRelease
Hit:11 http://archive.ubuntu.com/ubuntu artful-security InRelease
Hit:12 https://download.sublimetext.com apt/stable/ InRelease
Reading package lists... Done
E: The repository 'cdrom://Ubuntu 17.10 _Artful Aardvark_ - Release amd64 (20171018) artful Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu artful Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
prabhat@prabhat-HP-Pavilion-Notebook:~$ find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;

/etc/apt/sources.list

     1 deb cdrom:[Ubuntu 17.10 _Artful Aardvark_ - Release amd64 (20171018)]/ artful main restricted
     2
     3 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
     4 # newer versions of the distribution.
     5 deb http://archive.ubuntu.com/ubuntu artful main restricted
     6 # deb-src http://in.archive.ubuntu.com/ubuntu/ artful main restricted
     7
     8 ## Major bug fix updates produced after the final release of the
     9 ## distribution.
    10 deb http://archive.ubuntu.com/ubuntu artful-updates main restricted
    11 # deb-src http://in.archive.ubuntu.com/ubuntu/ artful-updates main restricted
    12
    13 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    14 ## team. Also, please note that software in universe WILL NOT receive any
    15 ## review or updates from the Ubuntu security team.
    16 deb http://archive.ubuntu.com/ubuntu artful universe
    17 # deb-src http://in.archive.ubuntu.com/ubuntu/ artful universe
    18 deb http://archive.ubuntu.com/ubuntu artful-updates universe
    19 # deb-src http://in.archive.ubuntu.com/ubuntu/ artful-updates universe
    20
    21 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    22 ## team, and may not be under a free licence. Please satisfy yourself as to
    23 ## your rights to use the software. Also, please note that software in
    24 ## multiverse WILL NOT receive any review or updates from the Ubuntu
    25 ## security team.
    26 deb http://archive.ubuntu.com/ubuntu artful multiverse
    27 # deb-src http://in.archive.ubuntu.com/ubuntu/ artful multiverse
    28 deb http://archive.ubuntu.com/ubuntu artful-updates multiverse
    29 # deb-src http://in.archive.ubuntu.com/ubuntu/ artful-updates multiverse
    30
    31 ## N.B. software from this repository may not have been tested as
    32 ## extensively as that contained in the main release, although it includes
    33 ## newer versions of some applications which may provide useful features.
    34 ## Also, please note that software in backports WILL NOT receive any review
    35 ## or updates from the Ubuntu security team.
    36 deb http://archive.ubuntu.com/ubuntu artful-backports main restricted universe multiverse
    37 # deb-src http://in.archive.ubuntu.com/ubuntu/ artful-backports main restricted universe multiverse
    38
    39 ## Uncomment the following two lines to add software from Canonical's
    40 ## 'partner' repository.
    41 ## This software is not part of Ubuntu, but is offered by Canonical and the
    42 ## respective vendors as a service to Ubuntu users.
    43 deb http://archive.canonical.com/ubuntu artful partner
    44 # deb-src http://archive.canonical.com/ubuntu artful partner
    45
    46 deb http://archive.ubuntu.com/ubuntu artful-security main restricted
    47 # deb-src http://security.ubuntu.com/ubuntu artful-security main restricted
    48 deb http://archive.ubuntu.com/ubuntu artful-security universe
    49 # deb-src http://security.ubuntu.com/ubuntu artful-security universe
    50 deb http://archive.ubuntu.com/ubuntu artful-security multiverse
    51 # deb-src http://security.ubuntu.com/ubuntu artful-security multiverse
    52 deb [arch=i386,amd64,ppc64el] http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial main
    53 # deb-src [arch=i386,amd64,ppc64el] http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial main

/etc/apt/sources.list.d/openjdk-r-ubuntu-ppa-artful.list

     1 deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu artful main
     2 # deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu artful main
     3 # deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu artful main

/etc/apt/sources.list.d/sublime-text.list

     1 deb https://download.sublimetext.com/ apt/stable/

/etc/apt/sources.list.d/mysql.list

     1 ### THIS FILE IS AUTOMATICALLY CONFIGURED ###
     2 # You may comment out entries below, but any other modifications may be lost.
     3 # Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
     4 # deb http://repo.mysql.com/apt/ubuntu/ artful mysql-apt-config
     5 # deb http://repo.mysql.com/apt/ubuntu/ artful mysql-5.7
     6 # deb http://repo.mysql.com/apt/ubuntu/ artful mysql-tools
     7 # deb http://repo.mysql.com/apt/ubuntu/ artful mysql-tools-preview
     8 # deb-src http://repo.mysql.com/apt/ubuntu/ artful mysql-5.7

/etc/apt/sources.list.d/vscode.list

     1 ### THIS FILE IS AUTOMATICALLY CONFIGURED ###
     2 # You may comment out this entry, but any other modifications may be lost.
     3 deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main

/etc/apt/sources.list.d/bookworm-team-ubuntu-bookworm-artful.list

     1 # deb http://ppa.launchpad.net/bookworm-team/bookworm/ubuntu artful main
     2 # deb-src http://ppa.launchpad.net/bookworm-team/bookworm/ubuntu artful main
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo dpkg --audit

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
Mark Rijckenberg (markrijckenberg) said :
#1

Please send us the full Terminal output of following commands:

ls -lart /etc/systemd/system/mysql*

ls -lart /lib/systemd/system/mariadb*

sudo dpkg --get-selections | grep mysql

sudo dpkg --get-selections | grep mariadb

ps aux | grep mysql

sudo service mysql status

systemctl status mysql.service

sudo systemctl stop mysql

sudo stop mysql

sudo /etc/init.d/mysql stop

sudo killall mysqld

sudo rm /var/run/mysqld/mysqld.pid

sudo rm /var/run/mysqld/mysqld.sock

sudo rm /etc/systemd/system/mysql*

sudo apt install mysql-server-5.7

Revision history for this message
prabhat (prabhat7298) said :
#2

prabhat@prabhat-HP-Pavilion-Notebook:~$ ps aux | grep mysql
prabhat 8370 0.0 0.0 14352 1040 pts/3 S+ 14:08 0:00 grep --color=auto mysql
prabhat 9942 0.0 0.0 33852 772 pts/0 S+ 04:19 0:00 mysql --host=35.184.130.66 --user=root --password
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo service mysql status
Unit mysql.service could not be found.
prabhat@prabhat-HP-Pavilion-Notebook:~$ systemctl status mysql.service
Unit mysql.service could not be found.
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo systemctl stop mysql
Failed to stop mysql.service: Unit mysql.service not loaded.
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo stop mysql
sudo: stop: command not found
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo /etc/init.d/mysql stop
[....] Stopping mysql (via systemctl): mysql.serviceFailed to stop mysql.service: Unit mysql.service not loaded.
 failed!
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo killall mysqld
mysqld: no process found
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo rm /var/run/mysqld/mysqld.pid
rm: cannot remove '/var/run/mysqld/mysqld.pid': No such file or directory
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo rm /var/run/mysqld/mysqld.sock
rm: cannot remove '/var/run/mysqld/mysqld.sock': No such file or directory
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo rm /etc/systemd/system/mysql*
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo apt install mysql-server-5.7
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  mysql-server-5.7
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/3,184 kB of archives.
After this operation, 48.3 MB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 283575 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.21-0ubuntu0.17.10.1) ...
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for systemd (234-2ubuntu12.1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up mysql-server-5.7 (5.7.21-0ubuntu0.17.10.1) ...
Installing new version of config file /etc/apparmor.d/usr.sbin.mysqld ...
Installing new version of config file /etc/init.d/mysql ...
Installing new version of config file /etc/logrotate.d/mysql-server ...

Configuration file '/etc/mysql/debian-start'
 ==> Deleted (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ? Your options are:
    Y or I : install the package maintainer's version
    N or O : keep your currently-installed version
      D : show the differences between the versions
      Z : start a shell to examine the situation
 The default action is to keep your current version.
*** debian-start (Y/I/N/O/D/Z) [default=N] ? N
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 143: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 127
Processing triggers for systemd (234-2ubuntu12.1) ...
Processing triggers for ureadahead (0.100.0-20) ...
Errors were encountered while processing:
 mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
prabhat (prabhat7298) said :
#3

I think I shouldn't have chose here the Defaul value N. But now again when I'm going through the procedure the option doesn't come. What should we do now? Btw Thanks for your help Sir

Revision history for this message
Manfred Hampl (m-hampl) said :
#4

I suggest that you try the commands

sudo dpkg --remove mysql-server-5.7
sudo apt-get install mysql-common
sudo apt-get install mysql-server-5.7

and report the results.

Revision history for this message
prabhat (prabhat7298) said :
#5

prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo dpkg --remove mysql-server-5.7
[sudo] password for prabhat:
dpkg: dependency problems prevent removal of mysql-server-5.7:
 mysql-server depends on mysql-server-5.7.

dpkg: error processing package mysql-server-5.7 (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 mysql-server-5.7
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo apt-get install mysql-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-common is already the newest version (10.1.25+maria-1~xenial).
mysql-common set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 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-server-5.7 (5.7.21-0ubuntu0.17.10.1) ...
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 143: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo apt-get install mysql-server-5.7
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server-5.7 is already the newest version (5.7.21-0ubuntu0.17.10.1).
0 upgraded, 0 newly installed, 0 to remove and 0 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-server-5.7 (5.7.21-0ubuntu0.17.10.1) ...
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 143: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
prabhat@prabhat-HP-Pavilion-Notebook:~$

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

ok, try

sudo apt-get install --reinstall mysql-common

If this still produces error messages, then try

sudo dpkg --remove mysql-server-5.7 mysql-server
sudo apt-get install --reinstall mysql-common
sudo apt-get install mysql-server-5.7 mysql-server

Revision history for this message
prabhat (prabhat7298) said :
#7

prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo apt-get install --reinstall mysql-common
[sudo] password for prabhat:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/8,506 B of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 283660 files and directories currently installed.)
Preparing to unpack .../mysql-common_10.1.25+maria-1~xenial_all.deb ...
Unpacking mysql-common (10.1.25+maria-1~xenial) over (10.1.25+maria-1~xenial) ...
Setting up mysql-common (10.1.25+maria-1~xenial) ...
Setting up mysql-server-5.7 (5.7.21-0ubuntu0.17.10.1) ...
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 143: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                  Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo dpkg --remove mysql-server-5.7 mysql-server(Reading database ... 283658 files and directories currently installed.)
Removing mysql-server (5.7.21-0ubuntu0.17.10.1) ...
Removing mysql-server-5.7 (5.7.21-0ubuntu0.17.10.1) ...
Processing triggers for man-db (2.7.6.1-2) ...
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo apt-get install --reinstall mysql-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libevent-core-2.1-6 mysql-server-core-5.7
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/8,506 B of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 283583 files and directories currently installed.)
Preparing to unpack .../mysql-common_10.1.25+maria-1~xenial_all.deb ...
Unpacking mysql-common (10.1.25+maria-1~xenial) over (10.1.25+maria-1~xenial) ...
Setting up mysql-common (10.1.25+maria-1~xenial) ...
prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo apt-get install mysql-server-5.7 mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  mysql-server mysql-server-5.7
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/3,194 kB of archives.
After this operation, 48.5 MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 283583 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.21-0ubuntu0.17.10.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.21-0ubuntu0.17.10.1_all.deb ...
Unpacking mysql-server (5.7.21-0ubuntu0.17.10.1) ...
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for systemd (234-2ubuntu12.1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up mysql-server-5.7 (5.7.21-0ubuntu0.17.10.1) ...
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 143: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                  Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Manfred Hampl (m-hampl) said :
#8

Please provide the output of the command

apt-cache policy mysql-server-5.7 mysql-server mysql-common

I assume that your problem is caused by using a foreign repository whose mysql-common package is incompatible with the mysql-server-5.7 package from the Ubuntu repository.

Revision history for this message
prabhat (prabhat7298) said :
#9

prabhat@prabhat-HP-Pavilion-Notebook:~$ apt-cache policy mysql-server-5.7 mysql-server mysql-common
mysql-server-5.7:
  Installed: 5.7.21-0ubuntu0.17.10.1
  Candidate: 5.7.21-0ubuntu0.17.10.1
  Version table:
 *** 5.7.21-0ubuntu0.17.10.1 500
        500 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu artful-security/main amd64 Packages
        100 /var/lib/dpkg/status
     5.7.19-0ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu artful/main amd64 Packages
mysql-server:
  Installed: 5.7.21-0ubuntu0.17.10.1
  Candidate: 5.7.21-0ubuntu0.17.10.1
  Version table:
 *** 5.7.21-0ubuntu0.17.10.1 500
        500 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu artful-updates/main i386 Packages
        500 http://archive.ubuntu.com/ubuntu artful-security/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu artful-security/main i386 Packages
        100 /var/lib/dpkg/status
     5.7.19-0ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu artful/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu artful/main i386 Packages
mysql-common:
  Installed: 10.1.25+maria-1~xenial
  Candidate: 10.1.25+maria-1~xenial
  Version table:
 *** 10.1.25+maria-1~xenial 500
        500 http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial/main i386 Packages
        500 http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial/main amd64 Packages
        500 http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial/main ppc64el Packages
        100 /var/lib/dpkg/status
     5.8+1.0.2ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu artful/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu artful/main i386 Packages
prabhat@prabhat-HP-Pavilion-Notebook:~$

Revision history for this message
prabhat (prabhat7298) said :
#10

what do you think of this?
https://bugs.mysql.com/bug.php?id=86896

Revision history for this message
prabhat (prabhat7298) said :
#11

prabhat@prabhat-HP-Pavilion-Notebook:~$ sudo apt install mysql-server-5.7 --fix-broken --fix-missing
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-core-5.7
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7
  mysql-server-core-5.7
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/20.3 MB of archives.
After this operation, 160 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 283431 files and directories currently installed.)
Preparing to unpack .../mysql-common_10.1.25+maria-1~xenial_all.deb ...
Unpacking mysql-common (10.1.25+maria-1~xenial) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../mysql-client-core-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.21-0ubuntu0.17.10.1) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.21-0ubuntu0.17.10.1) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../mysql-server-core-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.21-0ubuntu0.17.10.1) ...
Setting up mysql-common (10.1.25+maria-1~xenial) ...
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 283586 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.21-0ubuntu0.17.10.1) ...
Processing triggers for ureadahead (0.100.0-20) ...
Setting up mysql-server-core-5.7 (5.7.21-0ubuntu0.17.10.1) ...
Processing triggers for systemd (234-2ubuntu12.1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up mysql-client-core-5.7 (5.7.21-0ubuntu0.17.10.1) ...
Setting up mysql-client-5.7 (5.7.21-0ubuntu0.17.10.1) ...
Setting up mysql-server-5.7 (5.7.21-0ubuntu0.17.10.1) ...
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 143: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 127
Processing triggers for systemd (234-2ubuntu12.1) ...
Processing triggers for ureadahead (0.100.0-20) ...
Errors were encountered while processing:
 mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
prabhat (prabhat7298) said :
#12

In above output mysql asked for password to be set for mysql in between but then the error "/var/lib/dpkg/info/mysql-server-5.7.postinst: line 143: /usr/share/mysql-common/configure-symlinks: No such file or directory" came

Revision history for this message
Manfred Hampl (m-hampl) said :
#13

I do not think that this bug as anything to do with your problem.
That bug is about access rights on /tmp/user/0.

Your problem is about a file /usr/share/mysql-common/configure-symlinks
The Ubuntu MySQL package expect that this file exists, but the mysql-common package from mariadb does not provide such file.

Remark: You are running Ubuntu artful, but have the mariadb repository for Ubuntu xenial activated. This also is questionable.

Revision history for this message
prabhat (prabhat7298) said :
#14

I can change anything related to artful or xenial but please I need mysql badly. Moreover, 2nd Answer here actually address a related problem https://unix.stackexchange.com/questions/389747/error-processing-package-mysql-community-server-during-apt-get-upgrade

Revision history for this message
Best Manfred Hampl (m-hampl) said :
#15

I can only repeat:

The mariadb package from http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial prevents the installation of the Ubuntu mysql-client-5.7 and mysql-server-5.7 packages because of a missing /usr/share/mysql-common/configure-symlinks file.

Also the problem report in stackexchange is different from your problem.

Revision history for this message
prabhat (prabhat7298) said :
#16
Revision history for this message
prabhat (prabhat7298) said :
#17

Thanks Manfred Hampl, that solved my question.

Revision history for this message
Peter (bokorpet) said :
#18

Hi Manfred, hi prabhat,

I have a very similar problem. prabhat how could you remove the wrong dependency?

Peter

Revision history for this message
prabhat (prabhat7298) said :
#19

Hi Peter

I can only tell how I solved this problem when I faced it. So, the solution was simply to uncheck the mariadb repository from xenial as I was using artful ubuntu.

Revision history for this message
Peter (bokorpet) said :
#20

I finally managed to solve it for me as well: I deleted the wrong repository entries in /etc/apt/sources.list.d/mariadb.list. This thread gave me the hint so thank you!