LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-25-2016, 05:40 PM   #1
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
proper syntax for a qemu command


I am trying to use qemu without a gui front-end. Having gone through the docs at http://wiki.qemu.org/download/qemu-d...isk_005fimages I have come up with the following:
Code:
qemu-x86_64 -cpu kvm64 \
 -soundhw sb16 \
 -vga std \
 -drive media=cdrom,if=ide,index=1,file=$HOME/Downloads/live_cds/gparted-live-0.16.1-1-i486.iso \
 -drive media=disk,if=ide,index=0,file=new_disk_image.img
I have verifed that the iso and img do exist and are where I say they are. The .img was made using qemu-img. No matter what I do, qemu (well, qemu-x86_64, as there is no actual qemu) prints the same "help" screen. It does not say anythng about the parameters passed to it.

By the way, the docs say that typing "qemu -cpu ?" will list the possible cpu choices and that "-soundhw ?" will list the possible sound card choices, but that is false. Instead, qemu prints the identical "help" screen.

To summarize, typing "qemu-x86_64" with any parameters is equivalent to typing "qemu-x86_64" without any parameters. Every time.

Is qemu being retarded or am I?

Can I have a hint? What am I missing? Are the docs out of date? The goal in my example above is to boot off a cd rom to then partition the emulated hard drive.

edit: i shoudl have put this in a general section, not a specific t this distro section. Damn, out of time, can't be helped.

Last edited by jr_bob_dobbs; 02-25-2016 at 05:42 PM.
 
Old 02-25-2016, 05:47 PM   #2
slacker1337
Member
 
Registered: Jun 2012
Location: Connecticut, USA
Distribution: Slackware
Posts: 148

Rep: Reputation: 40
Quote:
Originally Posted by jr_bob_dobbs View Post
Code:
qemu-x86_64 -cpu kvm64 \
 -soundhw sb16 \
 -vga std \
 -drive media=cdrom,if=ide,index=1,file=$HOME/Downloads/live_cds/gparted-live-0.16.1-1-i486.iso \
 -drive media=disk,if=ide,index=0,file=new_disk_image.img
Try setting the command to
Code:
qemu-system-x86_64
You will also see a drastic increase in performance by adding -enable-kvm
 
1 members found this post helpful.
Old 02-25-2016, 05:50 PM   #3
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
On my setup, there is a symlink '/usr/bin/qemu-kvm -> qemu-system-x86_64'.
'qemu-kvm -cpu ?' and 'qemu-kvm -soundhw ?' work as documented.
 
Old 02-25-2016, 06:57 PM   #4
Gerardo Zamudio
Member
 
Registered: Jan 2011
Distribution: Slackware
Posts: 128

Rep: Reputation: 112Reputation: 112
How did you install qemu? Check if the command you are running is a symlink or a binary as allend mentioned above.

I tried the your command on my system and instead of telling me the files don't exist it printed the help message too

Code:
gzamudio@hades:~ $ qemu-x86_64 -cpu kvm64 \
>  -soundhw sb16 \
>  -vga std \
>  -drive media=cdrom,if=ide,index=1,file=$HOME/Downloads/live_cds/gparted-live-0.16.1-1-i486.iso \
>  -drive media=disk,if=ide,index=0,file=new_disk_image.img
usage: qemu-x86_64 [options] program [arguments...]
Linux CPU emulator (compiled for x86_64 emulation)

Options and associated environment variables:

Argument      Env-variable      Description
-h                              print this help
-g port       QEMU_GDB          wait gdb connection to 'port'
-L path       QEMU_LD_PREFIX    set the elf interpreter prefix to 'path'
-s size       QEMU_STACK_SIZE   set the stack size to 'size' bytes
-cpu model    QEMU_CPU          select CPU (-cpu help for list)
-E var=value  QEMU_SET_ENV      sets targets environment variable (see below)
-U var        QEMU_UNSET_ENV    unsets targets environment variable (see below)
-0 argv0      QEMU_ARGV0        forces target process argv[0] to be 'argv0'
-r uname      QEMU_UNAME        set qemu uname release string to 'uname'
-B address    QEMU_GUEST_BASE   set guest_base address to 'address'
-R size       QEMU_RESERVED_VA  reserve 'size' bytes for guest virtual address space
-d item[,...] QEMU_LOG          enable logging of specified items (use '-d help' for a list of items)
-D logfile    QEMU_LOG_FILENAME write logs to 'logfile' (default stderr)
-p pagesize   QEMU_PAGESIZE     set the host page size to 'pagesize'
-singlestep   QEMU_SINGLESTEP   run in singlestep mode
-strace       QEMU_STRACE       log system calls
-seed         QEMU_RAND_SEED    Seed for pseudo-random number generator
-version      QEMU_VERSION      display version information and exit

Defaults:
QEMU_LD_PREFIX  = /usr/gnemul/qemu-x86_64
QEMU_STACK_SIZE = 8388608 byte

You can use -E and -U options or the QEMU_SET_ENV and
QEMU_UNSET_ENV environment variables to set and unset
environment variables for the target process.
It is possible to provide several variables by separating them
by commas in getsubopt(3) style. Additionally it is possible to
provide the -E and -U options multiple times.
The following lines are equivalent:
    -E var1=val2 -E var2=val2 -U LD_PRELOAD -U LD_DEBUG
    -E var1=val2,var2=val2 -U LD_PRELOAD,LD_DEBUG
    QEMU_SET_ENV=var1=val2,var2=val2 QEMU_UNSET_ENV=LD_PRELOAD,LD_DEBUG
Note that if you provide several changes to a single variable
the last change will stay in effect.
I checked each option using ?

Code:
gzamudio@hades:~ $ qemu-kvm -cpu ?
x86           qemu64  QEMU Virtual CPU version 2.4.1                  
x86           phenom  AMD Phenom(tm) 9550 Quad-Core Processor         
x86         core2duo  Intel(R) Core(TM)2 Duo CPU     T7700  @ 2.40GHz 
x86            kvm64  Common KVM processor                            
x86           qemu32  QEMU Virtual CPU version 2.4.1                  
x86            kvm32  Common 32-bit KVM processor                     
x86          coreduo  Genuine Intel(R) CPU           T2600  @ 2.16GHz

gzamudio@hades:~ $ qemu-kvm -soundhw ?
Valid sound card names (comma separated):
pcspk       PC speaker
hda         Intel HD Audio
cs4231a     CS4231A
gus         Gravis Ultrasound GF1
adlib       Yamaha YM3812 (OPL2)
ac97        Intel 82801AA AC97 Audio
es1370      ENSONIQ AudioPCI ES1370
sb16        Creative Sound Blaster 16

gzamudio@hades:~ $ qemu-kvm -drive ?
qemu-kvm: -drive ?: Must specify either driver or file
So far it looks like the values you passed to each option were correct until the -drive option. Something there may be incorrect. I checked the man page for qemu

Code:
-drive option[,option[,option[,...]]]
           Define a new drive. Valid options are:
    media=media
           This option defines the type of the media: disk or cdrom

-cdrom file
           Use file as CD-ROM image (you cannot use -hdc and -cdrom at the same time). You
           can use the host CD-ROM by using /dev/cdrom as filename.



Instead of -cdrom you can use:

           qemu-system-i386 -drive file=file,index=2,media=cdrom
Further down the man page one of the examples they list uses this syntax:

Code:
qemu-system-x86_64 --drive media=cdrom,file=http://dl.fedoraproject.org/pub/fedora/linux/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-20-1.iso,readonly
I'm not too experienced with command line usage since I use a GUI tool to manage QEMU but I hope this points you in the right direction.
 
Old 02-25-2016, 08:14 PM   #5
AlleyTrotter
Member
 
Registered: Jun 2002
Location: Coal Township PA
Distribution: Slackware64-15.0
Posts: 783

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Try adding
"""
-boot order=cd \
"""
after your vga line without the quotes
this should cause qemu to look at d drive (windows nomenclature for the cdrom) to boot when it doesn't find a bootable OS on the image file

Hope that helps
John

Last edited by AlleyTrotter; 02-25-2016 at 08:21 PM.
 
Old 02-26-2016, 09:22 PM   #6
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
Quote:
Originally Posted by slacker1337 View Post
Try setting the command to
Code:
qemu-system-x86_64
You will also see a drastic increase in performance by adding -enable-kvm
Wow. That fixed it. That's all I needed to do to fix it (I actually had all the parameters right). Thank you.

p.s. and yes, the -enable-kvm makes a noticable difference. Like at least a 5x speed increase.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Proper syntax for ACLOCAL_FLAGS variable Kenny_Strawn Programming 7 10-15-2017 01:24 PM
Trouble with qemu command syntax 2handband Linux - Virtualization and Cloud 4 11-24-2010 06:18 AM
Proper Syntax for If...Then..Else statements with a script kaplan71 Linux - Software 2 11-11-2008 12:44 PM
proper syntax for 'more' command bourne Linux - General 6 09-14-2007 09:26 AM
Tar for backups ? Proper syntax ? Reefcrazed Linux - Newbie 8 02-21-2006 05:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration