Red HatThis forum is for the discussion of Red Hat Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
trying to set a command to run at start up. Made a file with the command and added the file to /etc/rc.d/rc.local. I then set /etc/rc.d/rc.local and my command file to execute. I then checked systemctl status rc-local and got this error. All i did to the /etc/rc.d/rc.local file is add the last line to run the command file and i am not sure why it does not seem to have the information it needs or what to put into the file to make it work correctly.
[root@localhost ~]# systemctl status rc-local
● rc-local.service - /etc/rc.d/rc.local Compatibility
Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2018-02-04 10:35:53 EST; 2h 21min ago
Feb 04 10:35:53 localhost.localdomain rc.local[3311]: /etc/rc.d/rc.local: line 13: [Unit]: command not found
Feb 04 10:35:53 localhost.localdomain rc.local[3311]: /etc/rc.d/rc.local: line 14: Compatibility: command not found
Feb 04 10:35:53 localhost.localdomain rc.local[3311]: /etc/rc.d/rc.local: line 17: [Service]: command not found
Feb 04 10:35:53 localhost.localdomain rc.local[3311]: /etc/rc.d/rc.local: line 19: start: command not found
Feb 04 10:35:53 localhost.localdomain rc.local[3311]: /etc/rc.d/rc.local: line 25: [Install]: command not found
Feb 04 10:35:53 localhost.localdomain rc.local[3311]: xset: unable to open display ""
Feb 04 10:35:53 localhost.localdomain systemd[1]: rc-local.service: control process exited, code=exited status=1
Feb 04 10:35:53 localhost.localdomain systemd[1]: Failed to start /etc/rc.d/rc.local Compatibility.
Feb 04 10:35:53 localhost.localdomain systemd[1]: Unit rc-local.service entered failed state.
Feb 04 10:35:53 localhost.localdomain systemd[1]: rc-local.service failed.
[root@localhost ~]# cat /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
It looks as if your system is trying to run a systemd service file as a script. The question is what did you do to cause this confusion?
What kind of file is Compatibility? Is it a script or a service file? If it's a service file it should be in /etc/systemd/system with the others, not in /etc/rc.d.
I would start again from the beginning. Create a service file to launch your command, put it with the other service files and leave the scripts directory alone. The text stored in rc.local already indicates that you aren't supposed to use this on your system.
Well what i was trying to do was run a command at start up. I am still new to Linux so i was looking online and was trying to follow a guide on how to do it but was getting that error unlike the person who made the guide. The command i am trying to have ran is "xset led on" I have a led keyboard and just trying to set it up to turn on the lights at start up.
I have an led keyboard and was trying to run the command "xset led on" at start up. I am still new to linux and was following a guide and everything worked until i went to enable rc-local.service.
Find out if you run gnome-session-properties in command prompt it will pull up the gui for startup applications that i was unable to find in the menu area. In there i was able to add the command to the start up to run when the user logs in.
I am not familiar with XWindows. How would i need to access and set that up to run properly.
In Linux, the graphical desktop is not closely integrated with the underlying system as it is in Windows. X, as it is called, sits loosely on top of Linux like a hat on a head. You don't even need to wear a hat! Server distros don't bother to run X.
Desktop distros usually launch X automatically as the last part of the start-up procedure, so you don't need to know how to launch it yourself. But any graphical programs that you want to run at startup can be put into your personal graphical startup file. What that looks like will depend on which of the many available graphical desktops you are running.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.