0

Is there any possible (not necessary native) ways to get access (e.g., terminal usage is the main purpose for me) to guest OS with *nix using libvirt/LXC(not as libvirt module) capabilities? And I don't mean to use methods like lxc-console commands.

zerospiel
  • 417
  • 1
  • 5
  • 10

3 Answers3

2

If the guest is set up with a serial console, you can use virsh console. This works well with kvm, never tried it with LXC though

To access the serial console directly, without libvirt: Add this to the qemu-kvm cmd line

-chardev socket,id=monitor,path=/srv/kvm/${VMNAME}/run/monitor.sock,server,nowait \
-monitor chardev:monitor \
-chardev socket,id=serial0,path=/srv/kvm/${VMNAME}/run/console.sock,server,nowait \
-serial chardev:serial0

I pointed the socket to /srv/kvm/VMNAME/run in this case Then you can use minicom

cd /srv/kvm/VMNAME/run
minicom -D unix\#console.sock

On most distributions, you also need to have console=tty0 console=ttyS0,115200n8 or something similar in the kernel boot line

dyasny
  • 18,482
  • 6
  • 48
  • 63
0

virsh domdisplay <VM-name> will give you a URL for connecting to a graphical console for a guest, if the guest doesn't have a serial console enabled.

virsh console <VM-name> will connect to the guest's serial console.

If all of this command line crap just annoys you, install the virt-manager GUI and you can point and click your way around managing your guests. (Note that virt-manager cannot yet install LXC guests.)

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
0

You could define a private network that is not accessible outside the LXC-server and use that network to access the LXC-guests via SSH (and bind SSH only to that network within the LXC guest).

Nils
  • 7,657
  • 3
  • 31
  • 71