-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Remove key.json file if it appears to be corrupted (#1706) * Check with jq if key.json is parsable
- Loading branch information
Showing
2 changed files
with
14 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
buildroot-external/rootfs-overlay/etc/systemd/system/docker.service.d/failure.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
[Unit] | ||
FailureAction=reboot | ||
|
||
[Service] | ||
ExecStopPost=/usr/libexec/docker-failure |
11 changes: 11 additions & 0 deletions
11
buildroot-external/rootfs-overlay/usr/libexec/docker-failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
if [ "$SERVICE_RESULT" = "exit-code" ] && [ "$EXIT_STATUS" = "1" ]; then | ||
echo "Docker exited with exit status 1, this might be caused by corrupted key.json." | ||
size=$(stat -c %s "/etc/docker/key.json") | ||
echo "key.json: ${size} bytes" | ||
if ! jq < "/etc/docker/key.json" > /dev/null || [ "${size}" -eq 0 ]; then | ||
echo "key.json appears to be corrupted, it is not parsable. Removing it." | ||
rm -f "/etc/docker/key.json" | ||
fi | ||
fi |