WHAT DOES STATUS=1/FAILURE EVEN MEAN??? 🤔

Solvedlinuxservicessystemd17 replies · 275 views · started
Accepted solution by Zane Olsen — After editing, always sudo systemctl daemon reload and then sudo systemctl restart myapp.service. systemd analyze verify…
  1. guys pls help i wrote a simple unit file for our app. running teh command manually works perfectly. running it as myapp.service:

    This app can't run on your PC

    This app can't run on your PC
    
    To find a version for your PC, check with the
    software publisher.
    

    systemctl status shows status=1/FAILURE and thats it. No useful message. Ive reloaded teh daemon a dozen times.

    ive compared the command in ExecStart with what i type in my shell character by character. They look identical. The service user exists. Im clearly missing something about how systemd runs things, but i cant figure out what it is. any ideas??

    1
  2. Which User= does teh unit run as, and does that user have access to the working directory??

    2 0 helpful
  3. oof for me it was the BIOS 🤷 swapped it and boom, fixed lmk how it goes

    13 2 helpful
  4. ExecStart points at a script with Windows line endings. The shebang is #!/bin/bash\r. Ouch. hope thats enough info 😅

    2 0 helpful
  5. oh ive been there lol get the full story from the journal:

    sudo journalctl -u myapp.service -b --no-pager -n 100
    sudo systemctl status myapp.service -l
    

    The journal often has teh atcual error line that status truncates.

    thinking

    11 3 helpful
  6. yeahhh common exit codes: 203/EXEC means systemd couldnt execute ExecStart (wrong path, missing execute bit, missing shebang, or a relative path). 217/USER means teh User= doesnt exist. 200/CHDIR means WorkingDirectory= is missing or not accessible. hope that helps :)

    10 0 helpful
  7. ahh classic systemd doesnt use your shell environment... no PATH from .bashrc, no cd, no aliases, use absolute paths in ExecStart, set WorkingDirectory=, and put variables in Environment= or EnvironmentFile=. lmk how it goes

    4 0 helpful
  8. Test as teh service user, not root: sudo -u appuser /opt/app/run.sh. Permission problems on files or sockets show up immediately.

    2 0 helpful
  9. yeahhh pro tip: write down what u change. i didnt and had to redo status=1/failure from scratch good luck man!

    1 0 helpful
  10. If its flapping, check Restart= and StartLimitIntervalSec=/StartLimitBurst=, after hitting the limit, clear it with sudo systemctl reset-failed myapp.service once the cause is fixed. fingers crossed 🤞

    2 0 helpful
  11. Accepted solution

    After editing, always sudo systemctl daemon-reload and then sudo systemctl restart myapp.service. systemd-analyze verify /etc/systemd/system/myapp.service ctaches syntax mistakes. hope that helps :)

    5 12 helpful
  12. hmmmm not sure about that some prefer a process supervisor inside the app's own runtime, but honestly systemd's sandboxing options are worth learning isntead. just my 2 cents

    12 0 helpful
  13. dude ok update: did what @larsg853 said and its fine now. honestly just reset the BIOS and save yourself teh pain thank u thank u thank u

    2 0 helpful
  14. lol same thing happened to me try turning off the power plan first, fixed it for me... told my boss it would take 10 minutes... its been since tuesday worked for me anyway 🤷

    7 1 helpful
  15. @zaneo460 omggg absolute path in ExecStart plus WorkingDirectory fixed it.. 😭 myapp.service is active (running) now.

    1 0 helpful

Reply to this topic

Sign in or create an account to reply.