Skip to content
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

Unable to write program user data when invoking VS Code Portable in a singularity image #74130

Closed
rickstaa opened this issue May 22, 2019 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug install-update VS Code installation and upgrade system issues portable-mode VS Code portable mode issues verified Verification succeeded
Milestone

Comments

@rickstaa
Copy link

rickstaa commented May 22, 2019

Problem description:
I am trying to install vs code inside a singularity image. I, unfortunately, haven't been able to do this as I keep running into some problems. I first tried to install vs code inside the container using the .dep package. However, as inside this container, the vs code program doesn't have write permissions to the user data and data folder on the main system it wont start. To solve this I tried using the portable version as this is explained in the vscode portable documentation. Unfortunately, also this gave me the user-data and data directories should be writable error.

System information:

  • VSCode Version: 1.34.0
  • OS Version: Ubuntu 16.04 (Singularity container)

Steps to Reproduce:

  1. Install singularity according to this guide.
  2. Build a ubuntu 16.04 singularity image by running the following command:
    sudo singularity build --sandbox ubuntu1604 docker://ubuntu:16.04
  3. When finished run the shell as sudo by using sudo singularity run --nv --writable ubuntu1604
  4. Download the lates tar.gz and unzip it:
curl -L "https://go.microsoft.com/fwlink/?LinkID=620884" > vscode-stable.tar.gz
tar xzf vscode-stable.tar.gz
  1. Go into the VSCode-linux-x64 folder.
  2. Create a user-data and data folder as explained in the vscode portable documentation.
  3. Try to run the VSCode program by executing sh ./bin/code.
  4. You will now get the following error message:

image

This can be solved by running the shell as sudo but as this has some risks I was wondering if I can solve the error so that I can run vscode as a normal user from within a singularity container.

Extra information:
Does this issue occur when all extensions are disabled?: Yes

--verbose output:
Gtk-Message: Failed to load module "appmenu-gtk-module" Gtk-Message: Failed to load module "canberra-gtk-module" Gtk-Message: Failed to load module "canberra-gtk-module" [9043:0522/143121.884272:ERROR:bus.cc(394)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged. [main 2019-05-22T12:31:27.080Z] Error: listen EACCES /run/user/1000/vscode-5f7fbcc5-1.34.0-main.sock at Server.setupListenHandle [as _listen2] (net.js:1313:19) at listenInCluster (net.js:1378:12) at Server.listen (net.js:1477:5) at Promise (/jan/VSCode-linux-x64/resources/app/out/vs/code/electron-main/main.js:184:637) at new Promise (<anonymous>) at Object.t.serve (/jan/VSCode-linux-x64/resources/app/out/vs/code/electron-main/main.js:184:574) at n (/jan/VSCode-linux-x64/resources/app/out/vs/code/electron-main/main.js:490:263) at R (/jan/VSCode-linux-x64/resources/app/out/vs/code/electron-main/main.js:492:559) at l.invokeFunction (/jan/VSCode-linux-x64/resources/app/out/vs/code/electron-main/main.js:221:331) at then (/jan/VSCode-linux-x64/resources/app/out/vs/code/electron-main/main.js:494:347) [main 2019-05-22T12:31:27.084Z] Lifecycle#kill()

@vscodebot vscodebot bot added the install-update VS Code installation and upgrade system issues label May 22, 2019
@joaomoreno
Copy link
Member

joaomoreno commented May 23, 2019

This sounds more like an issue with how you configured the container, rather than with Code itself. Just make sure those folders are writable by whatever user Code is run as.

@joaomoreno joaomoreno added the info-needed Issue requires more information from poster label May 23, 2019
@rickstaa
Copy link
Author

@joaomoreno thanks for your response. I moved the issue to the singularity repository since I think this is indeed caused by a misunderstanding on my side on how singularity sets its user and group permissions.

@rickstaa
Copy link
Author

rickstaa commented May 27, 2019

Dear @joaomoreno I just got a response back from @rherban of the singularity repository who looked into my issue. He states that this issue might be caused by a deeper issue with vscode as while vscode gives the error writability error (see below) it can write data to the two data folders.

image

This can be seen from the fact that after the error is displayed, visual code appears to have populated the two folders with files.

[ricks@vscode]:~$ tree VSCode-linux-x64/data/
VSCode-linux-x64/data/
├── extensions
└── user-data
    ├── Backups
    ├── CachedData
    │   └── 5e1f9440d280b0b04cba843df6a0032bf517a2f0
    │       ├── bom-handling-b1716cdee35ff4762811cdcc843d7e96.code
    │       ├── dialog-34d1f7eee309f38a5250515ce6dcdb2b.code
    │       ├── extend-node-07ba1a9859a18c5869c4e0f59e54c27d.code
    │       ├── index-2a8af058d3e45af3b803c37f72a9379d.code
    │       ├── index-df4365cf379486c71562b3dc7304f303.code
    │       ├── main-7d4c18276698f568d0569214f70350a5.code
    │       ├── main.nls-90db9fc49f10cddf806fc31152c6dd1e.code
    │       ├── safer-1a434c00da794394212555f5808d94d1.code
    │       └── streams-e0cd9dcbbe043b48a9f4efe0e37b647f.code
    ├── logs
    │   ├── 20190524T110722
    │   ├── 20190524T111335
    │   ├── 20190524T113408
    │   ├── 20190524T113522
    │   ├── 20190524T124920
    │   └── 20190524T125223
    └── User
        ├── globalStorage
        └── workspaceStorage

15 directories, 9 files

@truatpasteurdotfr
Copy link

truatpasteurdotfr commented May 27, 2019

can you retry with the singularity flag -B /run and without it? code starts fine with -B /run but yields the same misleading errors without.

@rickstaa
Copy link
Author

The solution given by @truatpasteurdotfr solved my problem and therefore is a good workaround for people that experience the same issue. @joaomoreno do you maybe know why vscode needs access to the /run directory to run inside a singularity image. As @truatpasteurdotfr pointed out on the related singularity issue google chrome, and the brave browser also require the /run directory to run.

@joaomoreno
Copy link
Member

Oh I see what's happening:

The XDG_RUNTIME_DIR is taking precedence, regardless of portable. That is definitely wrong. Must fix.

@joaomoreno joaomoreno added portable-mode VS Code portable mode issues bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels May 28, 2019
@joaomoreno joaomoreno added this to the May 2019 milestone May 28, 2019
@rickstaa
Copy link
Author

@joaomoreno Thanks a lot for looking into it? Is there a way to watch this bug so I know when it is fixed? I looked into the may 2019 milestones but it is already closed there.

@rickstaa
Copy link
Author

rickstaa commented May 28, 2019

Ah, I tested it out and this bug appears to be fixed! You can now also use the .deb package inside a singularity image without receiving the writability error. Thanks a lot, @joaomoreno.

@joaomoreno
Copy link
Member

It was fixed today, so the next Insiders build (tomorrow) will have the fix. The next stable (next week) will have the fix.

@lramos15 lramos15 added the verified Verification succeeded label May 30, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug install-update VS Code installation and upgrade system issues portable-mode VS Code portable mode issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants