[Bug 670541] Re: Upgrade mysql5.0 -> 5.1 fails due to error on postrm script.

Mark - Syminet 670541 at bugs.launchpad.net
Thu Nov 4 16:56:45 GMT 2010


Hello, sure, here you go (I removed my "exit 0;" at the top):

=== snip ===


#!/bin/bash -e                                                                            
                                                                                          
# It is possible that Debconf has already been removed, too.                              
if [ -f /usr/share/debconf/confmodule ]; then                                             
  . /usr/share/debconf/confmodule                                                         
fi                                                                                        
                                                                                          
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi               
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }                            
                                                                                          
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"                       
                                                                                          
# Try to stop the server in a sane way. If it does not success let the admin              
# do it himself. No database directories should be removed while the server               
# is running!                                                                             
stop_server() {                                                                           
  set +e                                                                                  
  if [ -x /usr/sbin/invoke-rc.d ]; then                                                   
    invoke-rc.d mysql stop                                                                
  else                                                                                    
    /etc/init.d/mysql stop                                                                
  fi                                                                                      
  errno=$?                                                                                
  set -e                                                                                  
                                                                                          
  if [ "$?" != 0 ]; then                                                                  
    echo "Trying to stop the MySQL server resulted in exitcode $?." 1>&2                  
    echo "Stop it yourself and try again!" 1>&2                                           
    exit 1                                                                                
  fi                                                                                      
}                                                                                         
                                                                                          
case "$1" in                                                                              
  purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)              
    if [ -n "`$MYADMIN ping 2>/dev/null`" ]; then                                         
#      stop_server                                                                        
#      sleep 2                                                                            
    fi                                                                                    
  ;;                                                                                      
  *)                                                                                      
    echo "postrm called with unknown argument '$1'" 1>&2                                  
    exit 1                                                                                
  ;;                                                                                      
esac                                                                                      
                                                                    
# Remove Debconf generated config files to allow clean upgrades to 5.1.                   
rm -f /etc/mysql/conf.d/old_passwords.cnf                                                 
                                                                                          
#                                                                                         
# - Do NOT purge logs or data if another mysql-sever* package is installed (#307473)      
# - Remove the mysql user only after all his owned files are purged.                      
#                                                                                         
if [ "$1" = "purge" -a ! \( -x /usr/sbin/mysqld -o -L /usr/sbin/mysqld \) ]; then         
  # we remove the mysql user only after all his owned files are purged                    
  rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz}                                       
  rm -rf /var/log/mysql                                                                   
                                                                                          
  db_input high mysql-server-5.0/postrm_remove_databases || true                          
  db_go || true                                                                           
  db_get mysql-server-5.0/postrm_remove_databases || true                                 
  if [ "$RET" = "true" ]; then                                                            
    # never remove the debian.cnf when the databases are still existing                   
    # else we ran into big trouble on the next install!                                   
    rm -f /etc/mysql/debian.cnf                                                           
    rm -rf /var/lib/mysql                                                                 
    rm -rf /var/run/mysqld                                                                
    userdel mysql || true                                                                 
  fi                                                                                      
                                                                                          
  # (normally) Automatically added by dh_installinit                                      
  if [ "$1" = "purge" ] ; then                                                            
        update-rc.d mysql remove >/dev/null || exit 0                                     
  fi                                                                                      
  # (normally) End automatically added section                                            
fi                                                                                        
                                                                                          
# (normally) Automatically added by dh_installdebconf                                     
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then                         
        . /usr/share/debconf/confmodule                                                   
        db_purge                                                                          
fi                                                                                        
# (normally) End automatically added section                                              
                                                                                          
# (normally) Automatically added by dh_installinit                                        
if [ "$1" = "purge" ] ; then                                                              
        update-rc.d mysql-ndb-mgm remove >/dev/null || exit 0                             
fi                                                                                        
# (normally) End automatically added section                                              
# (normally) Automatically added by dh_installinit                                        
if [ "$1" = "purge" ] ; then                                                              
        update-rc.d mysql-ndb remove >/dev/null || exit 0                                 
fi                                                                                        
# (normally) End automatically added section                                              
                                                                                          
if [ "$1" = "purge" ] ; then                                                              
    rm -f /etc/apparmor.d/force-complain/usr.sbin.mysqld >/dev/null 2>&1 || true          
fi                                                                                        
# no DEBHELPER here, "update-rc.d remove" fails if mysql-server-5.0 is installed          
                                                                                          
exit 0

-- 
Upgrade mysql5.0 -> 5.1 fails due to error on postrm script.  
https://bugs.launchpad.net/bugs/670541
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to mysql-5.1 in ubuntu.



More information about the Ubuntu-server-bugs mailing list