Page MenuHomeVyOS Platform

Stray compiled Python objects break the VMware virtual machine resume script
Closed, ResolvedPublic

Description

When suspending and resuming the VM with VMware it will popup with the following message:

The VMware Tools resume script did not run successfully in this virtual machine.
If you have configured a custom resume script in this virtual machine, make sure that it contains no errors. You can also submit a support request to report this issue.

After digging into this error this seems to be caused by the /etc/vmware-tools/scripts/resume-vm-default.d/__pycache__ directory.
And can be reproduced using the following commands:

$ #sudo bash -x /etc/vmware-tools/suspend-vm-default; echo $?
$ sudo bash -x /etc/vmware-tools/resume-vm-default; echo $?
++ date
+ echo Wed 14 Jul 2021 03:05:57 PM UTC ': Executing '\''/etc/vmware-tools/resume-vm-default'\'''
Wed 14 Jul 2021 03:05:57 PM UTC : Executing '/etc/vmware-tools/resume-vm-default'
++ dirname /etc/vmware-tools/resume-vm-default
+ TOOLS_CONFDIR=/etc/vmware-tools

<snipped>

+ exitCode=0
+ RunScripts /etc/vmware-tools/scripts/resume-vm-default.d
+ scriptDir=/etc/vmware-tools/scripts/resume-vm-default.d
+ '[' -d /etc/vmware-tools/scripts/resume-vm-default.d ']'
+ for scriptFile in "$scriptDir"/*
+ '[' -x /etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py ']'
+ /etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py resume-vm
++ expr 0 '|' 0
+ exitCode=0
+ for scriptFile in "$scriptDir"/*
+ '[' -x /etc/vmware-tools/scripts/resume-vm-default.d/__pycache__ ']'
+ /etc/vmware-tools/scripts/resume-vm-default.d/__pycache__ resume-vm
/etc/vmware-tools/resume-vm-default: line 92: /etc/vmware-tools/scripts/resume-vm-default.d/__pycache__: Is a directory
++ expr 0 '|' 126
+ exitCode=126
+ return 126
126

The error that causing the resume scripts to return errors:
/etc/vmware-tools/resume-vm-default: line 92: /etc/vmware-tools/scripts/resume-vm-default.d/__pycache__: Is a directory

So the /etc/vmware-tools/resume-vm-default does not handle directories very well.

$ dpkg -S /etc/vmware-tools/resume-vm-default
open-vm-tools: /etc/vmware-tools/resume-vm-default

$ dpkg -S /etc/vmware-tools/scripts/resume-vm-default.d/__pycache__
vyos-1x-vmware: /etc/vmware-tools/scripts/resume-vm-default.d/__pycache__

To fix this warning, the __pycache__ directory should be removed from the vyos-1x-vmware package.

Details

Version
vyos-1.3.0-rc5, vyos-1.4.0-rc1
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

yun triaged this task as Normal priority.
yun created this object in space S1 VyOS Public.
Viacheslav changed the task status from Open to Needs testing.Jul 21 2021, 6:55 PM
Viacheslav assigned this task to yun.

Want to test latest rolling iso, but equuleus seems to be stuck at vyos-1.3-beta-202107121144-amd64.iso which doesn't have this fix yet.

Confirmed fixed, tested with vyos-1.3-beta-202108192027-amd64.iso

SrividyaA set Issue type to Bug (incorrect behavior).Aug 31 2021, 6:42 PM
yun reopened this task as Open.EditedJan 8 2024, 9:10 AM

Hi, this bug is introduced again in VyOS 1.4 (tested VyOS-1.4.0-rc1). Due to the following commit: https://github.com/vyos/vyos-1x/commit/64c9fdef02323309e97b2bb682604ada52d651e8

The modified regex parameter to compileall -x doesn't work, and thus still compiles: Compiling './src/etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py'... which triggers this vmware bug again when suspending and resuming in VMware.

I also submitted a proper bugfix in open-vm-tools via https://github.com/vmware/open-vm-tools/pull/689, but nothing has done with it from VMware side.

yun changed Version from vyos-1.3.0-rc5 to vyos-1.3.0-rc5, vyos-1.4.0-rc1.

Update from the PR

The changes from this pull request has already been incorporated and will be in the next major release of open-vm-tools.

https://github.com/vmware/open-vm-tools/pull/689#issuecomment-1948466725

There is still no new major release of open-vm-tools available as Debian package.

So although this issue has been marked as Resolved, it actually isn't for VyOS. I made a new PR https://github.com/vyos/vyos-1x/pull/4525

dmbaturin renamed this task from The VMware Tools resume script did not run successfully in this virtual machine. to Stray compiled Python objects break the VMware virtual machine resume script.May 29 2025, 12:05 AM
dmbaturin edited projects, added VyOS 1.4 Sagitta (1.4.3); removed VyOS 1.4 Sagitta (1.4.0-epa1), Restricted Project.
dmbaturin changed Is it a breaking change? from Behavior change to Perfectly compatible.
dmbaturin moved this task from Backlog to Finished on the VyOS 1.4 Sagitta (1.4.3) board.
dmbaturin moved this task from Open to Finished on the VyOS 1.5 Circinus (1.5-stream-2025-Q2) board.