User Tools

Site Tools


informatica:servidor_internet_2009_debian_10_part_2

Servidor web/dades

Actualització a Debian 10.12 "buster" - Part 2 - Agost de 2022

Debian 10.12 es va publicar el 26 de març de 2022. Debian 10.0 es va publicar inicialment el 6 de juliol de 2019.

Aquesta pàgina conté la segona part de la descripció detallada del procés d'actualització a Debian 10.12 “buster”.

Instal·lació de PHP5

Segueixo les instruccions a https://tecadmin.net/install-apache-php-fpm-debian-10/ per instal·lar PHP-5 a partir del magatzem Sury,

Primer edito el contingut del fitxer /etc/apt/sources.list.d/06-php-from-sury.list per activar el magatzem Sury

$ cat /etc/apt/sources.list.d/06-php-from-sury.list
     ## deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ buster main

     deb https://packages.sury.org/php/ buster main

# apt update
Hit:1 http://security.debian.org buster/updates InRelease
Hit:2 http://ftp.es.debian.org/debian buster InRelease                                
Get:3 https://packages.sury.org/php buster InRelease [6,837 B]                        
Hit:4 http://ftp.es.debian.org/debian buster-updates InRelease          
Hit:5 http://ftp.es.debian.org/debian buster-backports InRelease
Get:6 http://ftp.es.debian.org/debian buster/main DEP-11 48x48 Icons [3,770 kB]
Get:7 https://packages.sury.org/php buster/main amd64 Packages [364 kB]
Get:8 http://ftp.es.debian.org/debian buster/contrib DEP-11 48x48 Icons [56.4 kB]
Get:9 http://ftp.es.debian.org/debian buster/non-free DEP-11 48x48 Icons [3,491 B]
Fetched 4,200 kB in 2s (2,766 kB/s)                              
Reading package lists... Done
Building dependency tree       
Reading state information... Done
54 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@sermnserver:/etc/apt/sources.list.d# apt list --upgradable
Listing... Done
enchant/buster 1.6.1-1+0~20210212.1+debian10~1.gbp73138d amd64 [upgradable from: 1.6.0-11.1+b1]
libapache2-mod-php7.0/buster 7.0.33-60+0~20220627.68+debian10~1.gbp3d361a amd64 [upgradable from: 7.0.33-0+deb9u12]
...
Get:68 https://packages.sury.org/php buster/main amd64 php7.3 all 7.3.33-4+0~20220627.98+debian10~1.gbp40b3e4 [49.1 kB]
Get:69 https://packages.sury.org/php buster/main amd64 python3-libxml2 amd64 2.9.14+dfsg-0+0~20220524.12+debian10~1.gbpc5dc45 [205 kB]
Fetched 25.3 MB in 2s (10.2 MB/s)     
Reading changelogs... Done
Extracting templates from packages: 100%
(Reading database ... 220576 files and directories currently installed.)




# php -v                                                                                                                                   
PHP 8.1.8 (cli) (built: Jul 11 2022 08:53:35) (NTS)                                                    
Copyright (c) The PHP Group                                                                                                                                                              
Zend Engine v4.1.8, Copyright (c) Zend Technologies                                                    
    with Zend OPcache v8.1.8, Copyright (c), by Zend Technologies                                                                                                                        

# apt install php5.6                    
Reading package lists... Done                                                                                                                 
Building dependency tree                                                                   
Reading state information... Done                                                          
The following package was automatically installed and is no longer required:         
  php7.3-mysql                                                                                          
Use 'apt autoremove' to remove it.                                                                          
The following additional packages will be installed:                                                                
  libapache2-mod-php5.6 php5.6-cli php5.6-common php5.6-json php5.6-opcache php5.6-readline                                         
The following NEW packages will be installed:                                                                                                                                          
  libapache2-mod-php5.6 php5.6 php5.6-cli php5.6-common php5.6-json php5.6-opcache php5.6-readline                               
0 upgraded, 7 newly installed, 0 to remove and 1 not upgraded.                                                                    
Need to get 3,662 kB of archives.                                                                                                                                                        
After this operation, 14.2 MB of additional disk space will be used.                                                                                                                 
Do you want to continue? [Y/n]         
Get:1 https://packages.sury.org/php buster/main amd64 php5.6-common amd64 5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd [736 kB]                                                         
Get:2 https://packages.sury.org/php buster/main amd64 php5.6-json amd64 5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd [17.9 kB]                                                           
Get:3 https://packages.sury.org/php buster/main amd64 php5.6-opcache amd64 5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd [63.0 kB]                                                        
Get:4 https://packages.sury.org/php buster/main amd64 php5.6-readline amd64 5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd [13.0 kB]
Get:5 https://packages.sury.org/php buster/main amd64 php5.6-cli amd64 5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd [1,303 kB]
Get:6 https://packages.sury.org/php buster/main amd64 libapache2-mod-php5.6 amd64 5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd [1,260 kB]
Get:7 https://packages.sury.org/php buster/main amd64 php5.6 all 5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd [268 kB]
Fetched 3,662 kB in 0s (7,763 kB/s)
Selecting previously unselected package php5.6-common.
(Reading database ... 220795 files and directories currently installed.)
Preparing to unpack .../0-php5.6-common_5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd_amd64.deb ...
Unpacking php5.6-common (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...
Selecting previously unselected package php5.6-json.
Preparing to unpack .../1-php5.6-json_5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd_amd64.deb ...
Unpacking php5.6-json (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...
...
Creating config file /etc/php/5.6/mods-available/opcache.ini with new version
Setting up php5.6-readline (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...

Creating config file /etc/php/5.6/mods-available/readline.ini with new version
Setting up php5.6-cli (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...

Creating config file /etc/php/5.6/cli/php.ini with new version
Setting up libapache2-mod-php5.6 (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...

Creating config file /etc/php/5.6/apache2/php.ini with new version
libapache2-mod-php5.6: php5 module already enabled, not enabling PHP 5.6
Setting up php5.6 (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for php5.6-cli (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...
Processing triggers for libapache2-mod-php5.6 (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...

# update-alternatives --set php /usr/bin/php5.6
update-alternatives: using /usr/bin/php5.6 to provide /usr/bin/php (php) in manual mode

# php -v
PHP 5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Fix Bumblebee problems

El programa Bumblebee (servidor de reserves) dóna diversos errors.

# tail /var/log/apache2/error.log
[Sun Aug 07 12:20:40.886047 2022] [:error] [pid 15212] [client 158.109.48.53:59698] PHP Fatal error:  Call to undefined function mb_detect_encoding() in /opt/bmbee-117/system-inc/php-gettext
/gettext.inc on line 102, referer: http://sermn.uab.cat/wiki/doku.php
[Sun Aug 07 12:47:46.637033 2022] [:error] [pid 15210] [client 66.249.65.129:56948] PHP Fatal error:  Call to undefined function mb_detect_encoding() in /opt/bmbee-117/system-inc/php-gettext
/gettext.inc on line 102

Una consulta a Google indica que aquest error es deu a que no s'ha instal·lat l'extensió de PHP //mbstring// (que no s'instal·la per defecte). Instal·lo l'extensió, reinicio el servidor apache,

# apt search php5* | grep mbstring

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

php-mbstring/buster,now 2:8.1+92+0~20220117.43+debian10~1.gbpe0d14e all [installed,automatic]
php5.6-mbstring/buster 5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd amd64
php5.6-mbstring-dbgsym/buster 5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd amd64
  debug symbols for php5.6-mbstring
...

# apt install php5.6-mbstring
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  php5.6-mbstring
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 468 kB of archives.
After this operation, 1,514 kB of additional disk space will be used.
Get:1 https://packages.sury.org/php buster/main amd64 php5.6-mbstring amd64 5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd [468 kB]
Fetched 468 kB in 0s (2,757 kB/s)   
Selecting previously unselected package php5.6-mbstring.
(Reading database ... 226308 files and directories currently installed.)
Preparing to unpack .../php5.6-mbstring_5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd_amd64.deb ...
Unpacking php5.6-mbstring (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...
Setting up php5.6-mbstring (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...

Creating config file /etc/php/5.6/mods-available/mbstring.ini with new version
Processing triggers for libapache2-mod-php5.6 (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...
Processing triggers for php5.6-cli (5.6.40-60+0~20220627.67+debian10~1.gbp1f7ffd) ...

# apache2ctl restart

i el problema sembla haver-se resolt, però quan intento crear una reserva surt un nou missatge d'error,

2022-08-07 11:47:50 15798 [Warning] Aborted connection 15798 to db: 'bmbdb117' user: 'sermnadmin' host: 'localhost' (Got timeout reading communication packets)

Una cerca a Google indica que aquest error està relacionat amb la variable "wait_timeout", que té un valor per defecte de 40 segons que podria ser insuficient en el nostre cas.

La solució és assignar un nou valor a aquesta variable a la secció [mysqld] del fitxer de configuració,

# /etc/mysql/mariadb.conf.d
# cp 50-server.cnf 50-server.cnf.BKUP-20220807
# vi 50-server.cnf

i afegir les línies

# diff 50-server.cnf 50-server.cnf.BKUP-20220807
45,53d44
< # * Local Tuning - MCE - 20220807
< #
< # MySQL Got timeout reading communication packets when reading federated table
< # https://dba.stackexchange.com/questions/205398/mysql-got-timeout-reading-communication-packets-when-reading-federated-table
< #
< wait_timeout=3600       # from 40 seconds may reduce handler_rollback count
<
<
< #
73,77c64,68
< slow_query_log_file    = /var/log/mysql/mariadb-slow.log
< long_query_time        = 10
< log_slow_rate_limit    = 1000
< log_slow_verbosity     = query_plan
< log-queries-not-using-indexes
---
> #slow_query_log_file    = /var/log/mysql/mariadb-slow.log
> #long_query_time        = 10
> #log_slow_rate_limit    = 1000
> #log_slow_verbosity     = query_plan
> #log-queries-not-using-indexes

Referències:

Amb aquest canvi, desapareix aquest error, però llavors apareix un de nou,

[Sun Aug 07 16:04:47.456947 2022] [:error] [pid 25390] [client 158.109.48.53:60540] PHP Fatal error:  Call to undefined function T_() in /opt/bmbee-117/inc/db.php on line 46, referer: http:/
/sermn.uab.cat/reserves/index.php?action=book
[Sun Aug 07 16:04:55.344007 2022] [:error] [pid 25403] [client 158.109.48.53:60544] PHP Fatal error:  Call to undefined function T_() in /opt/bmbee-117/inc/db.php on line 46, referer: http:/
/sermn.uab.cat/reserves/index.php?action=book

que sembla indicar que hi ha un problema d'accés a la base de dades, però des de la línia de comandes em puc connectar:

# mariadb bmbdb117 -u sermnadmin -p 
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 670
Server version: 10.3.34-MariaDB-0+deb10u1 Debian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [bmbdb117]> show tables;
+---------------------------+
| Tables_in_bmbdb117        |
+---------------------------+
| ACTIVE_USERS              |
| bookings                  |
| consumables               |
| consumables_use           |
| costs                     |
| groups                    |
| instrumentclass           |
| instruments               |
| permissions               |
| permissions.BKUP-20210517 |
| permissions.BKUP-20210607 |
| permissions.BKUP-20211215 |
| projectgroups             |
| projectrates              |
| projects                  |
| roleusers                 |
| userclass                 |
| usergroups                |
| userprojects              |
| users                     |
| users.BKUP-20210914       |
+---------------------------+
21 rows in set (0.000 sec)

MariaDB [bmbdb117]> describe bookings ;
+------------+----------------------+------+-----+---------+----------------+
| Field      | Type                 | Null | Key | Default | Extra          |
+------------+----------------------+------+-----+---------+----------------+
| id         | int(10) unsigned     | NO   | PRI | NULL    | auto_increment |
| bookwhen   | datetime             | NO   |     | NULL    |                |
| duration   | time                 | NO   |     | NULL    |                |
| instrument | smallint(5) unsigned | NO   |     | NULL    |                |
| bookedby   | smallint(5) unsigned | NO   |     | NULL    |                |
| userid     | smallint(5) unsigned | NO   |     | NULL    |                |
| projectid  | smallint(5) unsigned | NO   |     | NULL    |                |
| discount   | float                | YES  |     | 0       |                |
| ip         | char(16)             | YES  |     | NULL    |                |
| comments   | text                 | YES  |     | NULL    |                |
| log        | text                 | YES  |     | NULL    |                |
| deleted    | tinyint(1)           | YES  |     | 0       |                |
+------------+----------------------+------+-----+---------+----------------+
12 rows in set (0.001 sec)

MariaDB [bmbdb117]> quit;
Bye

Per eliminar l'error associat a la funció “T_(”, l'elimino provisionalment del codi,

# diff db.php db.php.BKUP-20220807
46c46
<   $errmsg  = sprintf(('<p>Sorry, I couldn\'t connect to the database, so there\'s nothing I can presently do. This could be due to a booking system misconfiguration, or a failure of the da
tabase subsystem.</p><p>If this persists, please contact the <a href="mailto:%s">booking system administrator</a>.</p>'), $conf->AdminEmail);
---
>   $errmsg  = sprintf(T_('<p>Sorry, I couldn\'t connect to the database, so there\'s nothing I can presently do. This could be due to a booking system misconfiguration, or a failure of the 
database subsystem.</p><p>If this persists, please contact the <a href="mailto:%s">booking system administrator</a>.</p>'), $conf->AdminEmail);

intento crear una reserva sense èxit, i comprovo el missatge d'error al registre de MariaDB:

2022-08-07 18:36:08 590 [Warning] Aborted connection 590 to db: 'bmbdb117' user: 'sermnadmin' host: 'localhost' (Got an error reading communication packets)

Una consulta a Google indica que aquest error té relació amb la variable [[https://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_max_allowed_packet | max_allowed_packet.

Per intentar resoldre l'error, incremento el valor de la variable,

# diff 50-server.cnf 50-server.cnf.BKUP-20220807
34c34
< max_allowed_packet     = 64M
---
> #max_allowed_packet     = 16M
45,53d44
< # * Local Tuning - MCE - 20220807
< #
< # MySQL Got timeout reading communication packets when reading federated table
< # https://dba.stackexchange.com/questions/205398/mysql-got-timeout-reading-communication-packets-when-reading-federated-table
< #
< wait_timeout=3600       # from 40 seconds may reduce handler_rollback count
<
<
< #
73,77c64,68
< slow_query_log_file    = /var/log/mysql/mariadb-slow.log
< long_query_time        = 10
< log_slow_rate_limit    = 1000
< log_slow_verbosity     = query_plan
< log-queries-not-using-indexes
---
> #slow_query_log_file    = /var/log/mysql/mariadb-slow.log
> #long_query_time        = 10
> #log_slow_rate_limit    = 1000
> #log_slow_verbosity     = query_plan
> #log-queries-not-using-indexes

Però el problema persisteix.

Finalment, després d'activar les opcions per mostrar les comandes SQL i altres avisos i errors al programa de reserves:

[error_handling]
; Browser error stream:
; Set these to 0 for production systems, 1 for development/debugging
; Show all SQL statements in the browser
; VerboseSQL = 0
VerboseSQL = 1
; Show all PHP warnings (such as uninitialised variables)
AllWarnings = 1
; Show a warning if install folder still is in the server location
ignore_installer = 1
; Show all GET and POST data provided by the browser
; VerboseData = 0
VerboseData = 0
; Use the dBug class from http://dbug.ospinto.com/ to pretty print error
; and debug output (designed for developer use only; you need to put dBug.php
; somewhere in your include path for this to work).
UseDBug = 0

aconsegueixo veure que l'error està relacionat amb una configuració més estricta de MariaDB respecte versions anteriors, configuració que no és compatible amb la versió actual del programa. Després de provar a modificar la configuració del gestor de la base de dades sense èxit,

trobo que la forma més fàcil de resoldre provisionalment el problema, és fer ús de l'opció IGNORE a la comanda INSERT de forma que,

Normally INSERT stops and rolls back when it encounters an error.

By using the IGNORE keyword all errors are converted to warnings, which will not stop inserts of additional rows.

The IGNORE and DELAYED options are ignored when you use ON DUPLICATE KEY UPDATE.

Prior to MySQL and MariaDB 5.5.28, no warnings were issued for duplicate key errors when using IGNORE. You can get the old behavior if you set OLD_MODE to NO_DUP_KEY_WARNINGS_WITH_IGNORE. ( INSERT IGNORE)

Per això cal modificar el fitxer /opt/bmbee-117/inc/formslib/dbrow.php,

# diff dbrow.php dbrow.php.BKUP-20220807
252c252
<         $q = 'INSERT IGNORE INTO '.$conf->value('database', 'tableprefix').$this->table.' SET '.$vals;
---
>         $q = 'INSERT '.$conf->value('database', 'tableprefix').$this->table.' SET '.$vals;

Després de fer el canvi, comprovo que es poden crear reserves i un nou compte d'usuari, i assumeixo que la resta de comandes INSERT també funcionaran correctament.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
informatica/servidor_internet_2009_debian_10_part_2.txt · Last modified: 2022/08/10 14:43 by miquel