3

I've seen similar questions here but they don't seem to answer the question, instead deferring to graphical installs or PXE-based installs (and with little detail on the latter for my use case).

I want to create a VM in Ubuntu 12.04 with the Ubuntu 12.04 server ISO and virt-install, locally, using a console (non-graphical) interface. Since you aren't allowed to specify "--extra-args" when using an ISO, my options are evidently limited in getting a standard text-only console.

I've successfully started an install using PXE from a remote repository (see note at the end of this post), but I'd prefer to do this entirely locally, without graphics and network overhead. As I'm installing from the server ISO one would thing it ideally suited to performing a text-only install. (What if your only option is a serial interface to the box?)

If PXE is unavoidable, what's the simplest way to accomplish that locally? Can one avoid installing a web server solely for this thing to access a few local files?

Also, how will the system differ if I build it with PXE the normal ISO? Will they be indistinguishable, or does the PXE-based install add or remove things from the normal install?

An example of what doesn't work:

sudo virt-install --name ubuntu1204os --ram 1024 --arch x86_64 --vcpus 1 \
  --os-type=linux --os-variant=virtio26 --file=/myvms/ubuntu1204os.img \
  --file-size=4 --graphics none --accelerate --hvm --network bridge:virbr0 \
  --cdrom=/myvms/media/ubuntu-12.04-server-amd64.iso

Output:

Starting install...
Creating storage file ubuntu1204os.img                                                                                                   | 4.0 GB     00:00
Creating domain...                                                                                                                       |    0 B     00:00
Connected to domain ubuntu1204os
Escape character is ^]    

<console hangs here>

For reference, instead of the --cdrom option I can use the following options to perform a PXE install, but the point here is to do all this locally, ideally with the ISO alone -- unless that's impossible.

  --location http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/ \
  --extra-args='console=tty0 console=ttyS0,115200n8'

Edit: Actually, the PXE install hangs too but not before asking several install-related questions (e.g., keyboard type, etc., via a pseudo-graphical text interface). It specifically seems to hang after it gets the (default) name of the archive to use, and starts downloading the release files. Thoughts?

MartyMacGyver
  • 167
  • 3
  • 11

3 Answers3

2

I think you're missing a --graphics option to tell it to use VNC. Then you control it using any free VNC / remote desktop client from even a netbook. Here's how I did it:

virt-install --name=ubuntu-vm --os-variant=ubuntuquantal --ram=2048 --vcpus=2 \
--cdrom=/public/software/linux/iso/ubuntu-12.10-desktop-amd64.iso \
--disk path=/srv/vm/ubuntu.img,size=16 \
--network model=virtio \
--graphics vnc,listen=192.168.0.99,port=5906

0.99 is my server IP - use yours as appropriate and whatever iso / path you want for the cdrom. I'm looking into PXE though now too but the above doesn't need it.

user93184
  • 21
  • 2
  • Except the point is to do this "without graphics". I've done this with VNC before but it seemed like a lot of overkill for answering a few textual setup questions. Preseeds and other things can probably get the job done but there appears to be no way to install Ubuntu (or CentOS) from a dumb terminal. – MartyMacGyver Jan 01 '13 at 00:10
1

Don't start with a regular installer - start with a mini or alternate installer - both do cli/curses only install.

Its the ame kernel on both server and desktop versions since 12.04 . Alternate install is common to both varients, and should have the basic packages you need.

Journeyman Geek
  • 6,969
  • 3
  • 31
  • 49
  • I appreciate the answer but I'm not sure how accurate this is. I want to install the server version, NOT the desktop version as "alternate" does. Also, I don't want this going out over the network to get all the install artifacts as "mini" does. Ref: http://askubuntu.com/questions/17952/what-are-the-differences-between-desktop-server-and-alternate-installs – MartyMacGyver Oct 17 '12 at 12:56
  • Answer's outdated - [https://help.ubuntu.com/community/ServerFaq] . – Journeyman Geek Oct 17 '12 at 13:01
  • That page also implies that the "alternate" CD is a desktop variant, not a server variant (and the minimal install is still unsuitable). So the alternate won't install unwanted desktop components by default? – MartyMacGyver Oct 17 '12 at 13:26
  • Not as far as I remember. Its been a while, since I switched over to the mini cd for most part. – Journeyman Geek Oct 17 '12 at 13:30
  • I'm trying this now, but it also hangs at exactly the same place. I'm not sure it's right to say it "hangs" so much as it probably has no output tty defined - and the inability to use --extra-args with a CD prevents any attempt at fixing this that *I'm* aware of (which is why I asked the question in the first place). – MartyMacGyver Oct 17 '12 at 13:36
  • wait, are we talking *no* display, through a emulated serial console? As opposed to CLI vs GUI? – Journeyman Geek Oct 17 '12 at 13:39
  • Pretty much. As above, I'm attempting to do this via virt-install. This, only a console is present (we could assume ttyS0, if I could get the CD to boot with that option). Note that I'm open to rebuilding the CD via mkisofs... if it comes to THAT I should just need to get the right options in the right place. – MartyMacGyver Oct 17 '12 at 14:36
0

Change This

sudo virt-install --name ubuntu1204os --ram 1024 --arch x86_64 --vcpus 1 \
  --os-type=linux --os-variant=virtio26 --file=/myvms/ubuntu1204os.img \
  --file-size=4 --graphics none --accelerate --hvm --network bridge:virbr0 \
  --cdrom=/myvms/media/ubuntu-12.04-server-amd64.iso

TO

sudo virt-install \
--name ubuntu1204os \
--ram 1024 \
--arch x86_64 \
--vcpus 1 \
--os-type=linux \
--os-variant=virtio26 \
--file=/myvms/ubuntu1204os.img \
--file-size=4 \
--graphics none \
--accelerate \
--hvm \
--network bridge:virbr0 \
**--location** /myvms/media/ubuntu-12.04-server-amd64.iso \
**--extra-args='console=tty0 console=ttyS0,115200n8'**

Location works with ISO files allowing you to use --extra-args

chaos777b
  • 1
  • 2