[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Network setup by installer



On Thu 01 Feb 2018 at 10:55:35 (+0000), Brian wrote:
> On Wed 31 Jan 2018 at 20:05:17 -0600, David Wright wrote:
> 
> > On Wed 31 Jan 2018 at 23:13:52 (+0000), Brian wrote:
> > > On Wed 31 Jan 2018 at 12:29:38 -0600, David Wright wrote:
> > > 
> > > > On Fri 19 Jan 2018 at 19:09:27 (+0000), Brian wrote:
> > > > > On Sat 20 Jan 2018 at 03:25:00 +0900, Mark Fletcher wrote:
> > > > > > On Fri, Jan 19, 2018 at 02:33:23PM +0000, Brian wrote:
> > > > > > > On Fri 19 Jan 2018 at 22:10:39 +0900, Mark Fletcher wrote:
> > > > > > > > So, I return to the essential question, which I led with in my original 
> > > > > > > > post, which is which method does the installer use to set up networking, 
> > > > > > > > and where can I find documentation on that so I can replicate it for my 
> > > > > > > > wireless connection?
> > > > > > > 
> > > > > > > The installer uses the netcfg udeb to configure networking; the files in
> > > > > > > the package are the documentation (AFAIK). For a wired connection netcfg
> > > > > > > produces a file /etc/network/interfaces for use with the installer which
> > > > > > > is something like
> > > > > > > 
> > > > > > >  allow-hotplug enp0s25
> > > > > > >  iface enp0s25 inet dhcp
> > > > > > > 
> > > > > > > This file is transferred to the new system (mounted on /target) just
> > > > > > > before d-i finishes and booting into the new system takes place.
> > > > > > > 
> > > > > > > If you had chosen to install over a wifi connection, interfaces would
> > > > > > > have looked like this:
> > > > > > > 
> > > > > > >  allow-hotplug wlx0060b3f580c4
> > > > > > >  iface wlx0060b3f580c4 inet dhcp
> > > > > > >        wpa-ssid <access_point>
> > > > > > >        wpa-psk  <secret>
> > > > > > > 
> > > > > > > I would preseed the installer to replace the interfaces file it puts on
> > > > > > > /target with this file. Any firmware for the wireless adaptor would also
> > > > > > > have to be transferred to /target/lib/firmware too.
> > > > > > > 
> > > > > > > A fly in the ointment is the desktop you install (if any). If it brings
> > > > > > > in network-manager (MATE does) there is a possibility that there is no
> > > > > > > network at first boot.
> 
> As you have very clearly shown with your careful analysis.
> 
> > > > > > > 
> > > > > > 
> > > > > > Thank you Brian -- this is exactly the information I was after. Much 
> > > > > > appreciated, once again!
> > > > > > 
> > > > > > To get out of the situation I'm in on those two machines, I just need to 
> > > > > > hand-craft the interfaces file to something like what you have above, 
> > > > > > with appropriate device, ssid and WPA password values substituted. For 
> > > > > > these PARTICULAR systems, firmware doesn't seem to be a problem.
> > > > > 
> > > > > That's about it. The transferring of the interfaces file takes place in
> > > > > a late_command. I've not tried it myself but it should work and I intend
> > > > > to have a go tomorrow.
> > > 
> > > Mark Fletcher's problem was one of his own making. He chose (as he has
> > > very reasonably given reasons for) to install over an ethernet link and
> > > then met a problem *afterwards*. The solution given was how to avoid or
> > > mitigate the problem.
> > 
> > Yes, I recall making some suggestions. I don't know if they helped the OP.
> > 
> > > You are describing something completely different - an installation over
> > > a wireless link.
> > 
> > Yes, that's why I replied on *this* subthread. I was doing what the OP
> > might have been expected to do if they wanted to run their machine
> > with the wireless interface, ie install with the wireless interface.
> > One might expect the debian-installer to handle that case. But:
> 
> The installer does handle this case - just not in a manner you might
> expect.
>  
> > install on wired i/f → reboot and install more software on wired i/f.
> > install on wireless i/f → reboot and soliloquize with the loopback i/f.
> > 
> > Why the difference, and where is it documented?
> 
> The first question is best addressed to the d-i team; I am not aware of
> any comprehensive explanation for the difference. The documentation is
> in the netcfg package.
> 
> > > > OK, I've revisited this problem because what I read here runs counter
> > > > to my observations, so I've double checked.
> > > > 
> > > > I installed netinst 9.3 amd64 through the wireless interface. I ran
> > > > the installer through the ssh interface, and in parallel I ran a shells
> > > > on both the installee (wren) and installer (west).
> > > > (Yes, I have all the best words.)
> > > > 
> > > > The installee has /etc/network/interfaces set up by the time you ask
> > > > to install remotely (obviously, or you couldn't do it). Nothing else
> > > > interesting there until the installation is complete. From the
> > > > installer, you can observe:
> > > > 
> > > > /target appears after the partitioning step. Its interfaces file
> > > > appears after the base system is installed:
> > > > 
> > > > --✄--------
> > > > 
> > > > ~ # ls -l /target/etc/network/
> > > > drwxr-xr-x    2 root     root          4096 Jan 31 15:10 if-down.d
> > > > drwxr-xr-x    2 root     root          4096 Jan 31 15:10 if-post-down.d
> > > > drwxr-xr-x    2 root     root          4096 Jan 31 15:10 if-pre-up.d
> > > > drwxr-xr-x    2 root     root          4096 Jan 31 15:10 if-up.d
> > > > -rw-r--r--    1 root     root           361 Jan 31 15:10 interfaces
> > > > drwxr-xr-x    2 root     root          4096 Jan 30  2017 interfaces.d
> > > > ~ # cat /target/etc/network/interfaces
> > > > # This file describes the network interfaces available on your system
> > > > # and how to activate them. For more information, see interfaces(5).
> > > > 
> > > > source /etc/network/interfaces.d/*
> > > > 
> > > > # The loopback network interface
> > > > auto lo
> > > > iface lo inet loopback
> > > > 
> > > > # The primary network interface
> > > > allow-hotplug wlp2s0
> > > > iface wlp2s0 inet dhcp
> > > >         wpa-ssid deleted
> > > >         wpa-psk  deleted
> > > > ~ # # base system just installed
> > > > ~ #
> > > > 
> > > > --✄--------
> > > > 
> > > > All is still in place before the last keystroke of installation:
> > > > 
> > > > --✄--------
> > > > 
> > > > ~ # cat /target/etc/network/interfaces
> > > > # This file describes the network interfaces available on your system
> > > > # and how to activate them. For more information, see interfaces(5).
> > > > 
> > > > source /etc/network/interfaces.d/*
> > > > 
> > > > # The loopback network interface
> > > > auto lo
> > > > iface lo inet loopback
> > > > 
> > > > # The primary network interface
> > > > allow-hotplug wlp2s0
> > > > iface wlp2s0 inet dhcp
> > > >         wpa-ssid deleted
> > > >         wpa-psk  deleted
> > > > ~ # # about to eject
> > > > ~ # tail /var/log/syslog 
> > > > Jan 31 15:26:46 clock-setup: 1517412406.500000 is close enough to 1517412406.500000 (0.000000 < 0.001000)
> > > > Jan 31 15:26:46 clock-setup: Set RTC to 1517412406 (1517412406 + 0; refsystime = 1517412406.000000)
> > > > Jan 31 15:26:46 clock-setup: Setting Hardware Clock to 15:26:46 = 1517412406 seconds since 1969
> > > > Jan 31 15:26:46 clock-setup: ioctl(RTC_SET_TIME) was successful.
> > > > Jan 31 15:26:46 clock-setup: Not adjusting drift factor because the --update-drift option was not used.
> > > > Jan 31 15:26:46 finish-install: info: Running /usr/lib/finish-install.d/10open-iscsi
> > > > Jan 31 15:26:46 finish-install: info: Running /usr/lib/finish-install.d/10update-initramfs
> > > > Jan 31 15:26:47 finish-install: info: Running /usr/lib/finish-install.d/15cdrom-detect
> > > > Jan 31 15:26:47 cdrom-detect: Unmounting and ejecting '/dev/sdb1'
> > > > Jan 31 15:26:47 finish-install: info: Running /usr/lib/finish-install.d/20final-message
> > > > ~ # Connection to wren closed by remote host.
> > > > Connection to wren closed.
> > > > 255 west!david 09:27:43 ~ $ exit
> > > > 
> > > > Script done on Wed 31 Jan 2018 09:27:47 CST
> > > > 
> > > > --✄--------
> > > > 
> > > > So now I login on wren (sda6) and see what's been left in sda7 (installee):
> > > > 
> > > > --✄--------
> > > > 
> > > > $ cat /wrenbk/etc/network/interfaces
> > > > # This file describes the network interfaces available on your system
> > > > # and how to activate them. For more information, see interfaces(5).
> > > > 
> > > > source /etc/network/interfaces.d/*
> > > > 
> > > > # The loopback network interface
> > > > auto lo
> > > > iface lo inet loopback
> > > 
> > > Mmm.
> > > 
> > > > $ ls -lR /wrenbk/etc/network/
> > > > /wrenbk/etc/network/:
> > > > total 24
> > > > drwxr-xr-x 2 root root 4096 Jan 31 09:18 if-down.d
> > > > drwxr-xr-x 2 root root 4096 Jan 31 09:16 if-post-down.d
> > > > drwxr-xr-x 2 root root 4096 Jan 31 09:10 if-pre-up.d
> > > > drwxr-xr-x 2 root root 4096 Jan 31 09:18 if-up.d
> > > > -rw-r--r-- 1 root root  240 Jan 31 09:27 interfaces
> > > > drwxr-xr-x 2 root root 4096 Jan 30  2017 interfaces.d
> > > > 
> > > > /wrenbk/etc/network/if-down.d:
> > > > total 8
> > > > -rwxr-xr-x 1 root root 1015 Jan 23  2017 avahi-autoipd
> > > > -rwxr-xr-x 1 root root  332 Jun  2  2015 upstart
> > > > lrwxrwxrwx 1 root root   32 Oct 14 07:18 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh
> > > > 
> > > > /wrenbk/etc/network/if-post-down.d:
> > > > total 4
> > > > lrwxrwxrwx 1 root root   23 Jan 23  2017 avahi-daemon -> ../if-up.d/avahi-daemon
> > > > -rwxr-xr-x 1 root root 1409 Mar 24  2016 wireless-tools
> > > > lrwxrwxrwx 1 root root   32 Oct 14 07:18 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh
> > > > 
> > > > /wrenbk/etc/network/if-pre-up.d:
> > > > total 8
> > > > -rwxr-xr-x 1 root root 4178 Mar 24  2016 wireless-tools
> > > > lrwxrwxrwx 1 root root   32 Oct 14 07:18 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh
> > > > 
> > > > /wrenbk/etc/network/if-up.d:
> > > > total 16
> > > > -rwxr-xr-x 1 root root  923 Jan 23  2017 avahi-autoipd
> > > > -rwxr-xr-x 1 root root  484 Jan 23  2017 avahi-daemon
> > > > -rwxr-xr-x 1 root root  972 Oct 17 03:56 openssh-server
> > > > -rwxr-xr-x 1 root root 1483 Jun  2  2015 upstart
> > > > lrwxrwxrwx 1 root root   32 Oct 14 07:18 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh
> > > > 
> > > > /wrenbk/etc/network/interfaces.d:
> > > > total 0
> > > > $ ls -l --full-time /wrenbk/etc/network/interfaces
> > > > -rw-r--r-- 1 root root 240 2018-01-31 09:27:42.141512647 -0600 /wrenbk/etc/network/interfaces
> > > > $ 
> > > > 
> > > > --✄--------
> > > > 
> > > > No sign of the wireless interface. The file was tampered with after
> > > > the hwclock was set (Jan 31 15:26:46 clock-setup) and moments before
> > > > the ssh shell disconnected (255 west!david 09:27:43 ~ $ ). Here's
> > > > the culprit, which seems to be excited about its dirty work:
> > > 
> > > So this must be intentioal, wouldn't you say?
> > 
> > No.
> 
> Intentional on the part of the installer, I meant.
> 
> > > > --✄--------
> > > > 
> > > > Jan 31 15:26:47 finish-install: info: Running /usr/lib/finish-install.d/15cdrom-detect
> > > > Jan 31 15:26:47 cdrom-detect: Unmounting and ejecting '/dev/sdb1'
> > > > Jan 31 15:26:47 finish-install: info: Running /usr/lib/finish-install.d/20final-message
> > > > Jan 31 15:27:41 finish-install: info: Running /usr/lib/finish-install.d/30hw-detect
> > > > Jan 31 15:27:41 finish-install: info: Running /usr/lib/finish-install.d/50config-target-network
> > > > Jan 31 15:27:41 finish-install: info: Running /usr/lib/finish-install.d/55netcfg-copy-config
> > > > Jan 31 15:27:42 netcfg[30956]: INFO: Starting netcfg v.1.143
> > > > Jan 31 15:27:42 netcfg[30956]: DEBUG: No interface given; clearing /etc/network/interfaces
> > > 
> > > And this is also clearly intentional.
> > 
> > Intended to do what?
> 
> To leave the user without network connectivity after first boot? There
> are at least three bug reports against netcfg on the matter. My
> recollection is that no deeper intention is revealed there.

The two that seem most relevant are #694068 and #709017. Finding out
that a udeb package called netcfg even exists does of course require
examination of the logs and disection of the debian-installer.

The considered opinion of Sorina - Gabriela Sandu <sandu.sorina@gmail.com> is

     Date: Sun, 25 Nov 2012 17:30:28 +0200
    "For most cases, I think not adding configuration for wireless in /e/n/i is good"

which shows a lack of attention to important details like leaving the
new installation with some sort of connectivity.

The considered opinion of Colin Watson <cjwatson@debian.org> Date:
     Thu, 28 Aug 2014 20:03:55 +0100

    "This is wrong, I'm afraid.  /etc/network/interfaces will *always*
     exist at this stage, because it's copied by netcfg's
     base-installer hook.  However, the finish-install hook is
     explicitly using "netcfg write_loopback" in some cases to make
     sure that /etc/network/interfaces contains only the loopback
     entry.  Declining to copy this to the target system would break
     those cases.

    "What I'll do instead is copy /etc/network/interfaces only for the
     netcfg/target_network_config settings that require it.  Then this
     may just work for you if you don't have network-manager
     installed,"

This implies that "other cases" have been considered but forgotten.

Yes, I don't think the intentions are deeper, but just that simple
cases have been overlooked, and overlooked for several years.

> How connectivity is re-established on a machine with only a wireless
> interface is left as an exercise for the user.

This is some sort of sick joke.

> > The script /usr/lib/finish-install.d/55netcfg-copy-config is in
> > netcfg_1.143_amd64.udeb but I don't know the values of the variables
> > on entry to it so it's difficult to trace the flow.
> > 
> > It's very odd, though. The wireless network has been configured before
> > installation and copied to /target here (selection lines from log):
> > 
> > Jan 31 15:00:49 netcfg[8182]: INFO: Activating interface wlp2s0
> > […]
> > Jan 31 15:00:50 netcfg[8182]: INFO: Scan of wireless interface wlp2s0 succeeded.
> > […]
> > Jan 31 15:00:51 netcfg[8182]: INFO: Network chosen: deleted. Proceeding to connect.
> > […]
> > Jan 31 15:01:37 netcfg[8182]: DEBUG: State is now 6
> > Jan 31 15:01:38 netcfg[8182]: DEBUG: Network config complete
> > Jan 31 15:01:38 netcfg[8182]: DEBUG: No interface given; clearing /etc/network/interfaces
> > Jan 31 15:01:38 netcfg[8182]: DEBUG: Writing informative header
> > Jan 31 15:01:38 netcfg[8182]: DEBUG: Success!
> > Jan 31 15:01:38 netcfg[8182]: DEBUG: Writing loopback interface
> > Jan 31 15:01:38 netcfg[8182]: DEBUG: Success!
> > Jan 31 15:01:38 netcfg[8182]: DEBUG: Writing DHCP stanza for wlp2s0
> > Jan 31 15:01:38 netcfg[8182]: INFO: Detected wlp2s0 as a hotpluggable device
> > Jan 31 15:01:38 netcfg[8182]: DEBUG: Writing wireless options for wlp2s0
> > Jan 31 15:01:38 netcfg[8182]: DEBUG: Success!
> > 
> > and if it copies this stanza into /target/etc/network/interfaces
> > *before* installation (when it's neither required nor used), why
> > remove it after installation when it *is* required.
> 
> You think it is required. I think it is required. Other users think it
> is required. Perhaps the installer knows best? :)

Obviously not. It appears that the debian-installer team isn't able to
summon up the energy to debug one of their scripts and, because they
never meet the users who run into the bug, they feel no pressure to fix it.

> It does, however, give
> a way to go against its wishes:
> 
> Template: netcfg/target_network_config
> Type: select
> Choices-C: nm_config, ifupdown, loopback
> Choices: Network Manager, ifupdown (/etc/network/interfaces), No network configuration
> Description: for internal use; can be preseeded
>  Specifies what kind of network connection management tool should be
>  configured post-installation if multiple are available. Automatic
>  selection is used in this order when not specified: network-manager if
>  available (on Linux only), ethernet configuration through ifupdown on wired
>  installation and loopback configuration through ifupdown on wireless
>  installations.

If, by that, you mean preseeding, that's just a crummy workaround for
not fixing the problem. Preseeding wasn't designed for that.

> > > > Jan 31 15:27:42 netcfg[30956]: DEBUG: Writing informative header
> > > > Jan 31 15:27:42 netcfg[30956]: DEBUG: Success!
> > > > Jan 31 15:27:42 netcfg[30956]: DEBUG: Writing loopback interface
> > > > Jan 31 15:27:42 netcfg[30956]: DEBUG: Success!
> > > > Jan 31 15:27:42 finish-install: info: Running /usr/lib/finish-install.d/60cleanup
> > > > Jan 31 15:27:42 finish-install: info: Running /usr/lib/finish-install.d/65partman-md
> > > > Jan 31 15:27:42 finish-install: info: Running /usr/lib/finish-install.d/70mtab
> > > > Jan 31 15:27:42 finish-install: info: Running /usr/lib/finish-install.d/90base-installer
> > > > Jan 31 15:27:42 finish-install: info: Running /usr/lib/finish-install.d/90console
> > > > Jan 31 15:27:42 finish-install: info: Running /usr/lib/finish-install.d/94random-seed
> > > > Jan 31 15:27:42 finish-install: info: Running /usr/lib/finish-install.d/94save-logs
> > > > /wrenbk/var/log/installer/syslog ll.5925-5961/5961 end
> > > 
> > > More to write but I'm the cautious type. Please would you say first what
> > > options you chose at the tasksel stage (installing other sofware)?
> > 
> > As always,
> > 
> >   ┌───────────────────────────┤ [!] Software selection ├────────────────────────────┐   
> >   │                                                                                 │   
> >   │ At the moment, only the core of the system is installed. To tune the system     │   
> >   │ to your needs, you can choose to install one or more of the following           │   
> >   │ predefined collections of software.                                             │   
> >   │                                                                                 │   
> >   │ Choose software to install:                                                     │   
> >   │                                                                                 │   
> >   │                          [ ] Debian desktop environment                         │   
> >   │                          [ ] ... GNOME                                          │   
> >   │                          [ ] ... Xfce                                           │   
> >   │                          [ ] ... KDE                                            │   
> >   │                          [ ] ... Cinnamon                                       │   
> >   │                          [ ] ... MATE                                           │   
> >   │                          [ ] ... LXDE                                           │   
> >   │                          [ ] web server                                         │   
> >   │                          [*] print server                                       │   
> >   │                          [*] SSH server                                         │   
> >   │                          [*] standard system utilities                          │   
> >   │                                                                                 │   
> >   │                                   <Continue>                                    │   
> >   │                                                                                 │   
> >   └─────────────────────────────────────────────────────────────────────────────────┘   
> 
> No DE installed; therefore no network-manager. Installation was not over
> a wired connection; therefore no ifupdown stanza in /e/n/i.

I'm being sold a bill of goods here, then, as it's not clear how the
system can perform as a server if it has no connectivity.

So the final word is Sorina's:
"For most cases, I think not adding configuration for wireless in /e/n/i is good"

Considering events of the past year, I guess that's what now counts as
policy. It just took the world a while to catch up with Debian.

Cheers,
David.


Reply to: