Auto-login on bare metal or qemu


#1

I’m playing with ROS installed to Qemu VMs. Once ROS is installed to disk I am welcomed with nice ASCII art, but no hint what IP addresses were configured. IPs are assigned from DHCP pool hence it’s hard to figure out on which IP new machine is sitting.

Is there something in cloud-init that would auto-login me after reboot?


#2

I added the following to my cloud-config, which though is a workaround, but does solve my problem:

runcmd:
  - "ip addr show | grep inet >> /etc/issue"

Still would be nice to know how to enable auto-login after reboot on bare metal installations.

EDIT:

It caused me more trouble as ros config is incapable to parse this line, therefore the rest of the config was not included:

# ros config export
ERRO[0000] Failed to parse config file /var/lib/rancher/conf/cloud-config.d/user_config.yml: Cannot resolve ip addr show | grep inet >> /etc/issue into <[]string Value> at line 5, column 2 
{}

It’s weird because, this line is actually run on boot and /etc/issue is properly updated…

After all there’s undocumented (?) method to auto-login rancher user after installation:

# ros install -d /dev/sda -a rancher.autologin=tty1

#3

odd - in my case (v0.8.0) just after the ascii art, it tells me the IP address:

               ,        , ______                 _                 _____ _____TM
  ,------------|'------'| | ___ \               | |               /  _  /  ___|
 / .           '-'    |-  | |_/ /__ _ _ __   ___| |__   ___ _ __  | | | \ '--.
 \/|             |    |   |    // _' | '_ \ / __| '_ \ / _ \ '__' | | | |'--. \
   |   .________.'----'   | |\ \ (_| | | | | (__| | | |  __/ |    | \_/ /\__/ /
   |   |        |   |     \_| \_\__,_|_| |_|\___|_| |_|\___|_|     \___/\____/
   \___/        \___/     Linux 4.9.10-rancher

         RancherOS db5da1e-dirty rancher-dev ttyS0
         IPADDRESS is normally here!!!!

rancher-dev login: rancher (automatic login)

Last login: Fri Feb 17 18:29:08 from 10.0.2.2

(and awesomely, this example I found failed to show the IP address)

but yes - the best solution is rancher.autologin=tty1.

so much so, that I’m thinking to make it default: https://github.com/rancher/os/issues/1563


#4

Is there a convenient way (without reinstalling) to control what parameters are passed to kernel on boot? Perhaps something in cloud-config? What would you advise if I’ve decided to disable auto-login eventually?


#5

Say i make changes to the /etc/issue filedto display the ip address using ethos: \4{eth0} and i reboot the changes are not persisted. Is there a way to make the changes to /etc/issue file permanent?