# Symlink [SOLVED]

## NathanZachary

Hello all,

I just did an emerge --update --deep world, and it merged the new kernel (2.6.22-gentoo-r5).  I don't think that there's anything I would like to change about my kernel, but how do I update everything to make it realize the new kernel.  I assume there are new patches, and thus, the update.  The idea behind the symlink and the new kernel sources is actually still a little fuzzy to me.

Thanks preemptively,

Zach

----------

## IQgryn

```
cd /usr/src/linux-<oldversion>

cp -a .config ../linux-2.6.22-gentoo-r5
```

If you do NOT have the symlink USE flag enabled:

```
cd /usr/src

rm linux

ln -s linux-2.6.22-gentoo-r5 linux
```

Either way:

```
cd /usr/src/linux

make oldconfig

make && make modules_install && module-rebuild -X rebuild && make install
```

NOTE: if you normally copy the kernel images manually, you may prefer to do that instead of make install.  I personally prefer make install, as it lets me set up my grub.conf to point to vmlinuz and vmlinuz.old, which are automatically symlinked by make install to the latest and second-latest kernel images.  If you still want to copy the images manually, you will also need to update your bootloader configuration file.

NOTE #2: To run module-rebuild, you will have to have it installed (emerge module-rebuild).  Before the first time you run it as listed above, run it with the populate option (I don't recall the exact argument; run module-rebuild --help to find it).

I'll be happy to explain any and all of that in detail if you'd like (just ask!).

----------

## NathanZachary

To me, the first way makes more sense.  I would cd to /usr/src/linux-2.6.22-gentoo-r2, and then copy my .config file to a new folder with an absolute path of /usr/src/linux-2.6.22-gentoo-r5.  Then I would remove the symlink of linux, and make a new one by using ln -s linux-2.6.22-gentoo-r5 linux.  Then I should be good to go, right?  If I just copy over the old .config file, I shouldn't have to run the other commands like make oldconfig?

Also, how would I do it I wanted to make changes to the kernel before creating the symlink?  Does it always merge into a folder called:

/usr/src/linux-<version>

?

----------

## IQgryn

 *gentoo_zach wrote:*   

> To me, the first way makes more sense.  I would cd to /usr/src/linux-2.6.22-gentoo-r2, and then copy my .config file to a new folder with an absolute path of /usr/src/linux-2.6.22-gentoo-r5.  Then I would remove the symlink of linux, and make a new one by using ln -s linux-2.6.22-gentoo-r5 linux.  Then I should be good to go, right?  If I just copy over the old .config file, I shouldn't have to run the other commands like make oldconfig?

 

I assume by the first way, you mean without the symlink USE flag.

You MUST run make oldconfig if you want to be sure to have a working kernel when you're done.  It will configure the new kernel as close to the old kernel as possible, only asking you about new items, but you need to run it.  If you don't, you will eventually have a kernel that fails to either compile or boot.

 *gentoo_zach wrote:*   

> Also, how would I do it I wanted to make changes to the kernel before creating the symlink?  Does it always merge into a folder called:
> 
> /usr/src/linux-<version>
> 
> ?

 

I'm not sure what you mean by making changes to the kernel.  The symlink simply indicates which kernel source is considered the "in-use" one.  You can change the configuration of the new kernel source before, after, or both before and after you change the symlink without any ill effects.  You can even install the new kernel before you change the symlink.  You are not even really required to have the symlink, but some ebuilds depend on it being there and correct (generally kernel modules).

----------

## NathanZachary

So I could just:

```

cd /usr/src/linux-<new version>

make menuconfig

```

Then make my kernel configurations, build the kernel and copy it:

```

make && make modules_install

cp arch/i386/boot/bzImage /boot/kernel-2.6.22-gentoo-r5

```

Then, update the symlink by doing:

```

cd /usr/src

rm linux

ln -s 2.6.22-gentoo-r5 linux

```

And lastly, update it in my grub.conf file?  Sorry to have you actually spell it out to me, but this concept makes very little sense to me, and I'm just trying to understand.  I really appreciate you taking the time to help me!  :Smile:   One last question, is there an easier way to edit the grub.conf file?  Right now, I'm using the installation disc and chrooting back into the environment, because I can't seem to get to the file any other way.

Thanks again,

Zach

----------

## IQgryn

 *gentoo_zach wrote:*   

> So I could just:
> 
> ```
> 
> cd /usr/src/linux-<new version>
> ...

 

That way will work, yes.  You can also do as I mentioned above, and run make menuconfig after make oldconfig if there are additional changes you wish to make.  Do whichever you prefer, just know that if you're mostly happy with your current kernel config, make oldconfig will save you a lot of time.

 *gentoo_zach wrote:*   

> And lastly, update it in my grub.conf file?  Sorry to have you actually spell it out to me, but this concept makes very little sense to me, and I'm just trying to understand.  I really appreciate you taking the time to help me!   One last question, is there an easier way to edit the grub.conf file?  Right now, I'm using the installation disc and chrooting back into the environment, because I can't seem to get to the file any other way.
> 
> 

 

You need to either add an entry or modify an existing entry to point to the new kernel image (kernel-2.6.22-gentoo-r5).  If you use grub as your bootloader (it is the preferred bootloader, so you would know if you weren't using it), then you simply need to edit /boot/grub/grub.conf with your favorite text editor.  What issues are you having with getting to the file?

----------

## NathanZachary

The way I see it, the more times I configure my kernel manually, the better.  :Smile:   Also, about GRUB, I can't seem to find the grub.conf file.  I know that when I chroot, it is located at /boot/grub/grub.conf, but when I do:

```

nano /boot/grub/grub.conf

```

In my normal booted environment, it says the file doesn't exist.  :Confused: 

----------

## IQgryn

Perhaps your /boot partition has the noauto option in /etc/fstab?  Try running mount /boot as root before attempting to edit the file.  If that doesn't work, post the contents of /etc/fstab and the output of 

```
ls -l / /boot
```

 and I'll look at it in the morning.

----------

## NathanZachary

I will try mounting it manually.  I really appreciate all of your help.  Thank you so much!  :Smile: 

----------

## Ehnvis

Another way to handle the symlink instead of doing the manual ln -s is to use "eselect kernel list" and "eselect kernel set <number>" which handles the symlink nice.

----------

## NathanZachary

I was wondering about using eselect, because I saw it some guide a while ago.  I think that should work nicely.  I also have one more question though.  After I finished this procedure and got the new kernel working, I couldn't start X because it couldn't load the nvidia module.  My really asinine way around that problem was to unmerge the nvidia-drivers and emerge them again.  Then I followed the rest of the process listed in the nvidia guide.  While my method worked, I know that it was terribly inefficient.  Is there an easier method that I can use the next time I update my kernel/symlink?

Thanks again,

Zach

----------

## Ehnvis

emerge module-rebuild

Next time you update your kernel and have built it run "module-rebuild rebuild" and it will rebuild the modules/drivers like madwifi, nvidia and others for you.

----------

## NathanZachary

Thanks for that information; I knew there had to be some easy solution.  :Smile: 

----------

