1

I am facing an issue so strange in Xubuntu 18.04... I ran the following command after sudo apt update :

sudo apt upgrade

But it leads to an error :

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 linux-image-5.0.0-36-generic : Depends: linux-modules-5.0.0-36-generic but it is not going to be installed
E: Broken packages

I assume that I must install linux-modules-5.0.0-36-generic, but I am not sure and I would do bad things... I am just a beginner in Linux environment.

Some details :

uname -a
>>Linux mistapopo-Aspire-A515-52G 5.0.0-37-generic #40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

When I run the following commands

sudo apt update 
sudo apt dist-upgrade

I get the following log :

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
  libllvm8
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
Need to get 0 B/8 426 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up linux-image-unsigned-5.3.1-050301-generic (5.3.1-050301.201909210632) ...
Setting up linux-image-5.3.0-28-generic (5.3.0-28.30~18.04.1) ...
Setting up linux-image-5.3.0-26-generic (5.3.0-26.28~18.04.1) ...
Setting up linux-image-unsigned-5.3.1-050301-lowlatency (5.3.1-050301.201909210632) ...
Processing triggers for linux-image-unsigned-5.3.1-050301-generic (5.3.1-050301.201909210632) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.3.1-050301-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.3.1-050301-lowlatency
Found initrd image: /boot/initrd.img-5.3.1-050301-lowlatency
Found linux image: /boot/vmlinuz-5.3.1-050301-generic
Found initrd image: /boot/initrd.img-5.3.1-050301-generic
Found linux image: /boot/vmlinuz-5.3.0-28-generic
Found initrd image: /boot/initrd.img-5.3.0-28-generic
Found linux image: /boot/vmlinuz-5.3.0-26-generic
Found initrd image: /boot/initrd.img-5.3.0-26-generic
Found linux image: /boot/vmlinuz-5.0.0-37-generic
Found initrd image: /boot/initrd.img-5.0.0-37-generic
Found linux image: /boot/vmlinuz-5.0.0-36-generic
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
/usr/sbin/grub-mkconfig: 295: /usr/sbin/grub-mkconfig: /usr/bin/grub-script-check: not found
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/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-unsigned-5.3.1-050301-generic (--configure):
 installed linux-image-unsigned-5.3.1-050301-generic package post-installation script subprocess returned error exit status 1
Processing triggers for linux-image-5.3.0-28-generic (5.3.0-28.30~18.04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.3.0-28-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.3.1-050301-lowlatency
Found initrd image: /boot/initrd.img-5.3.1-050301-lowlatency
Found linux image: /boot/vmlinuz-5.3.1-050301-generic
Found initrd image: /boot/initrd.img-5.3.1-050301-generic
Found linux image: /boot/vmlinuz-5.3.0-28-generic
Found initrd image: /boot/initrd.img-5.3.0-28-generic
Found linux image: /boot/vmlinuz-5.3.0-26-generic
Found initrd image: /boot/initrd.img-5.3.0-26-generic
Found linux image: /boot/vmlinuz-5.0.0-37-generic
Found initrd image: /boot/initrd.img-5.0.0-37-generic
Found linux image: /boot/vmlinuz-5.0.0-36-generic
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
/usr/sbin/grub-mkconfig: 295: /usr/sbin/grub-mkconfig: /usr/bin/grub-script-check: not found
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/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-5.3.0-28-generic (--configure):
 installed linux-image-5.3.0-28-generic package post-installation script subprocess returned error exit status 1
Processing triggers for linux-image-5.3.0-26-generic (5.3.0-26.28~18.04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.3.0-26-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.3.1-050301-lowlatency
Found initrd image: /boot/initrd.img-5.3.1-050301-lowlatency
Found linux image: /boot/vmlinuz-5.3.1-050301-generic
Found initrd image: /boot/initrd.img-5.3.1-050301-generic
Found linux image: /boot/vmlinuz-5.3.0-28-generic
Found initrd image: /boot/initrd.img-5.3.0-28-generic
Found linux image: /boot/vmlinuz-5.3.0-26-generic
Found initrd image: /boot/initrd.img-5.3.0-26-generic
Found linux image: /boot/vmlinuz-5.0.0-37-generic
Found initrd image: /boot/initrd.img-5.0.0-37-generic
Found linux image: /boot/vmlinuz-5.0.0-36-generic
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
/usr/sbin/grub-mkconfig: 295: /usr/sbin/grub-mkconfig: /usr/bin/grub-script-check: not found
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/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-5.3.0-26-generic (--configure):
 installed linux-image-5.3.0-26-generic package post-installation script subprocess returned error exit status 1
Processing triggers for linux-image-unsigned-5.3.1-050301-lowlatency (5.3.1-050301.201909210632) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.3.1-050301-lowlatency
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.3.1-050301-lowlatency
Found initrd image: /boot/initrd.img-5.3.1-050301-lowlatency
Found linux image: /boot/vmlinuz-5.3.1-050301-generic
Found initrd image: /boot/initrd.img-5.3.1-050301-generic
Found linux image: /boot/vmlinuz-5.3.0-28-generic
Found initrd image: /boot/initrd.img-5.3.0-28-generic
Found linux image: /boot/vmlinuz-5.3.0-26-generic
Found initrd image: /boot/initrd.img-5.3.0-26-generic
Found linux image: /boot/vmlinuz-5.0.0-37-generic
Found initrd image: /boot/initrd.img-5.0.0-37-generic
Found linux image: /boot/vmlinuz-5.0.0-36-generic
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
/usr/sbin/grub-mkconfig: 295: /usr/sbin/grub-mkconfig: /usr/bin/grub-script-check: not found
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/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-unsigned-5.3.1-050301-lowlatency (--configure):
 installed linux-image-unsigned-5.3.1-050301-lowlatency package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-image-unsigned-5.3.1-050301-generic
 linux-image-5.3.0-28-generic
 linux-image-5.3.0-26-generic
 linux-image-unsigned-5.3.1-050301-lowlatency
E: Sub-process /usr/bin/dpkg returned an error code (1)
11
  • 1
    You didn't provide any release details, however the kernel 5.0 is no longer supported by Ubuntu so please provide details. It was used by Ubuntu 19.04 which is now EOL & thus off-topic here unless your question is specific to moving to a supported release of Ubuntu. It was also used by Ubuntu 18.04 with HWE enabled, but 18.04 moved to the 5.3 kernel before 5.0 was dropped from support. I would first try sudo apt -f install but your release details may alter my advice (your release maybe unsupported so I'd be considering that in my decision and planning release-upgrade or re-install).
    – guiverc
    Commented Feb 1, 2020 at 0:04
  • I am using Xubuntu. And I tried to install postgres by using the following command : ` sudo apt install postgresql postgresql-contrib ` hope it helps. Let me first try your ` sudo apt -f install ` command
    – Mistapopo
    Commented Feb 1, 2020 at 0:07
  • Ubuntu releases (including flavors) use a year.month format; the Ubuntu/Xubuntu doesn't tell me much without the rest of the detail, ie. release.
    – guiverc
    Commented Feb 1, 2020 at 0:08
  • Oh sorry. Xubuntu 18.04 LTS. I just run your command and it leads to : Errors were encountered while processing: linux-image-5.0.0-36-generic E: Sub-process /usr/bin/dpkg returned an error code (1)
    – Mistapopo
    Commented Feb 1, 2020 at 0:09
  • I don't understand :/ I already run sudo apt -f install and I got : Errors were encountered while processing: linux-image-5.0.0-36-generic E: Sub-process /usr/bin/dpkg returned an error code (1). How can I move to 5.3 kernel to solve my problem ?
    – Mistapopo
    Commented Feb 1, 2020 at 0:16

1 Answer 1

0

original answer that applies to most users:

When dpkg tries to finish the installation configuration for the kernel it runs grub-script-check when running grub-mkconfig to auto-generate /boot/grub/grub.cfg. If there is a problem with your configuration files, it will return this error. The error says that you have a syntax problem in /etc/default/grub or one of your other grub configuration files in your /etc/default/grub.d directory.

If you recently made changes to any of your grub configuration files like /etc/default/grub or any other file in your /etc/default/grub.d directory, you need to correct or delete the changes made.

After you fix the file or files, run the following command:

sudo dpkg --configure -a

or

sudo apt -f install

See this answer and this detailed example for more information about the grub syntax error.


UPDATE:

Run the following command:

file /usr/bin/grub-script-check

If it returns "no such file or directory" then run:

sudo apt install --reinstall grub-common

Then, run:

sudo dpkg --configure -a

or

sudo apt -f install

Whenever you have a "not found" error you can search for the package name that contains the file at packages.ubuntu.com or you can use the apt-file application but to install apt-file you have to first enable the universe repository: sudo add-apt-repository; sudo apt update.


Here's how I figured it out.

Starting at the end of your output we see two pretty generic errors that doesn't really tell us anything:

E: Sub-process /usr/bin/dpkg returned an error code (1)

and

dpkg: error processing package linux-image-unsigned-5.3.1-050301-lowlatency (--configure):

Now when we scroll up, we see an actual error that tells us something (syntax error):

Syntax errors are detected in generated GRUB config file.

Just above this line, we see exactly when this error occurred:

/usr/sbin/grub-mkconfig: 295: /usr/sbin/grub-mkconfig: /usr/bin/grub-script-check: not found

Now, a file name followed by "not found" usually means a missing file but we also have the syntax error indicating a problem in one of the grub config files.

A number after a file name (/usr/sbin/grub-mkconfig: 295) usually indicates the line number of the file so I looked up the file /usr/sbin/grub-mkconfig and on line 295, it references grub_script_check (/usr/bin/grub-script-check) and later it says to return a syntax error if anything is returned.

In this case, the syntax error wasn't returned by the grub-script-check command, the error was returned by the fact that the grub-script-check command was not found so there was no actual syntax error.

3
  • I did not change any grub files. I already tried those commands but nothing ...
    – Mistapopo
    Commented Feb 1, 2020 at 3:33
  • @Mistapopo What does file /usr/bin/grub-script-check return? If it says "no such file or directory" then run: sudo apt install --reinstall grub-common. If it says: ELF blah blah blah then please edit your question and post the output of cat /boot/grub/grub.cfg.new Thanks!
    – mchid
    Commented Feb 1, 2020 at 3:45
  • Well, reinstall grub-common helped me. Thanks !
    – Mistapopo
    Commented Feb 1, 2020 at 19:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .