[SOLVED] Cannot upgrade

Status
Not open for further replies.

anneranch

Active Member
Joined
Mar 16, 2019
Messages
223
Reaction score
43
Credits
2,078
Fetched 1,173 kB in 2s (403 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
73 packages can be upgraded. Run 'apt list --upgradable' to see them.
f@f-SATA:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
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-4.15.0-112-generic : Depends: linux-modules-4.15.0-112-generic but it is not going to be installed
E: Broken packages
f@f-SATA:~$


Any suggestion how to recover for the above will be appreciated
 


Try
Code:
sudo apt full-upgrade
If that doesn't rectify, then try
Code:
sudo apt install -f
followed by
Code:
sudo apt update

sudo apt full-upgrade
 
Code:
sudo dpkg --configure -a
Code:
sudo apt-get autoremove
Code:
sudo apt-get clean
Code:
sudo apt-get update
Code:
sudo apt-get upgrade
 
All good! apt-get is being (slowly) replaced by apt. But, apt-get still works.
 
It took a time to
sudo apt full-upgrade

and did this


f@f-SATA:~$ sudo apt install -f
[sudo] password for f:
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-112-generic
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
linux-image-4.15.0-112-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 8,223 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 282137 files and directories currently installed.)
Removing linux-image-4.15.0-112-generic (4.15.0-112.113~16.04.1) ...
/var/lib/dpkg/info/linux-image-4.15.0-112-generic.postrm ... removing pending trigger
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-112-generic
/etc/kernel/postrm.d/zz-update-grub:
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) /usr/sbin/update-grub: line 1094: read: read error: 0: Bad file descriptor
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-4.15.0-112-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-112-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
f@f-SATA:~$

After repeated install / upgrade I get this
'
/etc/kernel/postinst.d/zz-update-grub:
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) /usr/sbin/update-grub: line 1094: read: read error: 0: Bad file descriptor
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-4.15.0-128-generic (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-112-generic
linux-image-4.15.0-123-generic
linux-image-4.15.0-128-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
f@f-SATA:~$

PS. I get no chance to to select "generate menu.lst for you?"

'

Basically no improvement will not upgrade to 128 .
 
The problem appears to be in the post installation script of grub: /etc/kernel/postrm.d/zz-update-grub
This will remove the zz-update-grub script.
You will be warned you are removing your bootloader. Tab to OK and ENTER.
Code:
sudo apt purge grub-common
Then run
Code:
sudo apt install grub-pc
Tab to OK, and use the spacebar to select ONLY the Ubuntu drive, not the partition. This will restore the zz-update-grub file. If the problem was with the grub file, this should fix it.
Try to update again
 
Last edited by a moderator:
Folks, this part is not kosher, it means that the OP is using Legacy Grub?

Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) /usr/sbin/update-grub: line 1094: read: read error: 0: Bad file descriptor

@anneranch , what Linux Distro and version are you using?

Cheers

Wizard
 
Looks like op may be running Debian or a another Debian based os.

What is the output of:

cat /etc/os-release
 
Based on the Kernel maybe Mint 18 most likely Ubuntu Based OS
what is the output of
Code:
inxi -Fxz
 
Looks like op may be running Debian or a another Debian based os.

What is the output of:

cat /etc/os-release
f@f-SATA:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.7 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.7 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
f@f-SATA:~$

f@f-SATA:~$ inxi -Fxz
System: Host: f-SATA Kernel: 4.15.0-122-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Unity 7.4.5 (Gtk 3.18.9-1ubuntu3.3)
Distro: Ubuntu 16.04 xenial
Machine: Mobo: ASRock model: Q1900-ITX
Bios: American Megatrends v: P1.90 date: 03/01/2018
CPU: Quad core Intel Celeron J1900 (-MCP-) cache: 1024 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 15993
clock speeds: max: 2415 MHz 1: 2416 MHz 2: 2415 MHz 3: 1917 MHz
4: 1699 MHz
Graphics: Card: Intel Atom Processor Z36xxx/Z37xxx Series Graphics & Display
bus-ID: 00:02.0
Display Server: X.Org 1.19.6 drivers: (unloaded: fbdev,vesa)
Resolution: [email protected]
GLX Renderer: Mesa DRI Intel Bay Trail
GLX Version: 3.0 Mesa 18.0.5 Direct Rendering: Yes
Audio: Card Intel Atom Processor Z36xxx/Z37xxx Series High Definition Audio Controller
driver: snd_hda_intel bus-ID: 00:1b.0
Sound: Advanced Linux Sound Architecture v: k4.15.0-122-generic
Network: Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
driver: r8169 v: 2.3LK-NAPI port: e000 bus-ID: 03:00.0
IF: enp3s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
Card-2: Belkin F5D7050 Wireless G Adapter v4000 [Zydas ZD1211B]
usb-ID: 001-015
IF: N/A state: N/A mac: N/A
Drives: HDD Total Size: 6856.5GB (7.4% used)
ID-1: /dev/sda model: ST3320418AS size: 320.1GB
ID-2: /dev/sdb model: WDC_WD5000AAKX size: 500.1GB
ID-3: /dev/sdc model: WDC_WD5000AAKS size: 500.1GB
ID-4: /dev/sdd model: WDC_WD5000BEVT size: 500.1GB
ID-5: USB /dev/sde model: BUP_Ultra_Touch size: 2000.4GB
ID-6: USB /dev/sdk model: Gizmo!_JR. size: 4.0GB
ID-7: USB /dev/sdl model: DataTraveler_2.0 size: 31.1GB
ID-8: USB /dev/sdf model: Expansion size: 3000.6GB
Partition: ID-1: / size: 104G used: 68G (69%) fs: ext4 dev: /dev/sdc8
ID-2: swap-1 size: 3.98GB used: 0.48GB (12%) fs: swap dev: /dev/sdc3
RAID: Device-1: /dev/md120 - inactive components: online: none spare: sde22[8] sde21[7] sde20[6]
Device-2: /dev/md121 - active (auto-read-only) components: online: sde5[1] sde4[0] sde11[3] spare: sde18[5] sde17[4]
Info: raid: 5 report: 3/3 blocks: 204668928 chunk size: 512k
Device-3: /dev/md100 - active components: online: sdk3[3] sdk2[1] sdk1[4]
Info: raid: 5 report: 3/3 blocks: 1021952 chunk size: 512k
Device-4: /dev/md122 - active (auto-read-only) components: online: sde14[1] sde15[3] sdf25[4]
Info: raid: 5 report: 3/3 blocks: 102334464 chunk size: 512k
Device-5: /dev/md123 - active (auto-read-only) components: online: sdf21[1] sdf22[3] sdf20[0]
Info: raid: 5 report: 3/3 blocks: 204668928 chunk size: 512k
Device-6: /dev/md124 - active (auto-read-only) components: online: sdf14[3] sdf12[0] sdf13[1]
Info: raid: 5 report: 3/3 blocks: 204668928 chunk size: 512k
Device-7: /dev/md125 - active (auto-read-only) components: online: sde13[0] sdf24[3] sdd10[1]
Info: raid: 5 report: 3/3 blocks: 204668928 chunk size: 512k
Device-8: /dev/md126 - active (auto-read-only) components: online: sde9[3] sde19[5] sdd9[4]
Info: raid: 5 report: 3/3 blocks: 204668928 chunk size: 512k
Device-9: /dev/md127 - inactive components: online: none spare: sda3[0] sdc4[1]
Sensors: System Temperatures: cpu: 49.0C mobo: N/A
Fan Speeds (in rpm): cpu: N/A
Info: Processes: 287 Uptime: 1:13 Memory: 3119.3/7683.0MB
Init: systemd runlevel: 5 Gcc sys: 5.4.0
Client: Shell (bash 4.3.481) inxi: 2.2.35
f@f-SATA:~$


f@f-SATA:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
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-4.15.0-112-generic : Depends: linux-modules-4.15.0-112-generic but it is not going to be installed
E: Broken packages
f@f-SATA:~$


f@f-SATA:~$ sudo apt purge grub-common
[sudo] password for f:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libc6-i386
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
grub* grub-common* linux-image-4.15.0-112-generic os-prober*
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 21.0 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 280867 files and directories currently installed.)
Removing linux-image-4.15.0-112-generic (4.15.0-112.113~16.04.1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-112-generic
/etc/kernel/postrm.d/zz-update-grub:
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) /usr/sbin/update-grub: line 1094: read: read error: 0: Bad file descriptor
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-4.15.0-112-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-112-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
f@f-SATA:~$



f@f-SATA:~$ sudo apt install grub-pc
[sudo] password for f:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libc6-i386
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
grub-gfxpayload-lists grub-pc-bin grub2-common
Suggested packages:
desktop-base
The following packages will be REMOVED:
grub linux-image-4.15.0-112-generic
The following NEW packages will be installed:
grub-gfxpayload-lists grub-pc grub-pc-bin grub2-common
0 upgraded, 4 newly installed, 2 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 1,604 kB of archives.
After this operation, 4,271 kB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 grub2-common amd64 2.02~beta2-36ubuntu3.29 [512 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 grub-pc-bin amd64 2.02~beta2-36ubuntu3.29 [892 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 grub-gfxpayload-lists amd64 0.7 [3,658 B]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 grub-pc amd64 2.02~beta2-36ubuntu3.29 [197 kB]
Fetched 1,604 kB in 0s (1,962 kB/s)
Preconfiguring packages ...
(Reading database ... 280867 files and directories currently installed.)
Removing linux-image-4.15.0-112-generic (4.15.0-112.113~16.04.1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-112-generic
/etc/kernel/postrm.d/zz-update-grub:
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) /usr/sbin/update-grub: line 1094: read: read error: 0: Bad file descriptor
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-4.15.0-112-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Removing grub (0.97-29ubuntu68) ...
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
linux-image-4.15.0-112-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
f@f-SATA:~$
 
Last edited:
You're running Ubuntu 16.04.7 Xenial.

Looking at this:

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N)

You don't have your boot/grub/menu file so follow Lord Boltar's touch cmd to create it.

Just curious, what were you trying to install that you have unment dependencies along with broken packages?

Is your machine UEFI BIOS or Legacy?
 
we are going to use 'sudo dpkg --purge grub' instead. The problem you're having is that apt is trying to remove other packages which have already been marked for removal, and one of those is the kernel which is where you're running into problems in the first place due to the unconfigured grub on the system.Using dpkg --purge avoids apt trying to remove packages that you aren't requesting removal of.

Code:
sudo dpkg --purge grub
Code:
sudo apt install grub-pc
Code:
sudo touch /boot/grub/menu.lst
Code:
sudo update-grub
 
Just a tip with that method. During the process there will likely be a question asked on menu.list whether to use the local version or the package-maintener's version.

Choose the package-maintainer's version.

Wizard
 
You're running Ubuntu 16.04.7 Xenial.

Looking at this:

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N)

I may have not mentioned it here - but I DO NOT get a chance to make that selection;

You don't have your boot/grub/menu file so follow Lord Boltar's touch cmd to create it.

Will check that

Just curious, what were you trying to install that you have unment dependencies along with broken packages?

I have no idea how this happen.... life would be easier if I knew...


Is your machine UEFI BIOS or Legacy?

My is FULL UEFI and I do not want to complicate things changing UEFI setup at this point.
(It is another issue )
Been there, done that and it did not change anything with this issue , only made things complicated when booting.
 
mystery solved ???
Here is the latest "upgrade".

I do appreciate all the help and I am sorry for the trouble and wasted time.

But ... I can't fix it if ain't broken.


f@f-SATA:~$ sudo apt upgrade
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.
f@f-SATA:~$ uname -a
Linux f-SATA 4.15.0-122-generic #124~16.04.1-Ubuntu SMP Thu Oct 15 16:08:36 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
f@f-SATA:~$
 
mystery solved ???
Here is the latest "upgrade".

I do appreciate all the help and I am sorry for the trouble and wasted time.

But ... I can't fix it if ain't broken.


f@f-SATA:~$ sudo apt upgrade
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.
f@f-SATA:~$ uname -a
Linux f-SATA 4.15.0-122-generic #124~16.04.1-Ubuntu SMP Thu Oct 15 16:08:36 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
f@f-SATA:~$
If it is sovled can you pleas add [Solved} to your title Thanks
 
If it is sovled can you pleas add [Solved} to your title Thanks

That is not a requirement here, but I have added it.

and I am sorry for the trouble and wasted time.

Time is not wasted if in the end you get a satisfactory outcome :)

Enjoy your Linux and stay safe over the holiday season.

Wizard
 
Thanks for marking the thread solved.
I was reluctant to do so, mainly because the problem was not solved by any specific command.
The origin of the issue is unknown , so is the "fix" - hardly worth to keep statistics about such events.
Cheers
 
Status
Not open for further replies.

Members online


Top