7

We have a machine that runs VMware Server. It constantly creates a file called not_configured in /etc/vmware/, which somehow makes our virtual machines not able to be started.

I wondered if there was any reliable way to prevent this file from ever being created in the first place.

The file itself doesn't contain anything, so I don't want to create and write-protect it. It shouldn't be there in the first place.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
slhck
  • 473
  • 2
    I know this sounds like an X/Y problem and I should rather look into solving the VMware Server issue, but the people on SF obviously couldn't help either and this is more of a general question I've had in mind. – slhck Nov 27 '11 at 10:22
  • Hmm, fix the source, not the symptom. – daisy Oct 30 '12 at 08:53
  • @warl0ck As I mentioned, this is easier said than done, and I'm very well aware of the fact that this is asking for fixing the symptoms. – slhck Oct 30 '12 at 09:05
  • that's true, but I mean, submit a bug report to them... – daisy Oct 30 '12 at 09:25

5 Answers5

4

You can make the directory read-only in some way: with unix permissions (chmod a-w), or with more stringent measures such as mounting a read-only filesystem at that spot. I don't think Linux offers a built-in way of preventing a single file from being created, without making the directory read-only as a whole. There is of course the multipurpose tool FUSE but I don't know of an existing FUSE filesystem that lets you create a file blacklist in this way.

You can try creating a dangling symbolic link, especially one pointing to a nonexistent file in a read-only directory. Depending on how the one program checks for the file existence and the other program tries to create the file, this may or may not work.

I'd recommend figuring out what program is creating that file and shutting it off. See How to determine which process is creating a file?

  • I could be lucky and the directory does not need to be written to anyway. My fear is that the VMware service itself creates that file – but that's not really important here –, so we shall see if the symlink works out. Interesting approach nonetheless. – slhck Nov 27 '11 at 22:48
  • +1 for FUSE. See also http://unix.stackexchange.com/questions/9332/how-can-i-create-a-dev-null-like-blackhole-directory. – Mechanical snail Sep 19 '12 at 17:51
1

In short, if you have any Vmware products that you haven't uninstalled cleanly it would create such a problem that you describe.
Follow the instructions at this link, I have had success with them:

I have had the same problem, and after I have followed the above guide it solved.

enzotib
  • 51,661
Hanan
  • 5,771
  • 2
    You should probably post this on the question on Server Fault, and delete it here - it's not really the answer to this question. – slhck Nov 27 '11 at 13:18
  • It may not be the answer the person is looking for, but it's definitely the one that solves the cause rather than ignoring it. Upvote for reply. – laebshade Nov 28 '11 at 00:18
  • @laeb Probably, but it does not belong here at all. – slhck Nov 28 '11 at 07:04
1

The only standard way to do this is to remove the write permission from the directory. This will, of course, prevent anything from creating files in this directory.

wnoise
  • 1,961
1

Not sure about VMWare Server flexibility in that area but assuming the /etc/vmware directory is allowed to be located on a remote file system shared under NFS or CIFS, that would be an easy task by using an OS supporting DTrace at the file server side (Solaris, OpenIndiana, FreeBSD, MacOS/X, ...).

A simple so called destructive script could force or simulate a failure on any attempt to open the not_configured file.

jlliagre
  • 61,204
  • Could I even do that from the localhost? I don't think we have the capabilities to set up another machine for that. – slhck Nov 27 '11 at 22:45
  • I'm afraid not. VMWare server seems to only run on Windows or Linux. Windows doesn't support DTrace and Linux ports aren't fully operational, as far as I know. – jlliagre Nov 28 '11 at 06:24
0

I actually already do this.. you can make a listener in "watcher" or "incron" (I would use watcher, it's recursive) use that create trigger, write a script, wait 5 seconds (this is because all sorts of read only /tmp files can be "created" when a file is "created" - which you test for locked/read only and re pause if necessary) then in your script scan/move/delete any files in that folder you dislike..

NB: ensure your script is being intelligent for locked file/retry paradigm..

conners
  • 193