# How to recover a damaged AlmaLinux server?

**URL:** <https://hostingthreads.com/t/how-to-recover-a-damaged-almalinux-server/58>\
**Category:** Linux Troubleshooting\
**Tags:** linux\
**Created:** [April 7, 2026, 2:59am UTC](https://hostingthreads.com/t/how-to-recover-a-damaged-almalinux-server/58 "2026-04-07T02:59:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jennifer](https://hostingthreads.com/user_avatar/hostingthreads.com/jennifer/32/27_2.png) [@jennifer](https://hostingthreads.com/u/jennifer)\
**Post date:** [April 7, 2026, 2:59am UTC](https://hostingthreads.com/t/how-to-recover-a-damaged-almalinux-server/58/1 "2026-04-07T02:59:52Z")

</div>

Hello everyone,

How can I restore a corrupted AlmaLinux server if system files /lib /lib64 or other location are deleted? Any help appreciated.

Thanks in advance.

Jenn

---

<div class="post-metadata">

**Author:** ![computeman](https://hostingthreads.com/user_avatar/hostingthreads.com/computeman/32/29_2.png) [@computeman](https://hostingthreads.com/u/computeman)\
**Post date:** [April 7, 2026, 3:21am UTC](https://hostingthreads.com/t/how-to-recover-a-damaged-almalinux-server/58/2 "2026-04-07T03:21:09Z")

</div>

If critical system files are mistakenly removed such as the /lib64 or /lib directories — the best course of action is to restore them from a previously saved backup.

In case no backup is available, attempting to reinstall the relevant RPM packages is an alternative option.

The notes provided below should be treated as a last resort when trying to recover the system.

Enter the following commands before entering “chroot /mnt/sysimage” in Linux rescue mode.

Run the commands below to identify any missing files:

```plaintext
# rpm -Va --root /mnt/sysimage | tee /tmp/rpms_va
# for FILE in `awk '/^missing/ {print $NF}' /tmp/rpms_va`; do rpm -qf --root /mnt/sysimage $FILE; done | sort | uniq > /tmp/rpms_to_reinstall

```

Copy both the /var/lib/rpm directory and the /tmp/rpms\_to\_reinstall file to an internet-connected machine—using a USB drive, CD, or similar media. This machine must be registered with subscription and should be running the same major AlmaLinux version as the damaged server.

```plaintext
# scp -r /mnt/sysimage/var/lib/rpm /tmp/rpms_to_reinstall root@server:/tmp/

```

Log in to the internet-connected machine and install the yumdownloader package on it.

```plaintext
# yum install yum-utils
# yum clean all

```

Back up the existing RPM database directory on the internet-connected machine, then replace it with the RPM directory copied from the offline damaged server:

```plaintext
# mv -v /var/lib/rpm /var/lib/rpm.orig
# mv -v /tmp/rpm /var/lib/

```

Download the required RPM packages listed in /tmp/rpms\_to\_reinstall into the /tmp/rpms\_install directory, then restore the original /var/lib/rpm directory back to its previous state.

```plaintext
# mkdir -v /tmp/rpm_updates
# for RPM in `cat /tmp/rpms_to_reinstall`; do yumdownloader $RPM --destdir=/tmp/rpms_install; done
# rm -rvf /var/lib/rpm
# mv -v /var/lib/rpm.orig /var/lib/rpm

```

Copy the rpms back to the damaged server:

```plaintext
# scp -r /tmp/rpms_install server:/mnt/sysimage/tmp/

```

Switch back to the damaged server and execute the following:

```plaintext
# rpm -i --root /mnt/sysimage --force /mnt/sysimage/tmp/rpms_install/*.rpm
# reboot

```

To avoid such issues in future avoid deleting system linux files.

Relax.

Albert. 🧘‍♂️
