Score:2

dpkg error from /etc/default/grub when upgrading

be flag

I have a 22.04.2 version of Jammy Jellyfish installed on my machine. When I attempt to do an update and upgrade, I am getting the following error. Do any of you, by any chance, know what might have caused this and suggest how to fix it? Many Thanks

Processing triggers for linux-image-5.19.0-38-generic (5.19.0-38.39~22.04.1) ...

/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.19.0-38-generic

I: The initramfs will attempt to resume from /dev/dm-1
I: (/dev/mapper/vgxubuntu-swap_1)
I: Set the RESUME variable to override this.

/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 36: /etc/default/grub: bash:: not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127

dpkg: error processing package linux-image-5.19.0-38-generic (--configure):
 installed linux-image-5.19.0-38-generic package post-installation script subpro
cess returned error exit status 1

Errors were encountered while processing:
 linux-image-5.19.0-38-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

Here is the output of cat /etc/default/grub command as Baa suggested:

hetrengzy@hefto-Ubuntu:~$ cat /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=menu
GRUB_TIMEOUT=45
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
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"


bash: line 1: J: command not found

Can you suggest what to do with this please? Many thanks

Hugo avatar
mx flag
It's saying that the line `bash::` is inside the file `/etc/default/grub` and it probably shouldn't be. Please run `cat /etc/default/grub` then edit your question and add the output.
Score:5
mx flag

There is an additional line added to /etc/default/grub that's causing the problem bash: line 1: J: command not found. Not sure how it got there but just remove it.

  1. Use the command sudo gedit /etc/default/grub to open this file in a text editor.
  2. Locate the line that says bash: line 1: J: command not found at the end.
  3. Remove the entire line, be careful not to modify anything else in the file.
  4. Save and close the editor.
  5. Try updating again.
hefteng avatar
be flag
Thank you for your answer Baa, I fix the issue as you advised and the error seems to be gone.
Hugo avatar
mx flag
no problem glad that worked
I sit in a Tesla and translated this thread with Ai:

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.