hypriot / flash

Command line script to flash SD card images of any kind
MIT License
1.01k stars 175 forks source link

how to change hostname with flash hypriotos-rpi-v1.11.4.img.zip #157

Closed xiaods closed 4 years ago

xiaods commented 4 years ago

i follow the documents and flash arge helps , and successful flash the hypriotos-rpi-v1.11.4.img.zip to SD. but i have try many time without successful. the hypriotos already init with default hostname black-pearl.local. anyone can give some hints for me. thanks a lot.

follow the docs instruction: https://rancher.com/docs/k3s/latest/en/installation/ step:

  1. setup a device-init.yaml
    $ cat /boot/device-init.yaml 
    hostname: k3s-node1
    wifi:
    interfaces:
    wlan0:
      ssid: "CU_AxQa"
      password: "****"

    then i flash the SD:

    
    $ flash -c device-init.yaml ~/Downloads/hypriotos-rpi-v1.11.4.img.zip 
    Using cached image /tmp/hypriotos-rpi-v1.11.4.img                                                                                                                                 
    Filesystem                                                                                               Size   Used  Avail Capacity iused               ifree %iused  Mounted on
    /dev/disk1s1                                                                                            466Gi  374Gi   88Gi    81% 5727636 9223372036849048171    0%   /
    devfs                                                                                                   195Ki  195Ki    0Bi   100%     676                   0  100%   /dev
    /dev/disk1s4                                                                                            466Gi  3.0Gi   88Gi     4%       3 9223372036854775804    0%   /private/va
    r/vm                                                                                     
    map -hosts                                                                                                0Bi    0Bi    0Bi   100%       0                   0  100%   /net       
    map auto_home                                                                                             0Bi    0Bi    0Bi   100%       0                   0  100%   /home
    /Users/xiaods/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent.app  466Gi  374Gi   90Gi    81% 5724523 9223372036849051284    0%   /private/va
    r/folders/lk/xc7vf4p51wq8drc7h31tk8hr0000gn/T/AppTranslocation/5B85B325-4956-4A9E-8712-79F20B75E22B
    /dev/disk2s1                                                                                             64Mi   52Mi   12Mi    82%     512                   0  100%   /Volumes/Hy
    priotOS                                                                                  

Is /dev/disk2 correct? yes
Unmounting disk2 ...
Unmount of all volumes on disk2 was successful
Unmount of all volumes on disk2 was successful
Flashing /tmp/hypriotos-rpi-v1.11.4.img to disk2 ...
Password:
1.27GiB 0:01:51 [11.7MiB/s] [==================================================================================================================================>] 100%
0+20800 records in
0+20800 records out
1363148800 bytes transferred in 110.995825 secs (12281082 bytes/sec)
Copying device-init.yaml to /Volumes/HypriotOS/device-init.yaml ...
Unmounting and ejecting disk2 ...
Unmount of all volumes on disk2 was successful
Unmount of all volumes on disk2 was successful
Disk /dev/disk2 ejected
🍺 Finished.



when i boot the SD with my RPi 3+b, it works but with original hostname. it wired.
xiaods commented 4 years ago

when airgap install failed, i reinstall by one-installation script:

url -sfL https://get.k3s.io | sh -

it always failed by tls handshake failed. dubug logs use journalctl -xe , see blow messages:

cycle,LimitRanger,ServiceAccount,NodeRestriction,TaintNodesByCondition,Priority,DefaultTolerationSeconds,DefaultStorageClass,StorageObjectInUseProtection,MutatingAdmissionWebhook,RuntimeClass.
Nov 10 03:20:32 black-pearl k3s[1974]: I1110 03:20:32.572830    1974 plugins.go:161] Loaded 7 validating admission controller(s) successfully in the following order: LimitRanger,ServiceAccount,Priority,PersistentVolumeClaimResize,ValidatingAdmissionWebhook,RuntimeClass,ResourceQuota.
Nov 10 03:20:32 black-pearl k3s[1974]: time="2019-11-10T03:20:32.823956070Z" level=info msg="Running kube-scheduler --bind-address=127.0.0.1 --kubeconfig=/var/lib/rancher/k3s/server/cred/scheduler.kubeconfig --leader-elect=false --port=10251 --secure-port=0"
Nov 10 03:20:32 black-pearl k3s[1974]: time="2019-11-10T03:20:32.905733232Z" level=info msg="Running kube-controller-manager --allocate-node-cidrs=true --bind-address=127.0.0.1 --cluster-cidr=10.42.0.0/16 --cluster-signing-cert-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --cluster-signing-key-file=/var/lib/rancher/k3s/server/tls/server-ca.key --kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --leader-elect=false --port=10252 --root-ca-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --secure-port=0 --service-account-private-key-file=/var/lib/rancher/k3s/server/tls/service.key --use-service-account-credentials=true"
Nov 10 03:20:33 black-pearl k3s[1974]: I1110 03:20:33.577549    1974 controllermanager.go:161] Version: v1.16.2-k3s.1
Nov 10 03:20:33 black-pearl k3s[1974]: I1110 03:20:33.595590    1974 deprecated_insecure_serving.go:53] Serving insecurely on [::]:10252
Nov 10 03:20:33 black-pearl k3s[1974]: I1110 03:20:33.632742    1974 server.go:143] Version: v1.16.2-k3s.1
Nov 10 03:20:33 black-pearl k3s[1974]: I1110 03:20:33.636746    1974 defaults.go:91] TaintNodesByCondition is enabled, PodToleratesNodeTaints predicate is mandatory
Nov 10 03:20:33 black-pearl k3s[1974]: W1110 03:20:33.690567    1974 authorization.go:47] Authorization is disabled
Nov 10 03:20:33 black-pearl k3s[1974]: W1110 03:20:33.693645    1974 authentication.go:79] Authentication is disabled
Nov 10 03:20:33 black-pearl k3s[1974]: I1110 03:20:33.697008    1974 deprecated_insecure_serving.go:51] Serving healthz insecurely on [::]:10251
Nov 10 03:20:43 black-pearl k3s[1974]: time="2019-11-10T03:20:43.234004978Z" level=fatal msg="starting tls server: Get https://127.0.0.1:6444/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions: net/http: TLS handshake timeout"
Nov 10 03:20:43 black-pearl systemd[1]: k3s.service: Main process exited, code=exited, status=1/FAILURE
StefanScherer commented 4 years ago

We have moved from device-init to cloud-init some time ago. The option in flash is obly there to support old sd card images. Maybe it‘s time to remove this option. Please have a look at the samples https://github.com/hypriot/flash/blob/master/sample/README.md

xiaods commented 4 years ago

@StefanScherer thanks a lot. it resolve my case.