Jump to content

Unable to run shell as Sudo on Mac


Tom Clifton

Recommended Posts

Hi,

I've been struggling getting PlasticSCM working with Team City and was hoping to get some help resolving the issues I am seeing. Team City is running on MacOS. I have attempted to follow this guide for integrating the plugin but the plugin file location is only specified for PC and no equivalent seems to exist for Mac so I have uploaded the plugin from the location on my PC.

I am unable to get past the step of setting up the VCS root on Team City. After filling in the information and clicking either Create or Test Connection the UI gets stuck on a spinning circle. Looking at the Team City server logs I can see the following error:
 

Quote
Error running command line client on shell mode. The 'cm shell' command was launched but the process terminated abnormally.

I have found some similar forum threads here, here and with Jenkins here but unfortunately none of these has helped and the proposed solutions are all for Windows.

Following this forum post suggestion

I tried running both

Quote

cm shell

lrep

and

Quote

sudo cm shell

lrep

The first one worked correctly as expected but the second one just hangs in the terminal and doesnt respond to lrep or any other shell commands. Given that this seems to be the issue but I can't figure out exactly what the issue is or how to resolve it. From looking at some of the forum posts above it looks like the issue is to do with a missing configuration file when running as sudo (which is what Team City is running under as well) but I can't figure out where I should be placing the client.conf file on Mac to get this working. I have also double checked my path and that should be fine. I already have `usr/local/bin` in it and have tried adding other paths as well such as `usr/local/bin/cm` but that has not helped.

I'd really appreciate some help in resolving this issue.

Thanks
Tom

MacOS: (Big Sur - 11.1)
Team City: 2021.2
Plastic SCM: 10.0.16.6179

Link to comment
Share on other sites

Hi Carlos,

So i did also try that as it was suggested on the linked forum posts and have double checked that (and tried restarting the machine) and it is still not working.

As mentioned running `cm shell` and then plastic commands works fine but running `sudo cm shell` results in nothing happening which I assume is the issue that Team City is happening.

Could you please advise me on what else I could try or let me know any relevant logs to attach.

Thanks,
Tom

Link to comment
Share on other sites

Hi,

 

Is there any update on this? This basically means that we can't use Team City on Mac with Plastic which is a big issue for us. As stated above the config file is located in the above specified location but we still can't perform and shell commands as sudo. Is there something else I should be looking at?

Any help would be greatly appreciated.

Thanks
Tom

Link to comment
Share on other sites

Could you also review the permissions of the "client.conf" in the new path? If you pasted the "client.conf" in the client binaries folder, all the machine users will be configured to use Plastic.

If you are a paying customer, you can reach us at support@codicesoftware.com and we can arrange a meeting to debug it.

Regards,

Carlos.

Link to comment
Share on other sites

Hi Carlos,

You were right about the permissions being incorrect but I'm still not having any luck unfortunately. I adjusted the owner to root which is the owner that the rest of the files in the MonoBundle folder have as well as the user that TeamCity runs under. I tried a few different permissions (chmod 644 to start as that seemed to be what most of the rest used) but couldn't get it to work even setting chmod to 777. Here are the files in the MonoBundle folder showing permissions:


image.png.28faceef389335c3925f5dd757c9fb35.png+image.png.0fd0b47a2b6ab5a6a5569dc5a8e8b374.png

And here is the result in the terminal. As you can see running the shell normally the commands work but under sudo it just hangs there.
image.png.d8a567182b12b265561cf90025bc7abe.png

I have tried restarting the terminal and machine after making these changes but not having any success at all. I have also tried this on 2 macs. My other mac is using a slightly older version of plastic scm (9) but this does not work for either. I also tried adding the log conf file as noted in this post which generated a log file with the older version of plastic SCM but not the latest 10.0 version. Interestingly the newer version does not have the cm.exe file in the MonoBundle folder so don't know if that is a factor there or not. The log file did not show anything useful anyway though so I have ignored that part.

I'm not sure whether any of that information helps to narrow down what's going on. If not then I can certainly open a support ticket but at the moment the provided instructions seem incorrect as far as I can determine.

Thanks,
Tom

Link to comment
Share on other sites

  • 3 weeks later...

After going through support with Carlos and the plastic team we were able to get to the bottom of this so thought it would be worth posting the issue and solution for anyone else who comes across this.

The main issue was that this just was not working with the cloud version of plastic that we were using on MacOS and we had to switch to the Enterprise version instead. I then had to run `clconfigureclient` in the terminal and follow the prompts to get plastic configured correctly for the LDAP working mode.

After that the client.conf file needs to be copied from ~/Library/.plastic4 to the plastic scm binary folder. I also had to copy tokens.conf and cloudregions.conf from that folder to the same binaries folder as well (its possible other conf files might need copying there too but that did the job for me).

The binaries folder where we copy these conf files to is also different between plastic 10 that we are using and older versions.

On plastic 10 it is:

/Applications/PlasticSCM.app/Contents/Applications/cm.app/Contents/MacOS/

And on older versions of plastic it is the path mentioned above:

/Applications/PlasticSCM.app/Contents/MonoBundle/

Following these steps got the shell command working when run under sudo and team city started working with plastic again after that.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...