Following an upgrade to vCenter 8.0, some environments may experience domain user created scheduled tasks failing to run.
/var/log/vmware/vpxd/vpxd.log
file, the following error(s) are observed:2024-11-12T11:07:02.475+01:00 error vpxd[06802] [Originator@6876 sub=MoScheduledTask opID=ProcessScheduledTaskFiring-********] [AcquireToken] Failed to get token. Error:
--> Error:
--> com.vmware.oauth2.errors.invalid_grant
--> No messages!
-->
2024-11-12T11:07:02.478+01:00 error vpxd[06802] [Originator@6876 sub=MoScheduledTask opID=ProcessScheduledTaskFiring-********] BadVapiConfiguration / NotAuthenticated Exception while running the task: Error:
--> com.vmware.oauth2.errors.invalid_grant
--> No messages!
-->
/var/log/vmware/sso/tokenservice.log
file, the following error is observed:2024-11-12T10:07:02.468Z ERROR tokenservice[79:tomcat-http--41] [CorId=********-****-****-****-************ OpId=] [com.vmware.vcenter.tokenservice.vapi.TokenProviderImpl] Exchange failed due to invalid grant:
com.vmware.vcenter.tokenservice.exceptions.InvalidGrant: JWT token failed signature verification. Token:{"sub":"ExampleUser@domain","aud":"vmware-tes:vc:persistabletoken","act":{"sub":"vpxd-*******-****-****-****-************@vsphere.local"},"scope":"offline_access","iss":"https:\/\/domain.domain\/openidconnect\/domain_name","iat":1722332383,"jti":"********-****-****-****-************"}
vCenter server 8.0.2
vCenter server 8.0.3
Workaround:
For affected users accounts, a script can be run to clear the stale token(s):
chmod +x remove_persistable_tokens.sh
4. Run the script with the impacted usernames which was reported in the tokenservice.log as the parameters. This will cause all the previously scheduled tasks for the users to fail
./remove_persistable_tokens.sh 'your.domain\test1' 'your.domain\test2' ...
5. Remove the existing scheduled task and re-schedule again
root@VC-XXX [ /tmp ]#./remove_persistable_tokens.sh 'your.domain\test1' 'your.domain\test2' ..."
: No such file or directory.sh: line 1: /etc/profile.d/vmware-vpostgres-config.sh
: No such file or directory.sh: line 2: /etc/profile.d/VMware-visl-integration.sh
./remove_persistable_tokens.sh: line 3: $'\r': command not found
./remove_persistable_tokens.sh: line 9: $'\r': command not found
./remove_persistable_tokens.sh: line 10: syntax error near unexpected token `$'do\r''
'/remove_persistable_tokens.sh: line 10: `for param in "$@"; do
sed -i -e 's/\r$//' remove_persistable_tokens.sh
./remove_persistable_tokens.sh 'your.domain\test1' 'your.domain\test2'