Erro durante a atualização do sistema

1

Estou aqui para pedir ajuda porque, cada vez que faço uma atualização do sistema, recebo erros no terminal e é impossível atualizar o kernel para versões mais recentes.

Aqui eu posto a saída do comando "sudo apt-get update":

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-3.2.0-37-generic linux-image-3.2.0-48-generic linux-image-3.2.0-51-generic linux-image-3.2.0-52-generic
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
6 not fully installed or removed.
After this operation, 599 MB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 313423 files and directories currently installed.)
Removing linux-image-3.2.0-37-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-37-generic /boot/vmlinuz-3.2.0-37-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-37-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-37-generic /boot/vmlinuz-3.2.0-37-generic
Generating grub.cfg ...
/etc/grub.d/00_header: 148: /etc/grub.d/00_header: Syntax error: Missing '}'
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-37-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-37-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.2.0-48-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-48-generic /boot/vmlinuz-3.2.0-48-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-48-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-48-generic /boot/vmlinuz-3.2.0-48-generic
Generating grub.cfg ...
/etc/grub.d/00_header: 148: /etc/grub.d/00_header: Syntax error: Missing '}'
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-48-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-48-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.2.0-51-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-51-generic /boot/vmlinuz-3.2.0-51-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-51-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-51-generic /boot/vmlinuz-3.2.0-51-generic
Generating grub.cfg ...
/etc/grub.d/00_header: 148: /etc/grub.d/00_header: Syntax error: Missing '}'
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-51-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-51-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.2.0-52-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-52-generic /boot/vmlinuz-3.2.0-52-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-52-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-52-generic /boot/vmlinuz-3.2.0-52-generic
Generating grub.cfg ...
/etc/grub.d/00_header: 148: /etc/grub.d/00_header: Syntax error: Missing '}'
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-52-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-52-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-image-3.2.0-37-generic
 linux-image-3.2.0-48-generic
 linux-image-3.2.0-51-generic
 linux-image-3.2.0-52-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

Eu também tentei remover os kernels que eu não estou usando atualmente, na verdade eu estou usando o kernel 3.2.0-49-generic. Ela segue a saída do comando "sudo apt-get purge linux-image-3.2.0-37-genérico linux-image-3.2.0-48-genérico linux-image-3.2.0-51-genérico linux-image- 3.2.0-52-generic ":

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-3.2.0-37-generic linux-image-3.2.0-48-generic linux-image-3.2.0-51-generic linux-image-3.2.0-52-generic
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
6 not fully installed or removed.
After this operation, 599 MB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 313423 files and directories currently installed.)
Removing linux-image-3.2.0-37-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-37-generic /boot/vmlinuz-3.2.0-37-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-37-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-37-generic /boot/vmlinuz-3.2.0-37-generic
Generating grub.cfg ...
/etc/grub.d/00_header: 148: /etc/grub.d/00_header: Syntax error: Missing '}'
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-37-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-37-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.2.0-48-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-48-generic /boot/vmlinuz-3.2.0-48-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-48-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-48-generic /boot/vmlinuz-3.2.0-48-generic
Generating grub.cfg ...
/etc/grub.d/00_header: 148: /etc/grub.d/00_header: Syntax error: Missing '}'
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-48-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-48-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.2.0-51-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-51-generic /boot/vmlinuz-3.2.0-51-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-51-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-51-generic /boot/vmlinuz-3.2.0-51-generic
Generating grub.cfg ...
/etc/grub.d/00_header: 148: /etc/grub.d/00_header: Syntax error: Missing '}'
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-51-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-51-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.2.0-52-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-52-generic /boot/vmlinuz-3.2.0-52-generic
update-initramfs: Deleting /boot/initrd.img-3.2.0-52-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-52-generic /boot/vmlinuz-3.2.0-52-generic
Generating grub.cfg ...
/etc/grub.d/00_header: 148: /etc/grub.d/00_header: Syntax error: Missing '}'
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-52-generic.postrm line 328.
dpkg: error processing linux-image-3.2.0-52-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-image-3.2.0-37-generic
 linux-image-3.2.0-48-generic
 linux-image-3.2.0-51-generic
 linux-image-3.2.0-52-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

Depois disso, lançando o comando "dpkg --list | grep linux-image", eu obtenho:

rH  linux-image-3.2.0-37-generic             3.2.0-37.58                                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rH  linux-image-3.2.0-48-generic             3.2.0-48.74                                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-49-generic             3.2.0-49.75                                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rH  linux-image-3.2.0-51-generic             3.2.0-51.77                                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rH  linux-image-3.2.0-52-generic             3.2.0-52.78                                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP

e clealry os kernels não utilizados ainda estão lá. Por fim, publico também o resultado do comando "sudo update-grub":

Generating grub.cfg ...
/etc/grub.d/00_header: 148: /etc/grub.d/00_header: Syntax error: Missing '}'

e o conteúdo do arquivo "/etc/grub.d/00_header" causando o erro de sintaxe:

#! /bin/sh
set -e

# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009,2010  Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.

transform="s,x,x,"

prefix="/usr"
exec_prefix="${prefix}"
datarootdir="${prefix}/share"
locale_dir='echo ${GRUB_PREFIX}/locale | sed ${transform}'
grub_lang='echo $LANG | cut -d . -f 1'

. "${datarootdir}/grub/grub-mkconfig_lib"

# Do this as early as possible, since other commands might depend on it.
# (e.g. the 'loadfont' command might need lvm or raid modules)
for i in ${GRUB_PRELOAD_MODULES} ; do
  echo "insmod $i"
done

if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi
if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=auto ; fi

if [ "x${GRUB_DEFAULT_BUTTON}" = "x" ] ; then GRUB_DEFAULT_BUTTON="$GRUB_DEFAULT" ; fi
if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_entry}' ; fi
if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi

cat << EOF
if [ -s \$prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
EOF
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
    cat <<EOF
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
   set default="${GRUB_DEFAULT_BUTTON}"
else
   set default="${GRUB_DEFAULT}"
fi
EOF
else
    cat <<EOF
set default="${GRUB_DEFAULT}"
EOF
fi
cat <<EOF
if [ "\${prev_saved_entry}" ]; then
  set saved_entry="\${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "\${boot_once}" ]; then
    saved_entry="\${chosen}"
    save_env saved_entry
  fi
}

function recordfail {
  set recordfail=1
  if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
EOF
if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
    cat <<EOF
  insmod ${GRUB_VIDEO_BACKEND}
EOF
else
    # Insert all available backends; GRUB will use the most appropriate.
    have_video=0;
    for backend in $(cat "${GRUB_PREFIX}/video.lst"); do
   have_video=1;
   cat <<EOF
  insmod ${backend}
EOF
    done
    if [ x$have_video = x0 ]; then
   echo "true"
    fi
fi
cat <<EOF
}

EOF

serial=0;
gfxterm=0;
for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
    if [ xserial = "x$x" ]; then
   serial=1;
    fi
    if [ xgfxterm = "x$x" ]; then
   gfxterm=1;
    fi
done

if [ "x$serial" = x1 ]; then
    if ! test -e "${GRUB_PREFIX}/serial.mod" ; then
   echo "Serial terminal not available on this platform." >&2 ; exit 1
    fi

    if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
   grub_warn "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used."
   GRUB_SERIAL_COMMAND=serial
    fi
    echo "${GRUB_SERIAL_COMMAND}"
fi

if [ "x$gfxterm" = x1 ]; then
    # Make the font accessible
    prepare_grub_to_access_device '${grub_probe} --target=device "${GRUB_FONT_PATH}"'

    cat << EOF
if loadfont 'make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"' ; then
  set gfxmode=${GRUB_GFXMODE}
  load_video
  insmod gfxterm
EOF

# Gettext variables and module
if [ "x${LANG}" != "xC" ] && [ -d "${locale_dir}" ] ; then
    prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir}) | sed -e "s/^/  /"
  cat << EOF
  set locale_dir=(\$root)$(make_system_path_relative_to_its_root ${locale_dir})
  set lang=${grub_lang

Obrigado a todos por qualquer ajuda :)

    
por yorsh 27.08.2013 / 16:48

1 resposta

0

% bl0ck_qu0te%

Correção rápida: abra o arquivo como root, vá até o final onde ele lê set lang=${grub_lang e adicione um } , então a última linha deve ser:

set lang=${grub_lang}

Alguém estava jogando com os scripts do grub e agora eles têm erros. Melhor maneira de resolver isso? Reinstale o grub:

sudo apt-get --reinstall install grub*

O arquivo deve ser substituído, se não for o caso, exclua-o primeiro e execute o comando acima novamente:

sudo rm /etc/grub.d/00_header
sudo apt-get --reinstall install grub*
    
por Braiam 28.08.2013 / 04:21