The package’s .preinst script is failing for some reason.
To find out why, examine the script in /var/lib/dpkg/info/PACKAGENAME.preinst
If you want to see exactly which line the script is failing on, edit the .preinst script and add set -x
immediately after the #!
line. This turns on execution tracing in the script.
NOTE: This assumes that the .preinst script is a shell script (either posix sh or bash). Almost all .preinst (and .postinst, .prerm, and .postrm) scripts are shell scripts but they don’t have to be, they could be any executable. e.g. on my main desktop machine with 9104 packages installed, 14 are perl scripts, 1 is a compiled executable (bash’s preinst — it can’t assume there is a functioning shell already installed), and all of the rest are shell scripts…9041 are POSIX shell scripts, 63 are bash scripts. If the .preinst is perl or python or something else, you’ll have to figure out how to enable debugging or execution trace mode or similar in that language.
Then run dpkg --configure --pending
.
This will cause dpkg to try to configure the half-installed package. DO NOT reinstall it with dpkg -i
, that will overwrite your edited .preinst script with the version in the .deb package.
This may give you enough information to fix the problem. It may be something simple like an unexpected or uncaught exit code from a program (most .preinst etc scripts have set -e
, to make them terminate on the first error), or assuming that a directory already exists (and this may be due to an undeclared dependency in the package’s debian/control file — i.e it should depend on foo but doesn’t. just install foo anyway)
Once it’s fixed, run dpkg --configure --pending
again, and the package should be properly installed.
If the .preinst script is buggy, there’s a reasonable chance that the .postinst (and/or .prerm and .postrm) scripts will be too. You may need to fix them as well.
Don’t forget to submit a bug report to whoever made the package so they can fix it.
I need mysql 8.0.17 on ubuntu 18.04.
I downloaded their archive mysql file mysql-server_8.0.17-1ubuntu18.04_amd64.deb-bundle.tar
(https://downloads.mysql.com/archives/community/)
and tried to install it according to the instruction https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/linux-installation-debian.html
when running
sudo dpkg -i mysql-{common, community-client, client, community-server, server}_*.deb
i got errors
Selecting previously unselected package mysql-common.
(Reading database ... 227920 files and directories currently installed.)
Preparing to unpack mysql-common_8.0.17-1ubuntu18.04_amd64.deb ...
Unpacking mysql-common (8.0.17-1ubuntu18.04) ...
Preparing to unpack mysql-community-client_8.0.17-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client (8.0.17-1ubuntu18.04) over (8.0.17-1ubuntu18.04) ...
Selecting previously unselected package mysql-client.
Preparing to unpack mysql-client_8.0.17-1ubuntu18.04_amd64.deb ...
Unpacking mysql-client (8.0.17-1ubuntu18.04) ...
Preparing to unpack mysql-community-server_8.0.17-1ubuntu18.04_amd64.deb ...
install: invalid user ‘mysql’
dpkg: error processing archive mysql-community-server_8.0.17-1ubuntu18.04_amd64.deb (--install):
new mysql-community-server package pre-installation script subprocess returned error exit status 1
Selecting previously unselected package mysql-server.
Preparing to unpack mysql-server_8.0.17-1ubuntu18.04_amd64.deb ...
Unpacking mysql-server (8.0.17-1ubuntu18.04) ...
Setting up mysql-common (8.0.17-1ubuntu18.04) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up mysql-community-client (8.0.17-1ubuntu18.04) ...
Setting up mysql-client (8.0.17-1ubuntu18.04) ...
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-community-server (= 8.0.17-1ubuntu18.04); however:
Package mysql-community-server is not installed.
dpkg: error processing package mysql-server (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Errors were encountered while processing:
mysql-community-server_8.0.17-1ubuntu18.04_amd64.deb
mysql-server
asked Jul 31, 2020 at 12:06
Try this. First you need to uninstall anything that is related to mysql.
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
Next thing is to upgrade your distro.
sudo apt-get dist-upgrade
Now after this is done, you can try to install mysql as normal again.
answered Jul 31, 2020 at 12:12
Tony StarkTony Stark
2,2681 gold badge19 silver badges38 bronze badges
Debian GNU/Linux 8.7 (jessie)
Хочу установить пакет mysql-server, выполняю команду:# apt-get install mysql-server
В результате получаю ошибку:
E: Sub-process /usr/bin/dpkg returned an error code (1)
Вот полный вывод:
root@dev:~# apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
mysql-server-5.5
Suggested packages:
tinyca
The following NEW packages will be installed:
mysql-server mysql-server-5.5
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,846 kB of archives.
After this operation, 32.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
(Reading database ... 48232 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.5_5.5.54-0+deb8u1_amd64.deb ...
Aborting downgrade from (at least) 10.1 to 5.5.
If are sure you want to downgrade to 5.5, remove the file
/var/lib/mysql/debian-*.flag and try installing again.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.5_5.5.54-0+deb8u1_amd64.deb (--unpack):
subprocess new pre-installation script returned error exit status 1
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.5.54-0+deb8u1_all.deb ...
Unpacking mysql-server (5.5.54-0+deb8u1) ...
Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-5.5_5.5.54-0+deb8u1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@dev:~# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
mysql-server-5.5
Suggested packages:
tinyca
The following NEW packages will be installed:
mysql-server-5.5
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,766 kB of archives.
After this operation, 32.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
(Reading database ... 48232 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.5_5.5.54-0+deb8u1_amd64.deb ...
Aborting downgrade from (at least) 10.1 to 5.5.
If are sure you want to downgrade to 5.5, remove the file
/var/lib/mysql/debian-*.flag and try installing again.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.5_5.5.54-0+deb8u1_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.5_5.5.54-0+deb8u1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@dev:~# dpkg --configure -a
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 is not installed.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server
Что эта ошибка означает, и как ее побороть?
- Печать
Страницы: [1] Вниз
Тема: Как установить MySQL server на Ubuntu 18.04 bionic на облачном Hetzner сервере (Прочитано 562 раз)
0 Пользователей и 1 Гость просматривают эту тему.
cegthgtlhj
Сам я абсолютный нуль в линуксах. Мне нужно установить MySQL server и развернуть на нем Джанго вебсайт.
У меня облачный сервер на Hetzner.de Ubuntu 18.04.4 LTS /// bionic
Начал устанавливать MySQL server, начал по простому
sudo apt update
sudo apt upgrade
sudo apt install mysql-server
Это не сработало.
Перерыл как минимум 10 веток на stackoverflow.com и перепробовал их.
Возвращается та же самая ошибка.
Последняя попытка была использовать эту инструкцию https://ru.stackoverflow.com/questions/992815/%D0%9A%D0%B0%D0%BA-%D1%83%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%B8%D1%82%D1%8C-mysql-8-0-8-0-15-%D0%BD%D0%B0-ubuntu-18-04-%D1%82%D0%B0%D0%BA-%D0%B6%D0%B5-%D0%B4%D0%BB%D1%8F-digitalocean
sudo -i
service mysql stop
killall -KILL mysql mysqld_safe mysqld
apt-get --yes purge mysql-server mysql-client
apt-get --yes autoremove --purge
apt-get autoclean
deluser --remove-home mysql
delgroup mysql
эрэм эрэф /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld /etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld
updatedb
sudo apt update
sudo apt upgrade
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
sudo dpkg -i mysql-apt-config*
apt update
sudo apt update
sudo apt upgrade
sudo apt install mysql-server
В результате та же самая ошибка
Пожста помогите
Reading package lists... Done
После каждой неуспешной попытки я делаю ребилд сервера чтобы не было мусора.
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libaio1 libmecab2 mysql-client mysql-common mysql-community-client mysql-community-client-core
mysql-community-server mysql-community-server-core
Recommended packages:
mecab-ipadic-utf8
The following NEW packages will be installed:
libaio1 libmecab2 mysql-client mysql-common mysql-community-client mysql-community-client-core
mysql-community-server mysql-community-server-core mysql-server
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.6 MB of archives.
After this operation, 195 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-common amd64 8.0.20-1ubuntu18.04 [94.3 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libaio1 amd64 0.3.110-5ubuntu0.1 [6,476 B]
Get:3 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client-core amd64 8.0.20-1ubuntu18.04 [1,707 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmecab2 amd64 0.996-5 [257 kB]
Get:5 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.20-1ubuntu18.04 [2,834 kB]
Get:6 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-client amd64 8.0.20-1ubuntu18.04 [90.7 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.20-1ubuntu18.04 [18.4 MB]
Get:8 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server amd64 8.0.20-1ubuntu18.04 [102 kB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-server amd64 8.0.20-1ubuntu18.04 [90.7 kB]
Fetched 23.6 MB in 1s (24.0 MB/s)
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 34325 files and directories currently installed.)
Preparing to unpack .../0-mysql-common_8.0.20-1ubuntu18.04_amd64.deb ...
Unpacking mysql-common (8.0.20-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-client-core.
Preparing to unpack .../1-mysql-community-client-core_8.0.20-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client-core (8.0.20-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-client.
Preparing to unpack .../2-mysql-community-client_8.0.20-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client (8.0.20-1ubuntu18.04) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../3-mysql-client_8.0.20-1ubuntu18.04_amd64.deb ...
Unpacking mysql-client (8.0.20-1ubuntu18.04) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../4-libaio1_0.3.110-5ubuntu0.1_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-5ubuntu0.1) ...
Selecting previously unselected package libmecab2:amd64.
Preparing to unpack .../5-libmecab2_0.996-5_amd64.deb ...
Unpacking libmecab2:amd64 (0.996-5) ...
Selecting previously unselected package mysql-community-server-core.
Preparing to unpack .../6-mysql-community-server-core_8.0.20-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-server-core (8.0.20-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack .../7-mysql-community-server_8.0.20-1ubuntu18.04_amd64.deb ...
You are required to change your password immediately (root enforced)
chfn: PAM: Authentication token is no longer valid; new one required
adduser: `/usr/bin/chfn -f MySQL Server mysql' returned error code 1. Exiting.
dpkg: error processing archive /tmp/apt-dpkg-install-mMEhYd/7-mysql-community-server_8.0.20-1ubuntu18.04_amd64.deb (--unpack):
new mysql-community-server package pre-installation script subprocess returned error exit status 1
Selecting previously unselected package mysql-server.
Preparing to unpack .../8-mysql-server_8.0.20-1ubuntu18.04_amd64.deb ...
Unpacking mysql-server (8.0.20-1ubuntu18.04) ...
Errors were encountered while processing:
/tmp/apt-dpkg-install-mMEhYd/7-mysql-community-server_8.0.20-1ubuntu18.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Спасибо
Dzhoser
sudo apt-get purge .*mariadb.* .*mysql.*
sudo apt-get autoremove
sudo locate mysql
Эта команда выдаст список оставшихся после удаления файлов/директорий/скриптов прошлых БД. Всех их тоже надо удалить.
sudo apt install mysql-server mysql-client
cegthgtlhj
остались следующие хвосты.
Питон нужно удалить?
как удалить последние два хвоста?
root@t-20200417:~# sudo locate mysql
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/__init__.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/__pycache__
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/base.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/features.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/introspection.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/operations.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/schema.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/__pycache__/__init__.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/__pycache__/base.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/__pycache__/features.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/__pycache__/introspection.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/__pycache__/operations.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/contrib/gis/db/backends/mysql/__pycache__/schema.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__init__.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__pycache__
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/client.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/compiler.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/creation.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/features.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/introspection.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/operations.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/schema.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/validation.py
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__pycache__/__init__.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__pycache__/base.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__pycache__/client.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__pycache__/compiler.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__pycache__/creation.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__pycache__/features.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__pycache__/introspection.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__pycache__/operations.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__pycache__/schema.cpython-36.pyc
/home/oleg/dj/venv/lib/python3.6/site-packages/django/db/backends/mysql/__pycache__/validation.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/__init__.py
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/__pycache__
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/base.py
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/features.py
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/introspection.py
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/operations.py
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/schema.py
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/__pycache__/__init__.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/__pycache__/base.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/__pycache__/features.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/__pycache__/introspection.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/__pycache__/operations.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/contrib/gis/db/backends/mysql/__pycache__/schema.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__init__.py
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__pycache__
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/base.py
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/client.py
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/compiler.py
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/creation.py
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/features.py
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/introspection.py
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/operations.py
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/schema.py
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/validation.py
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__pycache__/__init__.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__pycache__/base.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__pycache__/client.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__pycache__/compiler.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__pycache__/creation.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__pycache__/features.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__pycache__/introspection.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__pycache__/operations.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__pycache__/schema.cpython-36.pyc
/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/__pycache__/validation.cpython-36.pyc
/usr/share/bash-completion/completions/mysql
/usr/share/bash-completion/completions/mysqladmin
bezbo
После каждой неуспешной попытки я делаю ребилд сервера чтобы не было мусора.
покажите на чистом сервере
sudo apt search mysql-server
Dzhoser
Python удалять не нужно паки dist-packages будет достаточно. В домашнем каталоге тоже можно не удалять
cegthgtlhj
Благодарю вас за поддержку.
Мне подсказали следующее.
Пароль юзера истек — необходимо поменять.
Это видно из сообщения об ошибке, которое я не знал как истолковать.
Сделал как написано здесь — ввел пароли еще раз
https://scottlinux.com/2015/03/03/pam-error-authentication-token-is-no-longer-valid/
После этого установился MySQL без проблем
Благодарю вас еще раз
- Печать
Страницы: [1] Вверх
Code:
mysqld: unrecognized service
Code:
doctor@ED-Workstation:/etc/mysql$ ls conf.d my.cnf.fallback.dpkg-new
Code:
doctor@ED-Workstation:/etc/mysql/conf.d$ ls mysql.cnf.dpkg-new
Code:
doctor@ED-Workstation:/etc/init$ ls php7.2-fpm.conf
Code:
doctor@ED-Workstation:/etc/init$ apt policy Package files: 100 /var/lib/dpkg/status release a=now 500 http://repo.mysql.com/apt/ubuntu bionic/mysql-tools amd64 Packages release o=MySQL,n=bionic,l=MySQL,c=mysql-tools,b=amd64 origin repo.mysql.com 500 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 Packages release o=MySQL,n=bionic,l=MySQL,c=mysql-8.0,b=amd64 origin repo.mysql.com 500 http://repo.mysql.com/apt/ubuntu bionic/mysql-apt-config amd64 Packages release o=MySQL,n=bionic,l=MySQL,c=mysql-apt-config,b=amd64 origin repo.mysql.com 500 http://mirror.lstn.net/mariadb/repo/10.3/ubuntu bionic/main arm64 Packages release o=MariaDB,n=bionic,l=MariaDB,c=main,b=arm64 origin mirror.lstn.net 500 http://mirror.lstn.net/mariadb/repo/10.3/ubuntu bionic/main ppc64el Packages release o=MariaDB,n=bionic,l=MariaDB,c=main,b=ppc64el origin mirror.lstn.net 500 http://mirror.lstn.net/mariadb/repo/10.3/ubuntu bionic/main amd64 Packages release o=MariaDB,n=bionic,l=MariaDB,c=main,b=amd64 origin mirror.lstn.net 500 http://nginx.org/packages/ubuntu bionic/nginx amd64 Packages release o=nginx,a=stable,n=bionic,l=nginx,c=nginx,b=amd64 origin nginx.org 500 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=multiverse,b=amd64 origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=universe,b=amd64 origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=main,b=amd64 origin security.ubuntu.com 100 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages release v=18.04,o=Ubuntu,a=bionic-backports,n=bionic,l=Ubuntu,c=universe,b=amd64 origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=multiverse,b=amd64 origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=universe,b=amd64 origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=restricted,b=amd64 origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=main,b=amd64 origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=multiverse,b=amd64 origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=universe,b=amd64 origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=restricted,b=amd64 origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=main,b=amd64 origin archive.ubuntu.com Pinned packages:
Code:
doctor@ED-Workstation:/etc/init$ sudo apt install mariadb-server Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: mariadb-server : Depends: mariadb-server-10.3 (>= 1:10.3.11+maria~bionic) but it is not going to be installed mysql-server : Depends: mysql-community-server (= 8.0.13-1ubuntu18.04) but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). doctor@ED-Workstation:/etc/init$ sudo apt --fix-broken install Reading package lists... Done Building dependency tree Reading state information... Done Correcting dependencies... Done The following packages were automatically installed and are no longer required: libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.1-6 libfcgi-perl libfreetype6 libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libtimedate-perl liburi-perl Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: mysql-community-server The following NEW packages will be installed: mysql-community-server 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. 10 not fully installed or removed. Need to get 0 B/23.4 MB of archives. After this operation, 147 MB of additional disk space will be used. Do you want to continue? [Y/n] y Preconfiguring packages ... (Reading database ... 29350 files and directories currently installed.) Preparing to unpack .../mysql-community-server_8.0.13-1ubuntu18.04_amd64.deb ... install: invalid user �mysql� dpkg: error processing archive /var/cache/apt/archives/mysql-community-server_8.0.13-1ubuntu18.04_amd64.deb (--unpack): new mysql-community-server package pre-installation script subprocess returned error exit status 1 Errors were encountered while processing: /var/cache/apt/archives/mysql-community-server_8.0.13-1ubuntu18.04_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
What do I do about this? Haven’t run into this before and not finding an answer through Google…
My local install of mysql-community-server decided to fail today after applying some updates. I’m running Debian buster/sid so these kind of things are to be expected. But this was a totally new one to me.
Mysql failed to start so the update wouldn’t install.
Unpacking mysql-community-server (5.7.21-1debian9) ... Setting up mysql-community-client (5.7.21-1debian9) ... Setting up mysql-client (5.7.21-1debian9) ... Processing triggers for systemd (236-3) ... Processing triggers for man-db (2.7.6.1-4) ... Setting up mysql-community-server (5.7.21-1debian9) ... 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 Thu 2018-01-18 08:54:36 GMT; 9ms ago Process: 11123 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid ^[[0;1;31m(code=exited, status=1/FAILURE)^[[0m Process: 11088 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 Errors were encountered while processing: mysql-community-server Log ended: 2018-01-18 08:54:36
Then in my syslog file I saw lots of activity constantly trying to start and failing.
The problem all stemmed from three important lines in the syslog, two of which appear immediately after trying to start Mysql
Jan 18 08:55:03 myPC systemd[1]: Starting MySQL Community Server... Jan 18 08:55:03 myPC kernel: [ 770.041349] audit: type=1400 audit(1516265703.293:225): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=12004 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=120 ouid=0 Jan 18 08:55:03 myPC kernel: [ 770.042022] audit: type=1400 audit(1516265703.293:226): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=12004 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=120 ouid=0
The third appeared later on.
Jan 18 08:55:03 myPC kernel: [ 770.270695] audit: type=1400 audit(1516265703.525:227): apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/run/mysqld/mysqld.sock.lock" pid=12006 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=120 ouid=120
So apparmor
is preventing mysql from accessing files. I haven’t a clue what changed. But looking in the file /etc/apparmor.d/usr.sbin.mysqld
I can’t see references to the paths/files mysql is trying to access according to the above log entries. So I edited the file and added in some matching entries.
$ sudo vi /etc/apparmor.d/usr.sbin.mysqld
... /etc/mysql/mysql.conf.d/ r, /etc/mysql/mysql.conf.d/* r, /sys/devices/system/node/* r, /etc/mysql/*.cnf r, /run/mysqld/* rw, ...
Then reloaded the apparmor
service (don’t restart it, reload it!) restarted the mysql service and up it comes.
$ sudo systemctl reload apparmor.service $ sudo systemctl start mysql.service
I was then able to continue with the apt upgrade and see it complete successfully.
Other relevant errors noticed in the syslog file:
Jan 18 08:55:03 myPC mysqld[12004]: 2018-01-18T08:55:03.525899Z 0 [ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock. Jan 18 08:55:03 myPC mysqld[12004]: 2018-01-18T08:55:03.525910Z 0 [ERROR] Unable to setup unix socket lock file. Jan 18 08:55:03 myPC mysqld[12004]: 2018-01-18T08:55:03.525918Z 0 [ERROR] Aborting Jan 18 08:55:03 myPC mysqld[12004]: Initialization of mysqld failed: 0
References
Not related to Mysql, but a useful insight to apparmor and it’s features.
https://www.digitalocean.com/community/tutorials/how-to-create-an-apparmor-profile-for-nginx-on-ubuntu-14-04