# x11-drivers/nvidia-drivers-334.21: Unable to emerge

## UX.MAN

Hi,

I'm getting the following error when trying to emerge x11-drivers/nvidia-drivers-334.21:

```
make: Entering an unknown directory

make: *** /lib/modules/3.12.13-gentoo/build: Permission denied.  Stop.

make: Leaving an unknown directory

make[1]: *** [sub-make] Error 2

make[1]: Leaving directory `/usr/src/linux-3.12.13-gentoo'

NVIDIA: left KBUILD.

 nvidia.ko failed to build!

make: *** [nvidia.ko] Error 1
```

I can't find any inconsistencies in my system and have no clue what this is about.

I have uploaded the full log here:

http://pastebin.com/rVERV5fG

If anyone can help, I would appreciate!

----------

## Jaglover

Methinks you should file a bug - bugs.gentoo.org

----------

## UX.MAN

I was thinking about doing that. I will file a bug report.

If anyone has anything else to add, please update this post.

----------

## roarinelk

does the directory exist? and the kernel sources for it?

don't build kernels as root, use a default user for that.

----------

## UX.MAN

Yes, the directory exists. Also, I have always compiled the kernel as root within /usr/src/linux directory; I don't believe it represents any kind of  security risks.

I have filed in a bug report for this error. It's not been confirmed yet, but it might be. If you want to follow, here is the link https://bugs.gentoo.org/show_bug.cgi?id=506216

If the bug is confirmed, I will mark this thread as being temporarily solved, and will switch it to solved once a patch is developed.Last edited by UX.MAN on Tue Apr 01, 2014 6:33 pm; edited 1 time in total

----------

## Hu

 *UX.MAN wrote:*   

> I don't believe it represents any kind of  security risks.

 You are free to believe what you like, but the advice from roarinelk is sound.  Nothing in the kernel build process requires root privilege, so you should not give it root privilege.  Additionally, I have seen anecdotes of bugs, usually in early series -rc kernels, that would do substantial damage if run as root but be relatively harmless if run as an unprivileged user.

----------

## UX.MAN

Ok, the building process does not require root privileges, but the installation of modules does.

I will follow your suggestions and build the kernel as an unprivileged user, and them build the modules as root. I'll also remove any reminiscences of all other kernels I have previously installed and get back to you.

Stay tuned!

----------

## Chiitoo

 *Hu wrote:*   

> Nothing in the kernel build process requires root privilege, so you should not give it root privilege.  Additionally, I have seen anecdotes of bugs, usually in early series -rc kernels, that would do substantial damage if run as root but be relatively harmless if run as an unprivileged user.

 

Be that as it may, I can't remember nor find a mention of this in the handbook or the wikki.  As such, I imagine it's more likely for users to do just that, be they new or not-so-new.

I, too, tend to do it as root.  Whether it's a habit of old, or a risk I'm willing to take for no particular reason(s), I don't know.  ^^;

----------

## UX.MAN

@Chiitoo I agree with you. This should be mentioned on the handbook or wiki. None of this information is noted there.

I have found that there is a wiki article describing how to remove all the leftovers of previously installed kernels (here: https://wiki.gentoo.org/wiki/Kernel/Removal). I did not know that the kernel modules where left at /lib/modules/'your_kernel_version', even after unmerging gentoo-sources and even running a depclean.

I will try all this and get back to you with a brief report.

----------

## Hu

 *Chiitoo wrote:*   

> Be that as it may, I can't remember nor find a mention of this in the handbook or the wikki.  As such, I imagine it's more likely for users to do just that, be they new or not-so-new.
> 
> I, too, tend to do it as root.  Whether it's a habit of old, or a risk I'm willing to take for no particular reason(s), I don't know.  ^^;

 Right, Gentoo does not mention it.  I think I saw passing reference to it on LKML long ago.  I did not save a link or I would gladly share it here.

Incidentally, I like out-of-tree kernel builds for the convenience of building multiple distinct kernel configurations from a single kernel source tree.  Once you have out-of-tree working, building as an unprivileged user is an easy addition.  To build out of tree, set $KBUILD_OUTPUT to the directory where objects should go.  To stage an install, set $INSTALL_PATH and $INSTALL_MOD_PATH for the main kernel image and the modules, respectively.

----------

