SlackwareThis Forum is for the discussion of Slackware 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.
How can I debug my rc.d/rc.* scripts as they are called from init. I've got a problem (see other post) where dhcpcd is started 2 (or 3) times for the same network interface. I've tried using -x, but that doesn't help. Also, entering the scripts as commands doesn't work, because it works perfectly every time in this mode.
I've added a bunch of "echo" and "sleep" statements, but there still seems to be a problem with the order that things are showing up on the console. Could that be because of "multiuser" mode. If so, how can I get around it (while still staying "multi"). Should I use something instead of "sleep" to hold the console, to give me time to read it.
sh +x <scriptname>
to see where its failing, etc. This is what I use to see where a script fails and such.
.. and for the equivalent for usage inside (Ba)sh scripts, add a line "set +x".
if your starting several versions of dhcpcd i doubt it is your scripts that are cuasing the problem.
try this though:
grep dhcpcd /etc/rc.d/rc* <--- that will show you everywhere the dhcp Client Deamon is being called from.
should be only in there once and maybe some comments. Check in rc.inet1.conf and look for the lines like:
USE_DHCP[x]="" <--- i leave it blank for nics i dont have so they arent used, but i think it has to be "yes" for it to try and use dhcpcd for that nic
and make sure you have the correct settings
In /etc/rc.d/rc.inet.conf check what you have for nic settings.
if that all looks correct what does it say when you ps -ax for dhcpcd? should be like:
12345 ? S 0:00 /sbin/dhcpcd -t 10 -d eth0 <---does it show for all -d as eth0
check what you have in /etc/host.conf should be something like:
order bind, hosts
multi on
nospoof
if that all works try:
ifconfig eth0 down
ps -ax <--- see if all the dhcpcd processes ended if they did then run the next command if they didnt kill the other dhcpcd processes.
dhcpcd -t 10 -d eth0
ps -ax <--- see how many processes you have running starting dhcpcd this way.
I did grep through rc.d and the only place that dhcpcd is called is in rc.inet1. There are 2 entries, but wrapped inside an if - else, so only one could ever execute.
rc.inet1.conf is correct. There's only one entry with 'yes', USE_DHCP[0]='yes'.
You can see that both are for the SAME interface, with the SAME options set. Plus, the PIDs are so close, that they must have been fired off almost simultaneously.
As I said earlier, I've added some 'debugging' echos in the script, but the output doesn't seem to always run sequentially.
I can't try the other suggestions, as I'm not at home and taking down the interface will kill my cable connection, which will stop me restarting it.
Well, after a bunch of searching around on my system, I found a 2nd place where rc.inet1 is called. It's also called from /etc/hotplug/net.agent. And the only change I've made recently was to enable rc.hotplug so my USB ports are available at boot time for a UPS.
And guess what else I found. This in a SuSE sysconfig package changelog:
- is_iface_available(): It will now only modprobe <interface> if called from ifup, because it must not trigger unwanted hotplug events (#13178, dhcpcd was started twice)
Looks like Slack has the same bug. As long as I can work out what that cryptic comment means.
Grep through /etc on down. If you start in rc.d you'll miss potential uses above that directory. I found references to dhcpcd in pcmcia/network and rc.d/rc.inet1.
I could have 'grep'ped through the whole disk, and still only found one reference to dhcpcd.
The problem is that the script that starts dhcpcd, rc.inet1, is called from multiple places.
The problem is that the 1st time rc.inet1 is called, it fires off dhcpcd to get the IP (and all the rest of the stuff). Immediately after, rc.hotplug is then started, which because the preceeding dhcpcd is still running, thinks that the interface is not up, and so fires off rc.inet1 AGAIN.
My "short term" plan is to put a delay in, so that the 1st dhcpcd completes before rc.hotplug gets control.
Rather than putting in a delay, why not just comment out the reference to rc.inet1 in net.agent? Looking at the code in net.agent there is a Slackware section that runs ifconfig and greps for your interface. It fires it up the network card if ifconfig returns nothing. Just comment out the section for Slackware.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.