# SOLVED: Headscale error: "Could not connect: context deadline exceeded"

**URL:** https://forum.yunohost.org/t/solved-headscale-error-could-not-connect-context-deadline-exceeded/31901
**Category:** Support apps
**Tags:** vpnserver, english
**Created:** [November 9, 2024, 12:19pm UTC](https://forum.yunohost.org/t/solved-headscale-error-could-not-connect-context-deadline-exceeded/31901 "2024-11-09T12:19:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mowie](https://forum.yunohost.org/user_avatar/forum.yunohost.org/mowie/32/9298_2.png) [@mowie](https://forum.yunohost.org/u/mowie)
#### Post date: [November 9, 2024, 12:19pm UTC](https://forum.yunohost.org/t/solved-headscale-error-could-not-connect-context-deadline-exceeded/31901/1 "2024-11-09T12:19:59Z")

</div>

**What type of hardware are you using** : VPS bought online  
**What YunoHost version are you running** : 11.3.0.2  
**What app is this about** : Headscale

### Describe your issue

Hey,

i found the same issue here: [Problème d'ajout d'utilisateur dans Headscale](https://forum.yunohost.org/t/probleme-dajout-dutilisateur-dans-headscale/31043) but the thread is already closed. I could only find little help elsewhere, thats why i thought it might be helpful to others to open a new thread with the solution. (Even though posting a reply to the thread above seems better. Maybe a moderator can fix this?)

# Headscale error: “Could not connect: context deadline exceeded” solved it as follows:

## Can’t run “headscale”?

Use “\_\_INSTALL\_DIR/headscale” instead  
(thanks to the yunohost admin doc: “To call Headscale’s program, use sudo -u bash \_\_INSTALL\_DIR/headscale followed by its parameters.”)

## NOTE: “sudo -u bash” is NOT working!

Yunohost admin doc help (“To call Headscale’s program, use sudo -u bash \_\_INSTALL\_DIR/headscale followed by its parameters.”) did not work for me. I guess the user is missing?  
Try: “sudo” without “-u bash”.  
(Or) Try: “sudo -u headscale”

> **Full error message**
>
> “sudo: unknown user: bash”)

## Can’t find the “\_\_INSTALL\_DIR”?

Try: “/var/www/headscale/”

## Get “Error loading config”?

Try passing the path to the config file: “\_\_INSTALL\_DIR/headscale/config.yaml”  
(Example: “-c /var/www/headscale/config.yaml”)  
(Thanks to [Problème d'ajout d'utilisateur dans Headscale](https://forum.yunohost.org/t/probleme-dajout-dutilisateur-dans-headscale/31043) )

> **Full error message**
>
> Error loading config error="fatal error reading config file: Config File "config" Not Found in "[/etc/headscale /root/.headscale /home/yunoadmin]".)

## Get “Could not connect”?

Try: “headscale serve” before running your headscale command:

- “sudo mkdir /var/run/headscale” (not sure if this is needed)
- “sudo /var/www/headscale/headscale -c /var/www/headscale/config.yaml serve”

> **Full error message**
>
> “Could not connect: context deadline exceeded error=“context deadline exceeded””)

### Share relevant logs or error messages

Error messages shared in the post. Hope that is ok 🙂

Cheers

---

<div class="post-metadata">

### Author: ![tituspijean](https://forum.yunohost.org/user_avatar/forum.yunohost.org/tituspijean/32/3584_2.png) [@tituspijean](https://forum.yunohost.org/u/tituspijean)
#### Post date: [November 9, 2024, 1:04pm UTC](https://forum.yunohost.org/t/solved-headscale-error-could-not-connect-context-deadline-exceeded/31901/2 "2024-11-09T13:04:11Z")

</div>

I would need to update that piece of documentation. The best way to do so now is:

```auto
yunohost app shell headscale
# that opens a shell in the app's context
./headscale -c config.yaml [your command]

```

Edit: done in v0.23.0~ynh2. 😉

---

<div class="post-metadata">

### Author: ![system](https://forum.yunohost.org/uploads/default/original/2X/f/f59fe8e3ee6b100b4f574d30d6e30479c68b89f0.png) [@system](https://forum.yunohost.org/u/system)
#### Post date: [November 24, 2024, 1:04pm UTC](https://forum.yunohost.org/t/solved-headscale-error-could-not-connect-context-deadline-exceeded/31901/3 "2024-11-24T13:04:45Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
