proot-based non-root setup: refusing to run with elevated privileges (UID 0)

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Florian Thevissen
  • Pjotr Prins
Owner
unassigned
Submitted by
Florian Thevissen
Severity
normal
F
F
Florian Thevissen wrote on 15 Feb 2019 21:39
(address . bug-Guix@gnu.org)
81415b97-6e02-33dc-a4da-b1b046d5a4e7@florian-thevissen.de
Hi,

I am trying to get guix to run on a system where I do not have root
access, following a guide by pjotrp involving proot, here:

All guix operations that involve the script perform-download fail with
the error:

guix perform-download: error: refusing to run with elevated
privileges (UID 0)

I am not sure if this hints at a bug in guix itself, but a comment in
the guix sources lets me assume so. It says in package-management.scm:355

“Note that scripts like ‘guix perform-download’ do not run as root (…)”

In my setup, following this guide, however, it apparently is run as
root, and (assert-low-privileges) in the script perform-download.scm:89
acts accordingly by signalling the error and exiting.

(By the way - running guix-daemon with proot root privileges fails (-0),
and running it without (no -0) fails also.)

Now my question: why is perform-download run as root following pjotrs
guide, and is there anything that can be done about it?

I am a bit at a loss here, being unfamiliar with the guix sources and
overall system setup.

Looking forward to help, thanks,

Florian

?
Attachment: file
P
P
Pjotr Prins wrote on 16 Feb 2019 07:34
(name . Florian Thevissen)(address . mail@florian-thevissen.de)(address . bug-Guix@gnu.org)
20190216063452.xllpdkhz4lc4jz4q@thebird.nl
Did you try something like

proot -0 -b /proc -b /dev -b /etc -r . -b etc_guix/acl:/etc/guix/acl gnu/store/vir3l..-guix-0.x/bin/guix-daemon --disable-chroot

(note the extra -0 and chroot switches) and you should see on a guix package install.

That used to work. But maybe no longer?

On Fri, Feb 15, 2019 at 09:39:21PM +0100, Florian Thevissen wrote:
Toggle quote (40 lines)
> Hi,
>
> I am trying to get guix to run on a system where I do not have root
> access, following a guide by pjotrp involving proot, here:
> [1]https://github.com/pjotrp/guix-notes/blob/master/GUIX-NO-ROOT.org .
>
> All guix operations that involve the script perform-download fail with
> the error:
>
> guix perform-download: error: refusing to run with elevated
> privileges (UID 0)
>
> I am not sure if this hints at a bug in guix itself, but a comment in
> the guix sources lets me assume so. It says in
> package-management.scm:355
>
> “Note that scripts like ‘guix perform-download’ do not run as root
> (…)”
>
> In my setup, following this guide, however, it apparently is run as
> root, and (assert-low-privileges) in the script perform-download.scm:89
> acts accordingly by signalling the error and exiting.
>
> (By the way - running guix-daemon with proot root privileges fails
> (-0), and running it without (no -0) fails also.)
>
> Now my question: why is perform-download run as root following pjotrs
> guide, and is there anything that can be done about it?
>
> I am a bit at a loss here, being unfamiliar with the guix sources and
> overall system setup.
>
> Looking forward to help, thanks,
>
> Florian
> ?
>
> References
>
> 1. https://github.com/pjotrp/guix-notes/blob/master/GUIX-NO-ROOT.org
F
F
Florian Thevissen wrote on 16 Feb 2019 10:04
(name . Pjotr Prins)(address . pjotr.public12@thebird.nl)(address . bug-Guix@gnu.org)
0d4fc2ca-da74-dbb4-7e7d-df090b19a19f@florian-thevissen.de
Hi pjotr,

Did you try something like

proot -0 -b /proc -b /dev -b /etc -r . -b etc_guix/acl:/etc/guix/acl
gnu/store/vir3l..-guix-0.x/bin/guix-daemon —disable-chroot

Yes, this doesn’t work - with or without the -0 flag.

That used to work. But maybe no longer?

I tried the new guix binaries (0.16.0), and the ones that were recent
when you wrote the guide (0.13.0), and proot has not, if I see
correctly, significantly changed since then (v.5.1.0).

To me, this looks as if the setup on my particular system had something
special to it that would lead guix to not behave correctly. Here’s a
#guix chat-log, where Saone (at 00:25:29) comes to the same conclusion:

For the record - this happens on an Debian 4.9.130-2 x86_64 system. I'll
try this out on other systems/VMs today...



On 16/02/19 07:34, Pjotr Prins wrote:

Toggle quote (50 lines)
> Did you try something like
>
> proot -0 -b /proc -b /dev -b /etc -r . -b etc_guix/acl:/etc/guix/acl gnu/store/vir3l..-guix-0.x/bin/guix-daemon --disable-chroot
>
> (note the extra -0 and chroot switches) and you should see on a guix package install.
>
> That used to work. But maybe no longer?
>
> On Fri, Feb 15, 2019 at 09:39:21PM +0100, Florian Thevissen wrote:
>> Hi,
>>
>> I am trying to get guix to run on a system where I do not have root
>> access, following a guide by pjotrp involving proot, here:
>> [1]https://github.com/pjotrp/guix-notes/blob/master/GUIX-NO-ROOT.org .
>>
>> All guix operations that involve the script perform-download fail with
>> the error:
>>
>> guix perform-download: error: refusing to run with elevated
>> privileges (UID 0)
>>
>> I am not sure if this hints at a bug in guix itself, but a comment in
>> the guix sources lets me assume so. It says in
>> package-management.scm:355
>>
>> “Note that scripts like ‘guix perform-download’ do not run as root
>> (…)”
>>
>> In my setup, following this guide, however, it apparently is run as
>> root, and (assert-low-privileges) in the script perform-download.scm:89
>> acts accordingly by signalling the error and exiting.
>>
>> (By the way - running guix-daemon with proot root privileges fails
>> (-0), and running it without (no -0) fails also.)
>>
>> Now my question: why is perform-download run as root following pjotrs
>> guide, and is there anything that can be done about it?
>>
>> I am a bit at a loss here, being unfamiliar with the guix sources and
>> overall system setup.
>>
>> Looking forward to help, thanks,
>>
>> Florian
>> ?
>>
>> References
>>
>> 1. https://github.com/pjotrp/guix-notes/blob/master/GUIX-NO-ROOT.org

?
Attachment: file
F
F
Florian Thevissen wrote on 16 Feb 2019 11:07
(name . Pjotr Prins)(address . pjotr2019@thebird.nl)
e1babb24-bfb2-e591-1bc0-e00aade073d1@florian-thevissen.de
Thanks, Pjotr.

So I got it working on one system out of four, following the exact same
steps each time:

* Debian 9 (Stretch) - 4.9.130-2 x86_64 (real system) - *_fail_*
* Ubuntu 17.10 (Artful Aardvark) - 4.13.0-46-lowlatency (real system)
     - _*fail*_
* Ubuntu 14.04 (Trusty Tahr)  - 4.4.0-31-generic - _*fail*_
* Debian 9 (Stretch) - 4.9.0-8-amd64 (VM)    - _*works*_

I don't know what the significant differentiating factor could be, that
lets guix behave correctly on that one debian system but not on the others.

But what I also noticed, is that the "list of substitutes" is also not
being updated on the three failing systems. Is the update process using
the download script internally, maybe, and that silently fails? Or maybe
this hints at another problem?

I fear there's nothing more I can immediately do. @Ludo - can you help?



On 16/02/19 10:17, Pjotr Prins wrote:
Toggle quote (92 lines)
> Sorry about that.
>
> If you get it to work, do update the document - or me by E-mail. Maybe
> Ludo has something to say about this.
>
> Pj.
>
> On Sat, Feb 16, 2019 at 10:04:03AM +0100, Florian Thevissen wrote:
>> Hi pjotr,
>>
>> Did you try something like
>>
>> proot -0 -b /proc -b /dev -b /etc -r . -b etc_guix/acl:/etc/guix/acl
>> gnu/store/vir3l..-guix-0.x/bin/guix-daemon —disable-chroot
>>
>> Yes, this doesn’t work - with or without the -0 flag.
>>
>> That used to work. But maybe no longer?
>>
>> I tried the new guix binaries (0.16.0), and the ones that were recent
>> when you wrote the guide (0.13.0), and proot has not, if I see
>> correctly, significantly changed since then (v.5.1.0).
>>
>> To me, this looks as if the setup on my particular system had something
>> special to it that would lead guix to not behave correctly. Here’s a
>> #guix chat-log, where Saone (at 00:25:29) comes to the same conclusion:
>> [1]https://gnunet.org/bot/log/guix/2017-09-21 .
>> For the record - this happens on an Debian 4.9.130-2 x86_64 system.
>> I'll try this out on other systems/VMs today...
>>
>> On 16/02/19 07:34, Pjotr Prins wrote:
>>
>> Did you try something like
>>
>> proot -0 -b /proc -b /dev -b /etc -r . -b etc_guix/acl:/etc/guix/acl gnu/store/v
>> ir3l..-guix-0.x/bin/guix-daemon --disable-chroot
>>
>> (note the extra -0 and chroot switches) and you should see on a guix package ins
>> tall.
>>
>> That used to work. But maybe no longer?
>>
>> On Fri, Feb 15, 2019 at 09:39:21PM +0100, Florian Thevissen wrote:
>>
>> Hi,
>>
>> I am trying to get guix to run on a system where I do not have root
>> access, following a guide by pjotrp involving proot, here:
>> [1][2]https://github.com/pjotrp/guix-notes/blob/master/GUIX-NO-ROOT.org .
>>
>> All guix operations that involve the script perform-download fail with
>> the error:
>>
>> guix perform-download: error: refusing to run with elevated
>> privileges (UID 0)
>>
>> I am not sure if this hints at a bug in guix itself, but a comment in
>> the guix sources lets me assume so. It says in
>> package-management.scm:355
>>
>> “Note that scripts like ‘guix perform-download’ do not run as root
>> (…)”
>>
>> In my setup, following this guide, however, it apparently is run as
>> root, and (assert-low-privileges) in the script perform-download.scm:89
>> acts accordingly by signalling the error and exiting.
>>
>> (By the way - running guix-daemon with proot root privileges fails
>> (-0), and running it without (no -0) fails also.)
>>
>> Now my question: why is perform-download run as root following pjotrs
>> guide, and is there anything that can be done about it?
>>
>> I am a bit at a loss here, being unfamiliar with the guix sources and
>> overall system setup.
>>
>> Looking forward to help, thanks,
>>
>> Florian
>> ?
>>
>> References
>>
>> 1. [3]https://github.com/pjotrp/guix-notes/blob/master/GUIX-NO-ROOT.org
>>
>> ?
>>
>> References
>>
>> 1. https://gnunet.org/bot/log/guix/2017-09-21
>> 2. https://github.com/pjotrp/guix-notes/blob/master/GUIX-NO-ROOT.org
>> 3. https://github.com/pjotrp/guix-notes/blob/master/GUIX-NO-ROOT.org
Attachment: file
L
L
Ludovic Courtès wrote on 4 Mar 2019 22:45
(name . Florian Thevissen)(address . mail@florian-thevissen.de)(address . bug-Guix@gnu.org)
87lg1unwje.fsf@gnu.org
Hi Florian,

Florian Thevissen <mail@florian-thevissen.de> skribis:

Toggle quote (4 lines)
> I am trying to get guix to run on a system where I do not have root
> access, following a guide by pjotrp involving proot, here:
> https://github.com/pjotrp/guix-notes/blob/master/GUIX-NO-ROOT.org .

Not really answering your question, but would user namespaces be an
option for you?

If so,
might be a simpler option.

Thanks,
Ludo’.
F
F
Florian Thevissen wrote on 5 Mar 2019 19:57
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . bug-Guix@gnu.org)
3ecb593e-49d1-e728-4a48-d4eaf9a675d2@florian-thevissen.de
Hi Ludovic,

Not really answering your question, but would user namespaces be an
option for you? If so,
might be a simpler option.

Thank you for the suggestion, this does look interesting.

However, the original use-case of using guix in a non-root scenario is
no longer relevant to me: I was convincing enough to get guix
root-installed on all relevant machines on which I do not have root
access. So I can enjoy guix properly, now.

However, I could very well imagine guix to be used on a per-user basis,
acting on some sub-directory of $HOME. Afterall, many (most?)
desktop-systems are used by a single user - or so I would argue…

On the original topic - I recently learned that the mechanisms proot
employs might just not work on all systems. So the issue may not per-se
have been with guix, but with proot. I’m no expert on the subject
though, and didn’t dig deeper yet.

Best regards,
Florian

?
Attachment: file
L
L
Ludovic Courtès wrote on 6 Mar 2019 17:00
(name . Florian Thevissen)(address . mail@florian-thevissen.de)(address . bug-Guix@gnu.org)
87d0n4f0wt.fsf@gnu.org
Hi Florian,

Florian Thevissen <mail@florian-thevissen.de> skribis:

Toggle quote (14 lines)
> Hi Ludovic,
>
> Not really answering your question, but would user namespaces be an
> option for you? If so,
> <https://lists.gnu.org/archive/html/guix-devel/2018-05/msg00139.html>
> might be a simpler option.
>
> Thank you for the suggestion, this does look interesting.
>
> However, the original use-case of using guix in a non-root scenario is
> no longer relevant to me: I was convincing enough to get guix
> root-installed on all relevant machines on which I do not have root
> access. So I can enjoy guix properly, now.

Well, congrats. :-)

Note that https://guix-hpc.bordeaux.inria.fr/blog has some thoughts on
non-root usage that may be of interest to you.

Toggle quote (4 lines)
> However, I could very well imagine guix to be used on a per-user
> basis, acting on some sub-directory of $HOME. Afterall, many (most?)
> desktop-systems are used by a single user - or so I would argue…

I agree that non-root usage would be useful; it’s just that the kernel
Linux doesn’t make it easy, unless user namespaces are enabled…

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 6 Mar 2019 17:00
control message for bug #34494
(address . control@debbugs.gnu.org)
87bm2of0wh.fsf@gnu.org
tags 34494 notabug
close 34494
?