├── run.sh └── README.md /run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## Generates a password for the kernel cmdline 4 | password=$( cat /dev/urandom| tr -dc a-zA-Z0-9 | fold -w 20 | head -n 1 ) 5 | 6 | echo "## Installing kexec-tools, aria2" && \ 7 | apt-get update && \ 8 | DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --show-progress kexec-tools aria2 && \ 9 | apt-get clean 10 | 11 | echo "## Downloading RancherOS ISO" && \ 12 | aria2c https://github.com/rancher/os/releases/download/v0.6.1-rc2/rancheros.iso 13 | 14 | echo "## CRC Checksum of rancheros.iso - v0.6.1-rc2" && \ 15 | sha256sum rancheros.iso | grep \ 16 | 2ee7c0ad46fd7f61a45a81ff4c8c676cc3bc46a1a64cace88919e713a99ae613; 17 | [ $? -eq 0 ] && mount -t iso9660 rancheros.iso /mnt || echo bad iso image 18 | 19 | 20 | echo "## Entering Mounted RancherOS ISO" && \ 21 | [ -d /mnt/boot ] \ 22 | && cd /mnt/ \ 23 | || echo exit 24 | 25 | 26 | echo "## Credentials: ${password} (rancher)" && echo "## Kernel-Executing RancherOS" && \ 27 | kexec --initrd ./boot/initrd \ 28 | --command-line="rancher.password=${password}" \ 29 | ./boot/vmlinuz 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ### Install RancherOS on Hetzner (or from initramfs other than RancherOS) 3 | 4 | #### Notes 5 | 6 | You may want to use the following aliases for SSH 7 | 8 | _ssh-nocare-hostkey_ (try public keys (RancherOS rejects after too many keypair attempts)) 9 | ``` 10 | ssh \ 11 | -o PubkeyAuthentication=yes \ 12 | -o UserKnownHostsFile=/dev/null \ 13 | -o StrictHostKeyChecking=no 14 | ``` 15 | 16 | 17 | _ssh-nocare_ (do not use public key (when hetzner is in recovery/pxe-boot)) 18 | ``` 19 | ssh \ 20 | -o PubkeyAuthentication=no \ 21 | -o UserKnownHostsFile=/dev/null \ 22 | -o StrictHostKeyChecking=no 23 | ``` 24 | 25 | _connect to hetzbox_ 26 | 27 | ``` 28 | x1☘carbon:~/tmp% ssh-nocare-hostkey root@hetzbox 29 | Warning: Permanently added 'hetzbox,1.2.3.4' (ECDSA) to the list of known hosts. 30 | 31 | ------------------------------------------------------------------- 32 | 33 | Welcome to the Hetzner Rescue System. 34 | 35 | This Rescue System is based on Debian 8.0 (jessie) with a newer 36 | kernel. You can install software as in a normal system. 37 | 38 | To install a new operating system from one of our prebuilt 39 | images, run 'installimage' and follow the instructions. 40 | 41 | More information at http://wiki.hetzner.de 42 | 43 | ------------------------------------------------------------------- 44 | 45 | Hardware data: 46 | 47 | CPU1: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (Cores 8) 48 | Memory: 31996 MB 49 | Disk /dev/sda: 240 GB (=> 223 GiB) 50 | Disk /dev/sdb: 240 GB (=> 223 GiB) 51 | Total capacity 447 GiB with 2 Disks 52 | 53 | root@rescue ~ # ./rancher.sh 54 | ++ cat /dev/urandom 55 | ++ tr -dc a-zA-Z0-9 56 | ++ fold -w 20 57 | ++ head -n 1 58 | + password=OAQqylHPTQarbwnZK6M9 59 | + echo '## Installing kexec-tools, aria2' 60 | ## Installing kexec-tools, aria2 61 | + apt-get update 62 | Ign http://mirror.hetzner.de jessie InRelease 63 | Get:1 http://mirror.hetzner.de jessie/updates InRelease [63.1 kB] 64 | Get:2 http://mirror.hetzner.de jessie-backports InRelease [166 kB] 65 | Ign http://mirror.hetzner.de wheezy InRelease 66 | Get:3 http://security.debian.org jessie/updates InRelease [63.1 kB] 67 | Get:4 http://mirror.hetzner.de jessie Release.gpg [2,373 B] 68 | Hit http://mirror.hetzner.de wheezy Release.gpg 69 | Get:5 http://mirror.hetzner.de jessie Release [148 kB] 70 | Hit http://mirror.hetzner.de wheezy Release 71 | Ign http://cdn.debian.net jessie InRelease 72 | Get:6 http://cdn.debian.net jessie-backports InRelease [166 kB] 73 | Get:7 http://mirror.hetzner.de jessie/updates/main amd64 Packages [390 kB] 74 | Get:8 http://security.debian.org jessie/updates/main Sources [161 kB] 75 | Hit http://mirror.hetzner.de jessie/updates/contrib amd64 Packages 76 | Hit http://mirror.hetzner.de jessie/updates/non-free amd64 Packages 77 | Get:9 http://mirror.hetzner.de jessie/updates/main i386 Packages [390 kB] 78 | Hit http://mirror.hetzner.de jessie/updates/contrib i386 Packages 79 | Hit http://mirror.hetzner.de jessie/updates/non-free i386 Packages 80 | Get:10 http://mirror.hetzner.de jessie-backports/main amd64 Packages [700 kB] 81 | Get:11 http://security.debian.org jessie/updates/contrib Sources [1,439 B] 82 | Get:12 http://cdn.debian.net jessie Release.gpg [2,373 B] 83 | Get:13 http://security.debian.org jessie/updates/non-free Sources [14 B] 84 | Get:14 http://security.debian.org jessie/updates/main amd64 Packages [305 kB] 85 | Get:15 http://mirror.hetzner.de jessie-backports/contrib amd64 Packages [9,680 B] 86 | Get:16 http://mirror.hetzner.de jessie-backports/non-free amd64 Packages [23.3 kB] 87 | Get:17 http://mirror.hetzner.de jessie-backports/main i386 Packages [688 kB] 88 | Get:18 http://security.debian.org jessie/updates/contrib amd64 Packages [2,506 B] 89 | Get:19 http://cdn.debian.net jessie Release [148 kB] 90 | Get:20 http://security.debian.org jessie/updates/non-free amd64 Packages [14 B] 91 | Get:21 http://security.debian.org jessie/updates/main i386 Packages [305 kB] 92 | Get:22 http://security.debian.org jessie/updates/contrib i386 Packages [2,526 B] 93 | Get:23 http://mirror.hetzner.de jessie-backports/contrib i386 Packages [9,688 B] 94 | Get:24 http://security.debian.org jessie/updates/non-free i386 Packages [14 B] 95 | Get:25 http://mirror.hetzner.de jessie-backports/non-free i386 Packages [21.7 kB] 96 | Get:26 http://mirror.hetzner.de jessie/main amd64 Packages [6,787 kB] 97 | Get:27 http://cdn.debian.net jessie-backports/main i386 Packages [688 kB] 98 | Get:28 http://cdn.debian.net jessie-backports/main amd64 Packages [700 kB] 99 | Get:29 http://cdn.debian.net jessie-backports/non-free amd64 Packages [23.3 kB] 100 | Get:30 http://cdn.debian.net jessie/main amd64 Packages [6,787 kB] 101 | Get:31 http://cdn.debian.net jessie/non-free Sources [99.0 kB] 102 | Get:32 http://cdn.debian.net jessie/non-free amd64 Packages [83.6 kB] 103 | Get:33 http://cdn.debian.net jessie/main i386 Packages [6,789 kB] 104 | Get:34 http://cdn.debian.net jessie/contrib amd64 Packages [50.2 kB] 105 | Get:35 http://cdn.debian.net jessie/non-free i386 Packages [80.4 kB] 106 | Get:36 http://cdn.debian.net jessie/contrib i386 Packages [49.5 kB] 107 | Get:37 http://cdn.debian.net jessie-backports/non-free i386 Packages [21.7 kB] 108 | Get:38 http://cdn.debian.net jessie/main Sources [7,059 kB] 109 | Get:39 http://mirror.hetzner.de jessie/contrib amd64 Packages [50.2 kB] 110 | Get:40 http://mirror.hetzner.de jessie/non-free amd64 Packages [83.6 kB] 111 | Get:41 http://mirror.hetzner.de jessie/main i386 Packages [6,789 kB] 112 | Get:42 http://mirror.hetzner.de jessie/contrib i386 Packages [49.5 kB] 113 | Get:43 http://mirror.hetzner.de jessie/non-free i386 Packages [80.4 kB] 114 | Hit http://mirror.hetzner.de wheezy/openmanage amd64 Packages 115 | Hit http://mirror.hetzner.de wheezy/openmanage i386 Packages 116 | Get:44 http://cdn.debian.net jessie/contrib Sources [50.8 kB] 117 | Fetched 40.1 MB in 5s (7,735 kB/s) 118 | Reading package lists... Done 119 | + DEBIAN_FRONTEND=noninteractive 120 | + apt-get install --assume-yes --show-progress kexec-tools aria2 121 | Reading package lists... Done 122 | Building dependency tree 123 | Reading state information... Done 124 | The following extra packages will be installed: 125 | libc-ares2 126 | The following NEW packages will be installed: 127 | aria2 kexec-tools libc-ares2 128 | 0 upgraded, 3 newly installed, 0 to remove and 62 not upgraded. 129 | Need to get 1,359 kB of archives. 130 | After this operation, 5,165 kB of additional disk space will be used. 131 | Get:1 http://mirror.hetzner.de/debian/packages/ jessie/main libc-ares2 amd64 1.10.0-2 [76.7 kB] 132 | Get:2 http://mirror.hetzner.de/debian/packages/ jessie/main aria2 amd64 1.18.8-1 [1,202 kB] 133 | Get:3 http://mirror.hetzner.de/debian/packages/ jessie/main kexec-tools amd64 1:2.0.7-5 [80.2 kB] 134 | Fetched 1,359 kB in 0s (9,394 kB/s) 135 | Preconfiguring packages ... 136 | Selecting previously unselected package libc-ares2:amd64. 137 | (Reading database ... 63025 files and directories currently installed.) 138 | Preparing to unpack .../libc-ares2_1.10.0-2_amd64.deb ... 139 | Progress: [ 0%] 140 | Progress: [ 6%] 141 | Unpacking libc-ares2:amd64 (1.10.0-2) ... 142 | Progress: [ 12%] 143 | Progress: [ 18%] 144 | Selecting previously unselected package aria2. 145 | Preparing to unpack .../aria2_1.18.8-1_amd64.deb ... 146 | Progress: [ 25%] 147 | Unpacking aria2 (1.18.8-1) ... 148 | Progress: [ 31%] 149 | Progress: [ 37%] 150 | Selecting previously unselected package kexec-tools. 151 | Preparing to unpack .../kexec-tools_1%3a2.0.7-5_amd64.deb ... 152 | Progress: [ 43%] 153 | Unpacking kexec-tools (1:2.0.7-5) ... 154 | Progress: [ 50%] 155 | Progress: [ 56%] 156 | Processing triggers for man-db (2.7.0.2-5) ... 157 | Processing triggers for systemd (215-17+deb8u4) ... 158 | Setting up libc-ares2:amd64 (1.10.0-2) ... 159 | Progress: [ 62%] 160 | Progress: [ 68%] 161 | Setting up aria2 (1.18.8-1) ... 162 | Progress: [ 75%] 163 | Progress: [ 81%] 164 | Setting up kexec-tools (1:2.0.7-5) ... 165 | Progress: [ 87%] 166 | Generating /etc/default/kexec... 167 | Progress: [ 93%] 168 | Processing triggers for libc-bin (2.19-18+deb8u4) ... 169 | Processing triggers for systemd (215-17+deb8u4) ... 170 | + apt-get clean 171 | + echo '## Downloading RancherOS ISO' 172 | ## Downloading RancherOS ISO 173 | + aria2c https://github.com/rancher/os/releases/download/v0.6.1-rc2/rancheros.iso 174 | [#d22149 32MiB/41MiB(79%) CN:1 DL:4.4MiB ETA:1s] 175 | 09/25 01:51:05 [NOTICE] Download complete: /root/rancheros.iso 176 | 177 | Download Results: 178 | gid |stat|avg speed |path/URI 179 | ======+====+===========+======================================================= 180 | d22149|OK | 5.3MiB/s|/root/rancheros.iso 181 | 182 | Status Legend: 183 | (OK):download completed. 184 | + echo '## CRC Checksum of rancheros.iso - v0.6.1-rc2' 185 | ## CRC Checksum of rancheros.iso - v0.6.1-rc2 186 | + sha256sum rancheros.iso 187 | + grep 2ee7c0ad46fd7f61a45a81ff4c8c676cc3bc46a1a64cace88919e713a99ae613 188 | 2ee7c0ad46fd7f61a45a81ff4c8c676cc3bc46a1a64cace88919e713a99ae613 rancheros.iso 189 | + '[' 0 -eq 0 ']' 190 | + mount -t iso9660 rancheros.iso /mnt 191 | mount: /dev/loop1 is write-protected, mounting read-only 192 | + echo '## Entering Mounted RancherOS ISO' 193 | ## Entering Mounted RancherOS ISO 194 | + '[' -d /mnt/boot ']' 195 | + cd /mnt/ 196 | + echo '## Credentials: OAQqylHPTQarbwnZK6M9 (rancher)' 197 | ## Credentials: OAQqylHPTQarbwnZK6M9 (rancher) 198 | + echo '## Kernel-Executing RancherOS' 199 | ## Kernel-Executing RancherOS 200 | + kexec --initrd ./boot/initrd --command-line=rancher.password=OAQqylHPTQarbwnZK6M9 ./boot/vmlinuz 201 | Write failed: Broken pipe 202 | ``` 203 | 204 | _thanks for playing_ 205 | ``` 206 | x1☘carbon:~/tmp% ssh-nocare rancher@hetzbox 207 | Warning: Permanently added 'hetzbox,1.2.3.4' (ECDSA) to the list of known hosts. 208 | [root@rancher rancher]# uname -a 209 | Linux rancher 4.4.19-rancher #1 SMP Tue Sep 6 18:14:47 UTC 2016 x86_64 GNU/Linux 210 | ``` 211 | 212 | --------------------------------------------------------------------------------