LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   running dhcpcd on boot (https://www.linuxquestions.org/questions/linux-newbie-8/running-dhcpcd-on-boot-167849/)

gendreau 04-08-2004 02:33 PM

running dhcpcd on boot
 
Hi,

For some reason I need to run dhcpcd from root every time I boot up linux. Internet will work fine after running this command. My question is, how can I automatically run this command from root when I log in as an account other than root?

Thanks.

MasterC 04-08-2004 02:48 PM

It really depends on your distro. However, there should already be a way to do this without having to do what I'm about to say, unless of course you are running LFS, in which case, you still ought to be aware of what I'm about to say ;)

Somewhere in your /etc directory you should find a file called rc.local In Slackware this is /etc/rc.d/rc.local as well as a few other distros, I believe in Mandrake it's /etc/rc.local which is symlinked elsewhere, but that is fine. Either way, once you find this file, open it up in your favorite text editor and add the line:
/sbin/dhcpcd
assuming /sbin is the location where dhcpcd exists. If not, replace it with the directory where it lives, to find out type:
whereis dhcpcd
into a bash prompt.

Good Luck!

Cool

Theta13579 04-01-2012 03:08 PM

Slackware 13.37 64bit with x86_multilibs default stock kernel: hardware and drivers are fine, Eth0 (built in) and Eth1 (pci slot) never conflicted.... no conflicts with firewall.

My system was perfect up to a few weeks ago the same thing happened... where I needed to log into root to run dhcpcd in order to receive the router ip address.
The only thing changed may have been an update or two: (but I'm not blaming Patrick)

I looked at the dmesg boot and it doesn't display the output from the boot process and finding the command that allows me to post what I see verbatim, as messages go by during boot hasn't been a fun command to find (nor have I had to use it before).
So apologies for being unable to show the boot output.

First I tried looking at all config scripts relevant to the grabbing the ip address... dhcpcd, dhclient, .... even added the required variables to the config information of Eth0 and Eth1 in /etc/rc.inet1.conf. looked at rc.local, rc.networkmanager and man paged a lot of stuff...

however your solution did fix the problem:
but it placed it at the end of the boot process just before you'd log in if it's set to go to command prompt. Now instead of scanning once, it's scanning for the IP address twice and after the fix it's scanning 3 times for dhcpcd throughout the boot process.


The first time it looks for the leased line, carrier gained, carrier lost, then it checks and scans for it a second time immediately after the first try... and says ip address (gained) abc.def.ghi.jkl. (obviously with numbers listed). Then it moves on to other processes to load.

I log in to windowed session and I still needed to log in to root, to dhcpcd to get online.

So by that account it seems dhcpcd looses the network information between scans... ?? and i think it said ...can't find routers ipv4ll ip address after the second scan.

I came across this thread and now it scans for the IP address three times but it scans for it as being the last process in the boot just before asking for a login: as I'd prefer it to grab and retain the ip address during the first time it scans.


any ideas other than a fresh install? or reinstall for all relevant scripts and config files?


Quote:

...
Somewhere in your /etc directory you should find a file called rc.local In Slackware this is /etc/rc.d/rc.local as well as a few other distros, I believe in Mandrake it's /etc/rc.local which is symlinked elsewhere, but that is fine. Either way, once you find this file, open it up in your favorite text editor and add the line:
/sbin/dhcpcd
assuming /sbin is the location where dhcpcd exists. If not, replace it with the directory where it lives, to find out type:
whereis dhcpcd
into a bash prompt.

Good Luck!

Cool


All times are GMT -5. The time now is 12:17 PM.