Aigor Posted March 11, 2022 #1 Posted March 11, 2022 (edited) 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 Hope it helps Edited March 11, 2022 by Aigor Quote
Orphée Posted March 12, 2022 #2 Posted March 12, 2022 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. Quote
alienman Posted March 23, 2022 #3 Posted March 23, 2022 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? Quote
alienman Posted March 26, 2022 #4 Posted March 26, 2022 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? Quote
Aigor Posted March 26, 2022 Author #5 Posted March 26, 2022 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 Quote
alienman Posted March 26, 2022 #6 Posted March 26, 2022 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? Quote
Aigor Posted March 26, 2022 Author #7 Posted March 26, 2022 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 1 Quote
docop1 Posted May 11, 2022 #8 Posted May 11, 2022 Hi So @Aigor did you manage to get a working .spk openvmtool for the 3622 in dsm7/7.1 ? It can be quite the best as without auto shutdown.. the usage is quite limited. Quote
c_zs Posted June 12, 2022 #9 Posted June 12, 2022 I also recently installed DS3622xs+_7.1.0-42661, but I can't find open-vm-tools that can be used. Thank you very much if you can help to compile, Quote
alienman Posted July 5, 2022 #10 Posted July 5, 2022 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: Edit the file "synology-open-vm-tools/spk/open-vm-tools/src/conf/privilege" and replace " "run-as": "root" " with " "run-as": "package" " in all lines. Edit the file "synology-open-vm-tools/spk/open-vm-tools/src/service-setup.sh" and modify the "service_postinst ()" function adding the code in the patch. I feel this will be sufficient to generate a valid SPK package compatible with DSM 7.x Please, try it! Regards. Quote
alienman Posted July 5, 2022 #11 Posted July 5, 2022 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. Quote
Aigor Posted July 13, 2022 Author #12 Posted July 13, 2022 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 Quote
Aigor Posted July 14, 2022 Author #13 Posted July 14, 2022 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 Quote
alienman Posted July 18, 2022 #14 Posted July 18, 2022 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. 1 Quote
Aigor Posted July 19, 2022 Author #15 Posted July 19, 2022 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 Quote
Aigor Posted July 25, 2022 Author #16 Posted July 25, 2022 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 Quote
mrmvd Posted August 2, 2022 #17 Posted August 2, 2022 (edited) В 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 August 2, 2022 by mrmvd Quote
Aigor Posted August 2, 2022 Author #18 Posted August 2, 2022 2 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 as you wish Quote
Aigor Posted August 2, 2022 Author #19 Posted August 2, 2022 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 2 1 Quote
Aigor Posted August 2, 2022 Author #21 Posted August 2, 2022 3 minutes ago, mrmvd said: Thank you, friend! Try and report Quote
mrmvd Posted August 2, 2022 #22 Posted August 2, 2022 Reporting: DSM 7.1 does't allow it to install Quote
Aigor Posted August 3, 2022 Author #23 Posted August 3, 2022 10 hours ago, mrmvd said: Reporting: DSM 7.1 does't allow it to install Which one? both? Quote
c_zs Posted August 3, 2022 #24 Posted August 3, 2022 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 1 Quote
Aigor Posted August 3, 2022 Author #25 Posted August 3, 2022 58 minutes ago, c_zs said: 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 It works suspend and snapshot also Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.