Error initializing: open : no such file or directory #85

Closed
opened 2025-12-29 01:22:29 +01:00 by adam · 7 comments
Owner

Originally created by @Bpazy on GitHub (Dec 1, 2021).

Error occurred when I tried to run headscale with docker compose.

Here is my operations and error output:

root@5dbbd5e70962:/etc/headscale# ls
config.yaml  db.sqlite  derp.json
root@5dbbd5e70962:/etc/headscale# headscale namespaces create myfirstnamespace
2021/12/01 03:17:11 Error initializing: open : no such file or directory

The content of config.yaml:

server_url: http://headscale.example.host
listen_addr: 0.0.0.0:8080
ip_prefix: 192.168.196.0/24
disable_check_updates: true
log_level: debug
derp_map_path: derp.json
db_type: sqlite3
db_path: db.sqlite
ephemeral_node_inactivity_timeout: "30m"

The content of derp.json is copied from tailscale sample

And docker-compose.yaml with command sudo docker-compose run --build --force-recreate:

version: '3'
services:
  headscale:
    image: headscale/headscale:latest
    restart: always
    ports:
      - "1333:8080"
    volumes:
      - ./config:/etc/headscale/
    stdin_open: true # docker run -i. For debugging
    tty: true        # docker run -t. For debugging
    command: bash
Originally created by @Bpazy on GitHub (Dec 1, 2021). Error occurred when I tried to run headscale with docker compose. Here is my operations and error output: ``` root@5dbbd5e70962:/etc/headscale# ls config.yaml db.sqlite derp.json root@5dbbd5e70962:/etc/headscale# headscale namespaces create myfirstnamespace 2021/12/01 03:17:11 Error initializing: open : no such file or directory ``` The content of `config.yaml`: ``` server_url: http://headscale.example.host listen_addr: 0.0.0.0:8080 ip_prefix: 192.168.196.0/24 disable_check_updates: true log_level: debug derp_map_path: derp.json db_type: sqlite3 db_path: db.sqlite ephemeral_node_inactivity_timeout: "30m" ``` The content of `derp.json` is copied from [tailscale sample](https://raw.githubusercontent.com/tailscale/tailscale/main/net/dnsfallback/dns-fallback-servers.json) And `docker-compose.yaml` with command `sudo docker-compose run --build --force-recreate`: ```yaml version: '3' services: headscale: image: headscale/headscale:latest restart: always ports: - "1333:8080" volumes: - ./config:/etc/headscale/ stdin_open: true # docker run -i. For debugging tty: true # docker run -t. For debugging command: bash ```
adam closed this issue 2025-12-29 01:22:30 +01:00
Author
Owner

@Bpazy commented on GitHub (Dec 1, 2021):

docker run \
  -v $(pwd)/config:/etc/headscale/ \
  -p 127.0.0.1:8080:8080 \
  headscale/headscale:latest \
    headscale namespaces create myfirstnamespace

docker run got the same error: 2021/12/01 06:36:51 Error initializing: open : no such file or directory

And error still occurred headscale/headscale:0.11

@Bpazy commented on GitHub (Dec 1, 2021): ``` docker run \ -v $(pwd)/config:/etc/headscale/ \ -p 127.0.0.1:8080:8080 \ headscale/headscale:latest \ headscale namespaces create myfirstnamespace ``` `docker run` got the same error: `2021/12/01 06:36:51 Error initializing: open : no such file or directory` And error still occurred `headscale/headscale:0.11`
Author
Owner

@negbie commented on GitHub (Dec 1, 2021):

You should try latest master. If you want a binary you can download one from the latest sucessful github action run.

@negbie commented on GitHub (Dec 1, 2021): You should try latest master. If you want a binary you can download one from the latest sucessful github action run.
Author
Owner

@Bpazy commented on GitHub (Dec 5, 2021):

I used the latest from github action but failed again:

ubuntu@shan-tencent:/etc/headscale$ sudo headscale namespaces create myfirstnamespace
2021-12-05T04:59:34Z DBG Setting timeout timeout=5000
2021-12-05T04:59:34Z DBG HEADSCALE_CLI_ADDRESS environment is not set, connecting to unix socket. socket=/var/run/headscale.sock
2021-12-05T04:59:39Z FTL Could not connect: context deadline exceeded error="context deadline exceeded"
@Bpazy commented on GitHub (Dec 5, 2021): I used the latest from github action but failed again: ```sh ubuntu@shan-tencent:/etc/headscale$ sudo headscale namespaces create myfirstnamespace 2021-12-05T04:59:34Z DBG Setting timeout timeout=5000 2021-12-05T04:59:34Z DBG HEADSCALE_CLI_ADDRESS environment is not set, connecting to unix socket. socket=/var/run/headscale.sock 2021-12-05T04:59:39Z FTL Could not connect: context deadline exceeded error="context deadline exceeded" ```
Author
Owner

@kradalby commented on GitHub (Dec 5, 2021):

Was the server running? It looks like it times out because the server isn't running

@kradalby commented on GitHub (Dec 5, 2021): Was the server running? It looks like it times out because the server isn't running
Author
Owner

@Bpazy commented on GitHub (Dec 5, 2021):

Was the server running? It looks like it times out because the server isn't running

@kradalby According to the document Running.md step 5: Create a namespace. The server is not running yet.

@Bpazy commented on GitHub (Dec 5, 2021): > Was the server running? It looks like it times out because the server isn't running @kradalby According to the document [Running.md](https://github.com/juanfont/headscale/blob/main/docs/Running.md) **step 5: Create a namespace**. The server is not running yet.
Author
Owner

@kradalby commented on GitHub (Dec 5, 2021):

Aha, from the new version, in the main branch, the server must be running for the CLI to work, Would be great if you could PR a change to the doc.

@kradalby commented on GitHub (Dec 5, 2021): Aha, from the new version, in the `main` branch, the server _must_ be running for the CLI to work, Would be great if you could PR a change to the doc.
Author
Owner

@strausmann commented on GitHub (Dec 9, 2021):

That's good to know.

How to execute the command "headscale namespaces create myfirstnamespace" with the state of the "main" branch?
Compared to v0.11 which was still based on Ubnutu 20.04, the "main" branch uses a distroless image.
With this image you can't use EXEC anymore, because sh/bash is not available.
Likewise, you cannot integrate HEALTHCHECK in the distroless image, because there is no CURL or WGET, for example.

I can understand that the distroless images are very slim and can also offer little attack surface. But I think that is currently out of proportion.

If you want to use a GO application without any interaction, it makes a lot of sense. But how to interact with the CLI now?

@strausmann commented on GitHub (Dec 9, 2021): That's good to know. How to execute the command "headscale namespaces create myfirstnamespace" with the state of the "main" branch? Compared to v0.11 which was still based on Ubnutu 20.04, the "main" branch uses a distroless image. With this image you can't use EXEC anymore, because sh/bash is not available. Likewise, you cannot integrate HEALTHCHECK in the distroless image, because there is no CURL or WGET, for example. I can understand that the distroless images are very slim and can also offer little attack surface. But I think that is currently out of proportion. If you want to use a GO application without any interaction, it makes a lot of sense. But how to interact with the CLI now?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#85