Tiny Core Linux
Tiny Core Extensions => TCE Q&A Forum => Topic started by: SeventhSin on July 02, 2019, 02:03:07 PM
-
Hello all,
Currently testing with TinyCorePure64 in a VM deployed in VMwareWorkstation, but the same behavior has been observed on x86. I have enabled "Shared Folders" in the VM's configuration and created a test share, named vm-share. During boot (pre-X), the following message shows-up briefly:
fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf
Post-X, a new folder pops-up: /mnt/hgfs-vm-shared/. However it is empty, since nothing gets mounted.
tc@box:/$ tree /mnt/hgfs-vm-shared/
/mnt/hgfs-vm-shared/
0 directories, 0 files
Running vmhgfs-fuse manually leads to the desired behavior:
tc@box:/$ mkdir -p /mnt/hgfs/ && vmhgfs-fuse /mnt/hgfs
tc@box:/$ tree /mnt/hgfs
/mnt/hgfs
`-- vm-shared
`-- New\ folder
2 directories, 0 files
Of course there is no /etc/fuse.conf.
-
/etc/fuse.conf is created when the vmtoolsd service is started. Add this to /opt/bootsync.sh or /opt/bootlocal.sh:
/usr/local/etc/init.d/open-vm-tools start
-
/etc/fuse.conf is created when the vmtoolsd service is started. Add this to /opt/bootsync.sh or /opt/bootlocal.sh:
/usr/local/etc/init.d/open-vm-tools start
That solved it, thank you andyj !
Just a quick question: wouldn't it be more... "elegant" to have a root folder, say /mnt/hgfs and all the shared folders mounted under that instead of "polluting" (subjective choice of words) the /mnt with one entry per shared folder?
What do you guys think?
-
Shared folders are mounted in /etc/profile.d//etc/profile.d/open-vm-tools.sh when you log in. It would be a one-character change so it shouldn't be a big deal for the next version, whenever that is. Since I only have one shared folder it's not an issue for me. In theory they should be unmounted when you log out, but if ash supports a logout script I don't know what it is. Someone would have to look through the source and see. As always, suggestions and patches to open-vm-tools are welcome.
-
@andyj
I also noticed that the Services option in the ControlPanel app doesn't show open-vm-tools service as started although there is a /usr/local/etc/init.d/open-vm-tools start
entry in /opt/bootlocal.sh.
-
Hi SeventhSin
Try entering services at the command line and see if any errors are printed out.
-
Hi SeventhSin
Try entering services at the command line and see if any errors are printed out.
Hi Rich.
tc@tc-pure-10:~$ services
Found total 6 services.
Then the app's GUI gets displayed.
-
I also noticed a difference between TinyCore and TinyCorePure64: on TinyCore, there is one extra service showing up as started in services: fuse (this one does not appear on TinyCorePure64).
open-vm-tools not being listed as started holds true for TinyCore as well.
-
Hi SeventhSin
Post the output of these commands:
which ps
cat /usr/local/etc/init.d/open-vm-tools
-
I see this:
(https://www.asjohnson.com/open-vm-service.png)
Have you added open-vm-tools to onboot.lst? Maybe you need to reboot?
-
Hi SeventhSin
Post the output of these commands:
which ps
cat /usr/local/etc/init.d/open-vm-tools
Here you go, Rich.
TinyCorePure64 10.1:
tc@tc-pure-10-1:~$ which ps
/usr/local/bin/ps
#!/bin/sh
# Start, stop, and restart vmtoolsd
grep -q user_allow_other /etc/fuse.conf || echo "user_allow_other" >>/etc/fuse.c onf
case "$1" in
start)
# Interface check
NIF1=$(wc -l < /proc/net/dev)
# Load vmblock
vmblock_dev=/tmp/VMwareDnD
vmblockfusemntpt=/var/run/vmblock-fuse
[ -d $vmblock_dev ] || mkdir -m 1777 -p $vmblock_dev
if grep -q "$vmblockfusemntpt" /etc/mtab; then
true
else
mkdir -m 1777 -p $vmblockfusemntpt
vmware-vmblock-fuse -o subtype=vmware-vmblock,default_permissions,allow_ other $vmblockfusemntpt
fi
# Start vmtoolsd
if pidof vmtoolsd &>/dev/null; then
echo vmtoolsd already running
else
rm -f /var/run/vmtoolsd.pid
/usr/local/bin/vmtoolsd --background=/var/run/vmtoolsd.pid
fi
# add the following to .xession after mouse initialization if .xsession doesn't run scripts in /usr/local/etc/X.d
# [ $(which vmware-checkvm) ] && # [ vmware-checkvm ] && # vmware-user
# Use ethtool to optimize vmxnet
if which ethtool &> /dev/null; then
for e in $(grep eth /proc/net/dev|cut -d: -f1); do
ethtool -K $e gso on &> /dev/null
ethtool -K $e tso on &> /dev/null
done
fi
# Start DHCP client for new interfaces
if ! grep -q nodhcp /proc/cmdline; then
NIF2=$(wc -l < /proc/net/dev)
if [ $NIF2 -gt $NIF1 ]; then
/etc/init.d/dhcp.sh
fi
fi
;;
stop)
if pidof vmtoolsd &>/dev/null; then
killall vmtoolsd
echo stopped vmtoolsd
umount -l /mnt/hgfs
else
echo vmtoolsd is not running
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 (start|stop|restart)"
exit 1
;;
esac
TinyCore 10.1:
tc@tc-10:~$ which ps
/usr/local/bin/ps
#!/bin/sh
# Start, stop, and restart vmtoolsd
grep -q user_allow_other /etc/fuse.conf || echo "user_allow_other" >>/etc/fuse.conf
case "$1" in
start)
# Interface check
NIF1=$(wc -l < /proc/net/dev)
# Load vmblock
vmblock_dev=/tmp/VMwareDnD
vmblockfusemntpt=/var/run/vmblock-fuse
[ -d $vmblock_dev ] || mkdir -m 1777 -p $vmblock_dev
if grep -q "$vmblockfusemntpt" /etc/mtab; then
true
else
mkdir -m 1777 -p $vmblockfusemntpt
vmware-vmblock-fuse -o subtype=vmware-vmblock,default_permissions,allow_other $vmblockfusemntpt
fi
# Start vmtoolsd
if pidof vmtoolsd &>/dev/null; then
echo vmtoolsd already running
else
rm -f /var/run/vmtoolsd.pid
/usr/local/bin/vmtoolsd --background=/var/run/vmtoolsd.pid
fi
# add the following to .xession after mouse initialization if .xsession doesn't run scripts in /usr/local/etc/X.d
# [ $(which vmware-checkvm) ] && # [ vmware-checkvm ] && # vmware-user
# Use ethtool to optimize vmxnet
if which ethtool &> /dev/null; then
for e in $(grep eth /proc/net/dev|cut -d: -f1); do
ethtool -K $e gso on &> /dev/null
ethtool -K $e tso on &> /dev/null
done
fi
# Start DHCP client for new interfaces
if ! grep -q nodhcp /proc/cmdline; then
NIF2=$(wc -l < /proc/net/dev)
if [ $NIF2 -gt $NIF1 ]; then
/etc/init.d/dhcp.sh
fi
fi
;;
stop)
if pidof vmtoolsd &>/dev/null; then
killall vmtoolsd
echo stopped vmtoolsd
umount -l /mnt/hgfs
else
echo vmtoolsd is not running
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 (start|stop|restart)"
exit 1
;;
esac
-
I see this:
(https://www.asjohnson.com/open-vm-service.png)
Have you added open-vm-tools to onboot.lst? Maybe you need to reboot?
I have open-vm-tools-desktop.tcz in /mnt/sda1/tce/onboot.lst. Everything is backed-up, nice and juicy, no problem there.
I see that open-vm-tools misses the green check-box in your screenshot too. This is exactly how it shows in my Services app as well.
TinyCorePure64:
(https://i.imgur.com/uFMUpDt.png)
TinyCore:
(https://i.imgur.com/lNge9a6.png)
-
I patched /usr/local/etc/init.d/open-vm-tools so the light comes on, but clicking the button doesn't do anything. I'm not sure what that program is looking for.
-
I patched /usr/local/etc/init.d/open-vm-tools so the light comes on, but clicking the button doesn't do anything. I'm not sure what that program is looking for.
I can confirm that clicking the service button doesn't do anything on any of the systems. Attempting to disable fuse on TinyCore 10.1 fails too, the green checkbox comes back after clicking it.
-
Hi andyj
The services program is looking for a non-zero value to be returned from /usr/local/etc/init.d/PogramName status. The tftp
program uses this:
status)
pidof udpsvd
;;
The NFS utilities use this:
status)
if ps | awk '{print $3}' | grep -e "/usr/local/sbin/rpc.statd" >/dev/null && ps | awk '{print $3}' | grep -e "/usr/local/sbin/rpc.statd" >/dev/null && ps | awk '{print $3}' | grep -e "\[nfsd\]" >/dev/null; then
echo "NFS-server is running."
exit 0
else
echo "NFS-server is not running."
exit 1
fi
;;
If you use the latter, include this at the top of the file:
alias ps='busybox ps'
-
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.
-
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:
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 &
;;
-
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.
-
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.
-
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.
-
...
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.