Jump to content
XPEnology Community

Almost functional open-vmtools for DS3622xs+


Aigor

Recommended Posts

It seems that i'v obtained a almost functional openvmtools package, snapshot works, suspend works, shutdown stil doesn't work, if you do shutdown, it powers off VM 
I need help with some debug 
If someone is interested 
https://mega.nz/file/PHxWBAKC#dL5P0J7nzYCNCiZMhyFZY3JZY5qSj89R4isfUGmrFvM 
Is for DS3622xs+ 7.01 

image.thumb.png.231a543a52f8054c31ac379449b66c50.png

 

Hope it helps 

Edited by Aigor
Link to comment
Share on other sites

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 comment
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 comment
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 comment
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 comment
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 comment
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 comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 4 weeks later...

Hi @Aigor,

 

I finally found the solution to solve the problem of calling to the shutdown command with root privileges in DSM 7.x. However, I need your help. Then, could you please prepare a new package with this information?

  • The workaround is based on the technique used by some community SPK packages that implement device drivers (for example, the RTL8156 USB Ethernet devices or the Aquantia AQC111U). In the repos of these packages they have implemented a simple tool called "spk_su.c". This tool only changes the corresponding "conf/privilege" file of the package to obtain the root privilege to execute some commands in the package. The tool is then included in the package, and it's required to call it manually after the first install of the package, because the installer checks the "privilege" file. However, after the first installation of the package, if you call with something like "sudo install -m 4755 -o root -D /var/packages/_my_package/target/bin/spk_su /opt/sbin/spk_su" then you can retry to install the package, and it will work. If you check the source code of the tool you will see that it only patches the "conf/privilege" file.
  • You can read more about this here: https://github.com/bb-qq/r8152/issues/137

So, my request is to recompile your current version of the open-vmtools package changing these points:

  • Restore the standard user in the package, that's "package" instead of any other.
  • Add the "spk_su.c" file to the project and compile it.
  • Edit the "postinst" script to call to the spk_su tool.

All of the previous changes are resumed on this patch as example: https://github.com/bb-qq/aqc111/commit/f9c024c5b575d8b57aacdfec9bd40ef5e16ecb2a .
So I feel you only need to do this:

I feel this will be sufficient to generate a valid SPK package compatible with DSM 7.x

Please, try it!
Regards.

 

Link to comment
Share on other sites

On 7/5/2022 at 3:22 PM, alienman said:

Hi @tbc0309,

 

I see that you have a fork of the synology-open-vm-tools package at https://github.com/tbc0309/synology-open-vm-tools . So I feel you're mainting it. Therefore, could you try my suggestion in the previous post, please?

 

I need help from someone to update the SPK package with root admin for reliable shutdown.
Regards.

Hi, sorry for late answer, I'll try to compile package adding this patches 

Link to comment
Share on other sites

A little step ahead, now it seems that package 11.3.5 is working almost as expected, i have to fix one thing
wrong place where config files will be placed., to fix user simply change from package to root in /var/packagename/config/privilege file, i know is  porkaround, but it seems working 
I have other minor problem that it comes from lacks of VMCI modules for synology kernel 

 

Link to comment
Share on other sites

12 hours ago, alienman said:

Hi @Aigor,

 

I confirm that installing your SPK in the first post and changing after in the /var/packages/open-vm-tools/config/privilege file from

"run-as": "package"

to

"run-as": "root"

then it works!

 

I hope you soon can share a new package with version 11.3.5.
Regards.

 

I need to understood several things 
1)  How to move kernel modules in right place and add loading at boot time 

2) How to point main executable to standard place where config file is located.

 

I tried to compile V 12 of Vmtools but it doesn't works because it needs a special lib that i don't know how to add to spksrc framework 

Link to comment
Share on other sites

  • 2 weeks later...
В 25.07.2022 в 16:38, Aigor сказал:

Hi friends, attached there is a new version for openvmtools , as usual change to root in /var/package/open-vmtools-12/conf/privilege file.
Is compiled for broadwellnk let me know if you need for other arch
Try and report 
https://mega.nz/file/2KYUnT7Z#dqr-3e59ysRtRV7Mlmz9iYfw3xoRM9jIxN4F6tMoXGo

 

Hi! Thanks for work. Can you pleas compile VMtools for DVA1622? It is Geminilake, and DVA3221 on Atom C3538 it's codename Denverton

 

Edited by mrmvd
Link to comment
Share on other sites

3 hours ago, mrmvd said:

 

Hi! Thanks for work. Can you pleas compile VMtools for DVA1622? It is Geminilake, and DVA3221 on Atom C3538 it's codename Denverton

 

Denverton 
https://mega.nz/file/qLIxHISA#jy3mNgxxo-kyYUoc5R0iIYqL1l0Rmyue0G5DXY0wxM8

 

Geminilake 

 

https://mega.nz/file/TapDCDjR#Ho8GGFLbQgvYpomTIn6bTm1ozHVl3xEH3Q52s6h5ZlA

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

On 7/25/2022 at 9:38 PM, Aigor said:

Hi friends, attached there is a new version for openvmtools , as usual change to root in /var/package/open-vmtools-12/conf/privilege file.
Is compiled for broadwellnk let me know if you need for other arch
Try and report 
https://mega.nz/file/2KYUnT7Z#dqr-3e59ysRtRV7Mlmz9iYfw3xoRM9jIxN4F6tMoXGo

 

Thank you very much, it is perfect on DS3622xs+_7.1.0-42661, now I can finally control the power on and off in esxi perfectly, thank you

  • Like 1
Link to comment
Share on other sites

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.

×
×
  • Create New...