Recursive symlink in /boot

Hi folks, I was looking into another issue when I noticed that in my /boot directory is a link to my /boot directory. Is this correct? If so why is it there?

ls -l /boot
total 49800
-rw-r--r-- 1 root root  2699260 Oct 15 08:09 System.map-3.11.5-1.ga012288-desktop
-rw------- 1 root root      512 Nov  9  2012 backup_mbr
lrwxrwxrwx 1 root root        1 Aug  9 13:54 boot -> .

Yes, that’s normal. That link is part of the grub package.

As to why it is there, see Gentoo Forums :: View topic - why /boot/boot is a symbolic link?

Its to keep the grub documentation simple.

When you do not have a boot partition and /boot is a directory on the / (root) partiton, the pathname to your kernel is

/boot/kernel...

and the root (hdx,y) statement points to your / (root) partition.
Now everything works as expected.

When you have a real boot, the root (hdx,y) statement points to the boot partition and a kernel at /boot/kernel… will not be found as the path /boot does not exist.
As the filesystem tree is not assembled when grub boots the system, you can’t point root (hd,x,y) to / as /boot is not attached.

The solution is a symlink called boot, pointing to itseld (.) so the kernel can still be at

 /boot/kernel...

but now, the symlink is used to satisfy the reference to /boot

No, that’s not recursive.

If it read:


lrwxrwxrwx 1 root root        4 Aug  9 13:54 boot -> boot

that would have been recursive.

As Wolfi said, this is normal.

Normally, you tell “grub2” to find its configuration file at “/boot/grub2/grub.cfg”. However, if there is a separate “/boot” partition, then the path is really “/grub2/grub.cfg” relative to that partition. The symlink makes it possible to always use “/boot/grub2/grub.cfg” as the path.

So leave that symlink there. It is useful.

On 2013-10-17 15:16, nrickert wrote:

>
> No, that’s not recursive.

Huh?

It is recursive here:


> cer@Telcontar:~> l /boot/boot/boot/boot/boot/boot/boot/boot
> lrwxrwxrwx 1 root root 1 Jun  8 04:04 /boot/boot/boot/boot/boot/boot/boot/boot -> ./



Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

That’s iterative, not recursive.

On 2013-10-17 18:46, nrickert wrote:
>
> robin_listas;2591785 Wrote:
>> It is recursive here:

> > That’s iterative, not recursive.

Possibly. I don’t have it clear :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

I should have put a smiley on my last post. This is an unimportant disagreement about the use of technical terms as metaphors.