Can't create SFTP connection: SSH slave exited unexpectedly with error code 255

Forum for questions and support relating to the 1.30.x releases only.
Locked
jkemp
Posts: 13
Joined: Thu Mar 05, 2015 10:20 pm

Can't create SFTP connection: SSH slave exited unexpectedly with error code 255

Post by jkemp »

Can someone help me figure out why I get a ton of the messages when trying to upload to ubuntu-server on local lan. I can log this user in sftp server no problem from a terminal on the very client zoneminder is running on.

I'm using ubuntu-server 16.04 LTS and the same with the client. Ubuntu 16.04 LTS desktop.

Every thing is working except the upload. I have 10 monitors running at 1280x720@30fps no problem. I can stream, view, and wrap up the .tar files. The logs shows it creating files to be uploaded. Uploading... Then Bam! This error message. Lots of them.

I have tried many combinations for the remote directory. Currently I have /zm-events entered. I have a user "zm" in jail under /home with root owning both directories but the directory "zm-events under /home/zm/zm-events is owned by "zm" and that user is in the sftp group.

Any time spent help me with this will greatly be appreciated.

Thank you
James
theroot
Posts: 2
Joined: Thu Aug 25, 2016 8:34 pm

Re: Can't create SFTP connection: SSH slave exited unexpectedly with error code 255

Post by theroot »

I'm having the same issue. What happens if you run this from the terminal as root : `zmfilter -f $FILTER_NAME` replacing $FILTER_NAME with whatever you set in the filter web ui setup?
Do you see something like this :

Code: Select all

ssh: Could not resolve hostname array(0x38a7c80): Name or service not known
If so it may be the same issue I have. It looks like an issue with their push function syntax on lines 555 & 557 in /usr/bin/zmfilter.pl . Haven't gotten around to filing a bug report for it, but lines 555-558 should probably read something like :

Code: Select all

            push(@more_ssh_args, '-o StrictHostKeyChecking=no')
                if ! $Config{ZM_UPLOAD_STRICT};
            push(@more_ssh_args, '-v')
                if $Config{ZM_UPLOAD_DEBUG};
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Can't create SFTP connection: SSH slave exited unexpectedly with error code 255

Post by knight-of-ni »

but, but, but ....what if my hostname really is "array(0x38a7c80)"? Kidding of course.

I guess this is a case of different perls behaving differently, as the current syntax tested fine on my CentOS 7 machine.
I think the issue is actually with line 559. Since more_ssh_args is already a list.

Change line 559 from:

Code: Select all

$sftpOptions{more} = [@more_ssh_args];
to:

Code: Select all

$sftpOptions{more} = @more_ssh_args;
Since more_ssh_args is already a list, my hypothesis is adding the brackets causes Perl to insert the list into a second list on your system.

Since this works fine on my machine as is, I'd appreciate it if both of you could test this and get back to me.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
theroot
Posts: 2
Joined: Thu Aug 25, 2016 8:34 pm

Re: Can't create SFTP connection: SSH slave exited unexpectedly with error code 255

Post by theroot »

knnniggett wrote:but, but, but ....what if my hostname really is "array(0x38a7c80)"? Kidding of course.

I guess this is a case of different perls behaving differently, as the current syntax tested fine on my CentOS 7 machine.
I think the issue is actually with line 559. Since more_ssh_args is already a list.

Change line 559 from:

Code: Select all

$sftpOptions{more} = [@more_ssh_args];
to:

Code: Select all

$sftpOptions{more} = @more_ssh_args;
Since more_ssh_args is already a list, my hypothesis is adding the brackets causes Perl to insert the list into a second list on your system.

Since this works fine on my machine as is, I'd appreciate it if both of you could test this and get back to me.
lol. I'm on CentOS7 as well - fresh build less than a week old, perl v 5.16.3 . I changed line 559 as you requested :

Code: Select all

            push @more_ssh_args, ['-o'=>'StrictHostKeyChecking=no']
                                if ! $Config{ZM_UPLOAD_STRICT};
            push @more_ssh_args, ['-v']
                if $Config{ZM_UPLOAD_DEBUG};
            $sftpOptions{more} = @more_ssh_args;
And I still get :

Code: Select all

Can't create SFTP connection: SSH slave exited unexpectedly with error code 255
Although it's a bit different of an error when ran manually :

Code: Select all

[root@phoenix ~]# zmfilter.pl -f uploadToIO
ssh: connect to host 2 port 16969: Invalid argument
When I dump more_ssh_args I see the proper assignments :

Code: Select all

$VAR1 = [
          [
            '-o',
            'StrictHostKeyChecking=no'
          ],
          [
            '-v'
          ]
        ];
However, when I dump sftpOptions 'more' gets assigned 2 instead (I changed user, pass, and host for this post).

Code: Select all

$VAR1 = {
          'password' => 'mypass',
          'timeout' => '600',
          'user' => 'myuser',
          'more' => 2,
          'port' => '16969',
          'host' => 'myhost'
        };
It appears assigning it like that is storing the count of arrays instead of the actual values. If I do another push to @more_ssh_args I get '3' returned there.

I was never a fan of perl TBH, haven't used it in years, so I might be missing the obvious issue. It seemed to me you guys were creating this multidimensional array of @more_ssh_args and I wasn't sure why that was needed, so reassigning it as a single array was my fix.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Can't create SFTP connection: SSH slave exited unexpectedly with error code 255

Post by knight-of-ni »

A Pull Request to fix this issue has been generated:
https://github.com/ZoneMinder/ZoneMinder/pull/1677

It awaits peer review and verification that the issue has been resolved on systems other than my own.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
Locked