rancher / os

Tiny Linux distro that runs the entire OS as Docker containers
https://rancher.com/docs/os/v1.x/en/
Apache License 2.0
6.45k stars 656 forks source link

[pxe] Enable kernel extras earlier on in boot process? #2809

Open ekristen opened 5 years ago

ekristen commented 5 years ago

RancherOS Version: (ros os version) 1.5.2

Where are you running RancherOS? (docker-machine, AWS, GCE, baremetal, etc.) baremetal

rancher:
  modules: [ftdi_sio, usbserial]
  services_include:
    kernel-extras: true

I'm doing strictly PXE boot using an eMMC module for state storage.

It seems on a clean and fresh install that the kernel-extras gets loaded super late, like just before the login prompt is shown, so on first clean boot the ftdi_sio and usbserial modules do not get loaded into the kernel, or they get loaded way late after all USB devices are already detected.

Is there any way to get this loaded earlier?

It seems on subsequent boots that since the kernel-extras is already on the state drive the modules get loaded before USB detection and I see my ttyACM and ttyUSB devices.

niusmallnan commented 5 years ago

I may try this way.

#cloud-config

write_files:
  - path: /etc/rc.local
    permissions: "0755"
    owner: root
    content: |
      #!/bin/bash

      stamp=/var/lib/rancher/.kernel-extras-init
      if [ ! -f $stamp ]; then
          # wait-for-network
          for _ in {1..20}; do
              gateway=$(cat /proc/net/route | grep 0003 | wc -l)
              if [[ $gateway -ge 1 ]]; then
                  echo "network is ready."
                  break
              fi
              sleep 1
          done

          # ros config
          ros s enable kernel-extras
          ros s up kernel-extras
          ros c set rancher.modules "['ftdi_sio', 'usbserial']"
          modprobe ftdi_sio
          modprobe usbserial
          touch $stamp
      fi