Debian sistemde dist-upgrade yapıldığı sırada mevcut sistem üzerinde kurulu olan paketlerin remove edilme ihtimali bulunmaktadır. (Genel olarak tüm linux sistemlerde bu vardır)
apt dist-upgrade komutunu çalıştırıldığında remove edilecek paketlerin listesi size sunulacaktır. Remove edilecek paketlerin çalışan sisteminizi etkilemeyeceğinden emin olun aksi halde geri dönmek zor olur ve veri kaybı yaşayabilirsiniz.
dist-upgrade işlemini bilinçsizce yapması sonucu bu tür durumlara düşmemek için felaket senaryoları hazırlamak şart.
# apt dist-upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… The following packages were automatically installed and are no longer required:
...
Use 'apt-get autoremove' to remove them.
Done
The following packages will be REMOVED:
apache2 mariadb-client-10.0 mariadb-server-10.0
İşlem sonrası mysql’e erişim sırasında karşılaşılan hata:
# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
r
# service mysqld start
Failed to start mysqld.service: Unit mysqld.service failed to load: No such file or directory.
# systemctl
UNIT LOAD ACTIVE SUB DESCRIPTION
apache2.service loaded failed failed LSB: Apache2 web server
mysql.service loaded failed failed LSB: Start and stop the mysql database server daemon
# systemctl start mysql.service
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details
Aslında sistem üzerinden apache ve mysql servisi var gibi görünüyor. Başlatmaya çalıştığınızda aşağıdaki hatalarla karşılaşıyorsunuz.
# systemctl status mysql.service
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Sat 2019-06-01 22:28:49 +03; 6s ago
Process: 1777 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Jun 01 22:28:19 /etc/init.d/mysql[1802]: /etc/init.d/mysql: line 110: /usr/bin/mysqld_safe: No such file or directory
Jun 01 22:28:49 /etc/init.d/mysql[2085]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Jun 01 22:28:49 /etc/init.d/mysql[2085]: /etc/init.d/mysql: line 75: /usr/bin/mysqladmin: No such file or directory
Jun 01 22:28:49 /etc/init.d/mysql[2085]:
Jun 01 22:28:49 mysql[1777]: Starting MariaDB database server: mysqld . . . . . . . failed!
Apache ve Mysql gibi uygulamaları apt gibi paket yöneticisi ile silmeniz durumda datalarınızın olduğu dizinler genelde sistemden silinmez. Tekrar apache ve mysql yüklenmesi durumunda muhtelemen aşağıdaki hatayı alacaksınız.
# apt install mariadb-server
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mariadb-server : Depends: mariadb-server-10.1 (>= 10.1.37-0+deb9u1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
# apt install apache2
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
apache2 : Depends: apache2-bin (= 2.4.25-3+deb9u7) but 2.4.10-10+deb8u14 is to be installed
E: Unable to correct problems, you have held broken packages.
# apt install mariadb-server-10.0
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mariadb-server-10.0 : Depends: libdbi-perl but it is not going to be installed
Depends: mariadb-client-10.0 (>= 10.0.38-0+deb8u1) but it is not going to be installed
Depends: mariadb-server-core-10.0 (>= 10.0.38-0+deb8u1) but it is not going to be installed
PreDepends: mariadb-common but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Bu hatayı almanızın nedeni mevcut repositorinizde bulunan uygulama sürümünün sisteminiz tarafından desteklenmediğinden kaynaklanmaktadır. Öncelikle Ağache için /etc/apache2 dizinini yedeklemelisiniz. Aynı şekilde Mysql ve diğer uygulamalarınız data dizinleri için de geçerli. Yedeklerin sağlam olduğundan emin olduktan sonra distribütörünüzün web sitesinden güncel repository’i sisteminize tanıtmalısınız. Bu linkten debian için uygun repository’i bulabilirsiniz. Repository’i sisteme tanıttıktan sonra Apache ve Mysql’i yükleyebilirsiniz.
Çözüm için aşağıdaki repo adreslerini /etc/apt/sources.list dosyası içerisine yazdım
# vi /etc/apt/sources.list
deb http://security.debian.org/debian-security stretch/updates main contrib non-free
deb http://ftp.de.debian.org/debian stretch main
# mv /etc/apache2 /etc/apache2.bck
# mv /etc/php /etc/php.bck
# cp -r /var/lib/mysql /var/lib/mysql.bck
# apt-get clean
# apt-get --purge remove apache2-bin
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
apache2-bin*
0 upgraded, 0 newly installed, 1 to remove and 27 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
# apt install apache2 mariadb-server-10.0
# systemctl status mysql
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: active (running) since Sat 2019-06-01 23:28:14 +03; 2s ago
Process: 7806 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
Process: 7841 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mysql.service
├─7865 /bin/bash /usr/bin/mysqld_safe
├─7932 /usr/sbin/mysqld --basedir=/usr --datadir=... --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-error --pid-file=
└─7933 logger -t mysqld -p daemon error
Jun 01 23:28:13 mysqld[7933]: 190601 23:28:13 [Note] InnoDB: Waiting for purge to start
Jun 01 23:28:13 mysqld[7933]: 190601 23:28:13 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.42-84.2 started; log sequ…310291801
Jun 01 23:28:13 mysqld[7933]: 190601 23:28:13 [Note] Plugin 'FEEDBACK' is disabled.
Jun 01 23:28:13 mysqld[7933]: 190601 23:28:13 [Note] Server socket created on IP: '::'.
Jun 01 23:28:13 mysqld[7933]: 190601 23:28:13 [Note] /usr/sbin/mysqld: ready for connections.
Jun 01 23:28:13 mysqld[7933]: Version: '10.0.38-MariaDB-0+deb8u1' socket: '/var/run/mysqld/mysqld.sock' (Debian)
Apache’i yükledikten sonra php modülünün aktif edilmesi gerekebilir. Bunun için aşağıdaki adımları izlemalisiniz. Bu işlemi yaptığımda php modülünü aktif edemedim ve mevcut sistemde bulunan dosları kopyalayarak çözdüm.
# a2enmod php7.3
Bu işe yaramayınca aşağıdaki şekilde çözdüm.
# cp /etc/apache2.bck/mod-available/php* /etc/apache2.bck/mod-available/
# a2enmod php7
Yeni yüklenen apache.conf ve php.ini dosyaları arasında herhangi bir fark var mı diye aşağıdaki şekilde kontrol edebilirsiniz.
# diff /etc/apache2.old/apache2.conf /etc/apache2/apache2.conf
# diff /etc/php.old/7.3/cli/php.ini /etc/php/7.3/cli/php.ini
Apache nin tekrar yklenmesinden kaynaklı mevcut siteleriniz de silinmiş lacaktır. Sistemde bulunan siteler aşağıdaki şekilde aktif edilebilir.
# cp /etc/apache2.bck/sites-available/*.conf /etc/apache2/sites-available/
# a2ensite hostname.conf
# a2ensite hostname2.conf
# a2ensite hostname3.conf
# service apache2 reload