Jump to content

lan0 doesn't auto-start with system


rnsi
Go to solution Solved by rnsi,

Recommended Posts

I've got Jammy Minimal running on my EspressoBin v7 from Armbian_23.5.1_Espressobin_jammy_current_5.15.113_minimal. All seems to be working except the NICs do not auto-start with the system. Only lo starts. I have to "ip link set lan0 up" and "dhclient" each time it reboots. My /etc/network/interfaces:

source /etc/network/interfaces.d/*
# Network is managed by Network manager
auto lo
iface lo inet loopback

auto lan0
allow-hotplug lan0
iface lan0 inet dhcp

 

The NetworkManager.service is running. How do I make lan0 auto start?

 

Thanks

Link to comment
Share on other sites

I've "solved" this problem by adding a systemd service to start lan0, but this is clearly not an ideal solution. Still looking for the right fix.

 

I've tried with jammy and jammy minimal, and bookworm and bookworm minimal with the same results. Also, it seems that dhclient is not installed in either bookworm image. Are these images expecting no network connections?

 

Link to comment
Share on other sites

Create a script with the following:

ip link set lan0 up
dhclient

then create a service file:

/etc/systemd/system/lan0.service

[Unit]
Description=Start lan0

[Service]
ExecStart=/usr/bin/bash /path/to/script.sh

[Install]
WantedBy=multi-user.target

then "systemctl daemon-reload" and "systemctl enable lan0".

reboot

 

While this will auto start lan0, it does not fix the issue of why doesn't the lan auto start out of the box. It also doesn't reconnect if the network drops. It seems that Armbian on EspressoBin doesn't expect to use the network. I might try GTI's filesystem next to see if I have better results. Though I doubt I'll ever see updates from them.

 

Link to comment
Share on other sites

Guys, are you familiar with systemd-networkd?  /etc/network/interfaces is not how it's done anymore.  Try checking the results of "nmcli"/"nmtui" or "networkctl" to see what is managing the interfaces, and then interact with those systems.  I'm not so familiar with NetworkManager, but systemd-networkd keeps its files in /etc/systemd/network/.

Link to comment
Share on other sites

systemd-networkd is masked, and nmcli & networkctl shows everything as unmanaged.

 

It seems like networking is disabled in this image.

 

When I unmasked and enabled systemd-networkd, it didn't complete boot.

Link to comment
Share on other sites

  • Solution

I believe I solved it.

 

No need to add anything to /etc/network/interfaces

 

Instead, edit /etc/NetworkManager/conf.d/10-ignore-interfaces.conf. This file instructs NetworkManager to ignore all of the ethernet ports. Remove those entries.

 

/etc/NetworkManager/conf.d/10-ignore-interfaces.conf:

[keyfile]
unmanaged-devices=interface-name:br*

I don't know what br* is, so I left it in there.

 

Reboot and the network connects with DHCP as it should. Update /etc/network/interfaces if you need static addresses.

 

Link to comment
Share on other sites

br* is a bridge interface.  The systemd configuration files have it set up so that all three ports are part of a single bridge.  When you unmasked systemd-networkd, it probably got stuck at "waiting for network to be online", which has something like a 3 minute timeout.

 

As you mentioned, systemd-networkd is masked by default, which is normal for every other armbian board.  Switching to use Network Manager is a valid solution.

Link to comment
Share on other sites

Hi ManoftheSea,

 

First, thanks for your work on this.

 

But I don't think I understand your comments.

On 7/25/2023 at 2:55 PM, ManoftheSea said:

Guys, are you familiar with systemd-networkd?  /etc/network/interfaces is not how it's done anymore.

You then go on to mention:

4 hours ago, ManoftheSea said:

As you mentioned, systemd-networkd is masked by default, which is normal for every other armbian board.

So which is it? systemd-networkd or not?

 

The image I downloaded has NetworkManager active by default. I assume the ports are flagged as unmanaged so the user can ENABLE only the services needed, rather than try to hunt down and DISABLE the unneeded services. It would have saved a bit of time if that were documented somewhere. But it doesn't matter now. The system is working and seems stable so far.

 

 

Link to comment
Share on other sites

I've been using systemd-networkd with espressobin for long.

 

The trouble with starting i-net i-faces on boot exists from the origin.

I get used adding the following to my 

# cat /etc/rc.local

## if necessary to activate wan i-face

/sbin/ip link set dev wan up

 

Another solution to explore :

## Jul 13 22:16:50 2018 action merged with systemd-networkd.service
## ExecStartPre=/sbin/ip link set wan down | up
 

Link to comment
Share on other sites

On 7/28/2023 at 3:55 AM, rnsi said:

It would have saved a bit of time if that were documented somewhere. But it doesn't matter now. The system is working and seems stable so far.

Sorry folks, I think I'm suffering from the the same 'disease', but I'm still 'blind' to see the solution to the following issue.

 

I'm on a v5 board to which I flashed the "new" uboot version a long time, ago. (I think I flashed flash-image-DDR3-1g_2cs_2-800_800.bin that time as I had timing issues with the version with higher speed.)
Though I could get the system to boot after the reset of the uboot environment I never was able to get the i-net running on the applied images, so I gave up in the end.

"Messing around" with my Cubietrucks atm I thought I would give the espressobin a second try, but still without success.

 

To me it looks like network manager is running and when I set "/sbin/ip link set dev wan up" as suggested by @y52 the wan-port will get ipv6 addresses (I have to connections to the i-net), but no ipv4 ones.

So what do I have to do to get those (in the meantime community versions of bookworm etc.) to work? (thx!)

 

root@espressobin:~# nmcli device show
GENERAL.DEVICE:                         eth0
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         5A:FD:04:25:F9:14
GENERAL.MTU:                            1508
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
WIRED-PROPERTIES.CARRIER:               on
IP4.GATEWAY:                            --
IP6.ADDRESS[1]:                         fe80::58fd:4ff:fe25:f914/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 256

GENERAL.DEVICE:                         lan0
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         5A:FD:04:25:F9:14
GENERAL.MTU:                            1500
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
WIRED-PROPERTIES.CARRIER:               off
IP4.GATEWAY:                            --
IP6.GATEWAY:                            --

GENERAL.DEVICE:                         lan1
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         5A:FD:04:25:F9:14
GENERAL.MTU:                            1500
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
WIRED-PROPERTIES.CARRIER:               off
IP4.GATEWAY:                            --
IP6.GATEWAY:                            --

GENERAL.DEVICE:                         wan
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         5A:FD:04:25:F9:14
GENERAL.MTU:                            1500
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
WIRED-PROPERTIES.CARRIER:               on
IP4.GATEWAY:                            --
IP6.ADDRESS[1]:                         2a02:908:nnnn:nnnn:58fd:4ff:fe25:f914/64
IP6.ADDRESS[2]:                         2002:mmmm:mmmm:0:58fd:4ff:fe25:f914/64
IP6.ADDRESS[3]:                         fe80::58fd:4ff:fe25:f914/64
IP6.GATEWAY:                            fe80::1eed:6fff:fe07:29bd
IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 256
IP6.ROUTE[2]:                           dst = ::/0, nh = fe80::1eed:6fff:fe07:2>
IP6.ROUTE[3]:                           dst = 2a02:908:nnnn:nnnn::/64, nh = ::, >
IP6.ROUTE[4]:                           dst = ::/0, nh = fe80::b2f2:8ff:fe23:29>
IP6.ROUTE[5]:                           dst = 2002:mmmm:mmmm::/64, nh = ::, mt >

GENERAL.DEVICE:                         lo
GENERAL.TYPE:                           loopback
GENERAL.HWADDR:                         00:00:00:00:00:00
GENERAL.MTU:                            65536
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
IP4.ADDRESS[1]:                         127.0.0.1/8
IP4.GATEWAY:                            --

 

Link to comment
Share on other sites

Currently networking in Armbian is possible in different ways:

1 - networkd

2 - network-manager
3 - netplan, using either networkd or network-manager

4 - /etc/network/interfaces (which is absolutely outdated)

5 - armbian-config (which uses networkmanager via a script)

 

Have you considered using 5?

Perhaps you need to install armbian-config first on a minimal image.

 

The timeout for systemd can omitted by disabling systemd-networkd-wait-online.service with systemctl.

The second place to look is the "optional: true" parameter if you use netplan (which only works for ethernet).

Edited by specs
Link to comment
Share on other sites

21 hours ago, specs said:

Have you considered using 5?

Perhaps you need to install armbian-config first on a minimal image.

BTW: How would you (easily) install armbian-config, if you don't have internet connection? 😉 But yes, as it's part of the jammy / booksworm builds: I've tried set stauts of some ports to managed, or to set a static IP address - no success.

Link to comment
Share on other sites

In my opinion setting up internet without tools is less work than setting up either networkd or network manager, because that would mean downloading all packages by hand and transfer them to the SBC (and probably add missing packages as you go).

The after getting the network up you can install anything you want using apt.

 

Look up on setting up ethernet from the commandline. I would suggest starting with wired ethernet if available.

ip link set eth0 up
ip route add default via 192.168.1.2 dev eth0
rm /etc/resolv.conf
echo nameserver 192.168.1.1 > /etc/resolv.conf

(Assuming your route is 192.168.1.1 and eth0 is set up with DHCP).

 

There is probably enough to comment on this. But it gives you a general direction as it points to setup the ethernet adapter with IP address, route and DNS lookup.

The order of "ip addr" and "ip link" is something you should find by trial. You probably use it only once before you switch to network manager.

 

PS https://access.redhat.com/sites/default/files/attachments/rh_ip_command_cheatsheet_1214_jcs_print.pdf

Edited by specs
Link to comment
Share on other sites

OK thx - rather than Jammy I think I finally got bookworm to "fly", but the freshly flashed image booted without network, and thus the initial setup is a bit cumbersome. As from the "logs" below I had to unmask  the systemd-networkd.service first, before the network ports became usable ...

 

PS: Beside just unmasking the service with systemctl unmask systemd-networkd.service it has to be enabled as well with systemctl enable systemd-networkd.service to have it started after a reboot.

 

Quote

 

Welcome to Armbian_community!

Documentation: https://docs.armbian.com | Community support: https://community.armbian.com/

IP address:

Create root password: **********
Repeat root password: **********

WARNING!

You are using an automated build meant only for developers to provide
constructive feedback to improve build system, OS settings or UX.

If this does not apply to you, STOP NOW!  Especially don't use this
image for production since things might not work as expected or at
all. They may  break anytime with next update.

Shell: BASH

Creating a new user account. Press <Ctrl-C> to abort

Please provide a username (eg. your first name): fb
Create user (fb) password: ********
Repeat user (fb) password: ********

Please provide your real name: Foo Bar

Dear Foo Bar, your account fb has been created and is sudo enabled.
Please use this account for your daily work from now on.

Detected timezone:

Set user language based on your location? [Y/n] n
n

At your location, more locales are possible:
[...]
Generating locales: de_DE.UTF-8
root@espressobin:~# systemctl status networking.service
Unit networking.service could not be found.
root@espressobin:~# systemctl status
? espressobin
    State: running
    Units: 262 loaded (incl. loaded aliases)
     Jobs: 0 queued
   Failed: 0 units
    Since: Thu 1970-01-01 01:00:02 CET; 54 years 2 months ago
  systemd: 252.22-1~deb12u1
   CGroup: /
           +-init.scope
           ¦ +-1 /sbin/init
           +-system.slice
           ¦ +-NetworkManager.service
           ¦ ¦ +-1259 /usr/sbin/NetworkManager --no-daemon
[...]
root@espressobin:~# armbian-config
Command 'armbian-config' not found, but can be installed with:
apt install armbian-config
root@espressobin:~# netplan status
'netplan status' depends on networkd, but systemd-networkd.service is masked. Please start it.
root@espressobin:~# systemctl unmask systemd-networkd.service
Removed "/etc/systemd/system/systemd-networkd.service".

root@espressobin:~# netplan status --all
Unknown device type: dsa
Unknown device type: dsa
Unknown device type: dsa
Unknown device type: dsa
Unknown device type: dsa
Unknown device type: dsa
Unknown device type: dsa
Unknown device type: dsa
Unknown device type: dsa
     Online state: online
    DNS Addresses: 1.0.0.1 (compat)
                   a.b.c.130 (compat)
                   fd00::1eed:6fff:fe07:29bd (compat)
                   2a02:nnnn.nnnn.nnnn:1eed:6fff:fe07:29bd (compat)
       DNS Search: .

?  1: lo ethernet UNKNOWN/UP (unmanaged)
      MAC Address: 00:00:00:00:00:00
        Addresses: 127.0.0.1/8
                   ::1/128

?  2: end0 ethernet UP (unmanaged)
      MAC Address: 5a:fd:04:25:f9:14

?  3: wan other UP (unmanaged)
      MAC Address: 5a:fd:04:25:f9:14

?  4: lan0 other LOWERLAYERDOWN/UP (unmanaged)
      MAC Address: 5a:fd:04:25:f9:14

?  5: lan1 other LOWERLAYERDOWN/UP (unmanaged)
      MAC Address: 5a:fd:04:25:f9:14

?  6: br0 bridge UP (unmanaged)
      MAC Address: 0a:a0:41:7b:6d:9a
        Addresses: a.b.c.26/24 (dhcp)
                   2002:mmmm.mmmm:0:8a0:41ff:fe7b:6d9a/64
                   2a02:nnnn.nnnn.nnnn:8a0:41ff:fe7b:6d9a/64
                   fe80::8a0:41ff:fe7b:6d9a/64 (link)
    DNS Addresses: a.b.c.130
                   fd00::1eed:6fff:fe07:29bd
                   2a02:nnnn.nnnn.nnnn:1eed:6fff:fe07:29bd
           Routes: default via a.b.c.3 from a.b.c.26 metric 1024 (dhcp)
                   a.b.c.0/24 from a.b.c.26 metric 1024 (link)
                   a.b.c.3 from a.b.c.26 metric 1024 (dhcp, link)
                   a.b.c.130 from a.b.c.26 metric 1024 (dhcp, link)
                   2002:mmmm.mmmm::/64 metric 1024 (ra)
                   2002:mmmm.mmmm::/56 via fe80::b2f2:8ff:fe23:2905 metric 1024 (ra)
                   2a02:nnnn.nnnn.nnnn::/64 metric 1024 (ra)
                   2a02:nnnn.nnnn.nnnn::/59 via fe80::1eed:6fff:fe07:29bd metric 1024 (ra)
                   fe80::/64 metric 256

 

 

Edited by odoll
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines