[core] check_for_gh_release issue #1816

Closed
opened 2025-11-20 05:17:53 -05:00 by saavagebueno · 16 comments
Owner

Originally created by @MrBrisk on GitHub (Aug 29, 2025).

Have you read and understood the above guidelines?

yes

📜 What is the name of the script you are using?

pocket-id

📂 What was the exact command used to execute the script?

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/pocketid.sh)"

⚙️ What settings are you using?

  • Default Settings
  • Advanced Settings

🖥️ Which Linux distribution are you using?

Debian 12

📈 Which Proxmox version are you on?

8.4.5

📝 Provide a clear and concise description of the issue.

I went to update my pocket-id installation today, but I ran into a strange error. What I found was that the file that is supposed to contain the version of the app (in this case pocket-id) is getting cleared somewhere, which then results in the upgrade script doing a check (if [[ "$(cat ~/.pocket-id)" < "1.0.0" ]];) with an empty string, which results in the script trying to migrate to 1.0.0 despite the fact that I am already running a version beyond it, causing the error.

I dug in to the new helper function check_for_gh_release for checking for a new release and found at the end that the version file ~/.pocket-id is indeed being cleared out if there is a version mismatch

if [[ -z "$current" || "$current" != "$latest" ]]; then
    CHECK_UPDATE_RELEASE="$latest"
    msg_info "New release available: v${latest} (current: v${current:-none})"
    : >"$current_file"
    return 0
fi

If this is expected behavior, the current version will need to be captured in the pocketid.sh script before check_for_gh_release is called. Do you really think it wise to clear the current saved version in the function in this manner though? It seems likely that there are other scripts which may do specific version checks after calling this function, and I don't see a reason why it would need to be cleared out here either, but feel free to correct.

🔄 Steps to reproduce the issue.

run the update command on a pocket-id installation other than latest.

Paste the full error output (if available).

⠋ Migrating PocketIDFailed to disable unit: Unit file pocketid-backend.service does not exist.
⠼ Migrating PocketID
[ERROR] in line 35: exit code 0: while executing command systemctl -q disable --now pocketid-backend pocketid-frontend caddy

🖼️ Additional context (optional).

No response

Originally created by @MrBrisk on GitHub (Aug 29, 2025). ### ✅ Have you read and understood the above guidelines? yes ### 📜 What is the name of the script you are using? pocket-id ### 📂 What was the exact command used to execute the script? bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/pocketid.sh)" ### ⚙️ What settings are you using? - [ ] Default Settings - [ ] Advanced Settings ### 🖥️ Which Linux distribution are you using? Debian 12 ### 📈 Which Proxmox version are you on? 8.4.5 ### 📝 Provide a clear and concise description of the issue. I went to update my pocket-id installation today, but I ran into a strange error. What I found was that the file that is supposed to contain the version of the app (in this case pocket-id) is getting cleared somewhere, which then results in the upgrade script doing a check (` if [[ "$(cat ~/.pocket-id)" < "1.0.0" ]]; `) with an empty string, which results in the script trying to migrate to 1.0.0 despite the fact that I am already running a version beyond it, causing the error. I dug in to the new helper function `check_for_gh_release` for checking for a new release and found at the end that the version file ~/.pocket-id is indeed being cleared out if there is a version mismatch ``` if [[ -z "$current" || "$current" != "$latest" ]]; then CHECK_UPDATE_RELEASE="$latest" msg_info "New release available: v${latest} (current: v${current:-none})" : >"$current_file" return 0 fi ``` If this is expected behavior, the current version will need to be captured in the pocketid.sh script before `check_for_gh_release` is called. Do you really think it wise to clear the current saved version in the function in this manner though? It seems likely that there are other scripts which may do specific version checks after calling this function, and I don't see a reason why it would need to be cleared out here either, but feel free to correct. ### 🔄 Steps to reproduce the issue. run the update command on a pocket-id installation other than latest. ### ❌ Paste the full error output (if available). ⠋ Migrating PocketIDFailed to disable unit: Unit file pocketid-backend.service does not exist. ⠼ Migrating PocketID [ERROR] in line 35: exit code 0: while executing command systemctl -q disable --now pocketid-backend pocketid-frontend caddy ### 🖼️ Additional context (optional). _No response_
saavagebueno added the bug label 2025-11-20 05:17:53 -05:00
Author
Owner

@MickLesk commented on GitHub (Aug 29, 2025):

I dont know what you mean. Many Text but less information for me.

Whats in the .pocket-id before update?
What is the current Version?
What is the target version?
What is the exact output?
Whats in the pocket-id after Update?

@MickLesk commented on GitHub (Aug 29, 2025): I dont know what you mean. Many Text but less information for me. Whats in the .pocket-id before update? What is the current Version? What is the target version? What is the exact output? Whats in the pocket-id after Update?
Author
Owner

@MrBrisk commented on GitHub (Aug 29, 2025):

I dont know what you mean. Many Text but less information for me.

Whats in the .pocket-id before update? What is the current Version? What is the target version? What is the exact output? Whats in the pocket-id after Update?

I am running pocket-id version 1.9.1
prior to the update, ~/.pocket-id contains 1.9.1
I want to update to 1.10.0 (the newest version)
I wish I could give you a better output, but that is exactly what is on my screen after I run the update command
after running the update and the error occurs, there is nothing in the ~/.pocket-id file

This is from the updated pocketid.sh file:

if check_for_gh_release "pocket-id" "pocket-id/pocket-id"; then
    if [[ "$(cat ~/.pocket-id)" < "1.0.0" ]]; then
      msg_info "Migrating ${APP}"
      systemctl -q disable --now pocketid-backend pocketid-frontend caddy
  • prior to the if statement that calls the new check_for_gh_release function, ~/.pocket-id still contains 1.9.1
  • The new function correctly identifies that a new version is available, but in the process clears ~/.pocket-id
  • a now empty ~/.pocket-id is then read again to compare to "1.0.0" because there were breaking changes in this version, but since an empty string is alphabetically less than "1.0.0" it begins to execute the code necessary to migrate to 1.0.0 instead of skipping to the upgrade. This false migration causes the error, since pocketid-backend and pocketid-frontend are already gone.
@MrBrisk commented on GitHub (Aug 29, 2025): > I dont know what you mean. Many Text but less information for me. > > Whats in the .pocket-id before update? What is the current Version? What is the target version? What is the exact output? Whats in the pocket-id after Update? I am running pocket-id version 1.9.1 prior to the update, ~/.pocket-id contains 1.9.1 I want to update to 1.10.0 (the newest version) I wish I could give you a better output, but that is exactly what is on my screen after I run the update command after running the update and the error occurs, there is _nothing_ in the ~/.pocket-id file This is from the updated pocketid.sh file: ``` if check_for_gh_release "pocket-id" "pocket-id/pocket-id"; then if [[ "$(cat ~/.pocket-id)" < "1.0.0" ]]; then msg_info "Migrating ${APP}" systemctl -q disable --now pocketid-backend pocketid-frontend caddy ``` - prior to the if statement that calls the new `check_for_gh_release` function, ~/.pocket-id still contains 1.9.1 - The new function correctly identifies that a new version is available, but in the process clears ~/.pocket-id - a now empty ~/.pocket-id is then read again to compare to "1.0.0" because there were breaking changes in this version, but since an empty string is alphabetically less than "1.0.0" it begins to execute the code necessary to migrate to 1.0.0 instead of skipping to the upgrade. This false migration causes the error, since pocketid-backend and pocketid-frontend are already gone.
Author
Owner

@tremor021 commented on GitHub (Aug 29, 2025):

Empty ~/.pocket-id should never happen. As its only one binary that gets deployed, i suggest you backing up your .env file and deploying a fresh new LXC.

@tremor021 commented on GitHub (Aug 29, 2025): Empty `~/.pocket-id` should never happen. As its only one binary that gets deployed, i suggest you backing up your .env file and deploying a fresh new LXC.
Author
Owner

@MrBrisk commented on GitHub (Aug 29, 2025):

Empty ~/.pocket-id should never happen. As its only one binary that gets deployed, i suggest you backing up your .env file and deploying a fresh new LXC.

Is ~/.pocket-id not just a text file to hold the current version of the app? I believe the binary for pocket-id is in /opt/pocket-id

@MrBrisk commented on GitHub (Aug 29, 2025): > Empty `~/.pocket-id` should never happen. As its only one binary that gets deployed, i suggest you backing up your .env file and deploying a fresh new LXC. Is `~/.pocket-id` not just a text file to hold the current version of the app? I believe the binary for pocket-id is in `/opt/pocket-id`
Author
Owner

@MickLesk commented on GitHub (Aug 29, 2025):

Yep its the Version File, but its only Created empty If there is Not exist (exmpl. old Installation with _version.txt)

@MickLesk commented on GitHub (Aug 29, 2025): Yep its the Version File, but its only Created empty If there is Not exist (exmpl. old Installation with _version.txt)
Author
Owner

@MickLesk commented on GitHub (Aug 29, 2025):

Ah lol, all right. I think I see the issue. It's not because of the new function, it was there before, but nobody reported it.

A string comparison is made so < 1.1.0, theoretically everything is < 1.1.0 with a string comparison

@MickLesk commented on GitHub (Aug 29, 2025): Ah lol, all right. I think I see the issue. It's not because of the new function, it was there before, but nobody reported it. A string comparison is made so < 1.1.0, theoretically everything is < 1.1.0 with a string comparison
Author
Owner

@MrBrisk commented on GitHub (Aug 29, 2025):

hmmm, "1.9.1" < "1.0.0" should evaluate to false in bash. And I updated pocket-id with zero issues just a few days ago, the issue has only started with the new function. Am I incorrect that the contents of ~/.pocket-id will always be cleared before this comparison is even made?

if [[ -z "$current" || "$current" != "$latest" ]]; then
    CHECK_UPDATE_RELEASE="$latest"
    msg_info "New release available: v${latest} (current: v${current:-none})"
    : >"$current_file"
    return 0
fi

This line : >"$current_file" is emptying ~/.pocket-id in the event that there is a version mismatch right?

@MrBrisk commented on GitHub (Aug 29, 2025): hmmm, `"1.9.1" < "1.0.0"` should evaluate to false in bash. And I updated pocket-id with zero issues just a few days ago, the issue has only started with the new function. Am I incorrect that the contents of `~/.pocket-id` will always be cleared before this comparison is even made? ``` if [[ -z "$current" || "$current" != "$latest" ]]; then CHECK_UPDATE_RELEASE="$latest" msg_info "New release available: v${latest} (current: v${current:-none})" : >"$current_file" return 0 fi ``` This line ` : >"$current_file"` is emptying `~/.pocket-id` in the event that there is a version mismatch right?
Author
Owner

@MickLesk commented on GitHub (Aug 29, 2025):

Actually, it can never get to this point; that only happens if it's a pinned version and the file doesn't exist. I'm not sure why it's going there for you. if -n “$pinned_version” ; then and pinned_version is empty because it was never transferred.

@MickLesk commented on GitHub (Aug 29, 2025): Actually, it can never get to this point; that only happens if it's a pinned version and the file doesn't exist. I'm not sure why it's going there for you. if [[ -n “$pinned_version” ]]; then and pinned_version is empty because it was never transferred.
Author
Owner

@MickLesk commented on GitHub (Aug 29, 2025):

can you try with an backup and give feedback? (in 5min - gh delay)

@MickLesk commented on GitHub (Aug 29, 2025): can you try with an backup and give feedback? (in 5min - gh delay)
Author
Owner

@MrBrisk commented on GitHub (Aug 29, 2025):

can you try with an backup and give feedback? (in 5min - gh delay)

Yes, worked perfectly now, just had to add back 1.9.1 to the ~/.pocket-id file. Thank you!

And for what it's worth, the code I posted does not only run if it's a pinned version, as the comment just above that block in the code shows: # No pinning → compare against latest, but it seems you've figured that out.

@MrBrisk commented on GitHub (Aug 29, 2025): > can you try with an backup and give feedback? (in 5min - gh delay) Yes, worked perfectly now, just had to add back 1.9.1 to the ~/.pocket-id file. Thank you! And for what it's worth, the code I posted does not only run if it's a pinned version, as the comment just above that block in the code shows: ` # No pinning → compare against latest`, but it seems you've figured that out.
Author
Owner

@appleimperio commented on GitHub (Aug 30, 2025):

@MickLesk Hi I'm having the same issue, but I don't have any ~/.pocket-id file. What I have is the /opt/PocketID_version.txt with 1.6.4 inside

    ____             __        __  ________ 
   / __ \____  _____/ /_____  / /_/  _/ __ \
  / /_/ / __ \/ ___/ //_/ _ \/ __// // / / /
 / ____/ /_/ / /__/ ,< /  __/ /__/ // /_/ / 
/_/    \____/\___/_/|_|\___/\__/___/_____/  
                                            

Reading package lists... Donecket-id
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libjq1 libonig5
The following NEW packages will be installed:
  jq libjq1 libonig5
0 upgraded, 3 newly installed, 0 to remove and 8 not upgraded.
Need to get 388 kB of archives.
After this operation, 1,165 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 libonig5 amd64 6.9.8-1 [188 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 libjq1 amd64 1.6-2.1 [135 kB]
Get:3 http://deb.debian.org/debian bookworm/main amd64 jq amd64 1.6-2.1 [64.9 kB]
Fetched 388 kB in 0s (10.8 MB/s)
Selecting previously unselected package libonig5:amd64.
(Reading database ... 20319 files and directories currently installed.)
Preparing to unpack .../libonig5_6.9.8-1_amd64.deb ...
Unpacking libonig5:amd64 (6.9.8-1) ...
Selecting previously unselected package libjq1:amd64.
Preparing to unpack .../libjq1_1.6-2.1_amd64.deb ...
Unpacking libjq1:amd64 (1.6-2.1) ...
Selecting previously unselected package jq.
Preparing to unpack .../archives/jq_1.6-2.1_amd64.deb ...
Unpacking jq (1.6-2.1) ...
Setting up libonig5:amd64 (6.9.8-1) ...
Setting up libjq1:amd64 (1.6-2.1) ...
Setting up jq (1.6-2.1) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for libc-bin (2.36-9+deb12u10) ...
  ⏳   Migrating PocketIDFailed to disable unit: Unit file pocketid-backend.service does not exist.

[ERROR] in line 36: exit code 0: while executing command systemctl -q disable --now pocketid-backend pocketid-frontend caddy

root@pocketid:~#
@appleimperio commented on GitHub (Aug 30, 2025): @MickLesk Hi I'm having the same issue, but I don't have any ~/.pocket-id file. What I have is the /opt/PocketID_version.txt with 1.6.4 inside ```` ____ __ __ ________ / __ \____ _____/ /_____ / /_/ _/ __ \ / /_/ / __ \/ ___/ //_/ _ \/ __// // / / / / ____/ /_/ / /__/ ,< / __/ /__/ // /_/ / /_/ \____/\___/_/|_|\___/\__/___/_____/ Reading package lists... Donecket-id Building dependency tree... Done Reading state information... Done The following additional packages will be installed: libjq1 libonig5 The following NEW packages will be installed: jq libjq1 libonig5 0 upgraded, 3 newly installed, 0 to remove and 8 not upgraded. Need to get 388 kB of archives. After this operation, 1,165 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian bookworm/main amd64 libonig5 amd64 6.9.8-1 [188 kB] Get:2 http://deb.debian.org/debian bookworm/main amd64 libjq1 amd64 1.6-2.1 [135 kB] Get:3 http://deb.debian.org/debian bookworm/main amd64 jq amd64 1.6-2.1 [64.9 kB] Fetched 388 kB in 0s (10.8 MB/s) Selecting previously unselected package libonig5:amd64. (Reading database ... 20319 files and directories currently installed.) Preparing to unpack .../libonig5_6.9.8-1_amd64.deb ... Unpacking libonig5:amd64 (6.9.8-1) ... Selecting previously unselected package libjq1:amd64. Preparing to unpack .../libjq1_1.6-2.1_amd64.deb ... Unpacking libjq1:amd64 (1.6-2.1) ... Selecting previously unselected package jq. Preparing to unpack .../archives/jq_1.6-2.1_amd64.deb ... Unpacking jq (1.6-2.1) ... Setting up libonig5:amd64 (6.9.8-1) ... Setting up libjq1:amd64 (1.6-2.1) ... Setting up jq (1.6-2.1) ... Processing triggers for man-db (2.11.2-2) ... Processing triggers for libc-bin (2.36-9+deb12u10) ... ⏳ Migrating PocketIDFailed to disable unit: Unit file pocketid-backend.service does not exist. [ERROR] in line 36: exit code 0: while executing command systemctl -q disable --now pocketid-backend pocketid-frontend caddy root@pocketid:~# ````
Author
Owner

@MickLesk commented on GitHub (Aug 30, 2025):

Thats Not the Same issue, i think. It checked for the Version File, Nobody has build the Migration from txt to .app

Maybe its better to remove the whole Migration Part into a guide

@MickLesk commented on GitHub (Aug 30, 2025): Thats Not the Same issue, i think. It checked for the Version File, Nobody has build the Migration from txt to .app Maybe its better to remove the whole Migration Part into a guide
Author
Owner

@appleimperio commented on GitHub (Aug 30, 2025):

Do you know where I can find the Migration guide? Thanks

@appleimperio commented on GitHub (Aug 30, 2025): Do you know where I can find the Migration guide? Thanks
Author
Owner

@MickLesk commented on GitHub (Aug 30, 2025):

It is currently Part of the Script. Look at the Script. But it should already migrated, why your Versionfile is missing, idk. You can move the .txt to new Version in ~/

@MickLesk commented on GitHub (Aug 30, 2025): It is currently Part of the Script. Look at the Script. But it should already migrated, why your Versionfile is missing, idk. You can move the .txt to new Version in ~/
Author
Owner

@MrBrisk commented on GitHub (Aug 30, 2025):

Do you know where I can find the Migration guide? Thanks

It should work if you just create the .pocket-id file in your home directory.

If you look at the code for the pocket-id update script before this change, you can see that text file was copied to the home directory location. Maybe this is your first time running the update so it never copied the file over? I'm not sure why it had a file there in the first place and didn't just create it in the home directory tbh. Whatever the reason, I suppose it doesn't matter all that much, but if this is something that continues to happen to other users it might be a good idea to add a check to see if that text file exists and copy it to the "correct" location before the code tries to migrate to 1.0

@MrBrisk commented on GitHub (Aug 30, 2025): > Do you know where I can find the Migration guide? Thanks It should work if you just create the .pocket-id file in your home directory. If you look at the code for the pocket-id update script before this change, you can see that text file was copied to the home directory location. Maybe this is your first time running the update so it never copied the file over? I'm not sure why it had a file there in the first place and didn't just create it in the home directory tbh. Whatever the reason, I suppose it doesn't matter all that much, but if this is something that continues to happen to other users it might be a good idea to add a check to see if that text file exists and copy it to the "correct" location before the code tries to migrate to 1.0
Author
Owner

@appleimperio commented on GitHub (Aug 30, 2025):

Thanks this work.
mv PocketID_version.txt ~/.pocket-id

@appleimperio commented on GitHub (Aug 30, 2025): Thanks this work. ```mv PocketID_version.txt ~/.pocket-id```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#1816