我对 ubuntu 还不熟悉,几天来一直无法安装任何新软件包。我需要安装 python-tkinter 软件包,所以我运行了
sudo apt-get install python-tk
我得到的错误是:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
linux-modules-4.15.0-20-generic
Use 'sudo apt autoremove' to remove it.
Suggested packages:
tix python-tk-dbg
The following packages will be REMOVED:
linux-image-4.15.0-20-generic
The following NEW packages will be installed:
python-tk
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/25.9 kB of archives.
After this operation, 8,183 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 282610 files and directories currently installed.)
Removing linux-image-4.15.0-20-generic (4.15.0-20.21) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-20-generic
/etc/kernel/postrm.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-23-generic
Found initrd image: /boot/initrd.img-4.15.0-23-generic
Found linux image: /boot/vmlinuz-4.15.0-22-generic
Found initrd image: /boot/initrd.img-4.15.0-22-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 8 on /dev/sda2
error: out of memory.
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 310
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-4.15.0-20-generic (--remove):
installed linux-image-4.15.0-20-generic package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-20-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
我搜索了一些答案,结果出现了几个命令,例如:
sudo apt-get install -f
和其他类似的命令然后我偶然发现了这个命令并运行了它
sudo apt install --reinstall linux-modules-4.15.0-22-generic linux-image-4.15.0-22-generic linux-modules-extra-4.15.0-22-generic
但这次错误是:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
linux-modules-4.15.0-20-generic
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
linux-image-4.15.0-20-generic
0 upgraded, 0 newly installed, 3 reinstalled, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 53.6 MB of archives.
After this operation, 8,278 kB disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-image-4.15.0-22-generic amd64 4.15.0-22.24 [7,875 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-modules-4.15.0-22-generic amd64 4.15.0-22.24 [12.9 MB]
27% [2 linux-modules-4.15.0-22-generic 5,801 kB/12.9 MB 45%]sudo apt install --reinstall linux-modules-4.15.0-22-generic linux-image-4.15.0-22-generGet:3 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-modules-extra-4.15.0-22-generic amd64 4.15.0-22.24 [32.8 MB]
Fetched 53.6 MB in 58s (923 kB/s)
(Reading database ... 282610 files and directories currently installed.)
Removing linux-image-4.15.0-20-generic (4.15.0-20.21) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-20-generic
/etc/kernel/postrm.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-23-generic
Found initrd image: /boot/initrd.img-4.15.0-23-generic
Found linux image: /boot/vmlinuz-4.15.0-22-generic
Found initrd image: /boot/initrd.img-4.15.0-22-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 8 on /dev/sda2
error: out of memory.
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 310
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-4.15.0-20-generic (--remove):
installed linux-image-4.15.0-20-generic package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-20-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
有人能帮帮我吗?谢谢