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

This comment has been minimized.

Copy link
Owner Author

@tavinus 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

This comment has been minimized.

Copy link

@ddimick ddimick commented May 29, 2019

Still works on 5.4-6, thanks.

@ts-sz

This comment has been minimized.

Copy link

@ts-sz 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

This comment has been minimized.

Copy link
Owner Author

@tavinus tavinus commented Jul 26, 2019

Just tested / checked v6 and works fine there too.

@zanechua

This comment has been minimized.

Copy link

@zanechua zanechua commented May 26, 2020

Works on v6.2

@vsurlien

This comment has been minimized.

Copy link

@vsurlien vsurlien commented Sep 25, 2020

One liner worked perfect on 6.2. Thanks

@Navneet-Suresh

This comment has been minimized.

Copy link

@Navneet-Suresh Navneet-Suresh commented Sep 25, 2020

Works on version 6.2-14.

Comment updated on 10-11-2020.

@kiekstje

This comment has been minimized.

Copy link

@kiekstje kiekstje commented Nov 11, 2020

Still works in 6.2-4. Thanks 👍

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