Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove PROXMOX 5.x / 6.x subscription message popup
#!/bin/sh
#######################################################
#
# Edits the proxmox Subscription file to make it
# think that it has a Subscription.
#
# Will disable the annoying login message about
# missing subscription.
#
# Tested on Proxmox PVE v5.2-1 / v6.0-4 / v6.3-2
#
# The sed command will create a backup of the changed file.
# There is no guarantee that this will work for future versions.
# Use at your own risk!
#
# OneLiner:
# wget -q -O - 'https://gist.github.com/tavinus/08a63e7269e0f70d27b8fb86db596f0d/raw/' | /bin/sh
# curl -L -s 'https://gist.github.com/tavinus/08a63e7269e0f70d27b8fb86db596f0d/raw/' | /bin/sh
#
# Save to Local File:
# wget -q -O rem_proxmox_popup.sh 'https://gist.github.com/tavinus/08a63e7269e0f70d27b8fb86db596f0d/raw/' && chmod +x rem_proxmox_popup.sh
# curl -L -o rem_proxmox_popup.sh 'https://gist.github.com/tavinus/08a63e7269e0f70d27b8fb86db596f0d/raw/' && chmod +x rem_proxmox_popup.sh
#
# Then you can just run the file after updates:
# ./rem_proxmox_popup.sh
#
#######################################################
init_error() {
local ret=1
[ -z "$1" ] || printf "%s\n" "$1"
[ -z "$2" ] || ret=$2
exit $ret
}
# Original command
# sed -i.bak 's/NotFound/Active/g' /usr/share/perl5/PVE/API2/Subscription.pm && systemctl restart pveproxy.service
# Command to restart PVE Proxy and apply changes
PVEPXYRESTART='systemctl restart pveproxy.service'
# File/folder to be changed
TGTPATH='/usr/share/perl5/PVE/API2'
TGTFILE='Subscription.pm'
# Check dependecies
SEDBIN="$(which sed)"
[ -x "$SEDBIN" ] || init_error "Could not find 'sed' binary, aborting..."
# This will also create a .bak file with the original file contents
sed -i.bak 's/NotFound/Active/g' "$TGTPATH/$TGTFILE" && $PVEPXYRESTART
r=$?
if [ $r -eq 0 ]; then
printf "%s\n" "All done! Please refresh your browser and test the changes!"
exit 0
fi
printf "%s\n" "An error was detected! Changes may not have been applied!"
exit 1
@tavinus
Copy link
Author

tavinus commented May 28, 2018

Maybe I should test to see if the backup file already exists and then increment the extension name or just abort execution.
I say this because someone that runs this twice will probably overwrite the backup.

@ddimick
Copy link

ddimick commented May 29, 2019

Still works on 5.4-6, thanks.

@ts-sz
Copy link

ts-sz commented Jun 25, 2019

hello @tavinus! thanks for your idea!
based on your idea i make the same for PMG: https://gist.github.com/ts-sz/f2fb901fd945cbf051713803649833e8

@tavinus
Copy link
Author

tavinus commented Jul 26, 2019

Just tested / checked v6 and works fine there too.

@zanechua
Copy link

zanechua commented May 26, 2020

Works on v6.2

@vsurlien
Copy link

vsurlien commented Sep 25, 2020

One liner worked perfect on 6.2. Thanks

@meta-n4vn33t
Copy link

meta-n4vn33t commented Sep 25, 2020

Works on version 6.4-5.

Comment updated on 25-05-2021.

@kiekstje
Copy link

kiekstje commented Nov 11, 2020

Still works in 6.2-4. Thanks 👍

@MarioHRK
Copy link

MarioHRK commented Apr 29, 2021

It works on 6.4-4. Ty

@a3vd
Copy link

a3vd commented May 17, 2021

Works on 6.4-6 Tnxs

@ItownTech
Copy link

ItownTech commented Oct 25, 2021

Works on 7.0-1. Thanks

@romanpeters
Copy link

romanpeters commented Jun 29, 2022

Works on 7.2-4, thanks. Anyone made a script for Proxmox Backup Server too?

@tavinus
Copy link
Author

tavinus commented Sep 19, 2022

Need to check if it uses the same file:
'/usr/share/perl5/PVE/API2/Subscription.pm'

And if it is just changing NotFound to Active into it.

If it is all the same. It should just work. Otherwise, needs tuning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment