Skip to content

Instantly share code, notes, and snippets.

@SvenDowideit
Last active May 2, 2019 07:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SvenDowideit/6b79bce042523a34be88d7a343e80721 to your computer and use it in GitHub Desktop.
Save SvenDowideit/6b79bce042523a34be88d7a343e80721 to your computer and use it in GitHub Desktop.
#cloud-config
# Auto install RancherOS on the first disk (we're assuming there is nothing you want to keep), and use the existing kernel params.
write_files:
- path: /opt/install
permissions: "0755"
content: |
#!/bin/sh
set -ex
echo "running" > /var/log/ros-install.log
system-docker exec console ros install -i rancher/os:v1.0.2 -d $(partprobe -s | head -n1 | cut -d : -f0) --append "$(cat /proc/cmdline)" -f --debug >> /var/log/install.log 2>&1
echo "done" >> /var/log/ros-install.log
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
rancher:
services:
ros-install:
image: alpine
entrypoint: /usr/bin/ros entrypoint
command: /opt/install
labels:
io.rancher.os.scope: system
io.rancher.os.after: console
uts: host
privileged: true
volumes:
- /var/log:/var/log
volumes_from:
- all-volumes
#!ipxe
dhcp
set base-url https://releases.rancher.com/os/v1.0.2
kernel ${base-url}/vmlinuz printk.devkmsg=on rancher.state.dev=LABEL=RANCHER_STATE rancher.state.wait console=tty0 rancher.state.mdadm_scan console=ttyS1,115200n8 rancher.autologin=ttyS1 rancher.network.interfaces.eth*.dhcp=true rancher.cloud_init.datasources=[packet]
initrd ${base-url}/initrd
boot
@SvenDowideit
Copy link
Author

SvenDowideit commented Jun 20, 2017

with read problem:

   |   .________.'----'   | |\ \ (_| | | | | (__| | | |  __/ |    | \_/ /\__/ /
   |   |        |   |     \_| \_\__,_|_| |_|\___|_| |_|\___|_|     \___/\____/
   \___/        \___/     Linux 4.9.33-rancher

         RancherOS 437034c sven2 ttyS1
         bond0: 147.75.108.131 lo: 127.0.0.1
sven2 login: rancher (automatic login)

[rancher@sven2 ~]$ > INFO[0007] [16/16] [preload-user-images]: Started       
> INFO[0007] [3/4] Starting sync                          
> INFO[0007] Project [os]: Project started                
> INFO[0007] [4/4] Starting banner                        
> INFO[0007] RancherOS 437034c started                    

[rancher@sven2 ~]$ 
[root@rancher-dev rancher]# agetty --version
agetty from util-linux 2.28

and after buildroot update, 2.29 - but problem persists

@SvenDowideit
Copy link
Author

ah :/, now to wonder why autologin causes stty -icrnl

[rancher@sven2 ~]$ read
�
[rancher@sven2 ~]$ diff before after 
--- before
+++ after
@@ -3,8 +3,8 @@
 eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
 werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
 -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
--ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon ixoff
--iuclc -ixany -imaxbel -iutf8
+-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
+-iuclc -ixany imaxbel -iutf8
 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
--echoctl echoke
+isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
+echoctl echoke
[rancher@sven2 ~]$ stty
speed 115200 baud; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-brkint -icrnl ixoff -imaxbel
-iexten -echoctl
[rancher@sven2 ~]$ stty icrnl
[rancher@sven2 ~]$ read

[rancher@sven2 ~]$ 

@SvenDowideit
Copy link
Author

SvenDowideit commented Jun 20, 2017

mmm, i wonder if using agetty from util-linux 2.28 and login from busybox is the problem. - that won't be fun to debug.

and centos also has the issue.

reminder to self - agetty is more consistent between consoles, so either extract the getty&login calls to outside the console, or...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment