BUG Community

Welcome! Log In

Forums BUG SDK New connection required each time?

Subscribe to New connection required each time?  31 posts, 7 voices

Log in to reply to this topic
 
May 12, 2008 1:21pm
Img_missing_medium Aldaron 4 posts

As near as I can tell, each time you restart the BUG and connect
it to a Mac (OS 10.5) you will have to create a completely new network
connection using the procedure outlined in the Wiki. The old one is
still there, with the correct settings saved, but the BUG won’t use it.

Does anyone else have this issue. Is there a workaround?

May 12, 2008 2:38pm
Medium Bug Labs team agordon 74 posts

Aldaron, this is a known issue with the current release of BUG as well as pretty much any linux-based gadget devices that uses the g_ether driver, from what I've seen in researching this problem.

We are working on a solution for this, and will hopefully release it with the next build of our root filesystem.

At the moment, I believe that you can work around the issue by ssh'ing into your BUG and editing the following files in /etc/rc.d:

/etc/rc.d/rc.conf:
comment out the line containing g_ether

/etc/rc.d/rc.local:
Just after the line that contains /sbin/modprobe bugfb, add:

/sbin/modprobe g_ether host_addr=46:0d:9e:67:69:eb dev_addr=b6:c8:ab:ac:44:7f
/sbin/ifconfig usb0 10.10.10.10 netmask 255.255.255.0


This should configure your IP/USB connection to have a static MAC address, rather than generating a random one each time the BUG boots. Mac OS X, unlike Windows and Linux, pays attention to these MAC addresses, storing them in a configuration file that is referenced when the OS tries to bring up a new network interface.
May 12, 2008 2:41pm
Medium Bug Labs team agordon 74 posts

I'd also like to note that you should be incredibly careful performing these changes. Errors in these configuration files can cause your BUG to not be able to initialize its networking components, requiring a re-flash of your MMC card with a fresh copy of the BUG root filesystem.
May 12, 2008 4:24pm
Img_missing_medium Aldaron 4 posts

agordon
I'd also like to note that you should be incredibly careful ...

Thanks. I'll wait.
May 12, 2008 10:13pm
Medium Bug Labs team finsprings 268 posts

I had the handylink cable and a serial connection as a fallback, so I tried this but it didn’t work for me.

Well, it worked when I did /sbin/rmmod g_ether and then modprobe’d it as above – I consistently got the same adaptor connected in OS X. So, it seemed like it was working.

However, when I powered the bug off and back on it didn’t quite work. The connection was made to OS X but the usb0 interface on the bug didn’t come up as 10.10.10.10, so there was no way to connect from the Mac to the bug over ethernet.

So, I went back in and undid my changes via the serial connection. This was harder than it should have been because I must have minicom set up incorrectly or something: the ‘x’ key in vi would delete from the line above the one I was on for some reason, although ‘dd’ would delete the line I was on. I managed to get it back and now it comes up as 10.10.10.10 again, albeit with a new adaptor in OS X again every time. Perhaps the usb0 ifconfig is trying to run too early in the modified setup?

May 14, 2008 2:36pm
Medium Bug Labs team agordon 74 posts

So, fin...

Are you sure that you removed or properly commented out the appropriate line in /etc/rc.d/rc.conf? It sounds like maybe the g_ether driver is still loading on boot.

You could also maybe try this in /etc/rc.d/rc.local:

/sbin/rmmod g_ether ; /sbin/modprobe g_ether host_addr=46:0d:9e:67:69:eb dev_addr=b6:c8:ab:ac:44:7f
Also, if you're feeling incredibly adventurous, and want to remove some of those old stale network connections, you can edit /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist and remove the entries that contain RNDIS/Ethernet Gadget. I believe you should be able to edit it using the Property List Editor in OS X via the following command from within Terminal.app: sudo open /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist

I strongly recommend making a backup of that file before making any modifications.
May 14, 2008 3:41pm
Medium Bug Labs team finsprings 268 posts

I am pretty sure I commented out the line in rc.conf, but I can definitely try it again. Thanks for the link to the plist file; I had tried to find it and failed. Interestingly plist editor crashed when I tried to expand one of the disclosure triangles, but vi worked just fine ;-)

May 14, 2008 4:25pm
Medium Bug Labs team agordon 74 posts

Ew, scary.

Yeah, I generally either use vi or TextMate to edit plist files, but don’t usually recommend that to other people.

May 14, 2008 4:33pm
Medium Bug Labs team finsprings 268 posts

I would have used TextMate but for me it seems to get a bit farty sometimes when I run it via sudo.

May 14, 2008 9:40pm
Medium Bug Labs team finsprings 268 posts

Al,

I tried again and got the same result: the port comes up and the Mac sees it, but it's not bound as 10.10.10.10:

root@BUG /etc/rc.d # diff rc.conf.save rc.conf
9d8
< export MODLIST="g_ether"
root@BUG /etc/rc.d # diff rc.local.save rc.local
19a20
> /sbin/modprobe g_ether host_addr=46:0d:9e:67:69:eb dev_addr=b6:c8:ab:ac:44:7f
root@BUG /etc/rc.d # ifconfig usb0
Using fallback suid method
usb0 Link encap:Ethernet HWaddr B6:C8:AB:AC:44:7F
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)


If I do an rmmod and do the explicit modprobe... line again from the shell, it doesn't come up as 10.10.10.10 either, so the only time I've had it work was when it was already up as 10.10.10.10 the default way then brought it up and down using the rmmod and explicit modprobe.... commands.
May 15, 2008 12:33pm
Medium Bug Labs team agordon 74 posts

Grrr.... Okay, please accept my apologies. I was operating from some old notes rather than my actual config, since I could not find the MMC card that I had previously used for this configuration.

If you look back up at my initial posting in this thread, I have edited it to hopefully be correct. Specifically, after the new modprobe line in /etc/rc.d/rc.local, you need to configure the interface with an IP and netmask:

/sbin/ifconfig usb0 10.10.10.10 netmask 255.255.255.0

I have not tested this, but uou may also want to want to add this immediately below those lines:

/sbin/route add default gw 10.10.10.1
May 17, 2008 10:46am
Medium Bug Labs team finsprings 268 posts

So I made the changes, including adding the default route, and I got to the point where I could ping yahoo.com by IP address, but not by DNS name. Still, progress!

However, I shut the bug down again from the serial connection and next time it came up the Mac didn't recognize it. I noticed the following in the system.log on the Mac:

May 17 09:49:39 dfindlay-macbook kernel[0]: USBF: 92797.876 AppleUSBHubPort: Port 1 of Hub at 0x3d000000 reported error 0xe00002ed while doing set feature (resetting port)
May 17 09:49:47 dfindlay-macbook /usr/sbin/ocspd[8545]: starting
May 17 09:49:54 dfindlay-macbook kernel[0]: 0 0 AppleUSBCDCACMData: start - Find CDC driver failed
May 17 09:49:54 dfindlay-macbook configd[14]: InterfaceNamer: failed to name the interface, kr=0xe00002bc
May 17 09:49:54 dfindlay-macbook kernel[0]: AppleUSBCDCECMData: Version number - 3.2.6, Input buffers 8, Output buffers 4


I tried rebooting the Mac but it didn't help, and I tried putting the original rc.conf and rc.local back and it didn't help, so I don't think it's necessarily related. I'm going to try reinstall the USB ether driver and see what that does.
May 17, 2008 11:05am
Medium Bug Labs team finsprings 268 posts

I went back to the original rc.conf and rc.local and the Mac again prompted me for a new enX. I then went to the modified ones and it didn't, so I think it was finding the old en7 somehow even though I had deleted it from Network. So I edited rc.local to make the host_addr end in ec instead of eb, just to make it different. Then when I restarted the bug it came up and prompted me for en9. I rebooted it again and en9 went live by itself.

I turned on Internet Sharing from Airport to en9 and I set the router and DNS Server fields of en9 to 192.168.13.1 to match my home network. After that I was able to ping yahoo.com by domain name from the bug.

So it looked good...but to be sure I shut the bug down and started it back up. This time en9 didn't connect itself and the Mac's system log again shows an error:

May 17 10:59:01 dfindlay-macbook kernel[0]: 0 0 AppleUSBCDCACMData: start - Find CDC driver failed
May 17 10:59:01 dfindlay-macbook configd[14]: InterfaceNamer: failed to name the interface, kr=0xe00002bc
May 17 10:59:01 dfindlay-macbook kernel[0]: AppleUSBCDCECMData: Version number - 3.2.6, Input buffers 8, Output buffers 4


So I can get this to work once, but not twice.

Any ideas?
May 17, 2008 11:08am
Medium Bug Labs team finsprings 268 posts

So now it's in the state again where it won't come up at all: I put the original rc.conf and rc.local back and the Mac won't connect to it:

May 17 11:02:29 dfindlay-macbook kernel[0]: USBF: 1024. 42 AppleUSBHubPort: Port 1 of Hub at 0x3d000000 reported error 0xe00002ed while doing set feature (resetting port)
May 17 11:02:41 dfindlay-macbook kernel[0]: 0 0 AppleUSBCDCACMData: start - Find CDC driver failed
May 17 11:02:41 dfindlay-macbook kernel[0]: AppleUSBCDCECMData: Version number - 3.2.6, Input buffers 8, Output buffers 4
May 17 11:02:41 dfindlay-macbook kernel[0]: AppleUSBCDCECMData: Ethernet address 6e:a7:2c:9e:3b:3e
May 17, 2008 9:15pm
Medium Bug Labs team agordon 74 posts

If you can ping a host on the internet by IP but not by name, it's a DNS problem. Most likely, the /etc/resolv.conf file on your BUG has the IP address of a computer that is not a DNS resolver, or is refusing to accept DNS connections from your BUG.

That file should contain a line like this:

nameserver 4.2.2.2

...where the IP address is that of a known server acting as a DNS resolver. The address listed above is a DNS server on the internet, so you'll need to make Internet Sharing work before that will work for you. Alternatively, you can enter the IP address of your router, if it has DNS server capabilities, or of a DNS server provided by your ISP.

Next: I'm not sure what the limit is on enx devices is on OS X, but I'm sure it can't be unlimited.

If I were in the situation you describe, I would do the following:

First, unplug your BUG from your Mac.

Next, on the Mac: Backup /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist, then edit it to remove all instances of RNDIS/Ethernet Gadget. Disable Internet Sharing. Reboot.

A side note: Since Internet Sharing maps traffic between two specific network adapters, your really want to get your Mac working so that it does not create a new connection each time you plug the BUG in, or reboot your BUG or Mac. If Network Sharing is setup to direct your BUG's packets on en4 to the internet through your ethernet adapter en0, and the next time you plug in your BUG, it's no longer mapped as en4 on the Mac, your Internet Sharing isn't going to work.

So, back to business...

Plug the BUG back in.

As long as the networking config files on the BUG aren't totally fubar, the interface should come back, hopefully with a low number (like en2 or en3, unless you have other interfaces configured, like virtual interfaces from VMWare or Parallels or whatever).

Log into the BUG and configure it as previously specified: Comment out or remove the appropriate line in /etc/rc.d/rc.conf, and make the changes in /etc/rc.d/rc.local.

If you decide to back out of these changes for some reason, you'll need to undo all of the changes. This means editing both files I just previously mentioned, not just one or the other. If you delete the line in rc.conf rather than comment it out, make sure to backup that file, or at least make a note of exactly what you did so that you can undo it later. If you have half-done or half-undone these changes, you may need to re-flash your BUG's MMC card, basically resetting it to defaults.

I'm not sure how to describe what needs to be done any better than this. But, if you're still having problems, and are running OS X 10.5, maybe I can do a remote desktop connection and walk through the config with you some time. The new features in iChat in Leopard are pretty nice for remote support.
May 17, 2008 11:02pm
Medium Bug Labs team finsprings 268 posts

I’ve cleared out the networks plist several times. The problem I’m having now is the one I’ve listed before showing an error in the Mac’s syslog, where the USB-to-IP connection simply doesn’t come up at all. It’s up on the bug’s side, which I can see from the handylink serial connection via minicom, but it won’t come up on the Mac, and the Mac gives me that error. This happens regardless of whether I’ve got tweaked rc.conf/rc.local or the originals. I booted the bug 3 times without touching its files and the Mac only brought up an enX once out of those 3.

I have a minimal plist right now, so I don’t think that’s the problem but it’s possible I guess. It just seems like that USB/IP ko is being flakey.

If I could get the bug to show up on the Mac consistently I can do the rest to get the sharing working, but as you said this is pointless until the bug comes up with the same MAC on the Mac, as otherwise you need to redo the Internet Sharing.

So, my problem right now is in getting the Mac not to give me that CDC driver failure when the bug starts its usb0 interface.

May 18, 2008 2:25pm
Medium Bug Labs team finsprings 268 posts

Al,

After our discussion, I restored the original plist, rebooted, reinstalled the CDC driver and rebooted again.

I started up the bug and it connected. I turned on Internet Sharing and the bug could ping yahoo.com. I shutdown the bug from serial and turned it back on. It came up, en21 went live and again the bug could ping yahoo.com. I shut it back down, turned it back on and this time en21 didn't go green. I tried several more times without success.

The difference in the Mac's system.log is the following line:

May 18 14:14:03 dfindlay-macbook configd[14]: InterfaceNamer: failed to name the interface, kr=0xe00002bc

When it works I see:

May 18 14:04:41 dfindlay-macbook kernel[0]: 0 0 AppleUSBCDCACMData: start - Find CDC driver failed
May 18 14:04:41 dfindlay-macbook kernel[0]: AppleUSBCDCECMData: Version number - 3.2.6, Input buffers 8, Output buffers 4
May 18 14:04:41 dfindlay-macbook kernel[0]: AppleUSBCDCECMData: Ethernet address 46:0d:9e:67:69:eb


When it doesn't work I see:

May 18 14:17:48 dfindlay-macbook kernel[0]: 0 0 AppleUSBCDCACMData: start - Find CDC driver failed
May 18 14:17:48 dfindlay-macbook configd[14]: InterfaceNamer: failed to name the interface, kr=0xe00002bc
May 18 14:17:48 dfindlay-macbook kernel[0]: AppleUSBCDCECMData: Version number - 3.2.6, Input buffers 8, Output buffers 4


BSD help says:

configd InterfaceNamer This bundle provides a name to each of the system's network interfaces. The bundle queries the IOKit Registry for a list of network devices attached to the system and gives them BSD style names such as "en0".


Why it would work a couple of times then stop working, I don't know.
May 18, 2008 2:38pm
Medium Bug Labs team finsprings 268 posts

Next I left the bug running and restarted the Mac, with the USB cable detached. Once the Mac was up I plugged in the USB cable and the bug came up as en27 - it was en21 before.

Here's my rc diffs so you can see it shouldn't be randomizing anything:

root@BUG /etc/rc.d # diff rc.conf.save rc.conf
9c9
< export MODLIST="g_ether"
---
> #export MODLIST="g_ether"
root@BUG /etc/rc.d # diff rc.local.save rc.local
19a20,22
> /sbin/modprobe g_ether host_addr=46:0d:9e:67:69:eb dev_addr=b6:c8:ab:ac:44:7f
> /sbin/ifconfig usb0 10.10.10.10 netmask 255.255.255.0
> /sbin/route add default gw 10.10.10.1


I shutdown and restarted the bug 5 times in a row and each time it came back up properly as en27. I then went in and turned on Internet Sharing from Airport to en27. I could ping yahoo. I then restarted the bug and it did *not* come up this time - I could the same "failed to name" error.

So, I am wondering if Internet Sharing is what's causing the problem. I tried turning it off, but it seems like once it's in the "failed to name" state it won't come back.
May 18, 2008 2:42pm
Medium Bug Labs team finsprings 268 posts

After last post, rebooted Mac and bug came back as en27 again (I disabled Internet Sharing before rebooting).

May 19, 2008 4:21pm
Medium Bug Labs team agordon 74 posts

Okay, so that makes sense. When your Mac boots and tries to instantiate ICS between two interfaces, and one of then doesn’t even exist because the BUG’s not plugged in, something in some part of the Mac’s network stack is probably in an unhappy state. Come to think of it, I think I did not keep ICS enabled on my Mac other than when I wanted the BUG to have access, and disabled it afterward.

So, let me get another thing straight: You’re clearing out your plist file and are still seeing interface numbers in the double digits? :shock: Are you also perhaps not removing those stale interfaces from the Network preference pane (Network GUI)? I realize now that I had not mentioned that specifically before, but I seem to recall doing that on my Mac prior to editing the plist file.

You know, it would be nice if you could either edit a text file OR just work in a GUI in the Mac, but it seems often, you need to do both. :x

May 19, 2008 4:49pm
Medium Bug Labs team finsprings 268 posts

This was after I restored my original plist, where original already had multiple connections from the bug from a random MAC. These enXXs were in the original plist but I’d already -’ed them from the Network utility.

I will try going back to a nice empty list and start the bug multiple times and hope it comes up as en2 or something reasonable. I’ll then try starting ICS and stopping it to see if I can reboot the bug, get ICS, undo it and come back up again without needing to reboot my Mac.

Fingers crossed….

BTW, thanks for all the help and support Al. It’s much appreciated.

May 19, 2008 7:52pm
Medium Bug Labs team finsprings 268 posts

Ok. I cleared the cruft out of my plist and now the bug consistently comes up as en4.

However, Internet Sharing is still broken. I can turn it on to share Airport to en4 once the bug is up running, and that’s fine – I can ping yahoo.com from the bug and all that good stuff. Now, even if I go in and disable Internet Sharing by unchecking it in the Sharing tab of System Preferences, I still can’t reboot the bug – if I do it gives me that interface name error and en4 stays unconnected. Rebooting the Mac at this point will bring back the en4 connection.

Internet Sharing is definitely still a bit unhappy even after the reboot as no matter what I do it won’t let me uncheck en4 from the interfaces to share Airport to; well it will, but when I click back on it en4 is checked again. If I turn it back on after the restart the bug can ping yahoo.com again, so it does seem to work for a single boot of the bug. I’ll take that for now until the HandyLink->eth0 adapter is out and I can get the USB connection out of the way altogether.

May 20, 2008 6:03am
Medium Bug Labs team agordon 74 posts

I’m sorry that this has been such a hassle, but glad to see you’ve gotten things to work as much as they currently are.

Yeah, the HandyLink <—> ethernet adapter should provide a better solution for you. Either that or the wi-fi module, when that’s ready.

May 20, 2008 7:57am
Medium Bug Labs team finsprings 268 posts