GithubHelp home page GithubHelp logo

Comments (15)

rafaeleyng avatar rafaeleyng commented on June 30, 2024 2

Hey @StefanScherer, thanks a lot for the quick response. Let's work together and fix this 😄 .

I'll just like to point out that, even if we manage to solve this problem, the main issue I see here is the obscurity/lack of consistency of the docs. If the docs were clearer, I might have ended with the same problem, but I sure wouldn't have to try a hundred combinations of factors and play the guessing game. And I think my original post helps to point out several of these inconsistencies.


One of the nasty things about cloud-init is that this yaml file must contain a first line containing

I'd take a step back here.

As somebody who doesn't know about cloud-init (just found out that it existed 2 days ago), this is one of the most obscure parts of all of this. Which file are we even referring to? userdata or metadata? What the difference between each of them? What should I put in which one of them? All of this is very implicit, especially in cloud-init doc (which does not include comprehensive documentation of both files, what are all the valid configurations, etc).

image

No one of these menus actually explains what it is. The first menu "User-Data Formats" talks a lot about file formats, shows some Python code, I and can't see the relationship between all of that and the yaml file we are talking about here.

The second menu "Cloud config examples" seems better, it does look like the yaml we are talking about (I still don't see the relationship of this with the User-Data Formats). And then it follows with a long list of examples that should supposedly just work, and only benefit people who already know what that actually does.

I'll not dive into the "metadata" part, whose documentation is even more obscure and confusing. But my point remains.

Let's talk about the issue in hand now.


#cloud-config

So, unfortunately, that was not my problem. I removed the comments in my examples shown in the original post, but in most of them (not all) I've actually copied examples from:

in which they all have the #cloud-config comment.


To be 100% sure, I have just tested it again:

  • Raspberry Pi 2 Model B (so, no onboard wifi, but using a wifi stick). Still not sure whether this makes any difference (see my main post for all the confusion about needing an extra step for devices with onboard wifi)
  • this exact configuration for --userdata (except for the password):
    #cloud-config
    
    # Set your hostname here, the manage_etc_hosts will update the hosts file entries as well
    hostname: black-pearl
    manage_etc_hosts: true
    
    # You could modify this for your own user information
    users:
      - name: pirate
        gecos: "Hypriot Pirate"
        sudo: ALL=(ALL) NOPASSWD:ALL
        shell: /bin/bash
        groups: users,docker,video
        plain_text_passwd: hypriot
        lock_passwd: false
        ssh_pwauth: true
        chpasswd: { expire: false }
    
    package_upgrade: false
    
    # # WiFi connect to HotSpot
    # # - use `wpa_passphrase SSID PASSWORD` to encrypt the psk
    write_files:
      - content: |
          allow-hotplug wlan0
          iface wlan0 inet dhcp
          wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
          iface default inet dhcp
        path: /etc/network/interfaces.d/wlan0
      - content: |
          country=BR
          ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
          update_config=1
          network={
          ssid="TP-Link_11FE_5G"
          psk="--------"
          proto=RSN
          key_mgmt=WPA-PSK
          pairwise=CCMP
          auth_alg=OPEN
          }
        path: /etc/wpa_supplicant/wpa_supplicant.conf
    
    # These commands will be ran once on first boot only
    runcmd:
      # Pickup the hostname changes
      - 'systemctl restart avahi-daemon'
    
      # Activate WiFi interface
      - 'ifup wlan0'

Some pictures of what I've got (note that these 3 pictures are from the Raspberry Pi 2 Model B, while in my original post they were all about the Raspberry Pi Zero, I don't have any pictures of the initial tests with the Pi 2 to compare).

Networking service:
service

ifconfig:
ifconfig

wpa supplicant:
wpa

Then I've retested the same configuration with the Pi Zero, and my results were the same as in the original post (including the pictures).

Update: I've tested on Pi Zero both with and without the --bootconf with the enable_uart=0 config (just to remember that the documentation about that is one of the questions I raise in my original post).


@YasserAntonio has a really good point. I've had several problems with several applications after upgrading OS X to Catalina.

from flash.

bkahlert avatar bkahlert commented on June 30, 2024 2

@rafaeleyng I feel you
Was just about to run into the same problems... half a year later. Docs as inconsistent as ever.
What you describe matches so much to what I experienced that I start to believe that that's the destiny of the silent majority of first-time users.
Well, and opening PRs... You would have to have at least some moments of success to feel motivated enough.

from flash.

StefanScherer avatar StefanScherer commented on June 30, 2024

Hey @rafaeleyng Thank you very much for your detailed repot. Oh you really tried hard and the time you put into getting it work and writing this feedback is extraordinary.

I haven't read all scenarios yet as I want to give you some quick tips that might help. But be assured I'll read all and reply with more comments later.

So, the basic tests worked fine, but as soon as you created an own coud-init.yaml it started to fail.

One of the nasty things about cloud-init is that this yaml file must contain a first line containing

#cloud-config

Thanks to your feedback I realise that this should be made more visible in our docs.
If that line is missing, cloud-init does not recognise this file and then, of course, none of the configurations are applied and won't work.

Maybe this little piece is the only thing that unblocks you.

from flash.

StefanScherer avatar StefanScherer commented on June 30, 2024

Here is a link to the cloud-init FAQ https://cloudinit.readthedocs.io/en/latest/topics/faq.html#how-can-i-debug-my-user-data

Two of the most common issues with user data, that also happens to be cloud-config is:

  1. Incorrectly formatted YAML
  2. First line does not contain #cloud-config

It's hard to add a yaml check into flash bash script, but at least we could check if the first line has the comment.

from flash.

StefanScherer avatar StefanScherer commented on June 30, 2024

I just found out that on macOS we already validate the YAML file. So the missing comment makes it to the top 1 problem. I've opened #178 to add a check for the comment in the first line of the user-data file.

from flash.

YasserAntonio avatar YasserAntonio commented on June 30, 2024

Hello, I upgraded my mac to Catalina and updated flash to it last version and I have the exacte same problem described in this issue with my rasp 3 and 4, even with the #cloud-config comment. Before everything was working well since I used the cloud-init config and flash several time before without any issue to report.

from flash.

rafaeleyng avatar rafaeleyng commented on June 30, 2024

Might be related: balena-io/etcher#2997

Note: I've also tried to run the flash script with sudo, getting the same results.

More information about notarization:

from flash.

rafaeleyng avatar rafaeleyng commented on June 30, 2024

I just finished trying to set up the Raspberry Pi 2 Model B again, but with the Vagrant setup, in a Linux VM. I was able to write the image to the card and added --userdata with the same configuration than I used in #177 (comment). I got the same results for all the commands.

from flash.

firecyberice avatar firecyberice commented on June 30, 2024

@rafaeleyng Thanks for your detailed report. Things evolved over time and the FAQ and docs got adapted from different persons as well. With that said sorry for the inconsistency.

For clarification of your hostname - fourth way section

This works white_check_mark. And by that, I mean: this did set the hostname (I'm not mentioning wifi so far).

I don't understand why. It seems that I've only added user information and wifi configuration, and that somehow makes the hostname work. I just give up investigating the hostname at this point.

When you add a cloud-init.yaml file without a user block like:

# You could modify this for your own user information
users:
  - name: pirate
    gecos: "Hypriot Pirate"
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
    groups: users,docker,video
    plain_text_passwd: hypriot
    lock_passwd: false
    ssh_pwauth: true
    chpasswd: { expire: false }

... then no user gets created so you cannot login.

That's why we added a default cloud-init userdata file if no specific userdata file is provided.

I have also struggled with the cloud-init docs in the beginning but if they are insufficient we should maybe open an issue or even better a PR there?

from flash.

rafaeleyng avatar rafaeleyng commented on June 30, 2024

Hey @firecyberice. I've ended up giving up on Hypriot some time after this issue was created. Since I wasn't able to make things work, I'm not comfortable in making a PR (I don't understand the problem and the solution, so I can't fix it).

from flash.

YasserAntonio avatar YasserAntonio commented on June 30, 2024

Hello guys just an easy workaround: When flashing dont set cloud-init.yml with the user-data param with flash. Just use flash to copy the Hypriot image on the sd card. After flashing remount the sd card and simply copy past your cloud-init.yml and rename it "user-data" (must be named this way, without extension) at the root of the sd card and it will work at boot.

from flash.

TheVegaByte avatar TheVegaByte commented on June 30, 2024

I did the following steps to change the hostname after run Hypriot 1.12.3 for the first time and it worked for me!

  1. Change the hostname value in /boot/user-data.

  2. Type the following commands:

    • sudo cloud-init clean
    • sudo cloud-init clean --logs
    • sudo cloud-init clean --reboot

After this the hostname should have changed.

from flash.

mrcabbie avatar mrcabbie commented on June 30, 2024

I made wifi work! read this https://kerneldriver.wordpress.com/2012/10/21/configuring-wpa2-using-wpa_supplicant-on-the-raspberry-pi/

from flash.

cengbrecht avatar cengbrecht commented on June 30, 2024

I made wifi work! read this https://kerneldriver.wordpress.com/2012/10/21/configuring-wpa2-using-wpa_supplicant-on-the-raspberry-pi/

From what I can read of this github issue, and the resultant conversation, nothing has changed, and the wifi part is only 1 very small part of the whole issue.
I too have NOT been able to change the username or the whole thing breaks again, and I have reflashed, and tried many different methods to get the default user to be something else.
ANY CHANGES that I make to the initial user-config break all ability to login, even though I have not removed or added ANY spaces whatsoever.

from flash.

cengbrecht avatar cengbrecht commented on June 30, 2024

I did the following steps to change the hostname after run Hypriot 1.12.3 for the first time and it worked for me!

  1. Change the hostname value in /boot/user-data.

  2. Type the following commands:

    • sudo cloud-init clean
    • sudo cloud-init clean --logs
    • sudo cloud-init clean --reboot

After this the hostname should have changed.

I have three pi's running Hypriotos, and am testing this RIGHT now.
Boot process is taking a bit longer.
Well, it did not undo my naming schema, however, I will have to re-reflash them again to know. For now, I will do it on the master only.
Can confirm that this whole issue, and the documentation still suck.

from flash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.