익명 22:15

Broken Links - Many broken links on a fresh install of Ubuntu Server 26.04LTS

Broken Links - Many broken links on a fresh install of Ubuntu Server 26.04LTS

I just did a fresh install of Ubuntu Server 26.04LTS, and am seeing loads of broken links already.

Since installing the OS, I have done an apt upgrade, added one additional user, and a static MoTD, so almost nothing really.

Yet, when I run:

sudo find / -xtype l -ls

I get scores (at least) of broken links showing up (I can post a complete list if it would help). If I exclude some paths thus:

find / -xdev -xtype l \
-not -path "/proc/*" \
-not -path "/sys/*" \
-not -path "/run/*" \
-not -path "/dev/*" \
2>/dev/null

it reduces the number of broken links listed to this list, which is still surprising (at least to me!)

/usr/src/linux-headers-7.0.0-27/scripts/kernel-doc
/usr/src/linux-headers-7.0.0-27-generic/rust
/usr/share/locale/it/LC_TIME/coreutils.mo
/usr/share/locale/be/LC_TIME/coreutils.mo
/usr/share/locale/ia/LC_TIME/coreutils.mo
/usr/share/locale/af/LC_TIME/coreutils.mo
/usr/share/locale/el/LC_TIME/coreutils.mo
/usr/share/locale/lt/LC_TIME/coreutils.mo
/usr/share/locale/ka/LC_TIME/coreutils.mo
/usr/share/locale/eo/LC_TIME/coreutils.mo
/usr/share/locale/sv/LC_TIME/coreutils.mo
/usr/share/locale/gl/LC_TIME/coreutils.mo
/usr/share/locale/et/LC_TIME/coreutils.mo
/usr/share/locale/cs/LC_TIME/coreutils.mo
/usr/share/locale/hu/LC_TIME/coreutils.mo
/usr/share/locale/uk/LC_TIME/coreutils.mo
/usr/share/locale/fi/LC_TIME/coreutils.mo
/usr/share/locale/bg/LC_TIME/coreutils.mo
/usr/share/locale/sr/LC_TIME/coreutils.mo
/usr/share/locale/zh_TW/LC_TIME/coreutils.mo
/usr/share/locale/ru/LC_TIME/coreutils.mo
/usr/share/locale/ja/LC_TIME/coreutils.mo
/usr/share/locale/ms/LC_TIME/coreutils.mo
/usr/share/locale/ga/LC_TIME/coreutils.mo
/usr/share/locale/id/LC_TIME/coreutils.mo
/usr/share/locale/ko/LC_TIME/coreutils.mo
/usr/share/locale/sl/LC_TIME/coreutils.mo
/usr/share/locale/pl/LC_TIME/coreutils.mo
/usr/share/locale/hr/LC_TIME/coreutils.mo
/usr/share/locale/vi/LC_TIME/coreutils.mo
/usr/share/locale/lg/LC_TIME/coreutils.mo
/usr/share/locale/da/LC_TIME/coreutils.mo
/usr/share/locale/nl/LC_TIME/coreutils.mo
/usr/share/locale/fr/LC_TIME/coreutils.mo
/usr/share/locale/pt_BR/LC_TIME/coreutils.mo
/usr/share/locale/es/LC_TIME/coreutils.mo
/usr/share/locale/ca/LC_TIME/coreutils.mo
/usr/share/locale/pt/LC_TIME/coreutils.mo
/usr/share/locale/sk/LC_TIME/coreutils.mo
/usr/share/locale/ro/LC_TIME/coreutils.mo
/usr/share/locale/nb/LC_TIME/coreutils.mo
/usr/share/locale/ta/LC_TIME/coreutils.mo
/usr/share/locale/kk/LC_TIME/coreutils.mo
/usr/share/locale/tr/LC_TIME/coreutils.mo
/usr/share/locale/eu/LC_TIME/coreutils.mo
/usr/share/locale/zh_CN/LC_TIME/coreutils.mo
/usr/share/locale/de/LC_TIME/coreutils.mo
/usr/share/man/man1/hashsum.1.gz
/usr/share/doc/libxml2-16/NEWS.gz
/usr/share/doc/xfsprogs/changelog.gz
/usr/share/doc/perl/Changes.gz
/usr/share/doc/python3-wadllib/NEWS.rst.gz

Is it expected that there would be a load of broken links on a fresh install? If not, perhaps something went wrong when I installed, and I should wipe and start from scratch, or perhaps the disk is knackered (although I did run the built-in disk diagnostic from the boot menu, and it found no issues).

Any suggestions welcome, and given I have almost nothing invested, I am also happy to use this for any tests that might be useful to understand what is happening.



Top Answer/Comment:

As it happens, I just installed a fresh version of Linux Mint1 on a machine and have loads of broken links, even just looking in /usr:

$ $ find /usr/ -xdev -xtype l 2>/dev/null | wc -l
3096

I also get similar numbers on an Ubuntu Server install that has been heavily used for a while:

$ find /usr/ -xdev -xtype l 2>/dev/null | wc -l
2706

So yes, it seems to be expected. Perhaps they are created just in case their targets are later installed? In any case, they aren't a problem and they are all relative. None of the link targets is an absolute path, none start with a /, they all start with a letter (meaning they point to a file in the same directory as the link) or with ../. On my Ubuntu Server:

## 3096 broken symlinks in /usr
$ find /usr/ -xdev -xtype l -exec readlink {} + | wc -l
   3096
## 2625 point to a parent directory
$ find /usr/ -xdev -xtype l -exec readlink {} + | grep -c '^\.\.'
2625
## the rest (2625 + 471 = 3096) point to a file/dir in the same directory
$ find /usr/ -xdev -xtype l -exec readlink {} + | grep -c '^[a-zA-Z]'
471

This suggests that they are some sort of fallback or compatibility layer in case other files are created in the future.


1Yes, I know Mint isn't Ubuntu, but I am making the point that a fresh install of an Ubuntu-based distribution also has this issue.

상단 광고의 [X] 버튼을 누르면 내용이 보입니다