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
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
Related
I'm trying to test Wazuh configuration related to half-configured packages. So, I'm trying to create a .deb package that will end up half configured when installed.
I started by following these instructions for creating a dirt-simple, do-nothing package.
I tried changing the exit code of debian/postinst.ex to 1, but the package installed successfully anyway.
I tried adding a non-existing file to debian/conffiles, but debuild failed.
I've also searched all over for information on the things that can cause a package to be left half configured, without any luck.
Thanks!
First of all, I want to mention that there are two different status for failed installed packages:
half-configured: The package is unpacked and configuration has been started, but not yet completed for some reason.
half-installed: The installation of the package has been started, but not completed for some reason.
Source: https://www.man7.org/linux/man-pages/man1/dpkg.1.html
If you want a half-configured package, then the package must be unpackaged and it is the configuration step the one that should fail.
Now, if you follow the guide you shared with us, you may have missed the part where it says that the *.ex files are examples and are not introduced in the package so if you're modifying the file postinst.ex, these changes will no take effect.
You can remove all the *.ex files and create your own postinst file. For example I've used this one:
root#ubuntu:/tmp/build/greetings-0.1# cat debian/postinst
#!/bin/sh
# postinst script for greetings
#
# see: dh_installdeb(1)
set -e
case "$1" in
configure)
echo "configuring..."
sleep 1
echo "..."
sleep 2
echo "ERROR!"
exit 1
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
Using this file (with the correct name), your code will be executed after the package installation. And you will get something like this:
root#ubuntu:/tmp/build# apt-get install ./greetings_0.1-1_all.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'greetings' instead of './greetings_0.1-1_all.deb'
The following NEW packages will be installed:
greetings
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/2916 B of archives.
After this operation, 14.3 kB of additional disk space will be used.
Get:1 /tmp/build/greetings_0.1-1_all.deb greetings all 0.1-1 [2916 B]
Selecting previously unselected package greetings.
(Reading database ... 76875 files and directories currently installed.)
Preparing to unpack .../build/greetings_0.1-1_all.deb ...
Unpacking greetings (0.1-1) ...
Setting up greetings (0.1-1) ...
configuring...
...
ERROR!
dpkg: error processing package greetings (--configure):
installed greetings package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
greetings
E: Sub-process /usr/bin/dpkg returned an error code (1)
Then, you could use the -s flag on dpkg to check the package status:
root#ubuntu:/tmp/build# dpkg -s greetings
Package: greetings
Status: install ok half-configured
Priority: optional
Section: unknown
Installed-Size: 14
Maintainer: Person McTester <person#company.tld>
Architecture: all
Version: 0.1-1
Description: <insert up to 60 chars description>
<insert long description, indented with spaces>
Homepage: <insert the upstream URL, if relevant>
As you can see, as the package has no way to handle this kind of error, the package is still installed and its status is install ok half-configured
I hope this has helped you :)
dpkg: error processing archive /var/cache/apt/archives/libmysqlclient20_5.7.21-1ubuntu16.04_i386.deb (--unpack):
Trying to overwrite shared '/usr/share/doc/libmysqlclient20/changelog.Debian.gz', which is different from other instances of package libmysqlclient20:i386
Processing triggers for libc-bin (2.23-0ubuntu9)
Errors were encountered while processing:
/var/cache/apt/archives/libmysqlclient20_5.7.21-1ubuntu16.04_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
You need to move the file as follows
sudo mv /usr/share/doc/libmysqlclient20/changelog.Debian.gz /usr/share/doc/libmysqlclient20/changelog.Debian.gz.backup
and then run apt-get -f install to solve this problem.
I am facing one issue. I am trying to install mysql-client mysql-server using below command.
sudo apt-get install mysql-client mysql-server libmysqlclient-dev
But here I am guessing that its installing properly. I am getting some errors also and those are given below.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libmysqlclient-dev is already the newest version.
mysql-client is already the newest version.
mysql-server is already the newest version.
The following packages were automatically installed and are no longer required:
gcc-4.8-base:i386 libasound2:i386 libasound2-plugins:i386 libasyncns0:i386
libaudio2:i386 libavahi-client3:i386 libavahi-common-data:i386
libavahi-common3:i386 libcups2:i386 libdrm-intel1:i386 libdrm-nouveau2:i386
libdrm-radeon1:i386 libelf1:i386 libexpat1:i386 libffi6:i386 libflac8:i386
libfontconfig1:i386 libfreetype6:i386 libgcrypt11:i386 libgl1-mesa-dri:i386
libgl1-mesa-glx:i386 libglapi-mesa:i386 libglib2.0-0:i386 libgnutls26:i386
libgpg-error0:i386 libgssapi-krb5-2:i386 libgstreamer-plugins-base1.0-0:i386
libgstreamer1.0-0:i386 libice6:i386 libjack-jackd2-0:i386 libjbig0:i386
libjpeg-turbo8:i386 libjpeg8:i386 libk5crypto3:i386 libkeyutils1:i386
libkrb5-3:i386 libkrb5support0:i386 libllvm3.4:i386 libmysqlclient18:i386
libogg0:i386 liborc-0.4-0:i386 libp11-kit0:i386 libpciaccess0:i386
libpulse0:i386 libqt4-dbus:i386 libqt4-declarative:i386 libqt4-network:i386
libqt4-opengl:i386 libqt4-script:i386 libqt4-sql:i386 libqt4-sql-mysql:i386
libqt4-xml:i386 libqt4-xmlpatterns:i386 libqtcore4:i386 libqtdbus4:i386
libqtgui4:i386 libqtwebkit4:i386 libsamplerate0:i386 libsm6:i386
libsndfile1:i386 libspeexdsp1:i386 libsqlite3-0:i386 libssl1.0.0:i386
libstdc++6:i386 libtasn1-6:i386 libtiff5:i386 libtxc-dxtn-s2tc0:i386
libudev1:i386 libvorbis0a:i386 libvorbisenc2:i386 libwrap0:i386
libx11-6:i386 libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386
libxcb-dri3-0:i386 libxcb-glx0:i386 libxcb-present0:i386 libxcb-sync1:i386
libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386
libxi6:i386 libxml2:i386 libxrender1:i386 libxshmfence1:i386 libxslt1.1:i386
libxss1:i386 libxt6:i386 libxv1:i386 libxxf86vm1:i386
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 309 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
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Setting up mysql-server-5.5 (5.5.55-0ubuntu0.14.04.1) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package mysql-server-5.5 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 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.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Here I need to install properly. Please help me.
I'm trying to setup a Vagrant environment involving a few Ubuntu machines with Ansible and am having trouble writing an Ansible Playbook to automate the process. Primarily, I'm following the instructions from this answer - https://stackoverflow.com/a/26598887
Here is the snippet of the error I'm getting from running the playbook;
PLAY [web] ********************************************************************
GATHERING FACTS ***************************************************************
ok: [business-web1]
TASK: [Install MySQL] *********************************************************
failed: [business-web1] => (item=mysql-server) => {"failed": true, "item": "mysql-server"}
stderr: start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 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.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
stdout: Reading package lists...
Building dependency tree...
Reading state information...
mysql-server is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.5 (5.5.44-0ubuntu0.14.04.1) ...
msg: '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'mysql-server'' failed: start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 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.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit #/home/vagrant/provision-business-mysql.retry
business-web1 : ok=1 changed=0 unreachable=0 failed=1
To the best of my understanding, it looks like the first 'install mysql' step isn't being run. To verify this, I managed to recreate the problem by running the ansible module directly from command line;
vagrant#mgmt:~$ ansible web -m apt -a "name=mysql-server update_cache=yes cache_valid_time=3600 state=latest" --sudo
business-web1 | FAILED >> {
"failed": true,
"msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\" install 'mysql-server'' failed: start: Job failed to start\ninvoke-rc.d: initscript mysql, action \"start\" failed.\ndpkg: error processing package mysql-server-5.5 (--configure):\n subprocess installed post-installation script returned error exit status 1\ndpkg: dependency problems prevent configuration of mysql-server:\n mysql-server depends on mysql-server-5.5; however:\n Package mysql-server-5.5 is not configured yet.\n\ndpkg: error processing package mysql-server (--configure):\n dependency problems - leaving unconfigured\nNo apport report written because the error message indicates its a followup error from a previous failure.\nErrors were encountered while processing:\n mysql-server-5.5\n mysql-server\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n",
"stderr": "start: Job failed to start\ninvoke-rc.d: initscript mysql, action \"start\" failed.\ndpkg: error processing package mysql-server-5.5 (--configure):\n subprocess installed post-installation script returned error exit status 1\ndpkg: dependency problems prevent configuration of mysql-server:\n mysql-server depends on mysql-server-5.5; however:\n Package mysql-server-5.5 is not configured yet.\n\ndpkg: error processing package mysql-server (--configure):\n dependency problems - leaving unconfigured\nNo apport report written because the error message indicates its a followup error from a previous failure.\nErrors were encountered while processing:\n mysql-server-5.5\n mysql-server\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n",
"stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nmysql-server is already the newest version.\n0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.\n2 not fully installed or removed.\nAfter this operation, 0 B of additional disk space will be used.\nSetting up mysql-server-5.5 (5.5.44-0ubuntu0.14.04.1) ...\n"
}
vagrant#mgmt:~$
Any idea how I can get mysql installed and a DB setup using Ansible?
I had this same error occurring trying to install mysql on a fresh ubuntu/trusty64 box. Crazily enough it turned out to be due to the VM instance having less than 512MB of memory. Make sure your Vagrantfile allots your VM enough memory.
config.vm.provider "virtualbox" do |vb|
vb.memory = "512"
end
#MicahElliott points into the right direction. The error is not related to ansible, but to apt.
E: Sub-process /usr/bin/dpkg returned an error code (1)
stdout: Reading package lists...
Building dependency tree...
Reading state information...
mysql-server is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.
2 not fully installed or removed.
Look here for a solution: https://askubuntu.com/a/438843/231051
when i am installing the mysql using(sudo apt-get install mysql-server mysql-common mysql-clien) in ubuntu 11.04 i get an error like this:
/var/cache/apt/archives/libdbi-perl_1.612-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
how should i avoid this error
info:Trying to install libdbi-perl_1.612-1_amd64.deb seperately also leads to an error
how can i avoid this.thanks in advancethe error code as follows
(Reading database ... 214333 files and directories currently installed.)
Unpacking libdbi-perl (from .../libdbi-perl_1.612-1_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/libdbi-perl_1.612-1_amd64.deb (--unpack):
trying to overwrite '/usr/bin/dbiprof', which is also in package perl-dbi 1.52-3
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Selecting previously deselected package libdbd-mysql-perl.
Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.016-1_amd64.deb) ...
Selecting previously deselected package mysql-client-core-5.1.
Unpacking mysql-client-core-5.1 (from .../mysql-client-core-5.1_5.1.63-0ubuntu0.11.04.1_amd64.deb) ...
Selecting previously deselected package mysql-client-5.1.
Unpacking mysql-client-5.1 (from .../mysql-client-5.1_5.1.63-0ubuntu0.11.04.1_amd64.deb) ...
Selecting previously deselected package mysql-server-core-5.1.
Unpacking mysql-server-core-5.1 (from .../mysql-server-core-5.1_5.1.63-0ubuntu0.11.04.1_amd64.deb) ...
Selecting previously deselected package mysql-server-5.1.
Unpacking mysql-server-5.1 (from .../mysql-server-5.1_5.1.63-0ubuntu0.11.04.1_amd64.deb) ...
Selecting previously deselected package mysql-client.
Unpacking mysql-client (from .../mysql-client_5.1.63-0ubuntu0.11.04.1_all.deb) ...
Selecting previously deselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.1.63-0ubuntu0.11.04.1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Errors were encountered while processing:
/var/cache/apt/archives/libdbi-perl_1.612-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
You have a file collision between the official Debian package libdbi-perl and a third-party package called perl-dbi. There is no perl-dbi package in Debian. You should probably remove it (dpkg -r perl-dbi) but first, try to figure out where it came from with apt-cache policy perl-dbi