Score:0

Unable to execute "sudo apt upgrade": Sub-process /usr/bin/dpkg returned an error code (1)

in flag

Whenever I try to execute sudo apt upgrade I get the following:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/8978 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-5.4.0-77-generic (5.4.0-77.86) ...
Processing triggers for linux-image-5.4.0-77-generic (5.4.0-77.86) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.4.0-77-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 36: /etc/default/grub: Syntax error: Unterminated quoted string
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 2
dpkg: error processing package linux-image-5.4.0-77-generic (--configure):
 installed linux-image-5.4.0-77-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-5.4.0-77-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

I interpret the output that everything is installed except for two packeges which are "not fully installed or removed".

When I try to execute sudo apt autoremove I get the following output:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-5.4.0-73-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 11.8 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 109583 files and directories currently installed.)
Removing linux-image-5.4.0-73-generic (5.4.0-73.82) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-73-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 36: /etc/default/grub: Syntax error: Unterminated quoted string
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
dpkg: error processing package linux-image-5.4.0-73-generic (--remove):
 installed linux-image-5.4.0-73-generic package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-5.4.0-73-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

I also tried the following but it doesn't help. How do I solve this problem?

Edit: /etc/default/grub

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

GRUB_CMDLINE_LINUX="libata.force=noncq

I deleted GRUB_CMDLINE_LINUX="libata.force=noncq now everything works fine again. Many thanks for your help!

Organic Marble avatar
us flag
You appear to have an error in /etc/default/grub. Please edit your post and include the contents of that file. Do not put it in a comment, edit your post. Please post text, not a screenshot.
Score:2
us flag

I don't know what this line from /etc/default/grub is supposed to do, but it needs an end quote

GRUB_CMDLINE_LINUX="libata.force=noncq

The following error was reported

/etc/default/grub: Syntax error: Unterminated quoted string

(Parenthetical note: After editing /etc/default/grub, you need to issue a sudo update-grub command to incorporate the changes. After you edited /etc/default/grub to make this change, either you didn't issue the command, or you ignored the resulting errors)

AvSaba avatar
ru flag
Entries on this line are added to the end of the 'linux' command line (GRUB legacy's "kernel" line) for both normal and recovery modes. It is used to pass options to the kernel. [Source](https://help.ubuntu.com/community/Grub2/Setup)
Organic Marble avatar
us flag
@AvSaba I know what the line does in general, just not the `libata....` part
AvSaba avatar
ru flag
Oh, I put the comment for sake of completely.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.