Я не могу использовать команду APT вообще

Я не могу использовать команду APT вообще, каждый раз я пытаюсь использовать ее, я получаю это:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  haguichi-indicator
The following packages will be REMOVED:
  linux-image-4.4.0-36-generic linux-image-4.4.0-38-generic
  linux-image-4.4.0-42-generic linux-image-4.4.0-45-generic
  linux-image-extra-4.4.0-36-generic linux-image-extra-4.4.0-38-generic
  linux-image-extra-4.4.0-42-generic linux-image-extra-4.4.0-45-generic
The following NEW packages will be installed:
  haguichi haguichi-indicator
0 upgraded, 2 newly installed, 8 to remove and 9 not upgraded.
16 not fully installed or removed.
Need to get 311 kB of archives.
After this operation, 871 MB disk space will be freed.
Get:1 http://ppa.launchpad.net/webupd8team/haguichi/ubuntu xenial/main amd64 haguichi amd64 1.3.6~ubuntu16.04.1 [295 kB]
Get:2 http://ppa.launchpad.net/webupd8team/haguichi/ubuntu xenial/main amd64 haguichi-indicator amd64 0.3.2~ubuntu16.04.1 [16.4 kB]
Fetched 311 kB in 33s (9,292 B/s)                                              
(Reading database ... 350665 files and directories currently installed.)
Removing linux-image-extra-4.4.0-36-generic (4.4.0-36.55) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-36-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-36-generic /boot/vmlinuz-4.4.0-36-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-36-generic /boot/vmlinuz-4.4.0-36-generic
Error! Your kernel headers for kernel 4.4.0-36-generic cannot be found.
Please install the linux-headers-4.4.0-36-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-36-generic cannot be found.
Please install the linux-headers-4.4.0-36-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-36-generic cannot be found.
Please install the linux-headers-4.4.0-36-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-36-generic /boot/vmlinuz-4.4.0-36-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-36-generic
WARNING: missing /lib/modules/4.4.0-36-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-36-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_shj3j9/lib/modules/4.4.0-36-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_shj3j9/lib/modules/4.4.0-36-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-36-generic /boot/vmlinuz-4.4.0-36-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-36-generic /boot/vmlinuz-4.4.0-36-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-36-generic /boot/vmlinuz-4.4.0-36-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-36-generic /boot/vmlinuz-4.4.0-36-generic
/usr/sbin/grub-mkconfig: 6: /etc/default/grub: 10: not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-extra-4.4.0-36-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-4.4.0-36-generic (4.4.0-36.55) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-36-generic /boot/vmlinuz-4.4.0-36-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-36-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-36-generic /boot/vmlinuz-4.4.0-36-generic
/usr/sbin/grub-mkconfig: 6: /etc/default/grub: 10: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-36-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-36-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-38-generic (4.4.0-38.57) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-38-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
Error! Your kernel headers for kernel 4.4.0-38-generic cannot be found.
Please install the linux-headers-4.4.0-38-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-38-generic cannot be found.
Please install the linux-headers-4.4.0-38-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-38-generic cannot be found.
Please install the linux-headers-4.4.0-38-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-38-generic
WARNING: missing /lib/modules/4.4.0-38-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-38-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_q0p1fx/lib/modules/4.4.0-38-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_q0p1fx/lib/modules/4.4.0-38-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
/usr/sbin/grub-mkconfig: 6: /etc/default/grub: 10: not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-extra-4.4.0-38-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-4.4.0-38-generic (4.4.0-38.57) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-38-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
/usr/sbin/grub-mkconfig: 6: /etc/default/grub: 10: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-38-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-38-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-extra-4.4.0-42-generic (4.4.0-42.62) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-42-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
Error! Your kernel headers for kernel 4.4.0-42-generic cannot be found.
Please install the linux-headers-4.4.0-42-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-42-generic cannot be found.
Please install the linux-headers-4.4.0-42-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-42-generic cannot be found.
Please install the linux-headers-4.4.0-42-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-42-generic
WARNING: missing /lib/modules/4.4.0-42-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-42-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_sRVHmx/lib/modules/4.4.0-42-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_sRVHmx/lib/modules/4.4.0-42-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
/usr/sbin/grub-mkconfig: 6: /etc/default/grub: 10: not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-extra-4.4.0-42-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-4.4.0-42-generic (4.4.0-42.62) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-42-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
/usr/sbin/grub-mkconfig: 6: /etc/default/grub: 10: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-42-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-42-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-extra-4.4.0-45-generic (4.4.0-45.66) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-45-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
Error! Your kernel headers for kernel 4.4.0-45-generic cannot be found.
Please install the linux-headers-4.4.0-45-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-45-generic cannot be found.
Please install the linux-headers-4.4.0-45-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-45-generic cannot be found.
Please install the linux-headers-4.4.0-45-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-45-generic
WARNING: missing /lib/modules/4.4.0-45-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-45-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_lvRMvc/lib/modules/4.4.0-45-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_lvRMvc/lib/modules/4.4.0-45-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
/usr/sbin/grub-mkconfig: 6: /etc/default/grub: 10: not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-extra-4.4.0-45-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-4.4.0-45-generic (4.4.0-45.66) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-45-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-45-generic /boot/vmlinuz-4.4.0-45-generic
/usr/sbin/grub-mkconfig: 6: /etc/default/grub: 10: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-45-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-45-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-extra-4.4.0-36-generic
 linux-image-4.4.0-36-generic
 linux-image-extra-4.4.0-38-generic
 linux-image-4.4.0-38-generic
 linux-image-extra-4.4.0-42-generic
 linux-image-4.4.0-42-generic
 linux-image-extra-4.4.0-45-generic
 linux-image-4.4.0-45-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

какие-либо предложения? И я не могу удалить проблемные пакеты, я не знаю почему.

2
задан 15 March 2017 в 17:12

1 ответ

Я врезаюсь в этот вид проблемы все время. Я выполняю набор полей KODI (что я создал), что вся начальная загрузка от выделенного сервера через PXE. Так, часто времена, когда я иду для обновления моих полей PXE через chroot (или иначе), я врезаюсь в проблемы обновления ядра. Так, недавно я решил создать сценарий, который создаст дерьмо depmod/apt-get, ищет так, можно правильно удалить те ядра.

Для запущения скрипта просто копируют и вставляют код в файл. В терминале сделайте это исполняемым файлом путем ввода:

$> chmod +x fixKernels.sh

Причем "fixKernels.sh" является названием сценария.

Оттуда, запустите скрипт путем ввода:

$> sudo ./fixKernels.sh

И затем просто следуйте за направлениями.

#!/bin/bash

####################################################
#
# NAME: fixKernels.sh
#
#
# DESCRIPTION: This script was designed to create
# fake kernel entries in places depmod and apt-get
# would normally look for existing kernels. The purpose
# of this script is to trick depmod or apt-get into
# believing these kernels exist on your system so it
# can successfully remove them without causing errors
# and preventing YOU from installing other things.
#
####################################################

# Spinner! Shows a rotating line animation
spinner()
{
    sleep 1
    PROC=$1
    BACKSPACE='\010'
    SPINNER='|/-\'
    INDEX=0
    while [ -d /proc/$PROC ]
    do
        echo -n -e "${SPINNER:$INDEX:1}"
        sleep 0.2
        (( INDEX = ($INDEX + 1) % 4 ))
        echo -n -e "$BACKSPACE"

    done

}

# Check for root
cp /etc/shadow /tmp/isroot 2>/dev/null

# IF ROOT
if [ ! -f /tmp/isroot ]; then
    echo "You ain't root, baby!"
    exit
else
    # Remove temp file
    rm /tmp/isroot
fi

# Make sure parameter is not empty
if [[ $1 != "" ]] && [[ `echo $1 | grep -i "linux"` == "" ]]; then

    # Needed echo! Great for displaying purposes
    echo

    # Determine if uname exists
    if [[ ! -d /lib/modules/`uname -r` ]]; then

        # Examine all the kernels found on the system
        for x in `ls -l /lib/modules | awk '{print $9}'`
        do

            # Determine that all the pieces exist before we use them!
            if [[ -f /boot/System.map-$x ]] && [[ -f /boot/vmlinuz-$x ]]; then

                # Use whatever we've got!!
                UNAME=$x

            fi


        done

        # IF the pieces aren't found... Not much else we can do!!
        if [[ $UNAME == "" ]]; then

            # Error
            echo "There's no kernel found on your system!! How are you reading this??"

            # Exit the script
            exit

        fi

    else # We've got what we need

        UNAME=`uname -r`
    fi

    # Make sure the kernel isn't copying on top of itself
    if [[ $1 != $UNAME ]]; then

        # Create a fake version of that kernel
        echo "Creating Fake System Map..."
        sudo cp /boot/System.map-$UNAME /boot/System.map-$1 -rfap &

        # Create a short animation to show user it's working
        spinner $!

        # Create the vmlinuz... But it's fake
        echo "Creating Fake Vmlinuz..."
        sudo cp /boot/vmlinuz-$UNAME /boot/vmlinuz-$1 -rfap &

        # Create a short animation
        spinner $!

        # Create the fake modules
        echo "Creating Fake Kernel Modules..."
        sudo cp /lib/modules/$UNAME /lib/modules/$1 -rfap &

        # Create a short animation
        spinner $!
    else

        # Warn user
        echo "This kernel exists... Skipping!"

    fi

else

    echo "USAGE: ./`basename $0` <kernel version>"
    echo "EXAMPLE: ./`basename $0` 4.4.0-31-generic"
fi
1
ответ дан 2 December 2019 в 04:50

Другие вопросы по тегам:

Похожие вопросы: