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/AM4378: Init script does not execute at startup

Part Number: AM4378


Tool/software: Linux

Dear,

We designed a board broadly based on AM437x-GP-evm and we are using SDK 4.02.

We want initiate/run a script at boot-up for making touch screen work. I followed below Link and the ways are given below.

  •        Login to the root file system using:
user name: root
password: <no password>
  • Change directory to the standard initscript directory /etc/init.d
    cd /etc/init.d
  • Open a file for editing called helloworld.sh in the /etc/init.d directory.
    vi helloworld.sh
  • Add the following lines to the helloworld.sh file
#!/bin/sh

     echo "Hello from Sitara!!!"   

             /usr/bin/eGTouchD

  • Give the init script executable permissions so that it can be run
    chmod +x helloworld.sh
  • The init script has been created, but it has not been linked into the list of scripts to run on boot. To do so you will need to create a symlink to the script in the proper run level directory. The default run level is 5 so the symlink will be created there.
    cd /etc/rc5.d
    ln -s ../init.d/helloworld.sh S99helloworld
  • rebooted  board using the following command
init 6
Now I am not receiving "Hello from Sitara!!!" at the terminal screen at bootup and " /usr/bin/eGTouchD" file also does not execute.
 
 
Does the problem exist with sdk 4.02 or run level number? How do i solve this issue?
 
Regards,
Winiston.P
  • Hello Winiston,

    The wiki page you referred applies up to Processor SDK 02.00.02.11, in Processor SDK 03.00.00.04 the SystemV service manager has replaced by SystemD.

    To make your old SystemV script work over SystemD, there is a systemd-sysv-generator backward comparability wrapper .service unit which you can use, but this method is not recommended, seeing that the SystemV is obsolete and its support has dropped.

    If you run this command the /lib/systemd/systemd-sysv-install will be called and the service will be installed by using the wrapper unit.
    root@am437x-evm:~# systemctl enable helloworld.sh.service

    My suggestion is to write a new native SystemD service by taking help from this and this thread.


    Best regards,
    Kemal

  • Dear Kemal,

    I tried with SystemD  service by creating new files as given below.

    It executes at startup. But the problem is,  it does not execute with root permission.

    Ultimately i want to execute a file "/usr/bin/eGTouchD" at startup. It is file which is used to initiate egalaxy touch screen.If i execute manually after entering into "root", it execute properly. But when it execute at starts up, it does not execute properly .I added one echo command ("hello from futura") in my startup script. It execute properly.

    I gave permission to "eGTouchD" like chmod 777 /usr/bin/eGTouchD . Still problem does not solve. Please have a look on my file contents

    "touch.sh" file content as given below

    #!/bin/sh

    echo "hello from futura"

    /usr/bin/eGTouchD

    exit 0

    "touch.service" file content as given below

    [Unit]
    Description=touch enable

    [Service]
    Type=oneshot
    ExecStart=/etc/init.d/touch.sh
    StandardOutput=journal+console

    [Install]
    WantedBy=multi-user.target

    then i entered below command

    chmod 644 /lib/systemd/system/touch.service
    chmod 755 /etc/init.d/touch.sh
    systemctl enable touch.service
    systemctl daemon-reload

    Ultimately i want to execute "/usr/bin/eGTouchD" at startup. How do i acheive this?

    Regards,

    Winiston.P

  • Can you post the output of this command?

    root@am437x-evm:~# systemctl status touch.service

  • Dear, 

    The output of "root@am437x-evm:~# systemctl status touch.service" is

    touch.service - touch enable
    Loaded: loaded (/lib/systemd/system/touch.service; enabled; vendor preset: en
    abled)
    Active: inactive (dead) since Sat 2017-12-23 13:46:16 UTC; 43s ago
    Process: 784 ExecStart=/etc/init.d/touch.sh (code=exited, status=0/SUCCESS)
    Main PID: 784 (code=exited, status=0/SUCCESS)

    Dec 23 13:46:16 am437x-evm systemd[1]: Starting touch enable...
    Dec 23 13:46:16 am437x-evm touch.sh[784]: hello from futura
    Dec 23 13:46:16 am437x-evm touch.sh[784]: rm: can't remove '/tmp/eGTouch_*': No
    such file or directory
    Dec 23 13:46:16 am437x-evm systemd[1]: Started touch enable.

    The above dark texts are content of touch.sh. I am getting "Dec 23 13:46:16 am437x-evm touch.sh[784]: rm: can't remove '/tmp/eGTouch_*': No
    such file or directory" when "/usr/bin/eGTouchD"  execute using script. and touch is not working.

    But it works fine when i execute manually from "root@am437x-evm:" after booting. The working message is given below.

    root@am437x-evm:~# /usr/bin/eGTouchD
    root@am437x-evm:~# [ 223.418122] input: eGalaxTouch Virtual Device for Single 4

    The above manual command works fine. How do i solve this issue?

    Regards,

    Winiston.P

  • Use this:

    "touch.sh" file content as given below

    #!/bin/sh

    echo "hello from futura"
    touch /tmp/eGTouch_
    /usr/bin/eGTouchD