I'm having trouble reinstalling grub through chroot, I get the following error whenever I try to reinstall it.
error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
Little bit of a backstory:
Recently while trying to convert my disk partition from MBR to GPT, I bricked my Ubuntu Installation. Once i restarted after using the following command sgdisk -g /dev/sda
I was unable to boot into Ubuntu!
My Main aim was to convert the MBR LVM partition to GPT so as to install Windows 10. I was under the impression that I had to change it into GPT to be able to install windows 10 but later found that simply resizing the partition using KDE Partition Manager or any other tool capable of LVM operations and then formatting the partition to NTFS ought to make the environment ready for installation of Windows 10.
The Problem Now:
While I've managed to get windows 10 running and as I type from it now, I'm in a bit of a rut, I love using Ubuntu Linux and I want a dual boot setup, Windows being used for Multimedia stuff & Games whereas Ubuntu Linux being the daily Operating System!
I came across an software called boot repair disk by yannubuntu on sourceforge, I booted it up on a usb stick and then ran the boot repair software, it asked me to execute the following command sudo chroot "/mnt/boot-sav/mapper/vgubuntu-root" apt purge --allow-remove-essential -y grub*-common shim-signed
so as to reinstall and configure grub on the Ubuntu LVM partition using chroot.
When I execute this command, I always get this library error /bin/bash: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory dpkg: error processing package grub-pc (--remove):
even though the libraries are installed in the boot repair disk as I found out while trying to install it using apt and I assume it is preinstalled in Ubuntu as well as the library is already present in the boot repair disk and it is based on Ubuntu.
Here's the full terminal view of my issue, the command executed and the aforementioned errors can be seen here.
Command:
sudo chroot "/mnt/boot-sav/mapper/vgubuntu-root" apt purge --allow-remove-essential -y grub*-common shim-signed
Output:
lubuntu@lubuntu:~$ sudo chroot "/mnt/boot-sav/mapper/vgubuntu-root" apt purge --allow-remove-essential -y grub*-common shim-signed
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'grub-common' for glob 'grub*-common'
Note, selecting 'grub2-common' for glob 'grub*-common'
Package 'shim-signed' is not installed, so not removed
The following packages will be REMOVED:
grub-common* grub-gfxpayload-lists* grub-pc* grub-pc-bin* grub2-common*
0 upgraded, 0 newly installed, 5 to remove and 73 not upgraded.
2 not fully installed or removed.
After this operation, 18.8 MB disk space will be freed.
(Reading database ... 305827 files and directories currently installed.)
Removing grub-pc (2.04-1ubuntu26.12) ...
/bin/bash: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
dpkg: error processing package grub-pc (--remove):
installed grub-pc package pre-removal script subprocess returned error exit status 127
dpkg: too many errors, stopping
/bin/bash: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
dpkg: error while cleaning up:
installed grub-pc package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
grub-pc
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
Please help me out, I'm stuck and I don't know what to do next!
Thanks!
Note:
Some things that I've already tried:
- Tried reinstalling grub on the bricked Ubuntu using chroot from a full fat Ubuntu 18.04 on a USB stick, the same library error persists