-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Bug] Latest Docker Release Breaks Foreign Key Constraint in Database #2373
Comments
I also had this issue ( in sqlite ) but running direct with no docker - I deleted the node using cmd line and it started up ok |
Which release did you upgrade from? This is unfortunate, this part of the code seem to be a minefield as there has been years of no constraint, allowing a lot of stale broken nodes/routes/keys being written to the database. The biggest challenge for me is figuring out what will blow up or needs to be removed before and what will not. |
@kradalby I was/am, on the Whatever version was assigned to the |
I can also say that pulling a backup and using any other container image updated today results in the same issue, so I was not able to go back to an earlier version unless it was really old. |
The same issue, on my side, I try to upgrade my Headscale from 0.23 to 0.24.1 |
If anyone have a database they could strip of personal info that they can send to me, then that would be helpful for me to include in a test case. My email is in my profile. |
I have not found any of this issue on any of my "long running instances", so I suspect that there is an old node that has been around from before certain constraint was introduced and now they are violating. |
@kradalby It depends on what "long running" means in this context, but my server has been up for 2-3 years. |
Thanks @xcjs for your solution!
My Headscale v0.24.1 works perfectly!!! |
I can probably do this with my backup copy of my database, but allow me a few days to look into scrubbing it. |
Thanks for publishing this here! I was going to try and mention it in passing at least for other people facing the issue. |
Is this a support request?
Is there an existing issue for this?
Current Behavior
Upon Watchtower updating the Headscale container, the following log messages repeat until the container dies:
2025-01-23T16:16:11Z INF Opening database database=sqlite3 path=/var/lib/headscale/db.sqlite 2025-01-23T16:16:11Z ERR Foreign key constraint violated parent=pre_auth_keys row_id=3 table=nodes 2025-01-23T16:16:11Z FTL Migration failed: foreign key constraints violated error="foreign key constraints violated"
The container updates from the
latest
tag, but it looks like several other container versions were pushed at the same time. I'm assuming (but haven't verified yet) that this correlates with 0.24.1 release, but definitely the release that occurred ~20 minutes ago.Expected Behavior
I would expect the database migration to succeed.
Steps To Reproduce
Updating the Docker container from a prior release to the release triggered 20 minutes ago on the latest tag should recreate this error.
Environment
Runtime environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: