Deleted /etc/X11 with rm -rf on Fedora. Any respite?

Attempting to clear out some temporary files on Fedora with (ext4 filesystem). Without the confirmation flag, I used rm -rf to delete the directory /etc/X11.

Digging deep, I found out that the directory contained important system configuration files that is necessary for the GUI to function optimally.

Is there hope of recovering the deleted /etc/X11 directory and all it’s contents intact? How can I restore the system to proper functionality given the situation without having to do a full reinstallation?

1 Like

@Slys thank you and you should be using the rm -rf with caution. Anyways, you can try the following

$sudo apt-get update 
$sudo apt-get upgrade
$sudo apt-get autoremove

and this will try to fix the missing links and the deb packages.

alles super,
gaurav

Recovering the deleted /etc/X11 directory without a backup can be challenging but not always impossible.

Immediately stop using the affected filesystem to avoid overwriting the deleted data. Tools like TestDisk or extundelete might help recover the directory, but success isn’t guaranteed and often depends on how much the disk has been used since deletion.

If recovery attempts fail, reinstalling the affected packages that use /etc/X11 configurations is a more straightforward approach. This can often restore functionality without a full system reinstall. Use your package manager to reinstall these packages.

For a Fedora system, using dnf to reinstall the xorg-x11-server-Xorg package and any other related packages might restore most functionality.

2 Likes

Best practice is to use a bootable USB to backup everything and install fresh. After this process you MUST learn how to use configuration files.

  1. Copy the config files to you $HOME directory cp /etc/<conf-file-or-folder> ~/.config/
  2. Use the ~/.config directory to play and leave the system files alone.
  3. On Unix systems, ‘sudo’, ‘su’ give elevated privileges and should be avoided. When it is necessary to use elevated privileges, make sure you are focused and careful.
  4. If you need community help, your system must not be customized. If I would like to help you troubleshoot your current “custom” system, I would need to check every configuration file you have tweaked!
2 Likes