Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Host interface isn't 'up' #4

Open
artgodwin opened this issue Mar 17, 2023 · 4 comments
Open

Host interface isn't 'up' #4

artgodwin opened this issue Mar 17, 2023 · 4 comments

Comments

@artgodwin
Copy link

I built and installed this, and it worked perfectly - but only after I'd manually brought the host side interface up.
The host is debian 11 on x86

After plugging in, the usb0: device appeared but it wasn't routed, had no address assigned and wasn't 'up'.
I could fix this with
ifconfig usb0: 192.1.7.10 up
(or, presumably, the equivalent 'ip' command)

However in my previous experience of the gadget interface on beaglebone this was done automatically, presumably by dhcp on the gadget side.

Is this normal for this code or has something failed in my build / host ?

@maxnet
Copy link
Owner

maxnet commented Mar 17, 2023

The dhcp client of your OS should normally take care of that.

That does require that you have networkmanager, dhcpcd, systemd-networkd, or similar running, which may not always be the case with Debian.
E.g. if you are using old fashioned /etc/network/interfaces for configuration, it will only run a dhcp client for the exact network interface you specified there.

@artgodwin
Copy link
Author

artgodwin commented Mar 18, 2023

Thanks. Changing /etc/network/interfaces makes it get the correct address. It now only needs 'ifup usb0' to get things working.
However, it does still need that : it doesn't happen automatically on connection
I'm not running network manager on this machine and that might be the problem - I'll look into that (I've just found that it does work on a Mint laptop, which IS running it).
I'm mostly surprised it doesn't work because I thought I have had other gadget interfaces work without changes, but it's some time ago. Perhaps settings have changed.

@maxnet
Copy link
Owner

maxnet commented Mar 18, 2023

You can also try constructs like "allow-hotplug usb0" in /etc/network/interfaces.

I'm mostly surprised it doesn't work because I thought I have had other gadget interfaces work without changes, but
it's some time ago. Perhaps settings have changed.

Sometimes other changes you do can indeed affect things.
Say you had your normal eth0 network set to dhcp before, causing a DHCP client to be started.
And the DHCP client installed doesn't just look at eth0 but starts managing other interfaces as well (like some clients like dhcpcd do, they act like a network manager), it could sometimes cause it to handle usb0 as well.

If you then at some point change /etc/network/interfaces so to that eth0 gets a static network configuration, that dhcp client may no longer run, and as a side effect no longer manages other interfaces as well.

@artgodwin
Copy link
Author

artgodwin commented Mar 18, 2023

I don't actually have 'dhcp' on the main ethernet interface - in fact, it's not mentioned in /etc/network/interfaces at all, but it does get the address from the router at startup. So there may be some other simplified network manager running.
This machine has been running debian for a very long time and updated in place, but last time I did a full install which probably gave me different defaults.
Also just tried it on a raspberry pi which is running a very small dedicated Yocto/busybox build and it even worked automatically on that. Very nice.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants