| View previous topic :: View next topic |
| Author |
Message |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Wed Oct 14, 2009 7:55 pm Post subject: [SOLVED] OpenRC 0.5.1 does not start my network correctly |
|
|
EDIT: Here is the solution to get DHCP to work properly with OpenRC 0.5 and DHCP 5. I assume your network interface is eth0.
1) Emerge openrc-0.5.2 and dhcpcd-5.1.2. You do not need openresolv.
2) Do not run the "network" service in any runlevel, but do run "net.lo", "net.eth0", and "dhcpcd" in the boot runlevel and networked services ("ntp-client", "ntpd", etc.) in the default runlevel.
3) You do not need anything in /etc/conf.d/network, but you do need the following in /etc/conf.d/net:
4) Add the following to /etc/dhcpcd.conf:
5) Reboot and enjoy!
As for the long version:
---
Hi,
I've just upgraded to OpenRC 0.5.1 without the oldnet USE flag. I moved /etc/conf.d/net into /etc/conf.d/network, deleted /etc/init.d/net.lo and /etc/init.d/net.eth0 and added network and dhcpcd to the boot runlevel. My network uses DHCP to obtain an IP from a router.
On startup, both dhcpcd and network claim to have started just fine, but they take 0 time to do so, and other services (ntp-client and netmount) fail immediately after. Once I log in, the network is fine, but I can't tell if that's because the DHCP request was backgrounded, or because my router gives me the same IP address every time. There is no mention of DHCP when I try dmesg.
Also note that while ntp-client and netmount claim to be "started", although my NFS shares are not mounted. Restarting each after boot makes it work properly.
Relevant info:
/etc/conf.d/network
| Code: | modules=( "iproute2" )
config_eth0="dhcp" |
rc-update show
| Code: | lvm | boot
xdm | nonetwork default
netmount | default
swap | boot
ntp-client | default
consolefont | boot
network | boot
keymaps | boot
mtab | boot
modules | boot
hwclock | boot
sshd | default
ntpd | default
mysql | default
savecache | shutdown
consolekit | boot
alsasound | boot
root | boot
udev | sysinit
fsck | boot
killprocs | shutdown
postgresql-8.4 | default
smartd | default
devfs | sysinit
dmesg | sysinit
hald | boot
lm_sensors | default
vixie-cron | default
local | nonetwork default
acpid | boot
procfs | boot
sysctl | boot
localmount | boot
dhcpcd | boot
mount-ro | shutdown
termencoding | boot
microcode_ctl | boot
syslog-ng | boot
bootmisc | boot
device-mapper | boot
urandom | boot
pulseaudio | boot
hostname | boot
dbus | boot |
emerge --info
| Code: | Portage 2.1.7.1 (default/linux/amd64/2008.0, gcc-4.4.1, glibc-2.10.1-r0, 2.6.31-gentoo-r2 x86_64)
=================================================================
System uname: Linux-2.6.31-gentoo-r2-x86_64-Intel-R-_Core-TM-2_CPU_6700_@_2.66GHz-with-gentoo-2.0.1
Timestamp of tree: Wed, 14 Oct 2009 18:00:01 +0000
app-shells/bash: 4.0_p33
dev-java/java-config: 2.1.9-r1
dev-lang/python: 2.6.3, 3.1.1-r1
dev-util/cmake: 2.6.4-r3
sys-apps/baselayout: 2.0.1
sys-apps/openrc: 0.5.1
sys-apps/sandbox: 2.1
sys-devel/autoconf: 2.13, 2.63-r1
sys-devel/automake: 1.8.5-r3, 1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils: 2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool: 2.2.6a
virtual/os-headers: 2.6.30-r1
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=core2 -O2 -pipe"
DISTDIR="/distfiles"
EMERGE_DEFAULT_OPTS="--nospinner --with-bdeps y --alphabetical"
FEATURES="assume-digests distlocks fixpackages news protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/oss-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac accessibility acpi adns akonadi alisp alsa amd64 amr amrnb amrwb archive assistant asyncns audiofile bash-completion bios bluetooth boost branding bugzilla bzip2 cairo calendar captury cdda cdinstall cdio cgraph chm cli consolekit context cracklib crypt css curl cyrillic dbus dhcp dirac djbfft djvu doc dri dts dvd dvdr dvdread dvipdfm dynamic eap-tls ebook embedded emovix encode exif extra extrafilters extras faac faad fam fame fbcondecor ffmpeg fftw firefox fits flac fluidsynth fontconfig fontforge fpx games gcrypt gd gdbm gif git glitz gnuplot gnutls gpg graphics graphviz gs gtk hal hdri hpn htmlhandbook humanities hyperestraier ical iconv icu id3tag idea idn imagemagick inotify ipv6 isdnlog ithreads jadetex java java6 javascript jbig jce jingle joystick jpeg jpeg2k jsapi kde kig-scripting kipi konqueror kpathsea ktts ladspa lame latex latex3 lcms libass libedit libffi libgcrypt libnotify libssh2 libtiger libwww lm_sensors lzo mad matroska mbrola mem-scramble mercurial mjpeg mmap mmx mmxext mng mod modplug modules mp3 mp4 mpeg mtp mudflap multilib musepack music mysql ncurses network network-cron nls nptl nptlonly nsplugin nuv odbc offensive ogg omega openal openexr opengl openmp oscar oss oss4 pam pango paste64 pcre pdf pg-intdatetime phonon pic plasma plotutils png policykit portaudio postgres ppds pppd pstricks pth publishers pulseaudio python python3 qemu qt3 qt3support qt4 qtscript quicktime rdesktop readline redland reflection rle rss rtsp ruby sasl schroedinger science sdl sdl-image semantic-desktop session slang smp sndfile sound soundtouch speex spell spl sql sqlite sqlite3 sse sse2 ssl ssse3 startup-notification stream subversion svg symlink sysfs theora threads tidy tiff toolbar truetype unicode usb utempter vamp vcd vde vdpau vlc vlm vnc vorbis vorbis-psy wavpack webkit wideband wifi wmf x264 xcb xcomposite xetex xforms xml xmlpatterns xmp xorg xscreensaver xulrunner xv xvid xvmc zip zlib zrtp" ALSA_CARDS="virtuoso" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset: CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS |
I would appreciate some help. Thanks!
BTW, what do I need to emerge to get the "ip" command?
Last edited by Godji on Mon Oct 19, 2009 11:37 pm; edited 2 times in total |
|
| Back to top |
|
 |
audiodef Advocate


Joined: 06 Jul 2005 Posts: 4983
|
|
| Back to top |
|
 |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Wed Oct 14, 2009 9:51 pm Post subject: |
|
|
In the other thread you claim to see dhcpcd negotiate a lease. I don't. It just flies past that and claims success for the network service.
| audiodef wrote: | | What "ip" command are you referring to? ifconfig? dhcpcd? |
ip as in "ip route" to show what routes the kernel is using for IP packets. |
|
| Back to top |
|
 |
Mike Hunt Watchman


Joined: 19 Jul 2009 Posts: 5287
|
Posted: Wed Oct 14, 2009 10:21 pm Post subject: |
|
|
| Do you have sys-apps/funtoo-netscripts in portage ? |
|
| Back to top |
|
 |
sera Developer

Joined: 29 Feb 2008 Posts: 961 Location: CEST
|
Posted: Thu Oct 15, 2009 5:46 am Post subject: |
|
|
| Quote: | | I moved /etc/conf.d/net into /etc/conf.d/network, |
Which has maybe overwritten the example configuration.
| Quote: | | deleted /etc/init.d/net.lo |
Why it's still a nice nice script.
| Quote: | | added network and dhcpcd to the boot runlevel |
dhcpcd-5x?
| Quote: | | Code: | modules=( "iproute2" )
config_eth0="dhcp" |
|
Both lines have no meaning with the network init script. They are for the net.lo script. |
|
| Back to top |
|
 |
audiodef Advocate


Joined: 06 Jul 2005 Posts: 4983
|
|
| Back to top |
|
 |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Thu Oct 15, 2009 4:48 pm Post subject: |
|
|
| Quote: | | Which has maybe overwritten the example configuration. |
Well, I just appended the two lines above to the example configuration, but everything in there was commented out anyway. The example configuration contains some other cases (static IPs, bridges, VLANs, wireless), none of which I need.
| Quote: | | Why it's still a nice nice script. |
Do I need that still? I thought "-oldnet" obsoleted that too, but please correct me if I'm wrong. How can I get that one back btw?
5.1.1
| Quote: | | Both lines have no meaning with the network init script. They are for the net.lo script. |
So, does that mean I need net.lo too?
Should I keep them in /etc/conf.d/network?
Was deleting net.lo my only mistake or did I miss anything else?
Thanks! |
|
| Back to top |
|
 |
sera Developer

Joined: 29 Feb 2008 Posts: 961 Location: CEST
|
Posted: Thu Oct 15, 2009 5:14 pm Post subject: |
|
|
| Quote: | | So, does that mean I need net.lo too? |
Likely not but network and wpa_supplicant init scripts are not enough to replace net.lo.
So for your ethernet card:
Something like:
| Code: | interfaces="eth0"
ifup_eth0="ifconfig \$int up" |
is enough. |
|
| Back to top |
|
 |
Mike Hunt Watchman


Joined: 19 Jul 2009 Posts: 5287
|
Posted: Thu Oct 15, 2009 6:10 pm Post subject: |
|
|
Is net-dns/openresolv installed?
I think they all work together, that is -> openrc openresolv dhcpcd
On my box I need all of those with sys-apps/openrc-0.5.0-r2 |
|
| Back to top |
|
 |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Thu Oct 15, 2009 8:22 pm Post subject: |
|
|
I tried these 2 lines in /etc/conf.d/network, and I installed openresolv, which I didn't have before. No change.
Also note that I have now installed 0.5.1-r1, which forces "oldnet", and I have restored /etc/init.d/net.lo, /etc/init.d/net.eth0 (both started at boot), and /etc/conf.d/net.
As I said, my network does work, but the services that depend on it fail at startup. All I need to do is make certain cervices (or ideally, the entire "default" runlevel) wait until the DHCP negotiation is complete.
Last edited by Godji on Thu Oct 15, 2009 8:24 pm; edited 1 time in total |
|
| Back to top |
|
 |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Thu Oct 15, 2009 8:24 pm Post subject: |
|
|
| Mike Hunt wrote: | | Do you have sys-apps/funtoo-netscripts in portage ? |
No. |
|
| Back to top |
|
 |
sera Developer

Joined: 29 Feb 2008 Posts: 961 Location: CEST
|
Posted: Thu Oct 15, 2009 9:16 pm Post subject: |
|
|
| Godji wrote: | | Mike Hunt wrote: | | Do you have sys-apps/funtoo-netscripts in portage ? |
No. | They are in the pure-funtoo overlay.
| Quote: | | As I said, my network does work, but the services that depend on it fail at startup. All I need to do is make certain cervices (or ideally, the entire "default" runlevel) wait until the DHCP negotiation is complete. | I had this problem long before openrc-0.5.x, the simple solution is to have an init script which tests for that using a loop and sleep. then let those services depend on this one. |
|
| Back to top |
|
 |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Thu Oct 15, 2009 10:47 pm Post subject: |
|
|
First of all, thank you for all your help!
| sera wrote: | | They are in the pure-funtoo overlay. |
OK, so assuming I get them, what should I do with them?
| sera wrote: | | I had this problem long before openrc-0.5.x, the simple solution is to have an init script which tests for that using a loop and sleep. then let those services depend on this one. |
I'd sooner downgrade to 0.4.x than start writing my own scripts. When getting a simple DHCP network client to work requires writing scripts, then something must have gone horribly wrong. Is there another way?
I can't be the only one running services at startup that require a network. |
|
| Back to top |
|
 |
Mike Hunt Watchman


Joined: 19 Jul 2009 Posts: 5287
|
Posted: Fri Oct 16, 2009 4:57 am Post subject: |
|
|
| pappy_mcfae explains it all very well here. |
|
| Back to top |
|
 |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Sun Oct 18, 2009 11:02 pm Post subject: |
|
|
That's good, but I would like to resolve this without writing any scripts. Even if I did put some time into wrting a script, everyone else with a similar problem would have to do it as well. I appreciate your efforts, but this is not an acceptable solution.
Now, I noticed that dhcp-5.1.2 has been released, and its changelog seems to be realted to my problem: http://roy.marples.name/archives/dhcpcd-discuss/2009/0108.html
I will try installing that in the next 24 hours and I will report what happens. |
|
| Back to top |
|
 |
Mike Hunt Watchman


Joined: 19 Jul 2009 Posts: 5287
|
Posted: Sun Oct 18, 2009 11:09 pm Post subject: |
|
|
I don't use any script. Nothing in runlevels.
There is only net.lo which belongs to openrc.
My static IP is configured in /etc/dhcpcd.conf (see man dhcpcd.conf)
That's it.  |
|
| Back to top |
|
 |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Mon Oct 19, 2009 5:37 am Post subject: |
|
|
| Iif your IP is static, do you use DHCP to get it? |
|
| Back to top |
|
 |
sera Developer

Joined: 29 Feb 2008 Posts: 961 Location: CEST
|
Posted: Mon Oct 19, 2009 9:07 am Post subject: |
|
|
| Godji wrote: | | Iif your IP is static, do you use DHCP to get it? |
It's a possibility. And to get the benefit of dhcpcd-5.1.2 a necessity. |
|
| Back to top |
|
 |
gcasillo l33t


Joined: 23 Sep 2003 Posts: 723 Location: Cincinnati, Ohio, USA
|
Posted: Mon Oct 19, 2009 7:53 pm Post subject: Re: OpenRC 0.5.1 does not start my network correctly |
|
|
| Godji wrote: | Hi,
I've just upgraded to OpenRC 0.5.1 without the oldnet USE flag. I moved /etc/conf.d/net into /etc/conf.d/network, deleted /etc/init.d/net.lo and /etc/init.d/net.eth0 and added network and dhcpcd to the boot runlevel. My network uses DHCP to obtain an IP from a router.
On startup, both dhcpcd and network claim to have started just fine, but they take 0 time to do so, and other services (ntp-client and netmount) fail immediately after. Once I log in, the network is fine, but I can't tell if that's because the DHCP request was backgrounded, or because my router gives me the same IP address every time. There is no mention of DHCP when I try dmesg.
Also note that while ntp-client and netmount claim to be "started", although my NFS shares are not mounted. Restarting each after boot makes it work properly. |
Just spent a painful afternoon retreating from the new openrc and dhcpcd. I need my network connections to Just Work, and without an authoritative step-by-step guide to migrate to the substantively different openrc design, I had to fallback to openrc-0.4.3-r4 and dhcpcd-5.1.1.
After rolling back to openrc-0.4.3-r4, I was still seeing the behavior you describe where several services weren't starting and dhcpcd seemed to blow by without actually doing anything. After reading up on the changes in dhcpcd-5.1.2, I decided to roll that back to dhcpcd-5.1.1. Problem solved. I have a functioning server that establishes it's network connection and all servers and services start normally.
Such is life when you run with keywords (~amd64 in this case). Looking forward to whatever improvements the revamped openrc and networking provide, but I'm not one to hack on network scripts and the like. Networking is the one thing on my boxes I want working without manual configuration. |
|
| Back to top |
|
 |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Mon Oct 19, 2009 9:59 pm Post subject: |
|
|
OK, I have almost fixed this.
So, I upgraded to dhcpcd-5.1.2 and openrc-0.5.2. The former has exactly what I need: an option to wait before backgrounding. Just add:
to /etc/dhcpcd.conf and dhcpcd will fully acquire an address before it backgrounds, pausing the boot process for a moment, as it should.
Next, I think you do not need anything in /etc/conf.d/network. My /etc/conf.d/net contains:
If /etc/init.d/net.eth0 exists (as a symlink to /etc/init.d/net.lo), the line above will make net.eth0 ask the dhcpcd daemon for an IP, which it already has, resulting in the correct behavior.
Using this, I obtain the correct IP and the correct DNS servers, but I do not get my default route (a.k.a. gateway) set, so I can only access the local network. I end up with mounted NFS shares but virtually nothing else works, in particular ntp-client.
Why is my default route not being set? |
|
| Back to top |
|
 |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Mon Oct 19, 2009 10:07 pm Post subject: |
|
|
Some additional info:
I reemerged iproute2 and got /sbin/ip back, so now I can have a look at the kernel routing table (ip route):
| Code: | 192.168.0.0/16 dev eth0 proto kernel scope link src 192.168.0.2 metric 202
unreachable 127.0.0.0/8 scope host
127.0.0.0/8 via 127.0.0.1 dev lo scope link |
Not only is it missing a default route, but the last two lines confuse me. What do they mean?
After boot, if I do "/etc/init.d/dhcpcd restart", I get:
| Code: | 192.168.0.0/16 dev eth0 proto kernel scope link src 192.168.0.2 metric 202
unreachable 127.0.0.0/8 scope host
127.0.0.0/8 via 127.0.0.1 dev lo scope link
default via 192.168.0.1 dev eth0 metric 202 |
and everything works. Except that those two lines still confuse me... |
|
| Back to top |
|
 |
Mike Hunt Watchman


Joined: 19 Jul 2009 Posts: 5287
|
Posted: Mon Oct 19, 2009 10:23 pm Post subject: |
|
|
Here is what I have and it works. dhcpcd-5.1.2-r1
openrc-0.5.0-r2
openresolv-3.3.2 | /etc/init.d/net.lo: | #!/sbin/runscript
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
depend() {
provide net
}
start() {
ebegin "Bringing up network interface lo"
ifconfig lo 127.0.0.1 netmask 255.0.0.0 up && \
route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
eend $?
}
stop() {
ebegin "Shutting down network interface lo"
route del -net 127.0.0.0 netmask 255.0.0.0 dev lo &&
ifconfig lo down
eend $?
} | I use a static IP which is configured in /etc/dhcpcd.conf | Code: | interface eth0
static ip_address=192.168.2.10
static routers=192.168.2.1
static domain_name_servers=192.168.2.1 | And dhcpcd in the default runlevel. That's all.
I do not have/etc/conf.d/net
/etc/init.d/net.eth0
/etc/init.d/network
or anything else
Result: | Code: | # route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 * 255.255.255.0 U 202 0 0 eth0
loopback * 255.0.0.0 U 0 0 0 lo
default mymodem 0.0.0.0 UG 202 0 0 eth0
|
|
|
| Back to top |
|
 |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Mon Oct 19, 2009 11:23 pm Post subject: |
|
|
A static IP is easy, since you don't have to wait for anything. If I were to set my IP as static, things would work, but that's not the point.
Anyway, I'm rather please to say that... I GOT IT!!!
All I had to do on top of what I posted above was disable the network service (rc-update del network boot). Voila! Everything works as before, no weird routes, ntp-date and nfs run at startup!
I will update the first post with the entire solution. |
|
| Back to top |
|
 |
Mike Hunt Watchman


Joined: 19 Jul 2009 Posts: 5287
|
Posted: Mon Oct 19, 2009 11:39 pm Post subject: |
|
|
Cool.
I suppose, I should also have mentioned that all my network services that I add to a runlevel get started by openrc during boot.
Glad you got that working.
Cheers.  |
|
| Back to top |
|
 |
Godji Guru

Joined: 08 Dec 2004 Posts: 391
|
Posted: Mon Oct 19, 2009 11:42 pm Post subject: |
|
|
Thanks for your help. And troubleshooting is part of what makes Gentoo fun  |
|
| Back to top |
|
 |
|