Skip to content

Segmentation fault (alpine) #528

New issue

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

By clicking “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? Sign in to your account

Closed
Tarocch1 opened this issue Apr 18, 2019 · 12 comments
Closed

Segmentation fault (alpine) #528

Tarocch1 opened this issue Apr 18, 2019 · 12 comments
Labels
bug Something isn't working

Comments

@Tarocch1
Copy link

  • code-server version: 1.868-vsc1.33.1
  • OS Version: alpine 3.9.3 (not in docker)

Description

If source code folder (code-server-1.868-vsc1.33.1) exists, code-server run fine, otherwise, code-server gets segmentation fault.

Steps to Reproduce

  1. Unzip code-server-1.868-vsc1.33.1.zip in /root
  2. yarn
  3. Add target option as alpine in /root/code-server-1.868-vsc1.33.1/packages/server/scripts/nbin.ts
  4. export NODE_ENV=production
  5. apk add libxkbfile-dev libsecret-dev
  6. yarn task build:server:binary
  7. cp /root/code-server-1.868-vsc1.33.1/packages/server/cli-linux-x64 /usr/local/bin/code-server
  8. code-server -H -N --disable-telemetry (work fine)
  9. mv /root/code-server-1.868-vsc1.33.1 /root/code-server-1.868-vsc1.33 (use mv as rm)
  10. code-server -H -N --disable-telemetry:
(node:13387) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(),
Buffer.allocUnsafe(), or Buffer.from() methods instead.
INFO  code-server development
INFO  Additional documentation: http://github.com/codercom/code-server
INFO  Initializing {"data-dir":"/root/.local/share/code-server","extensions-dir":"/root/.local/share/code-server/extensions","working-d
ir":"/root/work/backup","log-dir":"/root/.cache/code-server/logs/20190418071423996"}
INFO  Starting webserver... {"host":"0.0.0.0","port":8443}
WARN  No certificate specified. This could be insecure.
WARN  Documentation on securing your setup: https://github.com/codercom/code-server/blob/master/doc/security/ssl.md
WARN  Launched without authentication.
INFO
INFO  Started (click the link below to open):
INFO  http://localhost:8443/
INFO
INFO  Starting shared process [1/5]...
WARN  stderr {"data":"(node:13399) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please us
e the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n"}
INFO  Connected to shared process
INFO  WebSocket opened / {"client":1,"ip":"192.168.56.1"}
INFO  Starting shared process [1/5]... {"error":"Exited with null"}
WARN  stderr {"data":"(node:13432) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please us
e the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n"}
INFO  Connected to shared process
INFO  Starting shared process [1/5]... {"error":"Exited with null"}
[1]    13387 segmentation fault  code-server -H -N --disable-telemetry
@Tarocch1 Tarocch1 added the bug Something isn't working label Apr 18, 2019
@arvati
Copy link

arvati commented Apr 22, 2019

some error here at alpine (no docker) using lxc

wget https://github.com/codercom/code-server/archive/1.903-vsc1.33.1.zip
unzip 1.903-vsc1.33.1.zip
cd code-server-1.903-vsc1.33.1
yarn
nano packages/server/scripts/nbin.ts

take a look at = coder/nbin#3 (comment)

const bin = new Binary({
        mainFile: path.join(rootDir, "out", "cli.js"),
 target: 'alpine',
});

now last step

npm_config_build_from_source=true NODE_ENV=production npm_config_unsafe_perm=true yarn task build:server:binary --force
cp packages/server/cli-linux-x64 /usr/local/bin/code-server
code-server -H -N --disable-telemetry

same error = segment-fault after openning url

mv /root/code-server-1.903-vsc1.33.1 /root/code-server-1.903-vsc1.33
code-server -H -N --disable-telemetry

alternative install:

cd /
mv /root/code-server-1.903-vsc1.33.1 /opt/code-server-1.903-vsc1.33.1
cd /opt/code-server-1.903-vsc1.33.1
rm /opt/code-server-1.903-vsc1.33.1/packages/server/cli-linux-x64
rm /usr/local/bin/code-server
yarn
npm_config_build_from_source=true NODE_ENV=production npm_config_unsafe_perm=true yarn task build:server:binary --force
ln -s ../../../opt/code-server-1.903-vsc1.33.1/packages/server/cli-linux-x64 /usr/local/bin/code-server
code-server -H -N --disable-telemetry

code-server --help

Usage: code-server [options]
Run VS Code on a remote server.
Options:
  -V, --version               output the version number
  --cert <value>
  --cert-key <value>
  -e, --extensions-dir <dir>  Set the root path for extensions.
  -d --user-data-dir <dir>    Specifies the directory that user data is kept in, useful when running as root.
  --data-dir <value>          DEPRECATED: Use '--user-data-dir' instead. Customize where user-data is stored.
  -h, --host <value>          Customize the hostname. (default: "0.0.0.0")
  -o, --open                  Open in the browser on startup.
  -p, --port <number>         Port to bind on. (default: 8443)
  -N, --no-auth               Start without requiring authentication.
  -H, --allow-http            Allow http connections.
  -P, --password <value>      Specify a password for authentication.
  --disable-telemetry         Disables ALL telemetry.
  --help                      output usage information

Defaut Options:
data dir:    
~/.local/share/code-server       
extensions-dir:    
~/.local/share/code-server/extensions    
working-dir:    
~/code-server-1.903-vsc1.33.1    
log-dir:      
~/.cache/code-server/logs/20190422213854056    
url :      
http://192.168.1.75:8443/ or
https://192.168.1.75:8443/ 

@kylecarbs
Copy link
Member

This is because your native modules need to be built on alpine as well.

@Gooseware
Copy link

This is an issue because your docker image now suffers from this fault

WARN stderr {"data":"(node:20) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n"}
internal/child_process.js:366
throw errnoException(err, 'spawn');
^

Error: spawn ENOMEM
at ChildProcess.spawn (internal/child_process.js:366:11)
at Object.spawn [as _spawn] (child_process.js:538:9)
at t.async (/src/packages/server/out/cli.js:504:34598)
at e.exports (/src/packages/server/out/cli.js:504:34099)
at e (/src/packages/server/out/cli.js:504:32722)
at Timeout.u [as _onTimeout] (/src/packages/server/out/cli.js:504:33015)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)

@kylecarbs
Copy link
Member

You ran out of mem. Likely isn't an issue with the docker image

@tobbenb
Copy link

tobbenb commented Jun 3, 2019

I have been trying to get code-server working inside an alpine container, and had the same issue as the OP.
The problem is that the node_modules in the root of the directory you start the build in is needed when opening the webui.
From the build, the needed file is:
/source-folder/packages/server/cli-musl-x64
The directory needed is:
/source-folder/node_modules

The binary can be located where you want, but the node_modules directory needs to be located at the same place as during build.

Is this a bug in the build process or do I need to supply something to get the node_modules included in the binary?

@arvati
Copy link

arvati commented Jun 7, 2019

gist to install code-server using alpine lxc

I needed to compile from source again to get it working.

@TGATM-Magnus
Copy link

Has any one managed to actually get a working docker image here? I tried starting from a blank alpine:latest image today with the help of arvati's gist but somehow the build process is difficult to get to complete (at least for me XD). Also taking tobbenb's input and trying to fake the build by putting the already built binary together with the code repository after initializing node_modules doesn't really resolve the segmentation issue...the interface loads (I even get past the login screen) but then the process dies.

@arvati
Copy link

arvati commented Jun 28, 2019

these are packages installed on alpine. Check if some of them are missing before start compilation

apk info

musl
busybox
alpine-baselayout
openrc
alpine-conf
libcrypto1.1
libssl1.1
ca-certificates-cacert
libtls-standalone
ssl_client
zlib
apk-tools
busybox-suid
busybox-initscripts
scanelf
musl-utils
libc-utils
alpine-keys
alpine-base
ca-certificates
c-ares
libgcc
libstdc++
libuv
nodejs
npm
yarn
libmagic
ncurses-terminfo-base
ncurses-terminfo
ncurses-libs
openssh-keygen
libedit
openssh-client
openssh-sftp-server
openssh-server-common
openssh-server
openssh
screen
libssh2
expat
git
libgpg-error
libassuan
libcap
pinentry
libbz2
libgcrypt
gmp
nettle
libffi
p11-kit
libtasn1
libunistring
gnutls
libksba
db
libsasl
libldap
npth
sqlite-libs
gnupg
keychain
gdbm
readline
xz-libs
python3
gettext-asprintf
libintl
gettext-libs
libgomp
libxml2
gettext
gettext-dev
pkgconf
zlib-dev
bzip2-dev
linux-headers
libffi-dev
libuuid
libblkid
libfdisk
libmount
libsmartcols
util-linux-dev
libxml2-utils
libxslt
docbook-xml
docbook-xsl
pcre
glib
libpcre16
libpcre32
libpcrecpp
pcre-dev
glib-dev
libsecret
libsecret-dev
libxau
libbsd
libxdmcp
libxcb
libx11
libxkbfile
xorgproto
libxau-dev
xcb-proto
libpthread-stubs
libxdmcp-dev
libxcb-dev
xtrans
libx11-dev
libxkbfile-dev
make
m4
perl
autoconf
automake
binutils
isl
libatomic
mpfr3
mpc1
gcc
musl-dev
libc-dev
g++
bash
libltdl
libtool
nghttp2-libs
libcurl
pcre2
nano
http-parser
python2
openssl
curl

@TGATM-Magnus
Copy link

Thanks for that list - if I find the time I will try it tomorrow again...for now I at least got it to work on minideb.

@Merith-TK
Copy link
Contributor

Merith-TK commented Aug 23, 2019

2019-08-23-103220_1280x800_scrot

When running pre-built binary
(note, that is alpine Linux on real hardware, Its just my rice that looks windowsy)

EDIT: Same issue on Firefox

@nhooyr
Copy link
Contributor

nhooyr commented Jan 28, 2020

See #1306

@nhooyr nhooyr closed this as completed Jan 28, 2020
@nhooyr
Copy link
Contributor

nhooyr commented Jan 28, 2020

Nvm, this should be fixed. If this still occurs, please feel free to reopen.

@nhooyr nhooyr reopened this Jan 28, 2020
@nhooyr nhooyr closed this as completed Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants