LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   LFS 7.1 eth0 not found (http://www.linuxquestions.org/questions/linux-from-scratch-13/lfs-7-1-eth0-not-found-4175445770/)

engineer 01-15-2013 07:35 PM

LFS 7.1 eth0 not found
 
Ok guys and ladies. Now that I've finally booted and browsed around a bit, I have to say this is really really neat stuff!

After poking around, I've discovered that eth0 is not a recognized device. When I try
Code:

ifup eth0
the response I get is that eth0 is not found. A bit of googling around seems to indicate that I need to recompile the kernel and select a module (haven't figured out which one yet) that will allow the virtual ethernet interface to communicate with my hardware at the kernel level.

The way to do this, I think is to repeat Chapter 8.3 from the LFS 7.1 book--for convenience, I've posted the commands from this section below.

Code:

make mrproper
Code:

make LANG=<host_LANG_value> LC_ALL= menuconfig
Code:

make
Code:

make modules_install
Code:

cp -v arch/x86/boot/bzImage /boot/vmlinuz-3.2.6-lfs-7.1
Code:

cp -v System.map /boot/System.map-3.2.6
Code:

cp -v .config /boot/config-3.2.6
Code:

install -d /usr/share/doc/linux-3.2.6
cp -r Documentation/* /usr/share/doc/linux-3.2.6

If I do this, and then reboot, my understanding is that it will then load the new modules (assuming that I find the one for my network card) with the newly compiled kernel, and hopefully will then recognize the interface.

Is my logic correct? I would just go for it and try it, but I want to make sure there are no obvious steps I'm missing, and that it's really this simple to recompile the kernel.

stoat 01-15-2013 08:21 PM

Study what your host system (or another Linux system) uses to make that Ethernet card work. Try lspci -k and lsmod | sort in the host system and look for the driver module and anything else it may require amongst that information. Recompile the kernel with the driver components selected as modules (there may be more than one involved). Create the /etc/sysconfig/ifconfig.eth0 file. Create an entry in /etc/udev/rules.d/70-persistent-net.rules for the card (if one is not already there). You probably have the S20network symlink in /etc/rc.d/rc{3,4,5}.d already. All this stuff is in the book or already done. Anyway, then reboot and you might find the thing is up and running as soon as you log in. I does for me.

P.S.: This is optional, but I recommend that you retain the original kernel and its modules folder completely intact (just in case). You can do that by appending a unique local version number to this new kernel so its modules folder in /lib/modules will be a completely new folder leaving the original one as it is. The place to append a local version number or name to the modules folder that will be created is found in General Setup of the menuconfig interface (the very first item). I like to append that same local version number or name to the files copied to /boot. This way a new kernel does not harm an old kernel, and old unwanted kernels and modules folders are more easily identified for deletion. Remember to change your boot loader menuentry for the new kernel or create a new menuentry for it. Apologies if you knew this stuff. No offense if you would rather ignore it.

engineer 01-16-2013 07:29 AM

Thanks, Stoat. You're advice was well received. I went ahead and prepared to compile the kernel again, then realized it would be impossible to try and find the driver by browsing through the menu config, so I spent some time looking around for what has been used for this network card by others. This is in a Lenovo G580 laptop. The driver/module seems to be axl, and the manufacturer is Atheros.

I've found this much out, but I haven't yet had the chance to look through the kernel options to recompile it with the correct driver. I'm going to try this tonight and see how it goes.

stoat 01-16-2013 08:35 AM

I don't own an Atheros-based card. But I read about the alx driver. You might try the atl1c driver which is in the kernel now. No harm trying. If it doesn't work or doesn't work well, then you can download the alx driver and try it. It and installation instructions are not hard to find.

But first, consider posting the lspci -k and lsmod | sort output from your host system or another Linux system using the card (even a Linux live CD). Maybe some reader will come along who knows with certainty what you need to do for that device.

P.S.: There isn't much browsing required to find the Ethernet drivers. They're all found in Device Drivers ---> Network device support ---> Ethernet driver support --->. There are about six Atheros drivers there.

engineer 01-16-2013 06:34 PM

One final clarification before I finish and reboot (I'm going to boot into the live CD and do the lspci and lsmod if this doesn't work-I wasn't ignoring you :), and appreciate the suggestion).

Can you please check that the grub.cfg file modification I've proposed below will work? For clarity's sake, I've posted the original (that is working, and is in the /boot directory) as well. All I'm going to do is take my modified grub file, and the associated .config and System.map and kernel files and put them in the same directory as the old version. Also, I took your advice and did the option in the kernel configurator to append a new version name/number to the kernel file that is generated. In this blank, I simply put the string "test". What should I expect the new kernel name to be?

Code:

cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,6)
menuentry "GNU/Linux, Linux 3.2.6-lfs-7.1" {
        linux  /boot/vmlinuz-3.2.6-lfs-7.1 root=/dev/sda6 ro
}
EOF

New version:

Code:

cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,6)
menuentry "GNU/Linux, Linux 3.2.6-lfs-7.1" {
        linux  /boot/vmlinuz-3.2.6-lfs-7.1 root=/dev/sda6 ro

menuentry "GNU/Linux, Linux 3.2.6-lfs-7.1-test" {
        linux  /boot/vmlinuz-3.2.6-lfs-7.1-test root=/dev/sda6 ro
}
EOF


engineer 01-16-2013 07:21 PM

Update:

So I tried all that, and GRUB was not happy. I compiled the new kernel using the commands above, creating new config, vmlinuz, and System.map files, and then rebooted, and GRUB gave me a command prompt only, no menu from which to choose the kernel I wish to boot.

As a side note, see below for the output from the commands suggested above.

Code:

[root@localhost liveuser]# lspci -k | grep Ath*
03:00.0 Ethernet controller: Atheros Communications Device 1090 (rev 10)

Code:

[root@localhost liveuser]# lsmod | sort
arc4                  12473  2
bcma                  25114  1 brcmsmac
bluetooth            237959  7 bnep
bnep                  18863  2
brcmsmac              522563  0
brcmutil              13820  1 brcmsmac
cfg80211              169628  2 mac80211,brcmsmac
cordic                12446  1 brcmsmac
crc8                  12628  1 brcmsmac
drm                  199393  4 drm_kms_helper,i915
drm_kms_helper        35154  1 i915
fuse                  71314  3
i2c_algo_bit          12987  1 i915
i2c_core              28180  6 drm,drm_kms_helper,i2c_algo_bit,i915,i2c_i801,videodev
i2c_i801              17499  0
i915                  410067  3
ideapad_laptop        13670  0
ip6table_filter        12711  1
ip6_tables            17852  1 ip6table_filter
ip6t_REJECT            12826  2
iTCO_vendor_support    13243  1 iTCO_wdt
iTCO_wdt              17652  0
mac80211              427516  1 brcmsmac
media                  19719  2 videodev,uvcvideo
microcode              18642  0
Module                  Size  Used by
nf_conntrack          70557  3 xt_state,nf_conntrack_ipv6,nf_conntrack_ipv4
nf_conntrack_ipv4      14182  2
nf_conntrack_ipv6      13892  3
nf_defrag_ipv4        12601  1 nf_conntrack_ipv4
nf_defrag_ipv6        13642  1 nf_conntrack_ipv6
rfkill                20451  6 ideapad_laptop,cfg80211,bluetooth
snd                    62809  11 snd_timer,snd_pcm,snd_hwdep,snd_hda_codec,snd_hda_intel,snd_hda_codec_realtek,snd_hda_codec_hdmi
snd_hda_codec        103084  3 snd_hda_intel,snd_hda_codec_realtek,snd_hda_codec_hdmi
snd_hda_codec_hdmi    31422  1
snd_hda_codec_realtek  117533  1
snd_hda_intel          32324  2
snd_hwdep              13232  1 snd_hda_codec
snd_page_alloc        13709  2 snd_pcm,snd_hda_intel
snd_pcm                81137  3 snd_hda_codec,snd_hda_intel,snd_hda_codec_hdmi
snd_timer              23742  1 snd_pcm
soundcore              14123  1 snd
sparse_keymap          13342  1 ideapad_laptop
squashfs              42427  2
uinput                17304  0
usb_storage            42787  0
uvcvideo              66949  0
video                  18540  1 i915
videobuf2_core        31355  1 uvcvideo
videobuf2_memops      13086  1 videobuf2_vmalloc
videobuf2_vmalloc      12839  1 uvcvideo
videodev              83287  2 videobuf2_core,uvcvideo
wmi                    18273  0
xt_state              12514  5


stoat 01-16-2013 08:29 PM

Regarding the GRUB issue, you only needed to edit the grub.cfg file, not cat the whole thing again. An accident with cat could do something unexpected whereas a simple vi edit to add something is virtually harmless barring a gross syntax error. I think the problem may be that you omitted the closing bracket for the original menuentry.

For the Ethernet matter, that lsmod and lspci info only matters if the Ethernet card is working in that machine. Is it? I only recognize wireless stuff there. And the lspci output would be more informative with the -k option which might reveal a module or driver name (the pipe to grep cut that off).

The name for the new kernel is fine. And the config file and System.map files should be named similarly. I do that exact kind of thing all the time. Today even. Distros like your Fedora host system do that, too. Anyway, you can name those three files (vmlinuz, config, System.map) whatever you want. I usually give them the traditional version number name and append the same thing that I put in the config (and which gets appended to the modules folder). Usually just a -2 or -3, but sometimes a word like you did. Anyway, a kernel no matter what it is named knows where its module folder is.

engineer 01-16-2013 08:42 PM

Quote:

Originally Posted by stoat (Post 4871824)
Regarding the GRUB issue, you only needed to edit the grub.cfg file, not cat the whole thing again. An accident with cat could do something unexpected whereas a simple vi edit is virtually harmless barring a gross syntax error. I think the problem may be that you omitted the closing bracket for the original menuentry.

For the Ethernet matter, that lsmod and lspci info only matters if the Ethernet card is working in the that machine. Is it? I only recognize wireless stuff there. And the lspci output would be more informative with the -k option which might reveal a module or driver name (the pipe to grep cut that off).

The name for the new kernel is fine. And the config file and System.map files should be named similarly. I do that exact kind of thing all the time. Today even. Distros like Fedora do that, too. Anyway, you can name those three files (vmlinuz, config, System.map) whatever you want. I usually give them the traditional version number name and append the same thing that I put in the config (and which gets appended to the modules folder). Anyway, a kernel not matter what it is named knows where its module folder is regardless.

Ok, I'll double check my grub.cfg file for the bracket issue--my post was a bit misleading. I used vim to modify the file, but I posted the section from the book that it came from, so sorry about that. All I did was use vim to add the second menuentry, I just wasn't sure if I needed to add any of the other options again since I would have thought grub would at least load and let me pick a kernel to boot, which it did not.

As far as the ethernet, no, apparently the eth0 interface is not working or recognized, I have been using the wireless connection. I found the tarball for the driver though and downloaded that to the sources folder in my lfs partition so that when I am able to boot again, I can just install it and hopefully that will allow the eth0 iface to work.

The other thing I noticed while browsing around in the live CD using CentOS 6.3, was that the kernel image for my original (working) lfs-7.1 distro was colored green, and the new kernel lfs-7.1-test, was just black. I'm not sure what the green color for the filename means, but it seems like something did not work right when I compiled the kernel, and this may also have something to do with the boot problem...

stoat 01-16-2013 08:57 PM

Edit the grub.cfg from the live CD. Add the missing closing bracket. It should be good again then.

The colors of files in the terminal relate to things such as directories, symlinks, executables. All of this is established in a bash config file. I don't know where in your live CD, but it's the ~/.dircolors file in an LFS system. The filenames in green are executable, black are not. Links are cyan. Directories are blue. Anyway, try listing them again with ls -l and you'll see what I mean. For the files in the /boot folder it won't matter either way. Mine there are black (-rw-rw-r--), and I always simply copy them to /boot as root in the classic way from the LFS book making no effort to change up the permissions.

engineer 01-17-2013 08:24 PM

I was finally able to make this work. I recompiled the kernel, made sure I wasn't making any typos, and was able to boot into my new kernel, with CONFIG_CFG80211=M. More on that in a minute.

After scouring the nets, I learned that I needed the alx driver, namely, compat-wireless-3.6.8.1-snpc. After I downloaded the file, I did (from within LFS):

Code:

scripts/driver-select alx
make
make install
modprobe alx

This apparently brought the driver up and it now seems to be working! :)

I get the following output when running ifup eth0:

Code:

Bringing up the eth0 interface...
Adding OPv4 address 192.168.1.10 to the eth0 interface... [OK]
Setting up default gateway...RTNETLINK answers: No such process [FAIL]

I can tell that the link is at least working, since now, my router (192.168.0.1, which I've used for the default gateway) now has a signal light for the port I have connected to my laptop's eth0 interface. Just for grins, I tried pinging 8.8.8.8 and my gateway (router), and of course that didn't work.

My plan is to cruise over to BLFS and get dhcpcd-5.6.2 to allow me to configure my internet connection. I was thinking though, that I should be able to at least ping my router, since it is a static IP... Is this true?

You've been a great help, stoat, thank you very much!

stoat 01-17-2013 09:23 PM

Quote:

Originally Posted by engineer

My plan is to cruise over to BLFS and get dhcpcd-5.6.2 to allow me to configure my internet connection.

That's fine, but do it later. For now, I would take a couple of minutes to set up a simple static IP connection to test drive everything. You can always switch to dynamic addressing later (but I stayed with static here). It's up to you, of course. Anyway...

1. Create (or edit) /etc/sysconfig/ifconfig.eth0 for a static IP address. Mine follows just as an example...
Code:

ONBOOT=yes <-- I like all this to happen automatically at boot time.
IFACE=eth0 <-- No explanation needed.
SERVICE=ipv4-static <-- A script in /lib/services called on to acquire the IP address.
IP=192.168.2.100 <-- IP requested from the router. Has to be in the IP range set in router.
GATEWAY=192.168.2.1 <-- The router's IP address.
PREFIX=24 <-- Same as subnet mask. 24 is very standard. Use it.
BROADCAST=192.168.2.255 <-- Used by router to query all hosts. Router network prefix + 255. Very standard.

2. Create an entry in /etc/udev/rules.d/70-persistent-net.rules for the card (if one is not already there). Another example...
Code:

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# net device tg3
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1c:c0:cc:d1:72", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# ZyXel USB wireless adapter as wlan0
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="40:4A:03:05:3C:E0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

3. Enable the network init script in runlevel 3,4,5. You should have the symlink named S20network to /etc/rc.d/init.d/network (or create it). This init script will do the ifup step for you during booting.
Code:

ll /etc/rc.d/rc3.d
total 0
lrwxrwxrwx 1 root root 18 Sep  3 18:31 S10sysklogd -> ../init.d/sysklogd
lrwxrwxrwx 1 root root 18 Sep  4 20:05 S19iptables -> ../init.d/iptables
lrwxrwxrwx 1 root root 17 Sep  3 18:31 S20network -> ../init.d/network
lrwxrwxrwx 1 root root 14 Sep  6 12:17 S25dbus -> ../init.d/dbus
lrwxrwxrwx 1 root root 14 Sep 11 23:33 S30cups -> ../init.d/cups
lrwxrwxrwx 1 root root 17 Oct 29 17:36 S35postfix -> ../init.d/postfix
lrwxrwxrwx 1 root root 16 Sep  4 19:39 S40random -> ../init.d/random
lrwxrwxrwx 1 root root 15 Oct 31 15:43 S45fcron -> ../init.d/fcron
lrwxrwxrwx 1 root root 16 Sep  9 10:28 S50smartd -> ../init.d/smartd
lrwxrwxrwx 1 root root 13 Sep  4 17:42 S60gpm -> ../init.d/gpm
lrwxrwxrwx 1 root root 14 Nov 29 11:56 S85ntpd -> ../init.d/ntpd
lrwxrwxrwx 1 root root 15 Sep 17 16:21 S99pause -> ../init.d/pause

That's it. Now reboot or restart network. Try pinging an internet URL or IP (say, 173.194.75.14 or www.google.com). Wireless is a different matter, but this Ethernet stuff is almost hard to mess up.

engineer 01-17-2013 09:37 PM

I had all of those files/links created already. They follow the same form as you have there. It would appear I've found a way to mess it up.

What does this mean: Setting up default gateway...RTNETLINK answers: No such process [FAIL]

Right now, I have my default gateway set up as my router (192.168.0.1), which I believe should be the right thing to do.

stoat 01-17-2013 10:22 PM

I don't know really. Apparently something is wrong with the route being established. I guess try double-checking the numbers. Look in the router's setup utility to confirm its IP and the IP range set for users. Are any other network devices involved? See if you can get output from route -e or netstat -r and does it make sense vis-a-vis the numbers you're using. Try rebooting (it can be sort of magical sometimes).

engineer 01-21-2013 05:32 PM

Finally was able to get this working. I had to do a bit of reading about subnets and how IP address assignments work, but I figured out that the IP I selected above (192.168.1.10) was not in my subnet (255.255.255.0). I changed the /etc/sysconfig/ifconfig.eth0 file to have an IP address of 192.168.0.10, and now all is working!

Thank you so much for your help!

EDDY1 01-23-2013 01:02 AM

I made the same mistake recently, dhcpd is for issuing addresses to request addresses you use dhcp.
Quote:

dhcpcd-5.6.2


All times are GMT -5. The time now is 10:39 AM.