Skip to content

Go code, and nushell do not work in an alpine linux container I've created #158

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Open
godalming123 opened this issue Jan 18, 2025 · 2 comments

Comments

@godalming123
Copy link

godalming123 commented Jan 18, 2025

Firstly, thanks for creating the most complete developer environment I've found that runs fully in the web browser.

I've created a quite modified docker container that adds the go programming language, the helix text editor, nu shell, and the lf terminal file explorer to the environment. The code is here, and the live environment is here. My image also uses alpine linux instead of debian since alpine has more and newer packages (helix does not exist in the debain repos, nushell does not exist in the debian repos, and go has an older version in debain repos). 2nd note: I'm happy to break these into separate issues if you want.

Below is a list of issues that I'm having in order of importance. Note that everything below seems to work fine when I run the docker container locally with the command sudo docker build . --file dockerfiles/debian_mini --tag "debian_mini"; sudo docker run -it debian_mini.

Go, gopls (the language server for go), and lf do not work

All of these programs fail with the same error:

 runtime: panic before malloc heap initialized

 runtime stack:
 runtime.throw({0x8733ba3, 0x1e})
         runtime/panic.go:1067 +0x35 fp=0xc00ffdc4 sp=0xc00ffdb0 pc=0x80bc5b5
 runtime.mallocinit()
         runtime/malloc.go:387 +0x476 fp=0xc00ffdf0 sp=0xc00ffdc4 pc=0x8056c46
 runtime.schedinit()
         runtime/proc.go:818 +0xe6 fp=0xc00ffe30 sp=0xc00ffdf0 pc=0x80863a6
 runtime.rt0_go()
         runtime/asm_386.s:243 +0x161 fp=0xc00ffe34 sp=0xc00ffe30 pc=0x80c1d01

I think that this is caused by part of the go startup code, since all of these tools are at least partially written in go.

Nushell does not start

When I try to start nushell with the nu command, after being prompted about wether I should create the default configs in my config directory, I get the error written repeated forever in the console:

Error: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }

Things that don't affect me

These things don't affect me, although they still seem to be inconsistencies between how the container works when it is ran with webvm compared to when it is ran with docker.

USER root

Adding USER root in the dockerfile changes the user of the startup shell to root in docker, but doesn't appear to do anything in webvm (whoami still outputs user).

Doas

Setting up doas, and running doas sh in the container allows an unprivileged shell to get superuser privileges in docker, but creates the following error in webvm:

doas: Operation not permitted

Sudo

Setting up sudo and running sudo sh in the container allows an unprivileged shell to get superuser privileges in docker, but in webvm, it just asks for the user password, and then creates the following error:

sudo: error in event loop: Function not implemented
sudo: unexpected child termination condition: 0
@godalming123 godalming123 changed the title Go and lf executable do not work when installed from the alpine linux Go code, root access, and nushell do not work in an alpine linux container I've created Jan 18, 2025
@alexp-sssup
Copy link
Member

Thanks for getting in touch, another member of our team will be in touch about the various bugs. Please understand that it might take a while for all these issues to be identified and solved.

Accessing root, on the other hand, is an easy fix. Just use su. You can also change the WebVM initialization to run the shell as root. See here: https://cheerpx.io/docs/reference/CheerpX-Linux-run

@godalming123 godalming123 changed the title Go code, root access, and nushell do not work in an alpine linux container I've created Go code, and nushell do not work in an alpine linux container I've created Jan 18, 2025
@godalming123
Copy link
Author

Accessing root, on the other hand, is an easy fix. Just use su.

Thanks, turns out that /bin/su doesn't have setuid on by default in alpine linux, so this just needs me to add 1 line to the dockerfile to fix: RUN chmod +s /bin/su

No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants