Error "failed to copy cloud-config" when trying to install from USB to disc

Getting error “no space left on device”, I concluded I should no longer start from USB but rather from disc. Here I refer to

http://docs.rancher.com/os/storage/state-partition/
http://docs.rancher.com/os/running-rancheros/server/install-to-disk/

I boot from USB. /dev/sda is reserved for WIndows 10 (see How to mount a ntfs disk (read-only is ok)), /dev/sdb1 is owned by root.

Device     Boot   Start       End   Sectors  Size Id Type
/dev/sda1  *       2048   1026047   1024000  500M  7 HPFS/NTFS/exFAT
/dev/sda2       1026048 156299263 155273216   74G  7 HPFS/NTFS/exFAT
Device     Boot Start       End   Sectors  Size Id Type
/dev/sdb1        2048 117231407 117229360 55.9G 83 Linux

/dev/sdb1 is empty:

[rancher@rancher ~]$ sudo df
Filesystem           1K-blocks      Used Available Use% Mounted on
overlay                1978532    126860   1851672   6% /
tmpfs                  1958608         0   1958608   0% /dev
tmpfs                  1978532         0   1978532   0% /sys/fs/cgroup
tmpfs                  1978532         0   1978532   0% /mnt
tmpfs                  1978532         0   1978532   0% /media
none                   1978532       764   1977768   0% /run
devtmpfs               1958608         0   1958608   0% /host/dev
shm                      65536         0     65536   0% /host/dev/shm
none                   1978532       764   1977768   0% /var/run
tmpfs                  1978532    126860   1851672   6% /etc/hostname
shm                      65536         0     65536   0% /dev/shm
devtmpfs               1958608         0   1958608   0% /dev
shm                      65536         0     65536   0% /dev/shm
overlay                1958600   1797016    161584  92% /var/lib/docker/overlay/c8579fe88efe364c019a6e216dab56402720339dd3c73f74ef94cbb00832d943/merged
shm                      65536         0     65536   0% /var/lib/docker/containers/737f071daa2a6002c71cf1cdc98aae224abaa32c993d46433f5993c8b831185f/shm
/dev/sdb1             57562260     53196  54578332   0% /disk1

This is the state of cloud-config.yml:

[rancher@rancher ~]$ sudo cat /var/lib/rancher/conf/cloud-config.yml
rancher:
  cloud_init:
    datasources:
    - configdrive:/media/config-2
  network:
    dns:
      nameservers:
      - 8.8.8.8
      - 8.8.4.4
  ssh:
    keys:
      dsa: |+
        -----BEGIN DSA PRIVATE KEY-----
[...]

#cloud-config
ssh_authorized_keys:
  - ssh-rsa AAAAB3N...bR rancher@rancher
rancher:
  state:
    fstype: auto
    dev: LABEL=RANCHER_STATE
    autoformat:
    - /dev/sdb

As I was unsure if the public key should apply to user rancher or root, I also generated a key pair for root and added the public key, to no avail.

[root@rancher ~]# ros install -c cloud-config.yml -d /dev/sdb
> INFO[0000] No install type specified...defaulting to generic
> FATA[0000] Failed to copy cloud-config                   cloudConfig=cloud-config.yml

Google finds this error message in https://github.com/rancher/os/blob/master/cmd/control/install.go only, but nevertheless this doesn’t seem to apply, if I understand the source code correctly.

What am I doing wrong? What do I not understand?

By the way, being confused by naming conventions/dev/sdb vs. /dev/sdb1, I tried both versions, no difference though.

Does cloud-config.yml exist in the directory you’re currently in?

Well, that’s a good question. I issued the command from the rancher home directory, as noted by copy and paste.

The instructions are not very precise. Therefore, I tried to intuitively rule out all possibilities to get something wrong.

So I created a file cloud-config.yml in the home directory of user rancher, put the required information there, and also put this information in the file /var/lib/rancher/conf/cloud-config.yml, that is ssh_authorized_keys – but in another place I found a section called rancher (http://docs.rancher.com/os/storage/state-partition/), so I put this information in either place as well.

Also, I generated keys not only for user rancher but also for user root and put this information in both places also.

But the problem I faced here might stem from my working extensively on this USB-setup, where the last error was “no space left”.

Therefore I started from scratch. See https://www.gillum-webb.co.uk/rancher-os-the-perfect-place-to-run-docker/ – this sounds easy, works fine, but unfortunately the outcome is not really ok. The reboot works as expected, the ASCII art with Linux 4.9.0-rancher marker appears, then

RancherOS rancher tty1
lo: 127.0.0.1

rancher login:

And here we are – I have no idea which password I should supply. Actually I should have been logged in as rancher automatically without interaction, right? And there is no way to get out of this trap, is it?

As before, I tried to not only create cloud-config.yml in the home directory of rancher as indicated in said blog and use the public key of this user, but experimented with the other options I outlined above, too, but to no avail.

Thanks a lot for picking up my problem. I guess I’m not the only one experiencing this situation, as I don’t do anything special, and I’ll do what I can in order to work this out.

With sudo ros config export, I found out that ssh_authorized_keys has to be put to /var/lib/rancher/conf/cloud-config.yml – correct?