Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

vm doesn't reboot if I set k3os.mode = install #82

Closed
tfiduccia opened this issue May 9, 2019 · 3 comments
Closed

vm doesn't reboot if I set k3os.mode = install #82

tfiduccia opened this issue May 9, 2019 · 3 comments
Labels
kind/bug Something isn't working

Comments

@tfiduccia
Copy link
Contributor

Version - v0.2.0

Steps:

  1. Setup VMWare machine
  2. During boot process, press e to get into GNU Grub
  3. On linux cmdline add k3os.mode=install
  4. Ctrl-x to save, answer question and wait for reboot

Result: Machine goes to shutdown state instead of rebooting.
image

@tfiduccia tfiduccia added the kind/bug Something isn't working label May 9, 2019
@jcardoso-bv
Copy link

jcardoso-bv commented May 14, 2019

Experiencing exactly the same bug with v0.2.1 and when forcing the k3os.install.power_off=false configuration option in Grub.

@immanuelfodor
Copy link

I've found the same bug under Proxmox, it stays powered off after install.
However, this lets me avoid another bug 😀 when you reboot with the CD/DVD drive attached, then remove the drive and reboot again, the SSH config becomes corrupted, the k3s service fails regularly, and then I need to recreate the VM from scratch.

Here is a corrupt state when I reboot the VM without detaching the ISO:

$ sudo ls -la /var/lib/rancher/k3os/ssh
total 8
drwxr-xr-x 2 root root 1024 May 15 05:21 .
drwxr-xr-x 3 root root 1024 May 15 05:21 ..
-rw-r--r-- 1 root root    0 May 15 05:21 moduli
-rw-r--r-- 1 root root    0 May 15 05:21 ssh_config
-rw------- 1 root root 1381 May 15 05:21 ssh_host_dsa_key
-rw-r--r-- 1 root root    0 May 15 05:21 ssh_host_dsa_key.pub
-rw------- 1 root root  505 May 15 05:21 ssh_host_ecdsa_key
-rw-r--r-- 1 root root    0 May 15 05:21 ssh_host_ecdsa_key.pub
-rw------- 1 root root  411 May 15 05:21 ssh_host_ed25519_key
-rw-r--r-- 1 root root    0 May 15 05:21 ssh_host_ed25519_key.pub
-rw------- 1 root root 1823 May 15 05:21 ssh_host_rsa_key
-rw-r--r-- 1 root root    0 May 15 05:21 ssh_host_rsa_key.pub
-rw-r--r-- 1 root root    0 May 15 05:21 sshd_config

$ sudo cat /var/log/messages
...
May 15 05:24:44 myk3osnode daemon.info /etc/init.d/k3s-service[2193]: Child command line: /sbin/k3s server 
May 15 05:24:44 myk3osnode daemon.warn /etc/init.d/k3s-service[2072]: /sbin/k3s, pid 2193, exited with return code 1
May 15 05:24:45 myk3osnode auth.err sshd[2198]: error: Error loading host key "/etc/ssh/ssh_host_rsa_key": invalid format
May 15 05:24:45 myk3osnode auth.err sshd[2198]: error: Error loading host key "/etc/ssh/ssh_host_ecdsa_key": invalid format
May 15 05:24:45 myk3osnode auth.err sshd[2198]: error: Error loading host key "/etc/ssh/ssh_host_ed25519_key": invalid format
May 15 05:24:49 myk3osnode daemon.info /etc/init.d/k3s-service[2204]: Child command line: /sbin/k3s server 
May 15 05:24:49 myk3osnode daemon.warn /etc/init.d/k3s-service[2072]: /sbin/k3s, pid 2204, exited with return code 1
May 15 05:24:54 myk3osnode daemon.info /etc/init.d/k3s-service[2210]: Child command line: /sbin/k3s server 
May 15 05:24:54 myk3osnode daemon.warn /etc/init.d/k3s-service[2072]: /sbin/k3s, pid 2210, exited with return code 1
May 15 05:24:59 myk3osnode daemon.info /etc/init.d/k3s-service[2221]: Child command line: /sbin/k3s server 
May 15 05:24:59 myk3osnode daemon.warn /etc/init.d/k3s-service[2072]: /sbin/k3s, pid 2221, exited with return code 1
... and these errors all over again ...

$ kubectl get pods
FATA[0000] exec format error                            
$ kubectl get nodes
FATA[0000] exec format error 

Here is when I first detach the ISO when the VM is in poweroff state right after the install, then boot for the first time:

$ sudo ls -la /var/lib/rancher/k3os/ssh/
total 571
drwxr-xr-x 2 root root   1024 May 15 05:34 .
drwxr-xr-x 3 root root   1024 May 15 05:34 ..
-rw-r--r-- 1 root root 565252 May 15 05:34 moduli
-rw-r--r-- 1 root root   1495 May 15 05:34 ssh_config
-rw------- 1 root root   1381 May 15 05:34 ssh_host_dsa_key
-rw-r--r-- 1 root root    605 May 15 05:34 ssh_host_dsa_key.pub
-rw------- 1 root root    505 May 15 05:34 ssh_host_ecdsa_key
-rw-r--r-- 1 root root    177 May 15 05:34 ssh_host_ecdsa_key.pub
-rw------- 1 root root    411 May 15 05:34 ssh_host_ed25519_key
-rw-r--r-- 1 root root     97 May 15 05:34 ssh_host_ed25519_key.pub
-rw------- 1 root root   1823 May 15 05:34 ssh_host_rsa_key
-rw-r--r-- 1 root root    397 May 15 05:34 ssh_host_rsa_key.pub
-rw-r--r-- 1 root root   3177 May 15 05:34 sshd_config

So in this case, I'd prefer leaving the boot state in poweroff instead of an instant reboot.

@handcraftedbits
Copy link
Contributor

I ran into this as well. The problem is that install.sh will always power the machine off if k3os.mode=install, regardless of any other setting. In fact, it doesn't even take k3os.install.power_off into consideration!

I've attached a PR to fix this. This is actually a pretty big problem for certain use cases. For instance, I automate the creation of VMs using Terraform and it expects that any newly-created VM will get an IP address eventually. Obviously this can't happen if the VM is powered down after installation; it has to be rebooted.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants