Fedora – How to manually force reload of files from an RPM package

chrootfedorarpm

After a Fedora distro upgrade (27->28) with dnf, I tried to manually resolve conflicts between package versions (needed to keep older OS versions functional; effective OS version is selected at boot time in GRUB2 menu).

dnf security checks prevented the removal of conflicting packages and I used rpm -e xxx --force to do that. I inadvertently removed glibc and the PC immediately errored out.

I want to avoid rebuilding my computer from scratch because:

  1. I don't exactly remember all applications I installed years ago (they were automatically upgraded by dnf system-upgrade), and
  2. there would be a huge configuration work in /etc to restore custom settings for my network environment plus the servers on the machine.

Using a rescue disk, I could boot and examine the hard disk. Everything seems relatively "clean". Files from glibc package are simply missing.

I could not complete chroot to the former root (in order to run rpm -i glibc) because chroot tries to launch /bin/bash which is missing.

Is there a way to tell rpm to do its usual job but to install files in, say, /mnt/hard_disk/ instead of /?

I'll take care afterwards of package database consistency and integrity.

Best Answer

chroot can take a command to run to this might work:

chroot /mnt/hard_disk rpm -i glibc*.rpm

Also, rpm has the --root option so this is another option:

rpm -i --root /mnt/hard_disk glibc*.rpm
Related Question