[Solved] MX19 ahs: is /etc/rc.local executed? [Yes it is.)  [Solved]

Message
Author
thomasl

[Solved] MX19 ahs: is /etc/rc.local executed? [Yes it is.)

#1 Post by thomasl »

I have a frugal install of MX19.2 ahs.

I added some simple commands to /etc/rc.local to init a few things but they had no effect whatsoever after rebooting. Even a simple "echo init >/home/thomasl/test" has no effect.

I double-checked with sysv-rc-conf and rc.local is checked for runlevels 2-5. Am I missing something obvious?
Last edited by thomasl on Wed Nov 11, 2020 5:42 am, edited 1 time in total.

User avatar
dolphin_oracle
Developer
Posts: 22659
Joined: Sun Dec 16, 2007 12:17 pm

Re: MX19 ahs: is /etc/rc.local executed?  [Solved]

#2 Post by dolphin_oracle »

thomasl wrote: Tue Nov 10, 2020 8:10 am I have a frugal install of MX19.2 ahs.

I added some simple commands to /etc/rc.local to init a few things but they had no effect whatsoever after rebooting. Even a simple "echo init >/home/thomasl/test" has no effect.

I double-checked with sysv-rc-conf and rc.local is checked for runlevels 2-5. Am I missing something obvious?
it is executed (we use it for stuff).

so post your rc.local and lets see if there is something we can see.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

User avatar
dolphin_oracle
Developer
Posts: 22659
Joined: Sun Dec 16, 2007 12:17 pm

Re: MX19 ahs: is /etc/rc.local executed?

#3 Post by dolphin_oracle »

if you just added lines to the bottom of rc.local, and you are booting into an X environment, the commands are not be executed. place your commands above this line

Code: Select all

# Automatically switch to vt2 when not in runlevel 5
case $(runlevel) in
    *5) exit 0  ;;
esac
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

thomasl

Re: MX19 ahs: is /etc/rc.local executed?

#4 Post by thomasl »

dolphin_oracle wrote: Tue Nov 10, 2020 8:25 am if you just added lines to the bottom of rc.local, and you are booting into an X environment, the commands are not be executed. place your commands above this line

Code: Select all

# Automatically switch to vt2 when not in runlevel 5
case $(runlevel) in
    *5) exit 0  ;;
esac
:happy: I did.
And still that simple "echo ..." was not executed. I will later double-check with the original rc.local from the iso and report.

thomasl

Re: [Solved] MX19 ahs: is /etc/rc.local executed? [Yes it is.)

#5 Post by thomasl »

Well... we have here an nice case of PEBKAC.

rc.local IS indeed executed... if its execute bits are set! My rc.local was, for whatever reason, rw_r__r__. Mea culpa and sorry for the noise. Marked solved.

User avatar
dolphin_oracle
Developer
Posts: 22659
Joined: Sun Dec 16, 2007 12:17 pm

Re: [Solved] MX19 ahs: is /etc/rc.local executed? [Yes it is.)

#6 Post by dolphin_oracle »

thomasl wrote: Wed Nov 11, 2020 5:44 am Well... we have here an nice case of PEBKAC.

rc.local IS indeed executed... if its execute bits are set! My rc.local was, for whatever reason, rw_r__r__. Mea culpa and sorry for the noise. Marked solved.
:number1:

yep that'll do it :p

thanks for the update :happy:
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

sanskk
Posts: 12
Joined: Sun Apr 14, 2019 4:56 pm

Re: [Solved] MX19 ahs: is /etc/rc.local executed? [Yes it is.)

#7 Post by sanskk »

I'll just use your thread, because I've got the same problem, rc.local is not executed when I reboot or relog into the only user. It can be executed though, and "sudo service rc.local start" shows it is working generally, just not as intended automatically.

Code: Select all

#!/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.
#

exec 1>/tmp/rc.local.log 2>&1	# stdout und stderr zu log
set -x					  	# Befehle vor Ausführung anzeigen
# Verhindert Probleme bei Eintreten in den Suspend, falls Blauzahneingabegeräte verbunden sind.
# Momentan auskommentiert, da keine Blauzahneingabegeräte angeschlossen werden und beim
# Suspend dann immer der Powerknopf gedrückt werden muß.
sudo sh -c "echo XHC1 > /proc/acpi/wakeup" ; sudo sh -c "echo EHC1 > /proc/acpi/wakeup" ; sudo sh -c "echo EHC2 > /proc/acpi/wakeup"
# Lädt den für die beschissene Netzwerkkarte nötigen Treibernachbau.
sh -c "modprobe b43"
# Aktualisiert die user.js von Feuerfuchs und Donnervogel 
# nach den strengen Varianten des Privacyhandbuchs
sh -c "/home/user/Skripte/updater -dsyp '/home/user/.mozilla/firefox/01234.56789/' > /tmp/1FF-updatercron.log 2>&1"
sh -c "/home/user/Skripte/updater -dsyp '/home/user/.thunderbird/01234.56789/' > /tmp/2TB-updatercron.log 2>&1"

exit 0

User avatar
dolphin_oracle
Developer
Posts: 22659
Joined: Sun Dec 16, 2007 12:17 pm

Re: [Solved] MX19 ahs: is /etc/rc.local executed? [Yes it is.)

#8 Post by dolphin_oracle »

rc.local will only be used on boot or reboot. its executed before login.

its also executed as root user, so you don't need to call sudo.

you also don't need the "sh" lines as you are executing standard commands, you have no need to call an additional interpreter.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

sanskk
Posts: 12
Joined: Sun Apr 14, 2019 4:56 pm

Re: [Solved] MX19 ahs: is /etc/rc.local executed? [Yes it is.)

#9 Post by sanskk »

So the lines would be:

Code: Select all

echo XHC1 > /proc/acpi/wakeup ; echo EHC1 > /proc/acpi/wakeup ; echo EHC2 > /proc/acpi/wakeup
modprobe b43
/home/user/Skripte/updater -dsyp "/home/user/.mozilla/firefox/01234.56789/" > /tmp/1FF-updatercron.log 2>&1
/home/user/Skripte/updater -dsyp "/home/user/.thunderbird/01234.56789/" > /tmp/2TB-updatercron.log 2>&1
Thanks. And if it is executed before start I guess the commands I'm trying to automate are wrong in there and should be in crontab with @reboot?

User avatar
dolphin_oracle
Developer
Posts: 22659
Joined: Sun Dec 16, 2007 12:17 pm

Re: [Solved] MX19 ahs: is /etc/rc.local executed? [Yes it is.)

#10 Post by dolphin_oracle »

sanskk wrote: Thu Nov 12, 2020 10:11 am So the lines would be:

Code: Select all

echo XHC1 > /proc/acpi/wakeup ; echo EHC1 > /proc/acpi/wakeup ; echo EHC2 > /proc/acpi/wakeup
modprobe b43
/home/user/Skripte/updater -dsyp "/home/user/.mozilla/firefox/01234.56789/" > /tmp/1FF-updatercron.log 2>&1
/home/user/Skripte/updater -dsyp "/home/user/.thunderbird/01234.56789/" > /tmp/2TB-updatercron.log 2>&1
Thanks. And if it is executed before start I guess the commands I'm trying to automate are wrong in there and should be in crontab with @reboot?
not knowing what is in your scripts I can't answer that. but the command will be executed, just it will be by the root user, not the local user.

you could also setup a script that loads when you login in, say in your bashrc or in the autostart area of your desktop of choice. there are a lot of ways to do that. Xfce even supports actions at logout rather than just login.

I need to backup on someting I said earlier. if your scripts do not have the executable bit set, then you should set it (chmod a+x FILENAME), else you will need the "sh -c" part on your own scripts.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

Post Reply

Return to “General”