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

Re: Network setup by installer



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.
> > > > > 
> > > > 
> > > > 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:

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?

> > 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.

> > --✄--------
> > 
> > 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?

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.

> > 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>                                    │   
  │                                                                                 │   
  └─────────────────────────────────────────────────────────────────────────────────┘   

Cheers,
David.


Reply to: