MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.81k stars 494 forks source link

MariaDB recovery and Stretch => Buster => Bullseye upgrade #4511

Closed Phil1988 closed 3 years ago

Phil1988 commented 3 years ago

Creating a bug report/issue

Required Information

Additional Information (if applicable)

Steps to reproduce

Update from 7.1.2 to 7.2.3

Actual behaviour

mariadb doesnt start. At bootup I get: [FAILED] Dietpi-Services start : mariadb

Extra details

Checked the ownership for mysql files but everything is ok

root@DietPi:~# systemctl restart mariadb.service
Job for mariadb.service failed because a fatal signal was delivered to the control process.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
root@DietPi:~# systemctl status mariadb.service
● mariadb.service - MariaDB 10.1.48 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: enabled)
   Active: activating (start) since Thu 2021-06-24 19:58:45 CEST; 846ms ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 11498 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`
cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP
_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 11493 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (c
ode=exited, status=0/SUCCESS)
  Process: 11491 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (co
de=exited, status=0/SUCCESS)
 Main PID: 11588
   Status: "InnoDB: Error: Database page corruption on disk or a failed file read of tablespa
ce ./ibdata1 page  [page id: space=0, page number=5]. You may have to recover from a backup."
    Tasks: 13 (limit: 19660)
   CGroup: /system.slice/mariadb.service

Jun 24 19:58:45 DietPi systemd[1]: Starting MariaDB 10.1.48 database server...
Jun 24 19:58:45 DietPi mysqld[11588]: 2021-06-24 19:58:45 140479465110912 [Note] /usr/sbin/my
sqld (mysqld 10.1.48-MariaDB-0+deb9u2) starting as process 11588 ...
Jun 24 19:58:45 DietPi systemd[1]: mariadb.service: Main process exited, code=killed,
 status=6/ABRT

I hope you have ideas :)

MichaIng commented 3 years ago

The gmp and bcmath modules are two other cases which you can ignore. Those are only required for a specific password-less login method (WebAuthn). If you don't use it, you don't require those. I wish they wouldn't add general recommendations/warnings for modules that are only required for specific features. Better to show the warning/info on the settings page where/when this feature is enabled: https://github.com/nextcloud/server/issues/22849

Probably you get the NC21 offer on next update check. Of force it from console: ncc update:check


Okay to sum it up, on Buster => Bullseye upgrade, prior to doing it:

dietpi-services stop
command -v a2dismod > /dev/null && a2dismod php7.3
# In case backup custom PHP configurations from /etc/php/7.3
G_AGP '*php7.3*'
G_EXEC rm -Rf /etc/php/7.3
dietpi-software reinstall 83 84 85 38 40 47 48 56 93 114 143

This reinstalls all (installed) software titles which require additional PHP modules and/or configs.

Phil1988 commented 3 years ago

I also noted everything down for the summery.

This is what I had and you better on deciding what was important and what not: buster to bullseye

rm /etc/apt/trusted.gpg.d/dietpi-php.gpg
rm /etc/apt/preferences.d/dietpi-php
rm /etc/apt/preferences.d/dietpi-openssl
/boot/dietpi/func/dietpi-set_software apt-cache clean
apt update
apt upgrade
sed -i 's/buster/bullseye/' /etc/apt/sources.list
sed -i 's/buster/bullseye/' /etc/apt/sources.list.d/*.list
apt update
apt upgrade
apt full-upgrade
apt autopurge
/boot/dietpi/func/dietpi-obtain_hw_model
. /boot/dietpi/func/dietpi-globals

install lsof: sudo apt install lsof

install mariadb-server:

apt install mariadb-server
dietpi-services dietpi_controlled mariadb

Mosquitto repo:

sed -i 's/bullseye/buster/' /etc/apt/sources.list.d/*mosquitto*.list
apt update

Installed fdisk: apt install fdisk

removing php 7.3 and reinstall NC:

G_AGP 'php7.3-*'
dietpi-software reinstall 114
a2dismod php7.3
a2enmod php7.4
systemctl restart apache2
G_AGP libapache2-mod-php7.3

I tried also to install bcmath and gmp to make the message dissapear, but that didnt worked:

apt install php7.4-bcmath
apt install php7.4-gmp

Also the update check showed there is no more recent version:

root@DietPi:~# ncc update:check
Everything up to date

Question: Should I revert back to buster and try your way to verify? I would happli do this for you if it helps.

If not, then I stay at my system :D

MichaIng commented 3 years ago

The Ondrej repository stuff is actually required for Stretch => Buster. We should keep those (Stretch => Buster and Buster => Bullseye) separate. But also good to not forget about it.

Same with the fdisk package, which became a dedicated package with Buster. That one however is not strictly required. fdisk is used to view and manipulate partitions, but e.g. parted can do the same (and is installed on all distro versions) and none of our scripts uses fdisk, aside of the partition/filesytem resize service on very first boot.

I'm not yet sure why the mariadb-server got removed as part of the Bullseye upgrade, instead of mariadb-server-10.5 being installed, i.e. mariadb-server-10.3 => mariadb-server-10.5 migration. During the upgrade to Buster (10.1 => 10.3) this obviously worked fine. I need to replicate this, else jep the additional step doesn't hurt anyway, when MariaDB was installed before, of course. In your case the Nextcloud reinstall would have (re)installed MariaDB as well. lsof is then also installed as MariaDB dependency, so that is not strictly required as dedicated step.

I hope, when Bullseye is release at the end of the month, Mosquitto will provide a suite for it as well, so then reverting that repo to Buster won't be required.

I think we have the important parts around PHP for both upgrade steps, so no need to redo the upgrade from my end. Many thanks for doing this and reporting back how it went. A valuable documentation 👍😃!!

Joulinar commented 3 years ago

@MichaIng I guess we would need to review all the repositories we add during installation?

MichaIng commented 3 years ago

I've done this already and added Bullseye => Buster fallback when this was not found. So checking the dietpi-software script for ${G_DISTRO_NAME/bullseye/buster} can be done to find affected repos. Only for Mosquitto we do not add it on Bullseye at all (as also it does not support ARMv8/arm64). I have to change that so we have a single identifier and as any next Mosquitto release won't make it into Bullseye anymore. Currently the Debian repo still ships the newest Mosquitto 2.0.11.

But I guess many repos will start supporting Bullseye soon, so this needs to be reviewed.

Phil1988 commented 3 years ago

Ok great!

So I hope this have not been too much information/command line copys, but I rather prefer to have it documented a little too much then not enough :)

A and the apt install php7.4-bcmath apt install php7.4-gmp did in the end work...

grafik

maybe considerable of you install it right away if NC is installed. I know dietpi is lightweight and we all love it that way (at least I know nobody that tested it and was not satisfied), but its also great for beginners with a great install management (dietpi-software). So maybe these few MB prevents you from getting time consuming questions in the future :D

Btw: I installed the brave browser just for your project and I hope I can tip you by that. As I am a poor student, I will spend again a few bucks but not as much as I wished, so this is at least something :) You guys and this support is really awesome! Thank you a lot!

The only thing that is still questionable from my side is, why there is no NC update visible. Any ideas?

Joulinar commented 3 years ago

What is the version of NC you are running at the moment?

Phil1988 commented 3 years ago

I'm on Nextcloud 20.0.11

grafik

Joulinar commented 3 years ago

Let it run over night. Hope it's gonna change 😃

Phil1988 commented 3 years ago

Haha ok!

Joulinar commented 3 years ago

@MichaIng Not sure if we should open a separate issue on the Bullseye update discussion or continue on this one. I found one more challenge on lighttpd. It's failing after the update to Bullseye.

root@DietPi4:/etc/php# /usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
2021-07-13 10:56:45: configfile.c.461) Warning: "mod_compress" is DEPRECATED and has been replaced with "mod_deflate".  A future release of lighttpd 1.4.x will not contain mod_compress and lighttpd may fail to start up
2021-07-13 10:56:45: plugin.c.195) dlopen() failed for: /usr/lib/lighttpd/mod_deflate.so /usr/lib/lighttpd/mod_deflate.so: cannot open shared object file: No such file or directory
2021-07-13 10:56:45: server.c.1238) loading plugins finally failed
root@DietPi4:/etc/php#

it would require apt install lighttpd-mod-deflate

as well /etc/lighttpd/conf-available/15-fastcgi-php.conf would need to be adjusted to reflect php7.4

MichaIng commented 3 years ago

Also good find (in the forum) about the security suite naming change, I totally forgot about that one (not relevant on Raspbian):

sed -i 's|bullseye/updates|bullseye-security|' /etc/apt/sources.list

Ah yes we found that automatic mod_compress to mod_deflate "migration" on Pi-hole as well, while the deflate module is not automatically installed anymore. The question is whether we shall recommend to remove and old config and let it be re-created by package upgrade/reinstall (that also requires to pass a special APT/DPkg flag), or shall we instruct how to remove or migrate the lines?

This again depends on whether we want to install the deflate module by default on Bullseye or not. It's for compressed file transfer, so HTML, text, CSS and JavaScript files (by default) are compressed on the server, sent to the client, decompressed there. Less/faster data transfer but a little additional processing/CPU time on server and client.

For removal:

sed -i '/^compress\./d' /etc/lighttpd/lighttpd.conf
sed -i '/"mod_compress"/d' /etc/lighttpd/lighttpd.conf
systemctl restart lighttpd

For migration the lines above should be removed as well, then:

apt install lighttpd-mod-deflate
lighty-enable-mod deflate
systemctl restart lighttpd

Another issue is that on Bullseye, even the SSL/TLS module is not present by default. That needs to be integrated into dietpi-letsencrypt at least. Also a question whether we want to install it by default or only via dietpi-letsencrypt. For distro upgrade, when HTTPS was enabled before, regardless which way:

apt install lighttpd-mod-openssl

EDIT: Regardless whether we install it by default, it makes sense that dietpi-letsencrypt assures that it's installed on Bullseye: https://github.com/MichaIng/DietPi/commit/7b308a1ad27a7303e01f61648bcccb4714afb490

... I think it makes sense to add Lighttpd to the list of software titles which need to be reinstalled via:

dietpi-software reinstall 84

We could then even include the removal of those lines.

Joulinar commented 3 years ago

@MichaIng regarding source list. Should it be

deb https://deb.debian.org/debian-security/ bullseye-security/updates or deb https://deb.debian.org/debian-security/ bullseye-security

MichaIng commented 3 years ago

The second. I mean the first works as well, so does bullseye-security/updates/updates/updates/..., as the updates subdirectory is a symlink to its parent, probably intentionally for backwards-compatibility or so.

Phil1988 commented 3 years ago

Hey!

does the lighttpd also affect me? Then I understand all I have to do is to dietpi-software reinstall 84 right?

For let's encrypt (which I am using), its recommended to apt install lighttpd-mod-openssl right?

Ah and by the way: Nextcloud is somehow stuck to the current version. Even after 4 days no update available grafik

Joulinar commented 3 years ago

You are running Apache web server. Therefore lighttpd is not applicable for you.

MichaIng commented 3 years ago

Probably switching to Nextcloud beta branch will offer you the latest version. There is currently no beta version so the latest one it can offer you is a stable one. After the update, you can switch back to stable branch.

Phil1988 commented 3 years ago

Yes, that did it.

Not automatically (I waited almost 3 hours) , but I had to push this: image

After this: image going to update now and report back :)

Phil1988 commented 3 years ago

I got some hints on the settings overview.

Solving Nextcloud warning messages First I did `ncc db:add-missing-indices` Then this remained ![image](https://user-images.githubusercontent.com/6054234/125617603-5a54d1c4-5d9e-4ed2-a04e-dd0c87ea5582.png) which I solved by adding `'default_phone_region' => 'DE',` to /var/www/nextcloud/config/config.php These have been pretty persistent ``` Dein Web-Server ist nicht richtig eingerichtet um "/.well-known/webfinger" aufzulösen. Weitere Informationen findest Du in der Dokumentation. Dein Web-Server ist nicht richtig eingerichtet um "/.well-known/nodeinfo" aufzulösen. Weitere Informationen findest Du in der Dokumentation. ``` Because I was sure I had to include this ``` Redirect 301 /.well-known/webfinger /nextcloud/index.php/.well-known/webfinger Redirect 301 /.well-known/nodeinfo /nextcloud/index.php/.well-known/nodeinfo ``` "somewhere" :D So first I included it here `/etc/apache2/sites-available/dietpi-nextcloud.conf` which appeared to not work. Later also to ``` /etc/apache2/sites-available/000-default-le-ssl.conf /etc/apache2/apache2.conf ``` Later I booted my brain and thought about restarting apache2 to load the config. So adding ``` Redirect 301 /.well-known/webfinger /nextcloud/index.php/.well-known/webfinger Redirect 301 /.well-known/nodeinfo /nextcloud/index.php/.well-known/nodeinfo ``` to `/etc/apache2/sites-available/dietpi-nextcloud.conf` with an `systemctl restart apache2` did the "trick" :) Last hint was about the "well loved" imagick. I hada a look at the supported formats: ``` root@DietPi:/etc/apache2/sites-available# php7.4 -r "phpinfo();" | grep format cURL Information => 7.74.0 Extended EXIF tag formats => Canon, Casio, Fujifilm, Nikon, Olympus, Samsung, Panasonic, DJI, Sony, Pentax, Minolta, Sigma, Foveon, Kyocera, Ricoh, AGFA, Epson ImageMagick number of supported formats: => 237 ImageMagick supported formats => 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVIF, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DNG, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, H, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPG, MRW, MSL, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV ``` And saw no `SVG` there. So I installed `libmagickcore-6.q16-6-extra` ``` root@DietPi:/etc/apache2/sites-available# apt install libmagickcore-6.q16-6-extra Paketlisten werden gelesen… Fertig Abhängigkeitsbaum wird aufgebaut… Fertig Statusinformationen werden eingelesen… Fertig Die folgenden zusätzlichen Pakete werden installiert: libdjvulibre-text libdjvulibre21 libilmbase25 libopenexr25 libwmf0.2-7 Vorgeschlagene Pakete: inkscape libwmf0.2-7-gtk Empfohlene Pakete: libjxr-tools gsfonts Die folgenden NEUEN Pakete werden installiert: libdjvulibre-text libdjvulibre21 libilmbase25 libmagickcore-6.q16-6-extra libopenexr25 libwmf0.2-7 0 aktualisiert, 6 neu installiert, 0 zu entfernen und 0 nicht aktualisiert. Es müssen 1.926 kB an Archiven heruntergeladen werden. Nach dieser Operation werden 7.467 kB Plattenplatz zusätzlich benutzt. Möchten Sie fortfahren? [J/n] j Holen:1 https://deb.debian.org/debian bullseye/main amd64 libdjvulibre-text all 3.5.28-2 [61,8 kB] Holen:2 https://deb.debian.org/debian bullseye/main amd64 libdjvulibre21 amd64 3.5.28-2 [591 kB] Holen:3 https://deb.debian.org/debian bullseye/main amd64 libilmbase25 amd64 2.5.4-1 [202 kB] Holen:4 https://deb.debian.org/debian bullseye/main amd64 libopenexr25 amd64 2.5.4-2 [689 kB] Holen:5 https://deb.debian.org/debian bullseye/main amd64 libwmf0.2-7 amd64 0.2.8.4-17 [165 kB] Holen:6 https://deb.debian.org/debian bullseye/main amd64 libmagickcore-6.q16-6-extra amd64 8:6.9.11.60+dfsg-1.3 [216 kB] Es wurden 1.926 kB in 0 s geholt (6.068 kB/s). Vormals nicht ausgewähltes Paket libdjvulibre-text wird gewählt. (Lese Datenbank ... 43671 Dateien und Verzeichnisse sind derzeit installiert.) Vorbereitung zum Entpacken von .../0-libdjvulibre-text_3.5.28-2_all.deb ... Entpacken von libdjvulibre-text (3.5.28-2) ... Vormals nicht ausgewähltes Paket libdjvulibre21:amd64 wird gewählt. Vorbereitung zum Entpacken von .../1-libdjvulibre21_3.5.28-2_amd64.deb ... Entpacken von libdjvulibre21:amd64 (3.5.28-2) ... Vormals nicht ausgewähltes Paket libilmbase25:amd64 wird gewählt. Vorbereitung zum Entpacken von .../2-libilmbase25_2.5.4-1_amd64.deb ... Entpacken von libilmbase25:amd64 (2.5.4-1) ... Vormals nicht ausgewähltes Paket libopenexr25:amd64 wird gewählt. Vorbereitung zum Entpacken von .../3-libopenexr25_2.5.4-2_amd64.deb ... Entpacken von libopenexr25:amd64 (2.5.4-2) ... Vormals nicht ausgewähltes Paket libwmf0.2-7:amd64 wird gewählt. Vorbereitung zum Entpacken von .../4-libwmf0.2-7_0.2.8.4-17_amd64.deb ... Entpacken von libwmf0.2-7:amd64 (0.2.8.4-17) ... Vormals nicht ausgewähltes Paket libmagickcore-6.q16-6-extra:amd64 wird gewählt. Vorbereitung zum Entpacken von .../5-libmagickcore-6.q16-6-extra_8%3a6.9.11.60+dfsg-1.3_amd64.deb ... Entpacken von libmagickcore-6.q16-6-extra:amd64 (8:6.9.11.60+dfsg-1.3) ... libwmf0.2-7:amd64 (0.2.8.4-17) wird eingerichtet ... libilmbase25:amd64 (2.5.4-1) wird eingerichtet ... libopenexr25:amd64 (2.5.4-2) wird eingerichtet ... libdjvulibre-text (3.5.28-2) wird eingerichtet ... libdjvulibre21:amd64 (3.5.28-2) wird eingerichtet ... libmagickcore-6.q16-6-extra:amd64 (8:6.9.11.60+dfsg-1.3) wird eingerichtet ... Trigger für libc-bin (2.31-12) werden verarbeitet ... root@DietPi:/etc/apache2/sites-available# ```

Now everything works fine again.

image

But I still cant see any updates for Nextcloud at the stable channel . image

When I switch again to the beta channel I can see NC 22.0.0 image

I'm not sure if NC 22.0.0 is beta or stable (for me it seems to be stable, as I can download that version directly from nextcloud). So I just want to be sure if the "update service" is still some kind of broken at my NC.

MichaIng commented 3 years ago

NC 22 is stable, else the version string would be prefixed with beta or RC. As always, Nextcloud offers the updates in waves, so for NC 22 it is perfectly possible that you do not receive it when on stable channel. But for NC 21 this was strange 🤔.

Phil1988 commented 3 years ago

Ahh ok! So my idea now is to update to 22 using the beta channel again and then change it again to the stable channel (and also leave it there in the future).

I will have a look at this and if I dont get any updates, I may open a new issue during the next year :D

MichaIng commented 3 years ago

We created an article about upgrading from Buster to Bullseye: https://dietpi.com/blog/?p=811 And a little HowTo about upgrading from Stretch to Buster: https://dietpi.com/docs/usage/#how-to-upgrade-to-buster

I'll mark this issue hence as closed, which was a great resource to catch upgrading issues and hence required steps.

Phil1988 commented 3 years ago

Great article! Very clear written with a good overview and good information 👍

BTW: Is there a bullseye realease coming out for VMware in the near future? (no pushing.. just as an information. Its ok that its done, when done ;) )

Joulinar commented 3 years ago

you could migrate existing VMWare Buster image to Bullseye

MichaIng commented 3 years ago

Many thanks for your feedback. Yes I'll update all VM images the next days.

Phil1988 commented 3 years ago

Thanks for that! I am looking forward to it :)