Results 1 to 5 of 5

Thread: rc.local doesn't execute at startup

  1. #1
    Join Date
    Aug 2012
    Beans
    5

    rc.local doesn't execute at startup

    When i do: sudo sh /etc/rc.local it works perfect but when i reboot my system, it wont start.

    There is my rc.local file:
    Code:
    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
    
    sudo setxkbmap tr 
    exit 0
    I've added >> /var/log/rc.local.log 2>&1 to end of my command for see what's wrong and i've got this error from the log after reboot:
    Code:
    Cannot open display "default display"
    I also tried sleep X but it didn't work too!

    Any help will be greatly appreciated.

  2. #2
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,510
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: rc.local doesn't execute at startup

    Quote Originally Posted by HasanOzbey View Post
    When i do: sudo sh /etc/rc.local it works perfect but when i reboot my system, it wont start.
    .........
    It works perfectly. It cannot run a X command because the X server has not started when rc.local runs (and it wouldn't even know where to send the output anyway).

    Put X commands in the user Startup Appliactions that run after login on the GUI.
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

  3. #3
    Join Date
    Feb 2012
    Location
    Athens/Greece
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: rc.local doesn't execute at startup

    Hello ,
    Of course @dcstar has right .

    I want to add an extra tip.

    rc.local don't need a sudo. It executes the commands as root.

    Thanks

  4. #4
    Join Date
    Aug 2012
    Beans
    5

    Re: rc.local doesn't execute at startup

    Quote Originally Posted by dcstar View Post
    It works perfectly. It cannot run a X command because the X server has not started when rc.local runs (and it wouldn't even know where to send the output anyway).

    Put X commands in the user Startup Appliactions that run after login on the GUI.
    Thank you so much but I'm such a newbie. I'll be appreciate it if you tell me how can i put those "X commands (?)" in the Startup Applications.

    Quote Originally Posted by NikTh View Post
    Hello ,
    Of course @dcstar has right .

    I want to add an extra tip.

    rc.local don't need a sudo. It executes the commands as root.

    Thanks
    Thanks for the tip!
    Last edited by HasanOzbey; September 1st, 2012 at 11:29 AM.

  5. #5
    Join Date
    Aug 2012
    Beans
    5

    Re: rc.local doesn't execute at startup

    Fixed.

    Created a file named "keyfix" and put this command inside:
    Code:
    setxkbmap tr
    Moved this file to /home and ran that command:
    Code:
    chmod +x /home/keyfix
    Added this file into Start Applications and it worked.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •