Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Qemu console resolution and ssh access to guest
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Tractor Girl
Apprentice
Apprentice


Joined: 16 May 2013
Posts: 159

PostPosted: Sun Mar 23, 2014 2:45 pm    Post subject: Qemu console resolution and ssh access to guest Reply with quote

Is there a way to change the resolution of guest's system console (tty) inside qemu?
I know I can change guest's X resolution using /etc/X11/xorg.conf, but what if I want to run just X-less guest with decent resolution.


Last edited by Tractor Girl on Thu Mar 27, 2014 2:31 pm; edited 1 time in total
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 488
Location: Gainesville, FL, USA

PostPosted: Tue Mar 25, 2014 1:14 am    Post subject: Reply with quote

I should try it out to be sure, but I'm betting that to get a bigger window of a guest's framebuffer console, you'd enter on the kernel's command line whatever the size parameters are for the virtualized hardware. Of course, before you can even get this far, you have to have enabled the appropriate framebuffer support in the kernel and pass in the appropriate command-line option to qemu.

This would be in either the bootloader or via the -append switch to QEMU (if you start QEMU using the -kernel parameter). For the default Cirrus card, that would be something like this in grub
Code:
kernel /boot/kernel-3.10.0 root=/dev/sda1 mode:1024x768
or at the qemu command like
Code:
-append "root=/dev/sda1 mode:1024x768"

(Again I hadn't tried this to be sure, either with real or with emulated Cirrus hardware. The Cirrus framebuffer documentation in the kernel sources leads me to think it's not "video=mode:1024x768", though the video= part seems perfectly plausible.)

If you're using one of the other alternatives (std, vmware, or qxl), you'd need to do a kernel setup for a VESA-compatible controller or some more specialized driver if you can find one.


Generally, though, I prefer to set it up so that I can ssh into a guest and be able to resize the terminal window to whatever I'd like. Doing that would save you from having to add framebuffer support to your guest kernel. So--no X, no framebuffer, and no delays from having to emulate a video controller.
Back to top
View user's profile Send private message
Tractor Girl
Apprentice
Apprentice


Joined: 16 May 2013
Posts: 159

PostPosted: Thu Mar 27, 2014 2:16 am    Post subject: Reply with quote

Great!
Thank You :D
Back to top
View user's profile Send private message
vaxbrat
l33t
l33t


Joined: 05 Oct 2005
Posts: 731
Location: DC Burbs

PostPosted: Thu Mar 27, 2014 5:28 am    Post subject: grub2 might have it in /etc/default/grub Reply with quote

If you are using grub2 for the boot loader and haven't forced it into text or vga console by futzing with the other defaults there's a resolution setting you can uncomment and set in /etc/default/grub

Code:
#GRUB_GFXMODE=640x480


That will take the next time you do a grub2-mkconfig. Some googling suggests that this may be risky with nvidia framebuffers and the nvidia-driver. I'm also not so sure about grub2 maybe being hoggish with the console if you want to do some sort of interactive thing with an initramfs init script.
Back to top
View user's profile Send private message
Tractor Girl
Apprentice
Apprentice


Joined: 16 May 2013
Posts: 159

PostPosted: Thu Mar 27, 2014 2:26 pm    Post subject: Reply with quote

Code:
GRUB_GFXMODE=1024x768

When I set this, grub spash screen is in desired resolution but next, when system is actually booting, it's switches back to the old resolution :(

How should I start qemu to be able to ssh into guest system?
Man says that -redir option is deprecated, and it doesn't seem to work for me. Also should I run qemu with -nographic or -curses for ssh-only access?

=================================================================
EDIT:
ok I managed to connect to guest system like this:
Code:
qemu-kvm -m 1024 -hda guest.img -nographic -redir tcp:33333::22

Code:
ssh -p 33333 guest_user@localhost


Still man says:
Quote:
Note: Legacy stand-alone options (...) -redir are still processed and
applied to -net user. Mixing them with the new configuration syntax gives undefined
results. Their use for new applications is discouraged as they will be removed from future
versions

How should this "new" syntax looks like?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum