Bug 216366

Summary: Netbeans Terminal: Unable to upload pty / Unable to start pty process
Product: cnd Reporter: gateon
Component: executionAssignee: Andrew Krasny <akrasny>
Status: RESOLVED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P3 CC: exceptions_reporter
Version: 7.3.1   
Target Milestone: 7.3   
Hardware: PC   
OS: Windows 8 x64   
See Also: https://netbeans.org/bugzilla/show_bug.cgi?id=176526
Whiteboard:
Issue Type: ENHANCEMENT Exception Report:

Description gateon 2012-08-03 13:21:10 UTC
Trying to run Netbeans Terminal on a remote host, results in two errors:

- Unable to start pty process (when /var/tmp has some permission restriction, such as a CHROOT command)
- Unable to upload pty (when the /var/tmp has some permission restriction - unknow example)

These problems were observed on Dreamhost hosting servers.

In a previous patch, user name and a hashed id was added to the terminal remote path.
The patch can be found here:
https://netbeans.org/bugzilla/__attachment.cgi?id=90937&__action=edit

However it assumes that /var/tmp dir is world writable and executable, what don't happen when you have the dir CHROOTED.

To solve the problem, I manually edited the file mentioned in the patch (/ide/bin/nativeexecution/hostinfo.sh), so that TMPBASE would refer to a path under my user ftp account in the remote host.
For example: /home/USERNAME/.netbeans

My suggestion for a fix is to use the FTP path as a upload directory for Netbeans tools.
For instance, my root directory is "/home/USERNAME".

Or instead, use the project root dir as it upload destination.
For instance, , FTP_ROOT + Start/load Directory.
Example: "/home/USERNAME/path/to/project/dir"

Both options are defined in Project Properties > Execution Configuration
(free translation from portuguese, "Propriedades do Projeto > Executar ConfiguraĆ§Ć£o")
Comment 1 Andrew Krasny 2012-08-03 14:21:42 UTC
This is a general problem with the approach that is used in cnd - to start some helper binary on a remote host it (in many cases) is uploaded to temp directory and the executed from there... Indeed in the described situation this scheme doesn't work.

We need to at least provide a way for specifying the base temp directory to use.
Comment 2 gateon 2012-10-21 14:48:34 UTC
On Netbeans 7.2.1, you can manually make the following update:

FILE: /ide/bin/nativeexecution/hostinfo.sh
LINE: 77

FROM: TMPBASE=${TMPBASE:-/var/tmp}
> TO: TMPBASE=${TMPBASE:-/home/${USER}/.netbeans}

This solved my problem on Dreamhost
Comment 3 Andrew Krasny 2012-10-27 21:00:18 UTC
gateon@netbeans.org,

this temp directory is needed by nb before any nb-process is started (and before a connection to a host is 'established'. As a part of connection establishment process some files are already uploaded..) 
So specifying this directory in project's properties doesn't look like a right place.. 

For now I have added a way for specifying this base directory via a system property - one can pass -J-Dcnd.tmpbase=<alternative location> to overwrite default setting. The option is global and will be used for all hosts once specified.. 

Is it acceptable for you? 
(I'll change a status of the bug to resolved-fixed. If you strongly disagree, feel free to reopen)

Thanks,
=Andrew
Comment 4 Andrew Krasny 2012-10-27 21:00:49 UTC
changeset: http://hg.netbeans.org/cnd-main/rev/469aedac842d
Comment 5 gateon 2012-10-29 17:07:47 UTC
Sorry, but I am unfamiliar with the approach suggested.
Can you give me an use example?

If I understood correctly, to use the global setting you suggested, I will have to add a parameter to the "Destination" property in the Netbeans shortcut.
It would like something like this?
"C:\Program Files\NetBeans 7.1\bin\netbeans.exe -J-Dcnd.tmpbase=/home/path/to/some/dir" 

While in the topic, your solution will accept variables?
As stated in my last comment, I have used the ${USER} variable/constant to define the path for upload.
This would be handy for those who works in shared servers...

Thanks for your time!
Comment 6 Andrew Krasny 2012-10-29 20:34:29 UTC
(In reply to comment #5)
> Sorry, but I am unfamiliar with the approach suggested.
> Can you give me an use example?
> 
> If I understood correctly, to use the global setting you suggested, I will have
> to add a parameter to the "Destination" property in the Netbeans shortcut.
> It would like something like this?
> "C:\Program Files\NetBeans 7.1\bin\netbeans.exe
> -J-Dcnd.tmpbase=/home/path/to/some/dir" 
> 

Yes, that's right.

> While in the topic, your solution will accept variables?
> As stated in my last comment, I have used the ${USER} variable/constant to
> define the path for upload.
> This would be handy for those who works in shared servers...
> 

Not guaranteed (need to double-check though...). The value specified in cnd.tmpbase is used as a root directory for temp files. There will be at least one additional directory level unique to [user]/[host (s)he is connecting from] so there will be no conflicts between different users. 

Also you can use some non-absolute path - in this case it will be related to the remote user's home directory.

But you're right that in general a single value could be not sufficient, as specified folder (absolute path) may exist (or could be created) on one host and absent (and could not be created) on another one... 
But to serve this case we need to re-think how to implement it best... 

> Thanks for your time!
Comment 7 Quality Engineering 2012-10-30 02:33:11 UTC
Integrated into 'main-golden', will be available in build *201210300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/469aedac842d
User: Andrew Krasny <akrasny@netbeans.org>
Log: #216366 - Netbeans Terminal: Unable to upload pty / Unable to start pty process

A property cnd.tmpbase could be used to re-define default base location used for temp/helpers files.
Comment 8 Maria Tishkova 2013-05-17 13:45:26 UTC
*** Bug 227251 has been marked as a duplicate of this bug. ***
Comment 9 Maria Tishkova 2013-05-20 08:36:14 UTC
*** Bug 225473 has been marked as a duplicate of this bug. ***
Comment 10 Bennyonbeans 2013-08-08 01:32:56 UTC
I have a new install on a new Windows 8 64 bit machine. I get the error "Unable to start pty process:". I got this on a simple test run. Tools from Cygwin didn't load, so I loaded MinGW. I'm new to this. Please help me in very simple, step-by-step manner.
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo