Snappy should detect when running in KVM, specify correct ssh connection line

Bug #1621550 reported by Simos Xenitellis 
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
subiquity
Incomplete
Medium
Mathieu Trudel-Lapierre

Bug Description

When install Ubuntu Core on KVM (on Linux), the installation advises the user at the end to connect by SSH using a line like

ssh myusername@10.0.2.15

However, when running in KVM, the line should be instead

ssh myusername@localhost

(that is, 10.0.2.15 is not accessible from the host when Ubuntu Core is running in KVM)

How to reproduce:
1. Follow the instructions at https://developer.ubuntu.com/en/snappy/start/
to install an image from http://cdimage.ubuntu.com/ubuntu-snappy/16.04/current/
2. At the end of the installation it shows the erroneous line, as shown in the screenshot.

Revision history for this message
Simos Xenitellis  (simosx) wrote :
Revision history for this message
Oliver Grawert (ogra) wrote :

adding a task for subiquity since this is a UI issue, detection if being in kvm can be done via data from /proc/cpuinfo

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

This is kinda specific to user networking in KVM isn't it? I guess we can detect KVM we could can include some alternative suggestions...

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Do you just mean looking for "QEMU Virtual CPU version" in cpuinfo? Something like https://github.com/CanonicalLtd/subiquity/pull/166 (suggestions for better wording gratefully received).

Revision history for this message
Oliver Grawert (ogra) wrote :

the wording should actually mention that you most likely "need to use "$USER@localhost" with the right port" (i sadly doubt it is possible to get the port redirect from within the running VM so we can not show that bit, but probably explain it)

Revision history for this message
Ryan Harper (raharper) wrote :

It's specific to using qemu's userspace networking (-net user) and and using qemu's tcp redir to map the in-guest port 22 to the host.

http://wiki.qemu.org/Documentation/Networking#User_Networking_.28SLIRP.29

I don't think we always want to key off of QEMU cpu string;
It's possible for someone to boot this image with bridged
networking and then the UI wouldn't be right either.

To detect default -net user configs, maybe a combination of the
DHCP server IP (10.0.2.2) and lack of ICMP response?

% ping -w 1 -c1 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.

--- 8.8.8.8 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 999ms

% echo $?
1

http://wiki.qemu.org/Documentation/Networking#User_Networking_.28SLIRP.29

If present, this tells you the virt type:

$ systemd-detect-virt
qemu

Revision history for this message
Oliver Grawert (ogra) wrote :

well, i'm kind of assuming the user follows the snappy instructions at
https://developer.ubuntu.com/en/snappy/start/#snappy-local

but indeed if you use complex commandlines for kvm and set up bridge networking you might end up with different ways to ssh in ... perhaps we need a full paragraph explaining it ... though this might become tricky in 80x24 ...

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

I strongly disagree with displaying this. It seems extremely clunky: why display addresses and then mention they are wrong? Plus it's not impossible that the setup is done "on purpose", and that the users have configured their host appropriately to access the system with whatever access is provided, even with user-mode networking.

Rather than doing this, I would support either doing better detection that permits us to make sure the IP addresses would be wrong (which seems fraught with peril too), or leave it to users to know what they are doing.

An elegant solution might be to always display the ssh line for user@hostname, and expect that users will pick that first, or display user@hostname, and list "configured IP addresses" after that (without the ssh line), so that if access via the hostname doesn't work, then one of the IPs might.

Changed in subiquity (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Michael Hudson-Doyle (mwhudson)
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Assigned to Michael since he has already started working on this...

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Well you seem to have much stronger opinions than me!

Changed in subiquity (Ubuntu):
assignee: Michael Hudson-Doyle (mwhudson) → nobody
assignee: nobody → Mathieu Trudel-Lapierre (cyphermox)
Revision history for this message
Oliver Grawert (ogra) wrote :

btw, using systemd-detect-virt might be the best way forward for detecting if we are in a VM ...
also, since snappy final freeze is today, is this still on the radar for being fixed ?

Revision history for this message
Steve Langasek (vorlon) wrote :

Detecting that you're in KVM is definitely not the same thing as detecting that port redirection is in use.

I don't launch my KVM guests from the commandline using redir, I launch them under libvirt virt virt-manager, and the current instructions are correct for me...

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Setting to incomplete as the is certainly no consensus about what to do here. Maybe nothing?

Changed in subiquity (Ubuntu):
status: Triaged → Incomplete
Revision history for this message
Simos Xenitellis  (simosx) wrote :

The goal of this report is to deal with the usability issue. The issue that when you start Ubuntu Core through KVM, you do not get a working command on how to connect to the running image.

A simple solution could be to adapt the text on #1 to say something like:

   <email address hidden> can connect remotely to this device via SSH:

                   ssh you@10.0.15.1 (if running on standalone device)
                   ssh you@localhost (if running through KVM)

If KVM guests are not expected to be very common, then no change would be necessary. Any instructions that describe how to boot into KVM, should have the additional information on how to connect with SSH.

affects: subiquity (Ubuntu) → subiquity
John Lenton (chipaca)
no longer affects: snappy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.