This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM4376: After enabling silent console application get terminated or crashed

Part Number: AM4376

Tool/software: Linux

Hell All,

We used AM4376 with TI Linux SDK.

We successfully silent the u-boot / kernel messages by enabling silent console option in u-boot and defining silent=1.

We successfully login using telnet on board. 

After login when i execute ps -e | grep myapplication we don't get any output.

I repeat same step after some time but get same result. Application was running before enabling silent console.

I run my application as systemd service.It is defined as follow:

[Unit]
Description=Initmyapplication

[Service]
ExecStart=/usr/bin/myapplication &
StandardOutput=tty

Please guide me to solve this issue.

Regards,

Dhananjay Patil

  • Hello Dhananjay,

    Does your application tries to print something on the console? If so disable these prints. Please, also remove the StandardOutput=tty from your Initmyapplication.service file and use the systemctl status myapplication.service and journalctl command to check the application's status.

    Best regards,
    Kemal

  • Hello Dhananjay,

    Were the prints in your application caused the termination? What did you see in the journalctl and systemctl status myapplication.service logs?

    Best regards,
    Kemal

  • Hi Kemal,
    Yes prints in my application causing the termination.
    This prints are debug prints of application.
    Debug prints should be available when I login through telnet port.
    For above requirement what should i define StandardOutput in service?

    I get following output of systemctl status myapplication.service

    Loaded: loaded (/lib/systemd/system/myapplication.service; static; vendor preset: enabled)
    Active: failed (Result: exit-code) since Fri 2019-01-18 18:38:11 IST; 36min ago
    Process: 791 ExecStart=/usr/bin/myapplication & (code=exited, status=209/STDOUT)
    Main PID: 791 (code=exited, status=209/STDOUT)

    Jan 18 18:38:11 SFT systemd[1]: Started Initmyapplication.
    Jan 18 18:38:11 SFT systemd[1]: myapplication.service: Main process exited, code=exited, status=209/STDOUT
    Jan 18 18:38:11 SFT systemd[1]: myapplication.service: Unit entered failed state.
    Jan 18 18:38:11 SFT systemd[1]: myapplication.service: Failed with result 'exit-code'.



    Regards,
    Dhananjay Patil
  • You can change the StandardOutput=tty to StandardOutput=journal and use journalctl -u myapplication.service command later to check the debug messages of your application.

  • Hi Kemal,

    Thank you for your help.
    journalctl -u myapplication.service gives debug messages
    I assume that after mentioning StandardOutput=journal, all debug messages will stored in file.Correct me if i am wrong.
    Could we redirect our STDOUT to telnet so that when we login using telnet it will print debug messages ?

    Regards,
    Dhananjay Patil
  • Yes. You can run your application with ExecStart=/bin/sh -c '/usr/bin/myapplication 2>&1 >> /etc/issue.net' and these debug messages will appear when you login using telnet.

  • Hi Kemal,
    Thanks for your reply.
    I run application with ExecStart=/bin/sh -c '/usr/bin/myapplication 2>&1 >> /etc/issue.net'.
    What should be StandardOutput for above change?
    I remove 'StandardOutput' option from service.
    Following are my observation:
    1. All log are saved in /etc/issue.net
    2.When I reboot the board it display old data

    Application print debug messages by using printf.
    When I kill my application and after sometime run my application( by giving /usr/bin/myapplication &) then i observe my output of printfs(used for debugging) .

    Is it due to i run my application as service?

    Regards,
    Dhananjay Patil
  • Yes. All the observations you saw are expected. Use this command line instead ExecStart=/bin/sh -c '/usr/bin/myapplication 2>&1 > /etc/issue.net' if you do not want to see the old data.

  • Hi kemal ,
    Thanks for quick reply.
    I have following questions.
    Is there any other way i can display my printf without storing the logs to specific file using telnet?We have limited amount of memory.
    How to start application during boot time without running as service ? So that printf output willbe available.

    Regards,
    Dhananjay Patil
  • Please, close this thread by clicking on "This resolved my issue" button and create a new thread for your new question.