rc.local not running on startup
Solution 1
According to This forum post the problem could be with failed distro-upgrades. After converting my physical disk to a VM and updating it there it worked with a test script: test.sh
echo run > run.txt
I then put back in my original script and it still didn't work. Taking the advice of Wazoox:
Yes obviously the "start_bt" script copy files around and run commands from a defined place which isn't / (from which /etc/rc.local is run). You should probably add a line like this : cd /home/[redacted]/Desktop/rtl8723bs_bt/ right after the line echo "Using device $TTY for Bluetooth"
By adding cd /home/[redacted]/Desktop/rtl8723bs_bt/ to the script fixed the problem of it not running. To fix this problem on the physical computer I will need to reinstall Ubuntu, which wasn't a problem for me.
Solution 2
I rewrite my comment as an answer:
The "start_bt" script copy files around and run commands from a defined place which isn't / (from which /etc/rc.local is ran). You should add a line like this :
cd /home/[redacted]/Desktop/rtl8723bs_bt/
right after the line
echo "Using device $TTY for Bluetooth"
So that all the commands are ran in the right folder.
Related videos on Youtube
Comments
-
Cutwow475 about 1 year
I have created a script to enable my Bluetooth driver. I then used rc.local to run it from startup. But, this is not working.
When running the command
systemctl status rc-local.service
I get:Failed to issue method call: no such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/systemd1/unit/rc_2dlocal_2eservice
What I should get is something that looks like this:
rc-local.service - /etc/rc.local Compatibility Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled) Drop-In: /lib/systemd/system/rc-local.service.d └─debian.conf Active: active (running) since Mon 2018-04-02 10:39:44 -03; 1s ago Process: 2044 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS) Main PID: 2049 (svscanboot) Tasks: 3 Memory: 556.0K CPU: 10ms CGroup: /system.slice/rc-local.service
All of my files are executable (
chmod 755 [filename]
), and I verified that the rc.local should run withsudo /etc/init.d/rc.local start
andsudo /etc/rc.local start
.Is there anything I am missing?
Current rc.local file:
#!/bin/sh -e # # # 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. /home/[redacted]/Desktop/rtl8723bs_bt/start_bt.sh exit 0
Contents from the start_bt.sh
#!/bin/bash # # Shell script to install Bluetooth firmware and attach BT part of # RTL8723BS # if [ "$1" = "" ] then # Find the TTY attached to the BT device TTYSTRING=`dmesg -t | grep tty | grep MMIO | cut -b 14-18` TTY=`expr substr "$TTYSTRING" 1 5` if [ "$TTYSTRING" = "" ] then echo echo "No BT TTY device has been found" echo "Either this computer has no BT device that uses hciattach, or" echo "Your kernel does not have module 8250_dw configured." echo "Note: The configuration variable is CONFIG_SERIAL_8250_DW." echo exit 1 fi else # Use the TTY device mentioned oi the call TTY=$1 fi TTY="/dev/$TTY" echo "Using device $TTY for Bluetooth" if [ ! -f /lib/firmware/rtl_bt/rtlbt_config ]; then mkdir -p /lib/firmware/rtl_bt/ cp rtlbt_* /lib/firmware/rtl_bt/. fi ./rtk_hciattach -n -s 115200 $TTY rtk_h5 > hciattach.txt 2>&1 &
-
pa4080 over 4 yearsDoes
systemctl status rc-local.service
provides active (running) when your script isn't there? -
wazoox over 4 yearsShow what's in your rc.local... Does it have a proper shebang, and ends with "exit 0"?
-
Cutwow475 over 4 years@wazoox Added. I have verified that the rc.local file works using the highlighted commands
-
wazoox over 4 yearsAren't you trying to run a program with a graphic component from rc.local? What's in "Blue.sh' ?
-
Cutwow475 over 4 years@wazoox sorry. I wasn't home when I put in the rc.local file. I fixed the path of the script and I added the script. And I am not trying to run a program with a GUI, just a script.
-
cmak.fr over 4 yearsTwo ideas - 1 - for the
start_bt.sh
script: try to provide full path, forrtlbt_*
and./rtk_hciattach -n -s 115200 $TTY rtk_h5 > hciattach.txt 2>&1 &
- 2 - Move thestart_bt.sh
script to somewhere like/opt
with root as owner. -
wazoox over 4 yearsYes obviously the "start_bt" script copy files around and run commands from a defined place which isn't / (from which /etc/rc.local is ran). You should probably add a line like this :
cd /home/[redacted]/Desktop/rtl8723bs_bt/
right after the lineecho "Using device $TTY for Bluetooth"
-
Cutwow475 over 4 years@wazoox that fixed it on my VM at least (which is a copy of the physical disc). But I think I found my real problem. Failed distro-upgrades, that could be giving me the error. With some more research, I found that this was a very likely cause of this problem.
-
Cutwow475 over 4 years@wazoox I would like to award you the bounty so if you could copy my answer or write your own I would be able to give the bounty.
-
-
Cutwow475 over 4 yearsThank you for all of the help. This fix seems so obvious now that you pointed it out.