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

rm: cannot remove 'target': Device or resource busy #5007

Open
1 of 2 tasks
richb-hanover opened this issue Nov 12, 2024 · 3 comments
Open
1 of 2 tasks

rm: cannot remove 'target': Device or resource busy #5007

richb-hanover opened this issue Nov 12, 2024 · 3 comments
Labels
bug Invalid compiler output or panic

Comments

@richb-hanover
Copy link
Contributor

What happened?

This is a refined report from #4974. It appears that the problem with my M2 Mac is that something is wrong with the file system in the Dev Container, and that files/directories cannot be modified.

I have removed all containers, images, and volumes for PRQL and the caches to rebuild the entire Dev Container. I don't intentionally have any external processes running on the Mac that would occupy the Dev Container file system.

@max-sixty @eitsupi @vanillajonathan Here's the evidence I have. What else could I collect? Thanks.

  • wasm-pack is not installed, running cargo install wasm-pack gives this error:
    error: failed to create directory /usr/local/cargo/registry/cache/index.crates.io-6f17d22bba15001f

  • task web:run-book gives this error:

    vscode ➜ /workspaces/prql (main) $ task web:run-book
    task: [web:run-book] mdbook serve --port=3000 -n 0.0.0.0
    2024-11-12 11:46:14 [INFO] (mdbook::book): Book building has started
        Updating crates.io index
      Downloaded colorchoice v1.0.1
    error: failed to create directory `/usr/local/cargo/registry/cache/index.crates.io-6f17d22bba15001f`
    
  • cd /workspaces/prql; rm -rf target gives this error:

vscode ➜ /workspaces/prql (main) $ ls -al
total 296
drwxr-xr-x 35 vscode vscode   1120 Nov 12 00:49 .
drwxr-xr-x  3 root   root     4096 Nov  5 03:29 ..
-rw-r--r--  1 vscode vscode   1924 Oct 19 22:37 bacon.toml
drwxr-xr-x  3 vscode vscode     96 Oct 19 22:37 .cargo
-rw-r--r--  1 vscode vscode 122537 Nov 12 00:49 Cargo.lock
-rw-r--r--  1 vscode vscode   1670 Nov 12 00:49 Cargo.toml
-rw-r--r--  1 vscode vscode  59433 Nov  5 03:42 CHANGELOG.md
drwxr-xr-x  7 vscode vscode    224 Nov  5 03:42 .config
drwxr-xr-x  4 vscode vscode    128 Oct 19 22:37 .devcontainer
-rw-r--r--  1 vscode vscode  10244 Nov 12 03:20 .DS_Store
-rw-r--r--  1 vscode vscode   4571 Nov  5 03:42 flake.lock
-rw-r--r--  1 vscode vscode   2882 Nov  5 03:42 flake.nix
drwxr-xr-x 16 vscode vscode    512 Nov 12 00:49 .git
-rw-r--r--  1 vscode vscode    640 Oct 19 22:37 .gitattributes
drwxr-xr-x 10 vscode vscode    320 Oct 19 22:37 .github
-rw-r--r--  1 vscode vscode    809 Oct 19 22:37 .gitignore
drwxr-xr-x  9 vscode vscode    288 Nov  5 00:45 grammars
-rw-r--r--  1 vscode vscode  10273 Oct 19 22:37 LICENSE
drwxr-xr-x  9 vscode vscode    288 Nov  5 03:35 lutra
-rw-r--r--  1 vscode vscode    535 Oct 19 22:37 .markdownlint-cli2.yaml
-rw-r--r--  1 vscode vscode   1928 Oct 19 22:37 .mega-linter.yaml
drwxr-xr-x 12 vscode vscode    384 Nov  5 05:26 node_modules
-rw-r--r--  1 vscode vscode   3086 Nov 12 00:49 .pre-commit-config.yaml
-rw-r--r--  1 vscode vscode    486 Oct 19 22:37 .prettierignore
-rw-r--r--  1 vscode vscode    183 Oct 19 22:37 .prettierrc.yaml
drwxr-xr-x 10 vscode vscode    320 Nov  5 03:42 prqlc
-rw-r--r--  1 vscode vscode   8076 Nov  5 03:42 README.md
-rw-r--r--  1 vscode vscode    285 Nov  5 03:42 rust-toolchain.toml
-rw-r--r--  1 vscode vscode     62 Oct 19 22:37 .sqlfluff
drwxr-xr-x  2 vscode vscode   4096 Nov 12 11:49 target
drwxr-xr-x  4 vscode vscode    128 Nov  5 03:30 .task
-rw-r--r--  1 vscode vscode  13869 Nov  5 03:42 Taskfile.yaml
-rw-r--r--  1 vscode vscode    546 Nov  5 03:42 .typos.toml
drwxr-xr-x  3 vscode vscode     96 Oct 19 22:37 .vscode
drwxr-xr-x  9 vscode vscode    288 Nov  5 00:45 web
vscode ➜ /workspaces/prql (main) $ ls -al target
total 4
drwxr-xr-x  2 vscode vscode 4096 Nov 12 11:49 .
drwxr-xr-x 35 vscode vscode 1120 Nov 12 00:49 ..
vscode ➜ /workspaces/prql (main) $ rm -rf target
rm: cannot remove 'target': Device or resource busy
vscode ➜ /workspaces/prql (main) $ 

PRQL input

N/A

SQL output

N/A

Expected SQL output

N/A

MVCE confirmation

  • Minimal example
  • New issue

Anything else?

No response

@richb-hanover richb-hanover added the bug Invalid compiler output or panic label Nov 12, 2024
@vanillajonathan
Copy link
Collaborator

This is a file system permission issue. It seems you can around it by running:

sudo chown vscode /usr/local/cargo/registry/

@max-sixty
Copy link
Member

  • cd /workspaces/prql; rm -rf target gives this error:

Currently we map target into the container. Could you try rm -rf target/* or cargo clean?

@max-sixty
Copy link
Member

max-sixty commented Nov 12, 2024

This is a file system permission issue. It seems you can around it by running:

sudo chown vscode /usr/local/cargo/registry/

Yes, this seems like good advice. For context, we also map this as a volume:

{
"source": "devcontainer-cargo-cache-${devcontainerId}",
"target": "/usr/local/cargo/registry",
"type": "volume"
},

...though only run chown on the target path:

"set-ownership": "sudo chown vscode target",


For more context, we use a non-root user: https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user. (I've traditionally used a root user in all my docker containers, but ofc trust @eitsupi 's judgement here — and possibly this is standard for dev containers. I don't think it's PRQL that is setting the user to vscode. You could try "remoteUser": "root" in devcontainer.json as an alternative.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Invalid compiler output or panic
Projects
None yet
Development

No branches or pull requests

3 participants