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.44k stars 655 forks source link

iPXE boot mounts the RANCHER_STATE partition by default #2008

Open janeczku opened 7 years ago

janeczku commented 7 years ago

RancherOS Version: (ros os version) v1.0.2

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

https://github.com/rancher/os/pull/1034 made it so that booting from ISO would not mount the state partition by default. This seemed to have worked until 1.0.0 or so. But in v1.0.2 the state partition is mounted by default when we boot from iPXE.

We are using the following kernel line:

kernel vmlinuz vga=0x341 printk.devkmsg=on rancher.password=rancher rancher.cloud_init.datasources=['url:https://foo}']

When booting from iPXE on a host that has a previous install of RancherOS on disk, the partition is mounted as state device and the config loaded from there. This prevents us from easily re-deploying RancherOS with new configurations (we have to completely destroy the VM instead).

Do we have to explicitly set rancher.state.dev=none? There is a ticket that says this does not skip the state partition either: https://github.com/rancher/os/issues/1656#issuecomment-284127029.

@SvenDowideit

SvenDowideit commented 7 years ago

I think this is going to be something in your local setup.

v1.0.2 specifically:

sven@y260:~/releases/v1.0.2$ sudo -E /home/sven/bin/pixiecore boot ./vmlinuz-4.9.30-rancher ./initrd-v1.0.2 --cmdline 'console=tty1 rancher.autologin=tty1 printk.devkmsg=on rancher.password=rancher console=tty1 rancher.autologin=tty1 console=ttyS0 rancher.autologin=ttyS0'
[sudo] password for sven: 
[DHCP] Offering to boot f0:de:f1:5a:a6:2c
[TFTP] Sent "f0:de:f1:5a:a6:2c/0" to 10.10.10.32:2070
[TFTP] Sent "f0:de:f1:5a:a6:2c/0" to 10.10.10.32:2071
[DHCP] Offering to boot f0:de:f1:5a:a6:2c
[HTTP] Sending ipxe boot script to 10.10.10.32:9023
[HTTP] Sent file "kernel" to 10.10.10.32:9023
[HTTP] Sent file "initrd-0" to 10.10.10.32:9023

and then from another ssh console:

sven@y260:~$ ssh rancher@10.10.10.32 sudo fdisk -l /dev/sda
rancher@10.10.10.32's password: 
Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x206321ea

Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1  *     2048 250066943 250064896 119.2G 83 Linux
sven@y260:~$ ssh rancher@10.10.10.32 sudo df -h
rancher@10.10.10.32's password: 
Filesystem                Size      Used Available Use% Mounted on
overlay                   1.8G    111.0M      1.7G   6% /
tmpfs                     1.8G         0      1.8G   0% /dev
tmpfs                     1.8G         0      1.8G   0% /sys/fs/cgroup
none                      1.8G    680.0K      1.8G   0% /run
tmpfs                     1.8G         0      1.8G   0% /media
tmpfs                     1.8G         0      1.8G   0% /mnt
none                      1.8G    680.0K      1.8G   0% /var/run
devtmpfs                  1.8G         0      1.8G   0% /host/dev
shm                      64.0M         0     64.0M   0% /host/dev/shm
tmpfs                     1.8G    111.0M      1.7G   6% /etc/hostname
shm                      64.0M         0     64.0M   0% /dev/shm
devtmpfs                  1.8G         0      1.8G   0% /dev
shm                      64.0M         0     64.0M   0% /dev/shm
sven@y260:~$ ssh rancher@10.10.10.32 sudo blkid
rancher@10.10.10.32's password: 
/dev/sda1: LABEL="RANCHER_STATE" UUID="efbe99d1-e711-4c71-a656-70413472d12f" TYPE="ext4" PARTUUID="206321ea-01"