Como lidar com um pacote que não está sendo configurado corretamente devido a seu script de inicialização se comportar mal?

2

Eu tenho uma instalação do mysql 5.5 que está funcionando completamente, tanto quanto eu posso dizer, mas toda vez que eu corro aptitude install someProgram ele tenta terminar a instalação, pedindo-me para definir uma nova senha mysql, e ainda falha.

Eu não quero desinstalá-lo, porque funciona, e eu já tentei reinstalá-lo, mas esse mesmo problema acontece todas as vezes.

É possível marcar o pacote como instalado para que o aptitude pare de gastar um minuto tentando configurar o mysql (e falhando) toda vez que eu instalar algo?

EDITAR : Aqui está a saída do aptitude, mas uma nova versão está mais abaixo abaixo

root@server:~# aptitude install fping
The following NEW packages will be installed:
  fping
The following partially installed packages will be configured:
  mysql-server mysql-server-5.5
0 packages upgraded, 1 newly installed, 0 to remove and 29 not upgraded.
Need to get 35.0 kB of archives. After unpacking 114 kB will be used.
Get: 1 http://http.debian.net/debian/ wheezy/main fping armhf 3.2-1 [35.0 kB]
Fetched 35.0 kB in 0s (86.4 kB/s)
Selecting previously unselected package fping.
(Reading database ... 29917 files and directories currently installed.)
Unpacking fping (from .../archives/fping_3.2-1_armhf.deb) ...
Processing triggers for man-db ...
Setting up mysql-server-5.5 (5.5.31+dfsg-0+wheezy1) ...
[ ok ] Stopping MySQL database server: mysqld.
[ ok ] Starting MySQL database server: mysqld . ..
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing 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 mysql-server (--configure):
 dependency problems - leaving unconfigured
Setting up fping (3.2-1) ...
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up mysql-server-5.5 (5.5.31+dfsg-0+wheezy1) ...
[ ok ] Stopping MySQL database server: mysqld.
130711 11:36:34 [ERROR] An old style --language value with language specific part detected: /usr/share/mysql/english/
130711 11:36:34 [ERROR] Use --lc-messages-dir without language specific part instead.
130711 11:36:34 [Note] Plugin 'FEDERATED' is disabled.
130711 11:36:34 InnoDB: The InnoDB memory heap is disabled
130711 11:36:34 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130711 11:36:34 InnoDB: Compressed tables use zlib 1.2.7
130711 11:36:34 InnoDB: Using Linux native AIO
130711 11:36:34 InnoDB: Initializing buffer pool, size = 128.0M
130711 11:36:35 InnoDB: Completed initialization of buffer pool
130711 11:36:35 InnoDB: highest supported file format is Barracuda.
130711 11:36:36  InnoDB: Waiting for the background threads to start
130711 11:36:37 InnoDB: 5.5.31 started; log sequence number 1595695
130711 11:36:37  InnoDB: Starting shutdown...
130711 11:36:38  InnoDB: Shutdown completed; log sequence number 1595695
[ ok ] Starting MySQL database server: mysqld . ..
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing 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 mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server

EDIT2 : Aqui está a nova saída do aptitude após as alterações do kostix:

root@server:~# grep -rFw language /etc/mysql/
/etc/mysql/my.cnf:language        = /usr/share/mysql/english
root@server:~# nano /etc/mysql/my.cnf
root@server:~# aptitude install
The following partially installed packages will be configured:
  mysql-server mysql-server-5.5
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 30 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Setting up mysql-server-5.5 (5.5.31+dfsg-0+wheezy1) ...
[ ok ] Stopping MySQL database server: mysqld.
[ ok ] Starting MySQL database server: mysqld ..
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing 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 mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.5
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up mysql-server-5.5 (5.5.31+dfsg-0+wheezy1) ...
[ ok ] Stopping MySQL database server: mysqld.
130711 13:10:35 [Note] Plugin 'FEDERATED' is disabled.
130711 13:10:35 InnoDB: The InnoDB memory heap is disabled
130711 13:10:35 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130711 13:10:35 InnoDB: Compressed tables use zlib 1.2.7
130711 13:10:35 InnoDB: Using Linux native AIO
130711 13:10:35 InnoDB: Initializing buffer pool, size = 128.0M
130711 13:10:35 InnoDB: Completed initialization of buffer pool
130711 13:10:35 InnoDB: highest supported file format is Barracuda.
130711 13:10:35  InnoDB: Waiting for the background threads to start
130711 13:10:36 InnoDB: 5.5.31 started; log sequence number 1595695
130711 13:10:36  InnoDB: Starting shutdown...
130711 13:10:37  InnoDB: Shutdown completed; log sequence number 1595695
[ ok ] Starting MySQL database server: mysqld ..
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing 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 mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server

EDIT3: com os sinalizadores set -u -e -x:

root@server:~# aptitude install screen
The following NEW packages will be installed:
  screen 
The following partially installed packages will be configured:
  mysql-server mysql-server-5.5 
0 packages upgraded, 1 newly installed, 0 to remove and 30 not upgraded.
Need to get 633 kB of archives. After unpacking 824 kB will be used.
Get: 1 http://http.debian.net/debian/ wheezy/main screen armhf 4.1.0~20120320gitdb59704-7 [633 kB]
Fetched 633 kB in 1s (443 kB/s) 
Selecting previously unselected package screen.
(Reading database ... 29927 files and directories currently installed.)
Unpacking screen (from .../screen_4.1.0~20120320gitdb59704-7_armhf.deb) ...
Processing triggers for install-info ...
Processing triggers for man-db ...
Setting up mysql-server-5.5 (5.5.31+dfsg-0+wheezy1) ...
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld ..
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing 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 mysql-server (--configure):
 dependency problems - leaving unconfigured
Setting up screen (4.1.0~20120320gitdb59704-7) ...
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up mysql-server-5.5 (5.5.31+dfsg-0+wheezy1) ...
Stopping MySQL database server: mysqld.
130711 16:39:19 [Note] Plugin 'FEDERATED' is disabled.
130711 16:39:19 InnoDB: The InnoDB memory heap is disabled
130711 16:39:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130711 16:39:19 InnoDB: Compressed tables use zlib 1.2.7
130711 16:39:19 InnoDB: Using Linux native AIO
130711 16:39:19 InnoDB: Initializing buffer pool, size = 128.0M
130711 16:39:19 InnoDB: Completed initialization of buffer pool
130711 16:39:19 InnoDB: highest supported file format is Barracuda.
130711 16:39:19  InnoDB: Waiting for the background threads to start
130711 16:39:20 InnoDB: 5.5.31 started; log sequence number 1595695
130711 16:39:21  InnoDB: Starting shutdown...
130711 16:39:22  InnoDB: Shutdown completed; log sequence number 1595695
Starting MySQL database server: mysqld ..
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing 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 mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
    
por Filip Haglund 11.07.2013 / 11:44

1 resposta

3

O primeiro problema (erros do MySQL)

Em relação a esses [ERROR] bits…

Por favor, faça

# grep -rFw language /etc/mysql/

como eu suponho que seus arquivos de configuração ainda se refiram a uma opção de configuração reprovada.

Por exemplo, em um dos meus sistemas Wheezy que foram atualizados do Squeeze, eu tenho:

# grep -rFw language /etc/mysql
/etc/mysql/my.cnf.dpkg-old:language     = /usr/share/mysql/english
# grep -rFw lc-messages-dir /etc/mysql
/etc/mysql/my.cnf:lc-messages-dir       = /usr/share/mysql

Observe que a diretiva antiga está no arquivo .dpkg-old (que não é usado) e lc-messages-dir está no arquivo "ativo".

Comentando que a opção language em um arquivo de configuração ativo deve corrigir isso para você. Note que o MySQL também carrega todos os arquivos que combinam com o padrão *.cnf do diretório /etc/mysql/conf.d .

O segundo problema (falha ao iniciar o daemon do MySQL)

Um rápido truque para passar pelo problema: abra /etc/init.d/mysql rc-file em um editor de texto, localize a opção case dispatching no argumento de script e coloque exit 0 antes do primeiro comando na ramificação que lida com o início argumento; em seguida, execute dpkg --configure --pending . Depois que (supostamente) for bem sucedido, reverta sua edição.

A idéia por trás desse truque é deixar o alvo inicial do script rc completar com sucesso. A mesma abordagem também pode ser útil para lidar com a desinstalação de um pacote quando seu script de pós-instalação (o script postinst no jargão do desenvolvedor Debian) se comportar mal - colocando exit 0 perto do início do script /var/lib/dpkg/info/<packagename>.postinst e executando dpkg --configure --pending geralmente ajuda.

Mas o usual aviso em negrito se aplica: não segue tais avisos cegamente: os scripts de configuração de pacotes não estão lá apenas para erradicar e fazer o usuário infeliz - eles geralmente executam certas configurações ou limpezas etc, e assim medidas como a descrita devem ser tratadas como o último recurso.

    
por 11.07.2013 / 12:28