Symlinks deleted by mistake?

I upgraded to Fedora 38 a few days ago.

Then I went to make trouble for myself, and followed some of the steps here:

What worries me the most is this step:

I checked for dangling simlinks, then decided to remove them. As recommended, I used:
sudo symlinks -r -d /usr

I interrupted this after a few moments, because it didn’t feel right to run it on all simlinks, and instead I used
sudo symlinks -r -d /usr|grep dangling

However some of the non-dangling simlinks were undoubtedly removed in the process, and now I am afraid many things will not work any more. I haven’t identified any problems so far, but I’m afraid to reboot, in case I removed something required, and cannot get it back running. Is there anything I can do to correct for potential problems? I’ve learned that ‘ldconfig’ may help, but I am not entirely sure with which parameters to run it (I’ve looked at the description, but prefer to ask those who know).

Thank you for advising - I’m sorry for doing such a stupid thing (probably).

-d is deleting the dangling symlinks.

The grep command was just to show you the links before deleting them. This would have been without the -d command.
If you see nothing now then it is correct because you deleted this kind of symlinks already.

Don’t worry. It would not be in the quickdocs if it would be dangerous for the system.
Btw. I made it too and restarted without any problems the system.


Note that using the command symlinks -r -d /usr does not discriminate as to type but expects to remove all symlinks in the named directory tree.

As extensive as that command is I would suggest that you may try sudo dnf reinstall \* and if dnf still works it may restore the removed symlinks.

Yes, it is inadvisable to blindly run commands without fully understanding what they do and the potential ramifications.

Note that on my system I have over 7000 symlinks under the /usr tree. All those are system created.

1 Like

I have 7176 at the moment. So I hope it’s not too bad.

Wouldn’t it take a very long time to reinstall everything? I’ve had no problem so far, after I ran that command - I’m just worried that it affected some process I don’t know about and this will have bad effects.

I guess I’ll backup before rebooting, and hope for the best. Then if I run into problems, I’ll correct each as it appears.

Thank you for the answer! I will keep in mind the ‘reinstall’ tip.

This was what I hoped too, that if it’s listed there it cannot do harm. But I thought perhaps we were meant to run it with specific arguments?

No longer sure what ‘grep’ is doing, perhaps you’re right that it is only the output of the command that is changed, but the effect of the command is the same.

In which case, it indeed did no harm, since I still have over 7000 links (unless ldconfig restored all of them, but I am not sure this is what happened - I should have checked before and after).

Thank you for the answer!

Please don’t do dnf reinstall \*. Makes no sense for Jeff to even suggest that; as L.S. has already explained, symlinks -d only deletes dangling symlinks.

If you want to reassure yourself, you can verify all installed packages:

sudo rpm -Va

May take a few minutes. It’ll tell you if any installed files are different from their original state in the package, and in what way. See man rpm under --verify for the legend (e.g. T means timestamp is different). If a file is missing it’ll just say missing.


Thank you, Justin, this is very helpful! I’ve run rpm -Va and many files are missing or have various other modifications. Some of the missing files I don’t think I need to worry about, but others I am not sure. I could reinstall them (as Jeff suggested, but not all files, just those with problems), but I am worried that perhaps the system has deleted/modified them for good reason - I haven’t removed any files since upgrading, apart from the simlinks.

May I copy here the output of rpm -Va, in case you can tell which files I need to reinstall? Otherwise I’ll do nothing - since I haven’t removed the files myself, I hope there’s no point reinstalling them.

Did you run it with sudo? If not you get many missing files because of Permission issues.


I ran it as root - thank you!

Does that mean it doesn’t report those missing files after running as root?

If there’s still anything you’re unsure about, feel free to copy the output here. If it’s very long, you can hide it like this:

paste the output here, in between the triple-backticks

which will look like this:

paste the output here, in between the triple-backticks
1 Like

I had run it as root in the first place.

There are many missing files with names of the form: /usr/lib/.build-id/xx/xxx… - which I don’t think I need to worry about (is this correct?).

The rest of the output is:

.......T.    /boot/efi/EFI/BOOT/BOOTX64.EFI
.......T.    /boot/efi/EFI/BOOT/fbx64.efi
.......T.    /boot/efi/EFI/fedora/shim.efi
.......T.    /boot/efi/EFI/BOOT/BOOTIA32.EFI
.......T.    /boot/efi/EFI/BOOT/fbia32.efi
.......T.    /boot/efi/EFI/fedora/BOOTIA32.CSV
.......T.    /boot/efi/EFI/fedora/mmia32.efi
.......T.    /boot/efi/EFI/fedora/shimia32.efi
missing     /lib/modules/6.2.14-100.fc36.x86_64/build
missing     /lib/modules/6.2.14-100.fc36.x86_64/source
missing     /lib/modules/6.2.15-100.fc36.x86_64/build
missing     /lib/modules/6.2.15-100.fc36.x86_64/source
.M.......  g /var/lib/dnf
missing     /usr/lib/firmware/qcom/LENOVO/21BX.xz
.M.......  c /etc/fstab
S.5....T.  c /etc/printcap
.M.......  g /run/motd
.M.......    /boot/efi/EFI
.M.......    /var/lib/fprint
.M.......  c /etc/locale.conf
.M.......  c /etc/vconsole.conf
........P    /usr/libexec/gstreamer-1.0/gst-ptp-helper
.....UG..  g /var/run/avahi-daemon
.......T.  c /etc/selinux/targeted/contexts/customizable_types
.M.......    /var/lib/bluetooth
S.5....T.  c /etc/java/java-17-openjdk/java-17-openjdk-
S.5....T.  c /etc/java/java-17-openjdk/java-17-openjdk-
missing     /lib/modules/6.3.8-200.fc38.x86_64/build
missing     /lib/modules/6.3.8-200.fc38.x86_64/source
S.5....T.  c /usr/lib64/R/etc/ldpaths
missing   d /usr/share/doc/gsound/README
missing     /run/gluster/metrics
.M.......  g /var/lib/selinux/targeted/active/modules/200/container
.M.......  g /var/lib/colord/mapping.db
.M.......  g /var/lib/colord/storage.db
missing     /usr/share/cockpit/branding/arch/apple-touch-icon.png
missing     /usr/share/cockpit/branding/arch/favicon.ico
missing     /usr/share/cockpit/branding/arch/logo.png
missing     /usr/share/cockpit/branding/debian/favicon.ico
missing     /usr/share/cockpit/branding/debian/logo.png
missing     /usr/share/cockpit/branding/opensuse/default-1920x1200.jpg
missing     /usr/share/cockpit/branding/opensuse/favicon.ico
missing     /usr/share/cockpit/branding/opensuse/square-hicolor.svg
missing     /usr/share/cockpit/branding/ubuntu/logo.png
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/libasan.a
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/libatomic.a
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/libitm.a
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/libquadmath.a
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/libubsan.a
S.5....T.  c /etc/texlive/tex/generic/config/language.dat
S.5....T.    /usr/share/texlive/texmf-dist/tex/generic/config/language.def
S.5....T.  c /etc/texlive/web2c/updmap.cfg
.M.......  g /usr/share/texlive/texmf-dist/web2c/fmtutil.cnf
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/libgfortran.a
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/
S.5....T.  c /etc/containers/registries.conf
.M.......  g /etc/containers/storage.conf
missing     /usr/share/rhel/secrets/etc-pki-entitlement
missing     /usr/share/rhel/secrets/redhat.repo
missing     /usr/share/rhel/secrets/rhsm
.M.......  g /run/libvirt/common
.M.......  g /run/libvirt/interface
.M.......  g /run/libvirt/nodedev
.M.......  g /run/libvirt/nwfilter
.M.......  g /run/libvirt/nwfilter-binding
.M.......  g /run/libvirt/secrets
.M...UG..  g /run/libvirt/qemu/dbus
.....UG..  g /run/libvirt/qemu/passt
.....UG..  g /run/libvirt/qemu/slirp
missing   d /usr/share/doc/python3-beautifulsoup4/NEWS.txt
.M....G..    /var/log/gdm
.M.......  g /etc/timeshift.json
S.5....T.  c /etc/yum.repos.d/google-chrome.repo
.M.......  g /run/thermald/
.M.......  c /boot/grub2/grub.cfg
.M.......  c /boot/grub2/grub.cfg
.M.......  c /boot/grub2/grub.cfg
.M.......    /boot/efi/System
.M.......    /boot/efi/System/Library
.M.......    /boot/efi/System/Library/CoreServices
.M.......    /boot/efi/System/Library/CoreServices/SystemVersion.plist
.M.......    /boot/efi/mach_kernel

I think I don’t need to worry about reinstalling any of these, but I don’t know with certainty.

What worries me a little more is that I seem to have lots of similar files, perhaps from different versions, or others that don’t apply to my system - perhaps many of the files I have on my system are not necessary. Not sure if I can detect them.

Just that you can be sure of your actions, please verifies before you are execute any command, the man pages. Let’s do it together about the simlinks tool.

man symlinks

SYMLINKS(1)                                                                      General Commands Manual                                                                     SYMLINKS(1)

       symlinks - symbolic link maintenance utility

Nothing dangerous … just to cleanup your system from old/unnecessary stuff.

Now lets check the parameters -u and -d :

       symlinks is a useful utility for maintainers of FTP sites, CDROMs, and Linux software distributions.  It scans directories for symbolic links and lists them on stdout, often re‐
       vealing flaws in the filesystem tree.

       Each link is output with a classification of relative, absolute, dangling, messy, lengthy, or other_fs.
       dangling links are those for which the target of the link does not currently exist.  This commonly occurs for absolute links when a filesystem is mounted at other than its  customary mount point (such as when the normal root filesystem is mounted at /mnt after booting from alternative media).
-r     recursively operate on subdirectories within the same filesystem.
-d     causes dangling links to be removed.

This are some of mine I removed. As you can see, GCC is the Gnome Compiler Collection, a tool you need to compile source code (human readable code) to executable (binary code).
On this stage of the OS you do not need to compile datas anymore.

missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/libasan.a
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/libatomic.a
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/libitm.a
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/libquadmath.a
missing     /usr/lib/gcc/x86_64-redhat-linux/13/32/libubsan.a

Now put the path in to a browser url to see the files where the link pointed too. You can see that this listed files are missing (you might have to look on your own system to get such “missing” links)

Now you have the proof that you not made something bad just made a maintenance of your system.

man grep

GREP(1)                                                                               User Commands                                                                              GREP(1)

       grep - print lines that match patterns
1 Like

Some symbolic links are actually needed in some cases, for example the ones from /lib/modules refers to directories provided by kernel-devel.

An incomplete list of which rpm modules provides which symbolic link

File Name                                              Provided by
=========                                              ============================
/lib/modules/6.3.8-200.fc38.x86_64/build               kernel-modules-core-6.3.8-200.fc38.x86_64
/lib/modules/6.3.8-200.fc38.x86_64/source              kernel-modules-core-6.3.8-200.fc38.x86_64
/usr/lib/firmware/qcom/LENOVO/21BX.xz                  linux-firmware-20230515-150.fc38.noarch
/usr/lib/gcc/x86_64-redhat-linux/13/32/libasan.a       gcc-13.1.1-4.fc38.x86_64
/usr/lib/gcc/x86_64-redhat-linux/13/32/libatomic.a     gcc-13.1.1-4.fc38.x86_64
/usr/lib/gcc/x86_64-redhat-linux/13/32/      gcc-13.1.1-4.fc38.x86_64
/usr/lib/gcc/x86_64-redhat-linux/13/32/libitm.a        gcc-13.1.1-4.fc38.x86_64
/usr/lib/gcc/x86_64-redhat-linux/13/32/libquadmath.a   gcc-13.1.1-4.fc38.x86_64
/usr/lib/gcc/x86_64-redhat-linux/13/32/libubsan.a      gcc-13.1.1-4.fc38.x86_64
/usr/share/doc/python3-beautifulsoup4/NEWS.txt         python3-beautifulsoup4-4.12.2-1.fc38.noarch

Eventually after several updates the missing symbolic links will be re-created when the corresponding package is updated.

The missing files seems not to be essential.


That looks ok. I wouldn’t reinstall any package unless you specifically run into a problem using it.

This should really be asked before running symlinks -d. Not your fault—I think the Docs are too casual about suggesting these optional steps. They’re optional in the sense of “Don’t do this unless you know why and how”.

I’ll explain a few.

kernel modules

Some of the missing /lib/modules/... are from F36 kernels. Harmless and will go away by itself once you get a few kernel updates in F38 and the old kernel packages are uninstalled.

These 2 are from current F38 kernel however:

missing     /lib/modules/6.3.8-200.fc38.x86_64/build
missing     /lib/modules/6.3.8-200.fc38.x86_64/source

They’re symlinks in kernel to files from kernel-devel, so if you don’t have the latter installed, then the symlinks were dangling and removed. If you ever install kernel-devel for the current kernel 6.3.8-200, then you should probably reinstall kernel at the same time to make sure those symlinks are in place. Otherwise it doesn’t matter.


The symlinks in /usr/lib/.build-id are used to identify unique builds. I’ve noticed that packages with subpackages contain build-id for all files in the main package. I’m not sure if this is intended, a limitation of the tooling, or a packaging error.

Either way it results in dangling symlinks if you only install the main package but not the subpackage. This is harmless to remove. You might need to reinstall a package if you’re using its debuginfo package for debugging (?).


The missing /usr/lib/gcc/x86_64-redhat-linux/... are symlinks to files from various i686 (32-bit) packages. If you don’t have those i686 packages (which is normal, don’t go installing them) then the symlinks were dangling and removed.

Again not sure if intended or a packaging error, but it should be harmless.

$ dnf -qC rq --whatprovides /usr/lib/gcc/x86_64-redhat-linux/13/32/libasan.a

$ rpm -qlv gcc | grep libasan.a
lrwxrwxrwx    1 root     root                       39 Jun 14 08:00 /usr/lib/gcc/x86_64-redhat-linux/13/32/libasan.a -> ../../../i686-redhat-linux/13/libasan.a

$ dnf -qC rq --whatprovides /usr/lib/gcc/i686-redhat-linux/13/libasan.a


Looks like cockpit-ws contains some symlinks to logos that are not available in any Fedora package. Maybe packaging error, or intended/ignored because it doesn’t matter.


Packaging error, /usr/share/doc/gsound/README is a symlink to /usr/share/doc/gsound/ which isn’t packaged. I’ll get this fixed.


Similar packaging error to gsound. I’ll get this fixed.

Lenovo firmware

Packaging issue, reported here rhbz#2145029


Yep, I misread the man page. My bad.

1 Like

That’s grat, LS, thank you for the patient answer! Agreed, I should have checked what simlinks -d does before running it, and in any case before starting this thread :slight_smile:
Thank you for all your help!

1 Like

I submitted fixes for gsound and python-beautifulsoup4, so thanks for your help too :grin:


I agree, thank you for the answer!

Justin, this is just great, thank you very, very much. About submitting fixes - any time, I have always been the original ‘fool’ in ‘foolproof’ :slight_smile:

So this is resolved now, thanks to everyone who responded.