all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* modprobe on guix
@ 2015-03-24 22:39 白い熊@相撲道
  2015-03-25 12:57 ` Mark H Weaver
  0 siblings, 1 reply; 9+ messages in thread
From: 白い熊@相撲道 @ 2015-03-24 22:39 UTC (permalink / raw)
  To: guix-devel

How do I load a kernel module in Guix?

I can insmod the concrete .ko file from the /gnu/store/... kernel 
directory, however this is impractical for scripts etc, since the 
directory will change with system reconfigure.

However 'sudo modprobe ...' doesn't load the kernel module...
-- 
白い熊@相撲道

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: modprobe on guix
@ 2015-09-20 18:55 Petter
  2015-09-21 16:10 ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: Petter @ 2015-09-20 18:55 UTC (permalink / raw)
  To: guix-devel

I've investigated a bit and have some light to shed on this issue.

First, I've tested printing the value of LINUX_MODULE_DIRECTORY as
suggested previously in this thread, and found it not to be a good test.

$ sudo bash -c "echo $LINUX_MODULE_DIRECTORY"
> /run/booted-system/kernel/lib/modules,
which shows indeed the expected output, but for the wrong reason.

This would be the shell doing the variable expansion while still in the
user's environment. Which makes it in effect similar to:
$ sudo bash -c "echo /run/booted-system/kernel/lib/modules"

Overwriting the variable in the user environment demonstrates this.
$ LINUX_MODULE_DIRECTORY=hello
$ sudo bash -c "echo $LINUX_MODULE_DIRECTORY"
> hello

Testing single quotes instead, which should leave the variable
unexpanded by the first shell.
$ sudo bash -c "echo $USER"
> petter
$ sudo bash -c 'echo $USER'
> root

And so this would be a better test.
$ sudo bash -c 'echo $LINUX_MODULE_DIRECTORY'
>
(empty value.)

As best i can find out  sudo  doesn't source any of the relevant shell
files, like /etc/profile; and so the root environment isn't set up like
if you logged in as root. And variables from the user environment isn't
passed on to it either. Besides using  sudo -E  , which passes on all
the user's environment variables (not recommended), the easiest fix
seems to be to use  sudo -i  . With  -i, --login  shell files will be
sourced, and we get an environment equal to being root user as far as i
can tell.

$ sudo -i bash -c 'echo $LINUX_MODULE_DIRECTORY'
> /run/booted-system/kernel/lib/modules

I don't know what the proper way of handling this is. But i'm using an
alias at the moment  alias sudo='sudo -i'  . With this  sudo modprobe
works fine.

(I've looked at whitelisting environment variables in /etc/sudoers, but
i believe this is for passing on user defined variables, not system
variables.)

Petter
(karhunguixi)

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: modprobe on guix
@ 2015-09-22  8:32 Petter
  2015-09-22 12:45 ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: Petter @ 2015-09-22  8:32 UTC (permalink / raw)
  To: guix-devel

> One solution would be to provide a /etc/environment file containing the
> right value for LINUX_MODULE_DIRECTORY (‘sudo’ honors that, according to
> sudoers(5).)

Yes, this is interesting. When i considered this previously i
prematurely put it aside because it requires PAM, and i wrongly
concluded our sudo wasn't configured with PAM (based on package
definition). On second look, i see PAM is on by default for Linux
distributions when building sudo; also running  sudo -V  as root user
confirms this. However, creating /etc/environment and putting stuff
there doesn't have any effect for me. But i believe the reason is that a
module needs to be added to linux-pam, namely pam_env[1].

I'd like to have a go at this and see if i can make a patch for this.

Maybe it makes sense to put /all/ the environment variables, especially
for root operations, in /etc/environment? From what i understand
variables from outside this file will not be expanded, so if not it
would mean duplicating definitions. Also, having this as a
just-for-those-sudo-users would be easy for root users to miss
updating. Then obviously root logins would have to make use of this file
as well, but i'm sure that can be arranged. I'll look more into this.

[1] http://www.linux-pam.org/Linux-PAM-html/sag-pam_env.html

Petter

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-22 12:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-24 22:39 modprobe on guix 白い熊@相撲道
2015-03-25 12:57 ` Mark H Weaver
2015-03-25 18:22   ` Alex Kost
2015-03-25 21:01     ` Ludovic Courtès
2015-03-26 13:06       ` Alex Kost
  -- strict thread matches above, loose matches on Subject: below --
2015-09-20 18:55 Petter
2015-09-21 16:10 ` Ludovic Courtès
2015-09-22  8:32 Petter
2015-09-22 12:45 ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.