Ошибка 255 returned 255

In my code I have the following to run a remote script.

ssh root@host.domain.com "sh /home/user/backup_mysql.sh"

For some reason it keeps 255’ing on me. Any ideas?

I can SSH into the box just fine (passless keys setup)

REMOTE SCRIPT:

MUSER='root' 
MPASS='123123'
MHOST="127.0.0.1"
VERBOSE=0

### Set bins path ###
GZIP=/bin/gzip
MYSQL=/usr/bin/mysql
MYSQLDUMP=/usr/bin/mysqldump
RM=/bin/rm
MKDIR=/bin/mkdir
MYSQLADMIN=/usr/bin/mysqladmin
GREP=/bin/grep

### Setup dump directory ###
BAKRSNROOT=/.snapshots/tmp

#####################################
### ----[ No Editing below ]------###
#####################################
### Default time format ###
TIME_FORMAT='%H_%M_%S%P'

### Make a backup ###
backup_mysql_rsnapshot(){
        local DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
        local db="";
        [ ! -d $BAKRSNROOT ] && ${MKDIR} -p $BAKRSNROOT
        ${RM} -f $BAKRSNROOT/* >/dev/null 2>&1
#       [ $VERBOSE -eq 1 ] && echo "*** Dumping MySQL Database ***"
#       [ $VERBOSE -eq 1 ] && echo -n "Database> "
        for db in $DBS
        do
                local tTime=$(date +"${TIME_FORMAT}")
                local FILE="${BAKRSNROOT}/${db}.${tTime}.gz"
#               [ $VERBOSE -eq 1 ] && echo -n "$db.."
                ${MYSQLDUMP} --single-transaction -u ${MUSER} -h ${MHOST} -p${MPASS} $db | ${GZIP} -9 > $FILE
        done
#               [ $VERBOSE -eq 1 ] && echo ""
#               [ $VERBOSE -eq 1 ] && echo "*** Backup done [ files wrote to $BAKRSNROOT] ***"
}

### Die on demand with message ###
die(){
        echo "$@"
        exit 999
}

### Make sure bins exists.. else die
verify_bins(){
        [ ! -x $GZIP ] && die "File $GZIP does not exists. Make sure correct path is set in $0."
        [ ! -x $MYSQL ] && die "File $MYSQL does not exists. Make sure correct path is set in $0."
        [ ! -x $MYSQLDUMP ] && die "File $MYSQLDUMP does not exists. Make sure correct path is set in $0."
        [ ! -x $RM ] && die "File $RM does not exists. Make sure correct path is set in $0."
        [ ! -x $MKDIR ] && die "File $MKDIR does not exists. Make sure correct path is set in $0."
        [ ! -x $MYSQLADMIN ] && die "File $MYSQLADMIN does not exists. Make sure correct path is set in $0."
        [ ! -x $GREP ] && die "File $GREP does not exists. Make sure correct path is set in $0."
}

### Make sure we can connect to server ... else die
verify_mysql_connection(){
        $MYSQLADMIN  -u $MUSER -h $MHOST -p$MPASS ping | $GREP 'alive'>/dev/null
        [ $? -eq 0 ] || die "Error: Cannot connect to MySQL Server. Make sure username and password are set correctly in $0"
}

### main ####
verify_bins
verify_mysql_connection
backup_mysql_rsnapshot

5

This is usually happens when the remote is down/unavailable; or the remote machine doesn’t have ssh installed; or a firewall doesn’t allow a connection to be established to the remote host.

ssh returns 255 when an error occurred or 255 is returned by the remote script:

 EXIT STATUS

     ssh exits with the exit status of the remote command or
     with 255 if an error occurred.

Usually you would an error message something similar to:

ssh: connect to host host.domain.com port 22: No route to host

Or

ssh: connect to host HOSTNAME port 22: Connection refused

Check-list:

  • What happens if you run the ssh command directly from the command line?

  • Are you able to ping that machine?

  • Does the remote has ssh installed?

  • If installed, then is the ssh service running?

answered Feb 14, 2013 at 23:30

P.P's user avatar

6

This error will also occur when using pdsh to hosts which are not contained in your «known_hosts» file.

I was able to correct this by SSH’ing into each host manually and accepting the question «Do you want to add this to known hosts».

1

If there’s a problem with authentication or connection, such as not being able to read a password from the terminal, ssh will exit with 255 without being able to run your actual script. Verify to make sure you can run ‘true’ instead, to see if the ssh connection is established successfully.

answered Feb 14, 2013 at 23:28

that other guy's user avatar

that other guythat other guy

116k11 gold badges168 silver badges193 bronze badges

Isn’t the problem in the lines:

### Die on demand with message ###
die(){
  echo "$@"
  exit 999
}

Correct me if I’m wrong but I believe exit 999 is out of range for an exit code and results in a exit status of 255.

1

I was stumped by this. Once I got passed the 255 problem… I ended up with a mysterious error code 1. This is the foo to get that resolved:

 pssh -x '-tt' -h HOSTFILELIST -P "sudo yum -y install glibc"

-P means write the output out as you go and is optional. But the -x ‘-tt’ trick is what forces a psuedo tty to be allocated.

You can get a clue what the error code 1 means this if you try:

ssh AHOST "sudo yum -y install glibc"

You may see:

[slc@bastion-ci ~]$ ssh MYHOST "sudo yum -y install glibc"
sudo: sorry, you must have a tty to run sudo
[slc@bastion-ci ~]$ echo $?
1

Notice the return code for this is 1, which is what pssh is reporting to you.

I found this -x -tt trick here. Also note that turning on verbose mode (pssh —verbose) for these cases does nothing to help you.

It can very much be an ssh-agent issue.
Check whether there is an ssh-agent PID currently running with eval "$(ssh-agent -s)"

Check whether your identity is added with ssh-add -l and if not, add it with ssh-add <pathToYourRSAKey>.

Then try again your ssh command (or any other command that spawns ssh daemons, like autossh for example) that returned 255.

### Die on demand with message ###
die(){
        echo "$@"
        exit 999
}

I don’t have the rep to comment on Alex’s answer but the exit 999 line returns code 231 on my WSL Ubuntu 20.04.4 box. Not quite sure why that is returned but I understand that it’s out of range.

1

This document (7018701) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 11 Service Pack 4 (SLES 11 SP4)

Situation

Upon right-clicking a folder in Gnome’s Nautilus file manager, choosing «Sharing Options,» selecting the «Share this folder» box and clicking the «Create Share» button in the open dialog, the following error is returned:

‘net usershare’ returned error 255:  net usershare add: cannot convert name «Everyone» to a SID. Access denied.

Resolution

Since samba-client version 3.6.3-76.1, a new global option is required in smb.conf.

hostname:~ # vi /etc/samba/smb.conf

Add this option under the [global] section:

client ipc signing = auto

After the change is written, restart the samba service:

hostname:~ # rcsmb restart

Cause

Several CVEs were addressed for this samba-client package with the update to version 3.6.3-76.1.  As a result of these changes, this new client ipc signing configuration option is required when creating usershares through Nautilus.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented «AS IS» WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7018701
  • Creation Date:
    09-Mar-2017
  • Modified Date:28-Sep-2022
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

  • Remove From My Forums
  • Question

  • Hi All, I am trying to depoy a exe on all our computers via SCCM. I have tested the command via command prompt and install perfectly but when I run it via SCCM it fails. I have checked the appenforce log file and all it says is error 255.

    The program is a exe that also installs a driver, for a USB display adaptor. the link for the file is as follows.

    http://www.j5create.com/download_new/driver/jua190_jua210_jua230_jua250_jua310_jua330_jua350_v14.01.0210.3179_win/j5UsbDisplayAdapter-v14.01.0210.3179-win.zip

    The command I am using is -v14.01.0210.3179-win.exe /s

    Below is the error in appenforce

    Process 1896 terminated with exitcode: 255]LOG]!><time=»09:39:12.903-660″ date=»03-07-2014″ component=»AppEnforce» context=»» type=»1″ thread=»6924″ file=»appexcnlib.cpp:1967″>
    <![LOG[    Looking for exit code 255 in exit codes table…]LOG]!><time=»09:39:12.903-660″ date=»03-07-2014″ component=»AppEnforce» context=»» type=»1″ thread=»6924″ file=»appexcnlib.cpp:505″>
    <![LOG[    Unmatched exit code (255) is considered an execution failure.]LOG]!><time=»09:39:12.903-660″ date=»03-07-2014″ component=»AppEnforce» context=»» type=»2″ thread=»6924″
    file=»appexcnlib.cpp:591″>

    Would love it if someone knows how to get this working and could let me know as I am stumped.

Answers

  • Tosten’s point is that all ConfigMgr can do (and does) is run the command-line that you tell it. The error code 255 returned is from the command-line that you gave it and is not specific to ConfigMgr in any way.

    Since the error code is specific to the exe you are running, that’s what you need to troubleshoot. A first good step is to add some logging to the command-line — once again this is specific to the command-line that you are running so we can’t tell you how
    to do that.

    Also, to properly simulate how ConfigMgr runs a program, you must run it in the System context (use psexec -s to launch a command-prompt running as System). On occasion, a poorly crafted installer makes some bad assumptions about the operating environment
    and thus fails when run as System.


    Jason | http://blog.configmgrftw.com

    • Marked as answer by

      Tuesday, March 11, 2014 12:16 AM

    • Marked as answer by
      Richard Bradley — St Catherine’s School
      Tuesday, March 11, 2014 12:16 AM
  • Hi Guys,

    Thanks for letting me know about PSEXEC. I didn’t know before now how it was actually loading the installers/commands, now I have another test I an use to ensure they work before putting them into SCCM.

    I have been able to work out how to get the installer for the program I need working. I was googling InstallSield installs (as I have found out it is a InstallShield Installer) and unlike usual where I could just run the /s switch to run the installer silently
    I created a recorded install for it which gave me a setup.iss file and used that.

    It has taken over prompts and anything in the background and has fixed the install issue.

    I can almost guarantee that he installer is behaving badly but by using the recorded install and the silent flag it is running correctly and successfully installing.

    Thanks again,

    Richard

    • Marked as answer by
      Richard Bradley — St Catherine’s School
      Tuesday, March 11, 2014 12:15 AM

I recently compiled a PHP 5.2.9 binary, and I tried to execute some PHP scripts with it. I can execute some scripts without problems, but one of them halts its execution midway, exiting with no errors or warnings. The returned status code of the process is 255.

I’ve read in the manual that such status is ‘reserved’. The question is: for what?

I believe it’s got something to do with missing dependencies in the PHP executable, but I can’t be sure.

Anyone knows what does an exit code of 255 mean?

P.S. There are no errors in the PHP scripts, they run OK on other machines.

masegaloeh's user avatar

masegaloeh

18.2k10 gold badges57 silver badges105 bronze badges

asked Jun 22, 2010 at 15:17

Silvio Donnini's user avatar

255 is an error, I could reproduce that same exit code by having a fatal error.

This means that somehow your error reporting is hidden, there are some possible causes for this:

  • error_reporting is not defined and php reports no error at all
  • An @ (error suppression operator) hides the output of the error
  • STDERR is redirected somewhere else (php -f somefile.php 2>/dev/null, remove the redirection)
  • This could still be an internal error due to missing dependencies and that a fatal error has the same exit code as a program crash.

hakre's user avatar

hakre

1561 silver badge13 bronze badges

answered Jun 22, 2010 at 16:05

Weboide's user avatar

WeboideWeboide

3,3351 gold badge24 silver badges33 bronze badges

1

It could also mean that /etc/php5/cli/php.ini (on Debian/Ubuntu) or /etc/php.ini (on RHEL/CentOS/etc.) has display_errors = Off which means that any errors or warnings from command-line scripts will go nowhere, unless log_errors = On (see also the error_log setting).

Try running your scripts with a wrapper script that uses php -d display_errors=on ...

answered Mar 12, 2014 at 7:08

Alastair Irvine's user avatar

2

It could also mean that

  • /etc/php5/cli/php.ini (on Debian/Ubuntu)

  • /etc/php.ini (on RHEL/CentOS/etc.)

has set

display_errors = Off 

which means that any errors or warnings from command-line scripts will go nowhere, unless

log_errors = On 

See also the error_log setting.

Try running your scripts with a wrapper

masegaloeh's user avatar

masegaloeh

18.2k10 gold badges57 silver badges105 bronze badges

answered Mar 6, 2016 at 15:15

Alauddin's user avatar

This might be caused by PHP suppressed error messages (the line starts with @). I found the line by

grep -r "@" src/ 

and then commented out the @. After this I got the actual error and was able to fix it easily. I also noticed afterwards that PHPStorm had found out the same error already, but I hadn’t fixed/noticed it.

answered Feb 11, 2016 at 17:03

Antti Hätinen's user avatar

In my case that was xDebug death because of low xdebug.max_nesting_level value.

answered Jan 16, 2018 at 12:34

zored's user avatar

zoredzored

1211 bronze badge

Locate what php.ini your php-cli used.

brain@cordova:~% php -i | grep "php.ini"

8:Configuration File (php.ini) Path => /etc/php/7.3/cli
9:Loaded Configuration File => /etc/php/7.3/cli/php.ini

Make sure display_errors parameters is active.

brain@cordova:~% php -i | grep "error"

106:display_errors => On => On
114:error_log => /tmp/php_errors.log => /tmp/php_errors.log
116:error_reporting => 22527 => 22527
134:log_errors => On => On

Make sure display_errors and log_errors are ON.

Define the error_log location to logging errors into file.

Error messages should shown now.

answered Mar 28, 2020 at 10:19

Brain90's user avatar

Brain90Brain90

1211 silver badge7 bronze badges

First of all, what is Samba error 255? Well, it is the error that we get when in Ubuntu (for example), we try to share a folder and we cannot because it tells us:

The "network share" returned error 255: net usershare: cannot open usershare directory / var / lib / samba / usershares. Error Permission Denied You do not have permission to create a usershare. Ask your administrator to grant you permissions to create a share.

This happened to me when I tried to create a shared folder on one of my users’ PCs, so that I could comfortably exchange files with a Windows XP virtual machine running on Virtualbox.

In the case of Ubuntu the solution is simple, because I solved everything by executing in the terminal:

sudo chmod 777 /var/lib/samba/usershares

But this may not be the solution for others. For example, in the case of Debian it can be easily solved also by adding our user to the sambashare group.

# addgroup usuario sambashare

They just told me by MP that another possible solution is adding to the file /etc/samba/smb.conf the parameter: users share owner only = False

But let’s say we want something more. In this case we do not want it to ask us for a username and password to access the shared folder. Well, for this, what we do is create a folder in / media:

# mkdir /media/compartir
# chmod -R 777

And then we add to the end of the file /etc/samba/smb.conf:

[documents] comment = Shared documents path = / media / share public = yes writable = yes

And well, in some cases we have to restart Samba:

# /etc/init.d/samba restart

Now, from the virtual machine I just have to put in Windows Explorer:

\192.168.X.Xcompartir

And ready..

The content of the article adheres to our principles of editorial ethics. To report an error click here.

Понравилась статья? Поделить с друзьями:
  • Ошибка 301 на лада калина
  • Ошибка 255 php
  • Ошибка 301 машины
  • Ошибка 25472 селектор
  • Ошибка 2546 фольксваген