rc.local not executing commands

silver.bullet at zoho.com silver.bullet at zoho.com
Thu Nov 5 17:03:00 UTC 2015


On Thu, 5 Nov 2015 16:51:42 +0000, R Kimber wrote:
>On Thu, 5 Nov 2015 16:04:08 +0100
>silver.bullet at zoho.com wrote:
>
>> On Thu, 05 Nov 2015 15:50:28 +0100, Oliver Grawert wrote:   
>> >how do you determine that it is not working, note that there is a
>> >"ondemand" system job that enforces the ondemand governor after boot
>> >(has a 60sec delay) which might set different cpufreq defaults after
>> >your code ran ...  
>> 
>> So a race condition seemingly is caused by /etc/init.d/ondemand from
>> http://packages.ubuntu.com/vivid/initscripts and the OP needs to
>> disable it first. However, after disabling it, I still recommend to
>> use a systemd unit.  
>
># This script is executed at the end of each multiuser runlevel.
>
>Does this not mean that rc.local is the last thing to be run ?
>Would that not overrride /etc/init.d/ondemand ?

Oli mentioned a 60 seconds delay, hence the race condition ;).

This one didn't came through the list, since I used two times the
wrong account:

On Thu, 2015-11-05 at 17:03 +0100, Tom H wrote:
> On Thu, Nov 5, 2015 at 3:26 PM, R Kimber <richardkimber at btinternet.com
> > wrote:
> > On Thu, 5 Nov 2015 15:08:37 +0100
> > Tom H wrote:
> > > > 
> > > > and the command
> > > >      sudo /usr/bin/cpufreq-set -u 4.0Ghz
> > > > works fine from the command line.
> > > 
> > > Does it work without sudo?
> > 
> >  But stuff in rc.local should be run as root.
> 
> That's why I suggested removing "sudo".

The OP likely used sudo from command line only and not for the script,
so the culprit likely is what was mentioned by Oli. The only sane way is
to get rid of the race condition by disabling the default ondemand
script.

Even running sudo with root privileges shouldn't cause an issue.

A test running Ubuntu 15.10 in a systemd-nspawn container:

[weremouse at moonstudio ~]$ sudo -k -i
[sudo] password for weremouse: 
[root at moonstudio ~]# sudo -k sleep 1
[root at moonstudio ~]# logout
[weremouse at moonstudio ~]$ su
Password: 
[root at moonstudio weremouse]# sudo -k sleep 1
[root at moonstudio weremouse]#

The sleep command runs and there's no need to enter a password.

Regards,
Ralf





More information about the ubuntu-users mailing list