WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: open-vm-tools: error on shares mapping  (Read 6540 times)

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: open-vm-tools: error on shares mapping
« Reply #15 on: July 03, 2019, 06:25:18 PM »
The main problem I'm having is that vmtoolsd, the program that provides copy/paste/resolution resizing/usb redirection, is a daemon that runs as root, whereas the mounts for the shared folders are through fuse and run as the logged in user. I could assume the user is tc, but I could also be wrong. I'm not sure how to handle both in one click.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11624
Re: open-vm-tools: error on shares mapping
« Reply #16 on: July 03, 2019, 08:26:59 PM »
Hi andyj
... I could assume the user is tc, but I could also be wrong. ...

I don't know if this helps, but maybe you can adapt what  tftp  uses:
Code: [Select]
case "${1}" in
start)
if [ -z "$HOME" ]; then
                   [ "$USER" ] || USER="$(cat /etc/sysconfig/tcuser)" || USER="tc"
                   HOME=/home/"$USER"
                fi
/sbin/udpsvd -E 0 69 tftpd $HOME &
;;

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: open-vm-tools: error on shares mapping
« Reply #17 on: July 04, 2019, 08:57:22 AM »
We need to get back to what the open-vm-tools "service" does and does not do. The service daemon vmtoolsd communicates with the host for things like status, time sync and power off. This is the only program run as root. The rest of the programs are user space programs, run separately, and do not require the daemon to be running. The shared folders do not require any other programs to be running, and can be used in a text only environment which is why they are mounted in /etc/profile.d/open-vm-tools.sh. The remaining program is started from /usr/local/etc/X.d/open-vm-tools which provides desktop resizing and copy/paste. This program exits when X exits.

I'll make a few changes. One, /etc/fuse.conf is created when the service is started if it doesn't already exist. It isn't needed by the service, it is needed for shared folders, so I'll move this bit of code from /usr/local/etc/init.d/open-vm-tools to /usr/local/tce.installed/open-vm-tools so it gets created when the extension is loaded. Two, I'll add a "status" option to /usr/local/etc/init.d/open-vm-tools so the services dialog will function correctly. Three, I'll update /etc/profile.d/open-vm-tools.sh to mount each shared folder as a subdirectory in /mnt/hgfs. If anyone can tell me how to make a script that runs when $USER logs off then the shared folders can be unmounted at that time. For now this part remains to be done.
« Last Edit: July 04, 2019, 09:02:42 AM by andyj »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11624
Re: open-vm-tools: error on shares mapping
« Reply #18 on: July 04, 2019, 10:24:31 AM »
Hi andyj
... If anyone can tell me how to make a script that runs when $USER logs off then the shared folders can be unmounted at that time. ...
Maybe use  inotifywait  to monitor for a  close_write  event in either  /var/run/utmp  or  /var/log/wtmp. Then use either  who, last, or w
to see if the user is still logged in.

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: open-vm-tools: error on shares mapping
« Reply #19 on: July 04, 2019, 12:55:03 PM »
I modified /root/.profile to run the tc login through strace, but busybox isn't looking for anything on exit beyond .ash_history. So it's a kludge or nothing.

SeventhSin

  • Guest
Re: open-vm-tools: error on shares mapping
« Reply #20 on: July 05, 2019, 07:19:50 AM »
...
Three, I'll update /etc/profile.d/open-vm-tools.sh to mount each shared folder as a subdirectory in /mnt/hgfs.

@andyj, thank you so much for taking this into consideration.