DHCP on usb0 does not work when SSH key is generated

Hello everyone,

We have a problem here with usb0 not acting as DHCP server - or generally speaking, the client/PC does not connect.

We use the Machinekit Debian Stretch Image for the BeagleBone Black, a version from November with lots of modifications.

The problem happens after the SSH key is generated with the boot script. I noticed this because where are using a custom sshd_config https://github.com/thecooltool/SandyBox-Updater/blob/v2/files/sshd_config and using this config, the DHCP server does work. However, booting takes forever since the SSH key is generated at every boot.

Changing the sshd_config to use HostKey /etc/ssh/ssh_host_ed25519_key speeds up boot time, but the DHCP server won’t work anymore.

Interestingly, when booting with 5V barrel jack power supply, the DHCP server seems to work after reconnecting USB the second time.

Does anyone have an idea what could be the problem? Also, where can I find the default sshd_config for the latest RCN Debian Stretch image for reference?

Thanks,
Alexander

Hi Alexander,

That is weird, it should only do it on the "first" boot..

You can cheat and just blow away the trigger file:

/etc/ssh/ssh.regenerate

https://github.com/RobertCNelson/boot-scripts/blob/master/boot/generic-startup.sh#L13

but i wonder where it's getting stuck in the above..

Regards,

Robert,

The problem actually appears after the SSH key generation was successful or when I delete the trigger file.

Alexander

I think I found the source of the problem. I noticed that the problem appears after installing network-manager.

It looks like network-manager blocks the initialization from working.

As a workaround following seems to work in my case:

sudo nano /etc/NetworkManager/NetworkManager.conf

and add

[keyfile]
unmanaged-devices=mac:78:a5:04:cc:90:f0;mac:78:a5:04:cc:90:f3

whereas the MAC addresses need to be changed to match usb0 and usb1 MAC addresses obtained via ip a.

Does anyone know a good and reliable way to automate this independently of the MAC addresses?

I think I found the source of the problem. I noticed that the problem
appears after installing network-manager.

It looks like network-manager blocks the initialization from working.

As a workaround following seems to work in my case:

sudo nano /etc/NetworkManager/NetworkManager.conf

Ah, network manager.. that's why...

and add

[keyfile]
unmanaged-devices=mac:78:a5:04:cc:90:f0;mac:78:a5:04:cc:90:f3

whereas the MAC addresses need to be changed to match usb0 and usb1 MAC
addresses obtained via ip a.

Does anyone know a good and reliable way to automate this independently of
the MAC addresses?

After first bootup, the mac address's used are static..

You can easily use the cached versions:

/etc/cpsw_1_mac
/etc/cpsw_5_mac

Regards,

A that explains why it didn’t work on the other BBB I just configured.

I found following configuration that works independently of the MAC address:

main]
plugins=ifupdown,keyfile
dns=dnsmasq

[ifupdown]
managed=false

[keyfile]
unmanaged-devices=interface-name:usb0;interface-name:usb1