Skip to content

Conversation

@balejk
Copy link

@balejk balejk commented Nov 3, 2021

Recently I needed to run a glibc dependent program on musl, preferably without having root privileges, and I had difficulties getting proot to work properly. It would have been useful to know about xbps-uunshare, because that worked out of the box, plus it is usually preinstalled on Void and no additional packages need to be installed.

@Duncaen
Copy link
Member

Duncaen commented Nov 3, 2021

We should not suggest proot at all for that, because it is that cursed and mostly broken and not required on a void system since we have user namespaces enabled.

I don't like to suggest xbps-uunshare, its made for xbps-src and not a general namespace/container tool, I would prefer to only suggest bubblewrap or similar programs.

@ericonr
Copy link
Member

ericonr commented Nov 3, 2021

I think the only advantage proot brings is that it allows you to fake chroot into a root owned dir. I don't think you can do that with bwrap or xbps-uunshare, might be wrong though.

@balejk
Copy link
Author

balejk commented Nov 5, 2021

I don't like to suggest xbps-uunshare, its made for xbps-src and not a general namespace/container tool, I would prefer to only suggest bubblewrap or similar programs.

I wasn't aware of this. bubblewrap seems to work for me, shall I instead of mentioning xbps-uunshare just replace proot with bubblewrap then?

@ericonr
Copy link
Member

ericonr commented Nov 14, 2021

I think that would be preferable! Thanks c:

@balejk balejk changed the title musl.md: mention xbps-uunshare musl.md: replace proot mention with bubblewrap Nov 14, 2021
@balejk balejk requested a review from Vaelatern November 14, 2021 09:52
chroot using [umount(8)](https://man.voidlinux.org/umount.8).

#### PRoot
#### bubblewrap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### bubblewrap
#### Bubblewrap

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the bubblewrap README it was not clear to me whether the official name is stylized with capital or lower "B" and as neither musl, nor glibc chroot section titles are capitalized, I chose the lowercase variant which seemed more likely based on the README. However, the README uses capital "B" in the title so indeed let's use that.

Comment on lines 53 to 56
An alternative for unprivileged users is the
[bwrap(1)](https://man.voidlinux.org/bwrap) command which uses Linux namespaces
to run applications in a sandbox container. It can be installed via the
`bubblewrap` package.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
An alternative for unprivileged users is the
[bwrap(1)](https://man.voidlinux.org/bwrap) command which uses Linux namespaces
to run applications in a sandbox container. It can be installed via the
`bubblewrap` package.
An alternative for unprivileged users is
[bwrap(1)](https://man.voidlinux.org/bwrap.1), which uses Linux namespaces. It can be installed via the
`bubblewrap` package. An example invocation is shown below:

Then include an example of how to use it, since it's not always obvious, IMO.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I omitted an example invocation because from CONTRIBUTING I inferred that it's preferred that readers study the manual page and decide for themselves which options will best suit their needs. Anyway, if you have any experience with this utility, please propose some full example, as all I needed to do in my case was

$ bwrap --bind path/to/chroot / command

which seems too basic.

Copy link
Member

@ericonr ericonr Nov 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this case the command is helpful, since what's desired from the tool isn't immediately obvious. I'd suggest adding --proc /proc and --dev /dev, at least.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'm currently unable to get a container set up using

$ XBPS_TARGET_ARCH=x86_64 xbps-install -S -r /tmp/chroot -R https://... base-voidstrap

to work properly - I have used

$ bwrap --bind /tmp/chroot / --uid 0 --gid 0 --dev  /dev --proc /proc --ro-bind /etc/resolv.conf /etc/resolv.conf sh

to chroot into it, but when I try to ping voidlinux.org, I get ping: socket: Operation not permitted. What am I missing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, apparently it's because of capabilities.

@ericonr
Copy link
Member

ericonr commented Nov 29, 2021

Ping?

@balejk
Copy link
Author

balejk commented Nov 29, 2021

Sorry, I'm just busy lately, but I didn't forget.

My last effort was to use bubblewrap to launch torbrowser-launcher on musl, but I haven't been successful. So I'd first like to be able to do that and then use that as an example. Any hints are appreciated.

@ericonr
Copy link
Member

ericonr commented Nov 29, 2021

Ok, just checking!

Can you share errors you got, if any? Given that torbrowser will probably use namespaces on its own, there might be some confusion.

@balejk
Copy link
Author

balejk commented Dec 3, 2021

Currently I'm getting

Tor Browser Launcher
By Micah Lee, licensed under MIT
version 0.3.5
https://github.com/micahflee/torbrowser-launcher
Traceback (most recent call last):
  File "/bin/torbrowser-launcher", line 30, in <module>
    torbrowser_launcher.main()
  File "/usr/lib/python3.10/site-packages/torbrowser_launcher/__init__.py", line 76, in main
    common = Common(tor_browser_launcher_version)
  File "/usr/lib/python3.10/site-packages/torbrowser_launcher/common.py", line 71, in __init__
    self.init_gnupg()
  File "/usr/lib/python3.10/site-packages/torbrowser_launcher/common.py", line 282, in init_gnupg
    self.import_keys()
  File "/usr/lib/python3.10/site-packages/torbrowser_launcher/common.py", line 367, in import_keys
    imported = self.import_key_and_check_status(key)
  File "/usr/lib/python3.10/site-packages/torbrowser_launcher/common.py", line 337, in import_key_and_check_status
    with gpg.Context() as c:
  File "/usr/lib/python3.10/site-packages/gpg/core.py", line 206, in __init__
    self.protocol = protocol
  File "/usr/lib/python3.10/site-packages/gpg/core.py", line 161, in __setattr__
    super(GpgmeWrapper, self).__setattr__(key, value)
  File "/usr/lib/python3.10/site-packages/gpg/core.py", line 885, in protocol
    errorcheck(gpgme.gpgme_engine_check_version(value))
  File "/usr/lib/python3.10/site-packages/gpg/errors.py", line 120, in errorcheck
    raise GPGMEError(retval, extradata)
gpg.errors.GPGMEError: GPGME: Invalid crypto engine

gnupg, gpgme and libgpgme are all installed in the container.

@balejk balejk requested a review from ericonr June 20, 2022 14:43
@balejk
Copy link
Author

balejk commented Sep 5, 2022

@ericonr I believe this is ready for another review.

classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Sep 5, 2022
- based on the section of installation/musl
- remove proot
- add xchroot, xbps-uchroot, xbps-uunshare, and bwrap

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Sep 5, 2022
- based on the section of installation/musl
- remove proot
- add xchroot, xbps-uchroot, xbps-uunshare, and bwrap

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Sep 8, 2022
- based on the section of installation/musl
- remove proot
- add xchroot, xbps-uchroot, xbps-uunshare, and bwrap

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Sep 8, 2022
- based on the section of installation/musl
- remove proot
- add xchroot, xbps-uchroot, xbps-uunshare, and bwrap

supercedes:
- closes void-linux#300
- closes void-linux#610
@balejk
Copy link
Author

balejk commented Oct 22, 2022

@classabbyamp I see you are working on some changes rendering this pull request rather obsolete, can I close it then?

@classabbyamp
Copy link
Member

up to you, I haven't been able to test what i wrote fully yet

classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Dec 23, 2022
- based on the section of installation/musl
- remove proot
- add xchroot, xbps-uchroot, xbps-uunshare, and bwrap
- mention OCI containers

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Dec 23, 2022
- based on the section of installation/musl
- remove proot
- add xchroot, xbps-uchroot, xbps-uunshare, and bwrap
- mention OCI containers

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Dec 23, 2022
- based on the section of installation/musl
- remove proot
- add xchroot, xbps-uchroot, xbps-uunshare, and bwrap
- mention OCI containers

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Dec 23, 2022
- based on the section of installation/musl
- remove proot
- add xchroot, xbps-uchroot, xbps-uunshare, and bwrap
- mention OCI containers

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Dec 23, 2022
- based on the section of installation/musl
- remove proot
- add xchroot, xbps-uchroot, xbps-uunshare, and bwrap
- mention OCI containers

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Dec 23, 2022
- based on the section of installation/musl
- remove proot
- add xchroot and bwrap
- mention OCI containers

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Dec 23, 2022
- based on the section of installation/musl
- remove proot
- add xchroot and bwrap
- mention flatpak and OCI containers

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Dec 24, 2022
- based on the section of installation/musl
- remove proot
- add xchroot and bwrap
- mention flatpak and OCI containers

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Dec 24, 2022
- based on the section of installation/musl
- remove proot
- add xchroot and bwrap
- mention flatpak and OCI containers

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Dec 25, 2022
- based on the section of installation/musl
- remove proot
- add xchroot and bwrap
- mention flatpak and OCI containers

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit to classabbyamp/void-docs that referenced this pull request Dec 26, 2022
- based on the section of installation/musl
- remove proot
- add xchroot and bwrap
- mention flatpak and OCI containers

supercedes:
- closes void-linux#300
- closes void-linux#610
classabbyamp added a commit that referenced this pull request Dec 27, 2022
- based on the section of installation/musl
- remove proot
- add xchroot and bwrap
- mention flatpak and OCI containers

supercedes:
- closes #300
- closes #610
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants