Almost functional open-vmtools for DS3622xs+


Recommended Posts

Shutdown/reboot will never work unless you edit a file in /var/packages/open-vm-tools/......
And change user by root. Then restart open-vm-tools.
But even changed, it does not work every time.
First click does nothing, another one works...
This is one of the reasons why I switched to Proxmox VE. It rely on ACPI instead of custom scripts needing root on VMware.





Link to post
Share on other sites
  • 2 weeks later...

Hi,

 

Regarding the SHUTDOWN process using the Open-VM-Tools, I feel we need to explore some alternatives as the current implementation of the DSM 7.x doesn't allow packages with root permissions. However, nothing is lost. We only need to find a simple method to execute the shutdown process. First, let me to explain what does the Open-VM-Tools package:

 

https://github.com/vmware/open-vm-tools/blob/19b6d0f9d9fb3092cb71df26eca60411c644af7f/open-vm-tools/lib/system/systemLinux.c#L325

Here is the souce of the open-vm-tools where the shutdown command is executed. If we found another alternative, it's wasy to modify this line and call to the desired command. So, first don't worry about what command is called. We can call to any command. The problem is how to execute the shutdown process from the package without root privileges.

 

The alternatives that perhaps could work are:

  • "synoshutdown" comand: This command from a plain user doesn't start the shutdown process.
  • Call to a user shutdown command: From the scripts we can create a new script for starting a shutdown. And then call to it from the command line (I don't know how to do this).
  • Wheel sudoers: We can add the spk package user to the sudoers file and enable to shutdown without password. But this implies to edit system config files as root.
  • Change to root with "sudo -i": This works from the command line, but implies to type the password.
  • Launch an ACPI power-off action: Anyone knows how to do this from the command line?
  • Call to a hidden function in the redpill.ko: Perhaps another option could be to open a backdoor in the redpill module to receive a syscall without root privileges to start a shutdown/reboot process.

I don't have more ideas. What you think? 

Link to post
Share on other sites

Hi @Aigor,

 

I'm interested on improve the "open-vm-tools" package. I've installed your package and the only problem is the shutdown. I'm searching for different solutions. In the meantime, could you please share how to compile your package? And can you change the user from [ "run-as": "package" ] to [ "run-as": "openvmtools" ] ? I'm studing if I could use a wheel user with privileges to shutdown without password. The idea is to inject this user from the redpill (as an extension) or create it manually in the DSM.

 

You can help me, please?  

Link to post
Share on other sites
53 minutes ago, alienman said:

Hi @Aigor,

 

I'm interested on improve the "open-vm-tools" package. I've installed your package and the only problem is the shutdown. I'm searching for different solutions. In the meantime, could you please share how to compile your package? And can you change the user from [ "run-as": "package" ] to [ "run-as": "openvmtools" ] ? I'm studing if I could use a wheel user with privileges to shutdown without password. The idea is to inject this user from the redpill (as an extension) or create it manually in the DSM.

 

You can help me, please?  

Hi, to compile package you need to have a ubuntu machine where to install spksrc https://github.com/SynoCommunity/spksrc that is the framework to compile spk package.
You can read doc on github to know howto setup initial environment and how to compile.
The problem is that from DSM7 DSM forbid  to install package that need root privilege to run, a possible workaround could be use docker with only vmtools installed.

If you need other info, ask me 
 

Link to post
Share on other sites

Hi @Aigor,

 

I've tested the docker with vmtools, and it's a pain. I don't want to run Docker just for this. The main reason is the time to start Docker. And a second problem is the ssh method to execute the shutdown... this could fail at any time. So this solution isn't robust and is slow.

 

Regarding how to compile the package, I've seen the README in the different repositories. However, I'll found it quite complex to a simple compile. Futhermore, I can't understand why the original author doesn't create a simple docker for this task. Futhermore, it's very annoying the manual editing of files. Why not create one script for the full task?

 

Finally, after a much time thinking on a good solution, my efforts will go oriented to use a gold user (openvmtools) to run the package and trigger the shutdown. Then this user will have the privileges to execute the "/sbin/shutdown" command (that is what the source code of the open-vm-tools calls to). So, for this reason I ask if you can prepare an alternative SPK package with this user instead of the default "package" one. Then I'll work on adding support (perhaps with a redpill extension) for this user with sudo/wheel privileges to execute the shutdown binary without additional passwords. That's my objective. You want to help me?

Link to post
Share on other sites
9 minutes ago, alienman said:

Hi @Aigor,

 

I've tested the docker with vmtools, and it's a pain. I don't want to run Docker just for this. The main reason is the time to start Docker. And a second problem is the ssh method to execute the shutdown... this could fail at any time. So this solution isn't robust and is slow.

 

Regarding how to compile the package, I've seen the README in the different repositories. However, I'll found it quite complex to a simple compile. Futhermore, I can't understand why the original author doesn't create a simple docker for this task. Futhermore, it's very annoying the manual editing of files. Why not create one script for the full task?

 

Finally, after a much time thinking on a good solution, my efforts will go oriented to use a gold user (openvmtools) to run the package and trigger the shutdown. Then this user will have the privileges to execute the "/sbin/shutdown" command (that is what the source code of the open-vm-tools calls to). So, for this reason I ask if you can prepare an alternative SPK package with this user instead of the default "package" one. Then I'll work on adding support (perhaps with a redpill extension) for this user with sudo/wheel privileges to execute the shutdown binary without additional passwords. That's my objective. You want to help me?

i can try, let me some time to prepare and compile 

 

  • Thanks 1
Link to post
Share on other sites
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.