Score:1

error while loading shared libraries libtinfo.so.5 while attempting to repair my bricked ubuntu installation using Boot Repair Disk by yannubuntu

us flag

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:

  1. 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
ChanganAuto avatar
us flag
Windows strictly requires GPT for UEFI mode and MBR for Legacy/CSM/BIOS. So, although Windows *can* be installed in Legacy mode doesn't mean it *should*. And if your Ubuntu was properly installed in UEFI mode (Linux has no restrictions) then the dual-boot won't work. If your Ubuntu was installed in Legacy as well then better to start over> Make the drive GPT and then reinstall Ubuntu or install Windows and then Ubuntu, typically easier but not really relevant if installing in the proper UEFI mode.
N0rbert avatar
zw flag
You need to install `libtinfo5` package to fix dynamic library linking.
hr flag
I have no comment on the advisability of what you are trying to do, however I wonder if `SHELL=/bin/sh chroot ...` or `SHELL=/bin/dash chroot ...` would be a workaround? It seems like `dash` (unlike `bash`) doesn't link `libtinfo5.so`
PassionateTechie24 avatar
us flag
@N0rbert How can i do that? When I try to install the package it says the package is already installed!
PassionateTechie24 avatar
us flag
@steeldriver I'll give that a try and update you on it!
PassionateTechie24 avatar
us flag
@ChanganAuto Can't really do that, I've got data in the disk and I don't have a spare drive to transfer it to, is there any other way to repair grub in this case?
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.