Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Scripts in /etc/local.d do not seem to start
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
walterbyrd
n00b
n00b


Joined: 26 Apr 2017
Posts: 48

PostPosted: Sun Jan 21, 2018 12:19 am    Post subject: Scripts in /etc/local.d do not seem to start Reply with quote

Code:

# uname -a
Linux systemname 4.14.13-calculate #1 SMP PREEMPT Thu Jan 11 14:31:45 UTC 2018 x86_64 AMD Athlon(tm) II X4 640 Processor Authentic AMD GNU/Linux


I am running calculate linux, which is supposed to be gentoo under the hood.

I am using openrc.

I am trying to follow the directions in the handbook.

https://wiki.gentoo.org/wiki//etc/local.d

But I cannot get this to work.

Code:

# rc-update add local default
 * rc-update: local already installed in runlevel `default'; skipping

# rc
 * rc is deprecated, please use openrc instead.
 * Caching service dependencies ...                                       [ ok ]
calculate-core    | * Start calculate core ...
calculate-core    | * start-stop-daemon: /usr/sbin/cl-core is already running
samba             | * samba -> start: smbd ...                            [ ok ]
samba             | * samba -> start: nmbd ...                            [ ok ]

# rc-service local start
local             | * WARNING: local has already been started
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54239
Location: 56N 3W

PostPosted: Sun Jan 21, 2018 12:25 am    Post subject: Reply with quote

walterbyrd,

Show us
Code:
 ls -l /etc/local.d/
an one of the scripts you have there.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5934

PostPosted: Sun Jan 21, 2018 1:40 am    Post subject: Reply with quote

I've found local.d scripts to be very flaky in terms of what runs and what doesn't.

This works...
Code:
#!/bin/bash

# Disable relatime=temporary on pool rootfs
ROOTFS=$(zpool get -o value -H bootfs)

zfs set relatime=off $ROOTFS


Yet this doesn't.
Code:
#!/bin/bash

DEBUG=0

# This turns off Intel turbo boost because the BIOS won't let us do it in there
# Requirements: CONFIG_X86_INTEL_PSTATE

until [ -e /sys/devices/system/cpu/intel_pstate/no_turbo ]; do
        if [ "$DEBUG" -eq "1" ]; then
                printf "Waiting for no_turbo to appear...\n"
        fi
        sleep 5
done

OUTPUT=`cat /sys/devices/system/cpu/intel_pstate/no_turbo`

if [ "$OUTPUT" -ne "1" ]; then
        until [ "$OUTPUT" -eq "1" ]; do
                echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
                OUTPUT=`cat /sys/devices/system/cpu/intel_pstate/no_turbo`
                if [ "$OUTPUT" -ne "1" ]; then
                        if [ "$DEBUG" -eq "1" ]; then
                        printf "Turbo did not get disabled, trying again...\n"
                        fi
                        sleep 5
                else
                        if [ "$DEBUG" -eq "1" ]; then
                                printf "Turbo should now be disabled...\n"
                        fi
                fi
        done
else
        if [ "$DEBUG" -eq "1" ]; then
                printf "Turbo is already disabled.\n"
        fi
fi


I couldn't tell you why the second script doesn't work, I tried debugging it but never got any output. :(

I wound up sticking the second script into cron.
Back to top
View user's profile Send private message
walterbyrd
n00b
n00b


Joined: 26 Apr 2017
Posts: 48

PostPosted: Sun Jan 21, 2018 7:09 pm    Post subject: Reply with quote

Code:

# ls -l /etc/local.d/
total 16
-rwxr-xr-x 1 root root 142 Jan 21 11:58 cip.start
-rwxr-xr-x 1 root root  32 Jan 20 17:07 helloworld.start
-rwxr-xr-x 1 root root 476 Jan 20 18:30 ksm.start
-rw-r--r-- 1 root root 652 Nov 30 07:30 README


The helloworld.start is simple enough:

Code:

#!/bin/bash

echo "hello world"


I created the cip.start because, although I have set up for static IP, I keep getting changed into DHCP. Also, almost every time I update, my net.eth0 link is removed (cip is for change IP).


Code:

#!/bin/bash
 
F1=/etc/init.d/net.eth0
F2=/etc/init.d/lo.eth0
if [ ! -h "$F1" ]
then
    ln -s $F2 $F1
fi
ifconfig eth0 192.168.1.109
/etc/init.d/net.eth0 rest


ksm.start was put there by the system.

Code:

#!/bin/bash
 
#------------------------------------------------------------------------------
# Modified Calculate Utilities 3.5.8.4
# Processed template files:
# /var/lib/layman/calculate/profiles/templates/3.5/2_ac_install_merge/sys-kernel/calculate-sources/ksm.start
# For modify this file, create /etc/local.d/ksm.start.clt template.
#------------------------------------------------------------------------------
F=/sys/kernel/mm/ksm/run
if [ -f $F ]
then
    echo 1 > $F
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sun Jan 21, 2018 9:07 pm    Post subject: Reply with quote

Did you create this "/etc/init.d/lo.eth0" file? That's not standard on any gentoo system and looks like a typo.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54239
Location: 56N 3W

PostPosted: Sun Jan 21, 2018 10:01 pm    Post subject: Reply with quote

walterbyrd,

Is this
Code:
/etc/init.d/net.eth0 rest
a copy/paste error?
It should be restart.

The right solution is to find out what's messing with your network setup and fix it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sun Jan 21, 2018 11:58 pm    Post subject: Reply with quote

bunder wrote:
I've found local.d scripts to be very flaky in terms of what runs and what doesn't.

I couldn't help you with the second script, but i could help you removing blur on why you may think it doesn't work.

printf, echo... all output are disable, so you can turn on DEBUG="1", you will never get a trace for that.

But you can see easy if a script work:
Code:
cat hello.start
#!/bin/bash
echo "hello world by echo"
printf "hello world by printf\n"
echo "hello world!" >> /tmp/hello


Code:
>LANG="C" cat /tmp/hello
cat: /tmp/hello: No such file or directory
>/etc/init.d/local restart
 * Stopping local ...                                                     [ ok ]
 * Starting local ...                                                     [ ok ]
>cat /tmp/hello
hello world!


But it's doable to enable output that will help you ;)
Code:
>echo 'rc_verbose="yes"' >> /etc/conf.d/local
>/etc/init.d/local restart
 * Caching service dependencies ...                                       [ ok ]
 * Stopping local ...
 *   Executing "/etc/local.d/openrc_cache.stop" ...                       [ ok ]
 * Starting local ...
 *   Executing "/etc/local.d/hello.start" ...
hello world by echo
hello world by printf                                                     [ ok ]
>cat /tmp/hello
hello world!
hello world!
Back to top
View user's profile Send private message
walterbyrd
n00b
n00b


Joined: 26 Apr 2017
Posts: 48

PostPosted: Mon Jan 22, 2018 11:23 pm    Post subject: Reply with quote

> Did you create this "/etc/init.d/lo.eth0" file?


I did. But I am not sure why. It is another link of net.lo.

I have changed the cip.sh file to create a link from net.lo and not lo.eth0.
Back to top
View user's profile Send private message
walterbyrd
n00b
n00b


Joined: 26 Apr 2017
Posts: 48

PostPosted: Mon Jan 22, 2018 11:33 pm    Post subject: Reply with quote

> Is this a copy/paste error?
> It should be restart.

Yes, it is a copy/paste error. Sorry. In the actual script I have restart.

> The right solution is to find out what's messing with your network setup and fix it.


I have tried, but gave up.

Settup static IP address, but booting dhcp
https://forums.gentoo.org/viewtopic-t-1065376-highlight-.html
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Tue Jan 23, 2018 2:20 am    Post subject: Reply with quote

Compare your /etc/conf.d/net with this:
Code:
$ cat /etc/conf.d/net| grep "^[^#;]"         
rc_verbose="yes"
config_eth0="192.168.0.104 netmask 255.255.0.0"
routes_eth0="default gw 192.168.0.1"
modules="!iproute2"    #prefer ifconfig
dhcp_eth0="release nodns nontp "
dhcp_lo="nodns"
dns_servers_eth0="127.0.0.1 192.168.0.1"
dns_servers_lo="127.0.0.1 "
ifdown_eth0="no"
ethtool_change_eth0="wol g"
ifdown="no"
postdown() {
      [ "${IFACE}" != "lo" ] && ethtool -s "${IFACE}" wol g
             return 0
       }
The ethtool stuff is to enable wakeonlan.

Updates should not destroy files in /etc. Not in gentoo. Are you running etc-update? You should address this problem in calculate linux forum.
Are you running two managers? Like networkmanager as well as netifrc?
From the gentoo wiki networkmanager page:
Quote:
Important
NetworkManager and other network management services typically do not work together. That includes a standalone instances of dhcpcd and Gentoo's default netifrc scripts. Be sure only one network management service is running at a time. Adding more than one network management service will lead to unpredictable results!
Back to top
View user's profile Send private message
walterbyrd
n00b
n00b


Joined: 26 Apr 2017
Posts: 48

PostPosted: Wed Jan 24, 2018 10:54 pm    Post subject: Reply with quote

This is my /etc/conf.d/net file.

It is shorter than yours, but I think what I have is correct.

Code:

config_eth0="192.168.1.109/24"
routes_eth0="default via 192.168.1.1"
dns_servers_eth0=( "75.75.75.75 75.75.76.76" )


I am not sure why I would need anything more than that.

Just ran etc-update:

Code:

# etc-update
Scanning Configuration files...
Exiting: Nothing left to do; exiting. :)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54239
Location: 56N 3W

PostPosted: Wed Jan 24, 2018 11:06 pm    Post subject: Reply with quote

walterbyrd,

Code:
dns_servers_eth0=( "75.75.75.75 75.75.76.76" )

The parentheses "()" may still be tolerated but they have been depreciated for many years now.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
walterbyrd
n00b
n00b


Joined: 26 Apr 2017
Posts: 48

PostPosted: Fri Jan 26, 2018 6:44 pm    Post subject: Reply with quote

> The parentheses "()" may still be tolerated but they have been depreciated for many years now.


I will do away with the parens, thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum