Skip to content

Instantly share code, notes, and snippets.

@natesubra
Forked from tavinus/rem_proxmox_popup.sh
Created June 26, 2018 13:33
Show Gist options
  • Save natesubra/628178d92b26f62b0d9e6f7f34e6573c to your computer and use it in GitHub Desktop.
Save natesubra/628178d92b26f62b0d9e6f7f34e6573c to your computer and use it in GitHub Desktop.
Remove PROXMOX 5.2 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 5.2-1
#
# 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
#
#######################################################
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
@DerekfromMadison
Copy link

works great! It surprised me because the PVEPXRESTART froze my shell terminal but I refreshed the webpage and everything worked. Thanks!

@juliandegroot
Copy link

I did that in a little other way: https://gist.github.com/zentavr/f95194d99b7859a1de3d60c9c5a2e903

This solution works for 5.3 and higher. The script above here does not unfortunately :)

@StoneyEagle
Copy link

/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js

if (data.status !== 'Active') { Ext.Msg.show({ title: gettext('No valid subscription'), icon: Ext.Msg.WARNING, msg: Proxmox.Utils.getNoSubKeyHtml(data.url), buttons: Ext.Msg.OK, callback: function(btn) { if (btn !== 'ok') { return; } orig_cmd(); } }); } else { orig_cmd(); }
Just remove the "!" from if (data.status !== 'Active') {

@binsky08
Copy link

What about this nice one line bash command :)

cd /usr/share/pve-manager/js && cp pvemanagerlib.js pvemanagerlib.js.bak && line=`grep -hnr "Proxmox.Utils.checked_command(function() {});" pvemanagerlib.js.bak | cut -d':' -f1` && sed -i "${line}s/Proxmox/\/\/Proxmox/" pvemanagerlib.js && cp pvemanagerlib.js pvemanagerlib.js.custom && cd -

@shanept
Copy link

shanept commented Apr 24, 2019

I'm annoyed with having to do this every time I update pveproxy. So I hooked apt to run this after every update.

If you want to remove the subscription message straight away, after running the following, you may call pve_removenag.

echo "sed -i.bak \"s/data.status !== 'Active'/false/g\" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && systemctl restart pveproxy.service" > /usr/local/bin/pve_removenag && chmod +x /usr/local/bin/pve_removenag && echo "Update { Post-Invoke { \"pve_removenag\"; }; } ;" > /etc/apt/apt.conf.d/80removenag

@L96Github
Copy link

I'm annoyed with having to do this every time I update pveproxy. So I hooked apt to run this after every update.

If you want to remove the subscription message straight away, after running the following, you may call pve_removenag.

echo "sed -i.bak \"s/data.status !== 'Active'/false/g\" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && systemctl restart pveproxy.service" > /usr/local/bin/pve_removenag && chmod +x /usr/local/bin/pve_removenag && echo "Update { Post-Invoke { \"pve_removenag\"; }; } ;" > /etc/apt/apt.conf.d/80removenag

Nice and clean. This worked on 5.4, thanks

@guitehub
Copy link

awesome, thx

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