# Networking works! ... but why?

## tcv

Hi folks,

I am in the process of installing Gentoo on a MSI MS-6378 mainboard. This board has an on-board NIC, an ADMtek AN983B. 

The boot identifies it as a tulip-compatible NIC, and tries to load that driver. An error occurs, however, unable to allocate resources.

But here's the odd part.

I placed a Netgear NIC in PCI Slot 1, just to see if I could get by with that card. 

Both NICs work.

If I take out the Netgear NIC, I am back to recieving resource errors on the ADMTek integrated NIC.

According the ECSD, the integrated NIC is on IRQ 11, sharing with two USB controllers. 

I've tried various things, including disabling the USB controllers and nothing seems to allow the proper detection and driver-loading of the integrated NIC as long as I don't have that Netgear card in PCI 1. There is a modem in PCI2, but I don't know it's make.

(For what it's worth, I know that it's not necessarily that particular NIC.)

The box that I'm playing with used to have Mandrake 8 on it. So, this is obviously a fine NIC otherwise.

Any ideas why this works? 

Cheers,

Mike...

----------

## BonezTheGoon

It might have something to do with APIC (Advanced Programmable Interupt Controller) which has nothing to do with ACPI (Advanced Configuration and Power Interface.)  APIC allows your system to double the number of allowed IRQ's and can sometimes lead to errors like you mentioned.  Even though your BIOS is assigning IRQ 11 to the onboard NIC if APIC is enabled then software can change the IRQ to anything it wants, including something above 15 which is previously not supported.  I have no idea why adding in a second NIC changes the behavior so much -- although I have seen on many APIC systems running Windows 2000 that try to group devices that allow it all onto one IRQ, maybe just maybe the APIC controller in Linux changed your onboard back down to a lower (normal) IRQ when you added in the PCI NIC.  My only suggestion though would be to try and boot with APIC disabled, I think there is (was, maybe?) an option for this when booting with the live CD.  I've not heard of big problems with the VIA chipset you are sporting on that board (like the problems so well documented for SiS chipset mainboards like the ones I use) regarding APIC support in Linux -- so this is just my guess.

Anyway, please let us know what you find!

Regards,

BonezTheGoon

----------

## tcv

 *BonezTheGoon wrote:*   

> It might have something to do with APIC (Advanced Programmable Interupt Controller) 
> 
> [snip]
> 
> Even though your BIOS is assigning IRQ 11 to the onboard NIC if APIC is enabled then software can change the IRQ to anything it wants, including something above 15 which is previously not supported.  
> ...

 

I don't see an option in the Live CD docs re: booting with a noapic option. I can disable APIC in my BIOS. I will try that.

Question: You said, "above 15 which is previously not supported." What do you mean by, "is previously not supported?"

This brings up another question.

Right now, I'm at the point in the installation in which I am about to edit make.conf. I could restart the computer and boot from CD to test out our theory here, but how would I get back to that point in the installation again? 

Would I have to emerge sync again?

Would I simply have to chroot?

Just wondering...

m

----------

## derk

you should be able to mount all your drives and /proc etc. and chroot into the install where you left off. i've done this a few times in the past on a very slow machine where I'd install/compile as much as i could overnight and then return the machine to that other os during the day. worked fine. i just had to make sure i cleanly unmounted when exiting and then restarting the gentoo install CD,  remounting everything each time before chrooting and continuing on.

derk

----------

## BonezTheGoon

 *tcv wrote:*   

> 
> 
> Question: You said, "above 15 which is previously not supported." What do you mean by, "is previously not supported?"

 

What I meant is that previous to APIC only 0-15 IRQ's (if memory serves me well on this Easter Sunday) were supported by an OS because only IRQ's 0-15 were previously (before APIC came along) support by the CPU.  Now with APIC the CPU will accept double the number of IRQ's from 0-31 (again this is not gospel I am just reciting what I seem to remember from a while ago when I learned about APIC) -- but the BIOS on most mainboards does not assume you have an OS that can use APIC so it still assigns everything in the "normal"/default range of 0-15 -- so then the way APIC works is that the OS (if it supports APIC that is, and also if the OS is set to USE APIC too) then can dynamically reassign IRQ's to whatever values it wants when booting and can assign them in the range from 0-31 any way it sees fit.  I hope that answers that question.

As for your second question derk pretty much summed it up.  Yes you can do what you were asking about.  Yes it can be hard to wrap your mind around the first few times.  It took me about ten installations of Gentoo from stage1 all the way through before I really grasped exactly what I was doing in each step.  But it seems like you already have a better understanding than I did when I started given I NEVER would have guessed this (meaning rebooting and then continuing the install again) was possible during my first install.

Regards,

BonezTheGoon

----------

## tcv

I appreciate your response ... and your encouragement. I've installed FreeBSD before with limited success, so I have some (dangerous) knowledge.

I understand the "mount" command.

I suppose there's an "unmount" command?

m

----------

## BonezTheGoon

Yeah there is a way to unmount things but it is named umount instead of unmount -- [Rant}you know those unix guys were so clever saving that ONE character really makes the difference in productivity (and also it improves job security for them since it hardly makes any sense it makes it harder for low-lifes to start into the field.)  [/Rant]

Regards,

BonezTheGoon

----------

## tcv

HI,

I am a little confused.

I'm following the code and I see what's been done, but I don't know how to untie it in order to try the APIC stuff. I'm afraid if I just reboot (reset) I will harm the system.

```

# mkdir /mnt/gentoo

# mount /dev/hda3 /mnt/gentoo

# mkdir /mnt/gentoo/boot

# mount /dev/hda1 /mnt/gentoo/boot

```

This says, if I follow it:

1. make a directory, "gentoo" off of /mnt

2. Mount HDA3 (system space/third partition) to /mnt/gentoo

3. Make a director "boot" off of /mnt/gentoo

4. Mount HDA1 (boot partition) onto /mnt/gentoo/boot

This means that I'm in HDA3 when I enter /mnt/gentoo (at least at this point).

Later, the code continues:

```

# mount -t proc proc /mnt/gentoo/proc

# cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

# chroot /mnt/gentoo /bin/bash

# env-update

```

I am unclear what "proc proc" does, but we copy "resolv.conf" to /mnt/gentoo/etc/resolv.conf. We then change our root from whatever it was to /mnt/gentoo. This means, if I'm right, that /mnt/gentoo becomes /. So, after I env-update, and I cd /, I'm in what was "/mnt/gentoo"

I don't know what the last part of the chroot line, "/bin/bash" means other than it's the bash shell.

So, I don't really know how to cleanly exit the system without jeporadizing anything. I thought I could chroot back to /mnt/gentoo, but that dir doesn't exist right now because it IS /, right? I can't umount hda1 and hda3 because they're now tied to /mnt/gentoo/boot and /mnt/gentoo respectively. 

Heh. A little lost.

Fun, though.

m

----------

## BonezTheGoon

To get out of your chroot(ed) environment simply issue the command

```
exit
```

and you will be back to the working directory you were in before you chrooted into /mnt/gentoo/ (which is some directory of the Live CD, it may even be /mnt/gentoo.)  Then you can cd (change directory) back to / and then begin unmounting things in the correct order.  So to do all that run these commands in this order . . .

```
exit

cd /

umount /mnt/gentoo/proc

umount /mnt/gentoo/boot

umount /mnt/gentoo

reboot

```

As you likely predicted the system will then reboot and you can try running the Live CD with one NIC and turning APIC off.

Regards,

BonezTheGoon

----------

## tcv

Wow. What a simple solution.

Exit.

Ok, so explain this to me a little. Am I in a different console? What am I exiting from? Does CHROOT create a new console or something?

It's almost like I'm exiting a simultaneous O/S or something...

m

----------

## BonezTheGoon

 *tcv wrote:*   

> It's almost like I'm exiting a simultaneous O/S or something...

 

This is the closest to what is happening (that I can think of) and I am hard pressed to come up with a better wording for what is going on, but I will try simply because I want to reaffirm your conclusion.  Basically chroot is this magical little command that allows you to change your root (hence the name) but that one simple thing has many implications.  Not only do you change where your root directory is (literally the / directory) but what you actually do is enter into an entirely different environment -- you have in essence switched into another instance of linux while using parts of the other instance (like /bin/bash which needs to be specified given the new system [only during an install though] doesn't yet have any valid shell to run) -- so what you have then is a master slave type relationship where the Live CD linux OS is life support for the new OS you are actively building inside of the Live CD instance.  I guess it is really very much like how humans reproduce, the infant grows from within the mother until it can sustain life (very fundamentally) on it's own then it is split off from the mother to learn and grow and develop on it's own.  That is a very good metaphor (if I do say so myself) for what is going on.  At the end of the installation document your baby linux installation is ready to be born, and so long as all the steps went as planned during gestational period it will be a successful birth and your baby linux will boot successfully on it's own -- take it's first breathe unassisted, if you will.  Then you can begin to teach it new tricks, like install Xfree and a window manager or desktop manager, etc, etc, etc.  Anyway, it's a pretty neat trick -- it is also one of the biggest reasons that any box that someone with malicous intent can touch is instantly comprimised.  Any malicous person (hacker/cracker, if you will) that can insert a Live CD boot disk into a production server running linux could (theoretically) gain root priveledges using chroot on the system and even change the local root password.

Anyway I think I am rambling, so I will shut up now.  Let me know if that makes any sense -- it's kind of late here and I have had a long day.  Sorry for the terrible lack of formatting in this post too -- tomorrow if I read it and it is too horrible I may edit in some formatting to make it easier to digest.

Regards,

BonezTheGoon

----------

## tcv

I do understand. Format away, if you care to do so.

First, let me report that the APIC idea did not work out. The integrated NIC simply isn't able to run without that other NIC in the PCI slot. (Again, I make no assumptions here that a NETGEAR NIC needs to go into PCI1 in order for this to work.)

Anyhoo, I followed your instructions, unmounted the various mount points and rebooted. I am back to installing.

Here's something interesting... but unfortunately.

I was performing the emerge -u system when about 1/2 through hda simply dropped out of sight. It's a hardware problem, no doubt. I reset the system and the BIOS was unable to detect the HDD. I turned OFF the system and the HDD came back. 

Sucks, really. I'm going to have to troubleshoot this with another HDD.

m

----------

## Regor

 *Quote:*   

> I was performing the emerge -u system when about 1/2 through hda simply dropped out of sight. It's a hardware problem, no doubt. I reset the system and the BIOS was unable to detect the HDD. I turned OFF the system and the HDD came back. 

 

Given that and your onboard NIC problems it sounds to me like you've got a flakey mobo.

----------

## derk

make sure after you chroot that you do the next two commands each time as well: (this may not apply in other chroot situations .. )

env-update

source /etc/profile

that is to be sure you are pointed at the correct executables and have your environment variables set corrrectly. I forgot these once and couldn't get things to work right until I did these commands first.

there is an interesting article on chroot at:

http://www.networkdweebs.com/chroot.html

for the curious.

derk

----------

## BonezTheGoon

I've not experienced disappearing hard disks before so I can't offer any theories or experiences.  Regor's comment is, unfortunately, a reasonable conclusion -- but like I said I really have no experience with such symptoms.

The only reasonable (meaning normal, as in not malfunctioning) explanation I could come up with for your NIC phenomenon was the APIC scenario, which we have proved is not the cause.  While there may be some other reasonable explanation out there I am unaware of one, and so I too conclude that there may be something faulty that is the root cause of the NIC situation -- but of course I cannot be sure.

Hope you get things worked out!!  I hope even more that they work out nicely and easily (which is rare!)

Regards,

BonezTheGoon

----------

## taz

I have just come across the same problem with my NIC, except that I haven't got a second NIC.  I have an ASUS mobo, which has been running fine, with a sis900 integrated NIC.  I am trying to install Gentoo, but can't connect to the net.  With the help of others, I think I have narrowed down the issue to the fact that my NIC and usb both share the same irq#.  I have tried booting the livecd with the apic both in my bios and in the boot line turned on and off in different variations and it doesn't seem to help.  I have also gone so far as to turn off irq9 (which is where the NIC and usb are being assigned), but the bios, or Gentoo, just moved both to irq5.  Has anyone any ideas?

tcv:  Did you figure out a solution to the integrated NIC, other than the second NIC?

Thanks

----------

## BonezTheGoon

taz5612 it sounds like you probably have a SiS7xx or SiS6xx (depending on whether you have an intel or amd cpu) series chipset, on these chipsets the current 2.4 Linux kernels implementation of APIC really causes trouble.  So I strongly urge you to disable APIC in both your BIOS and using the boot option on the live CD.  I have used the sis900 nic onboard four different mainboards in four different boxes for a few years now using linux.  I've never noticed that the USB and nic were sharing an IRQ though, this should be fine though.  Try disabling PnP in your BIOS as well, which will require the BIOS to assign resources given you are telling it that your OS is unable to -- this will atleast let you know who (what) is assigning the resources then.  The module you will need to load for your integrated nic is sis900 to load this module while using the liveCD just issue the command

```
modprobe sis900
```

Hope something in there helps!

Regards,

BonezTheGoon

----------

## dma

 *tcv wrote:*   

> Hi folks,
> 
> I am in the process of installing Gentoo on a MSI MS-6378 mainboard. This board has an on-board NIC, an ADMtek AN983B. 
> 
> 

 

This has the latest version of the tulip driver.  I'm not sure that they changed anything, however.  You might want to post some lspci output.

http://www.scyld.com/network/tulip.html

In addition, here is the diagnostic utils home page:

http://www.scyld.com/diag/index.html

(although you can't diagnose problems on an unloaded driver...)

----------

