Announcement

Collapse
No announcement yet.

qemu-kvm redux

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    qemu-kvm redux

    Last year, IIRC, while running Neon, I played with qemu-kvm and couldn't get it going properly. I got desktops running but they were snail like and lacked a lot. This evening I tried it again, with a little help from a video by Marcel Gagne, whom most of you probably know.

    The first thing I did was
    sudo apt install qemu-kvm
    I then used LXQt User Manager (thanks, Kubical!) to add me to the kvm group.

    I had previously downloaded UbuntuStudio 18.04 and made it a persistent LiveUSB on a 16GB stick.

    To start the virtual ubuntustudio I ran
    sudo qemu-system-x86_64 -enable-kvm -m 4096 -boot d Downloads/ubuntustudio-18.04-dvd-amd64.iso

    The "-enable-kfm" gave kvm acceleration utilising your graphic GPU.
    The "-m 4096" gave the VM a 4,096MB of memory.
    THe "-boot d" told it to boot from "drive d", old windows lingo for the cdrom. (A & B were floppies, C was the HD and D was usually the CDROM).
    Following that was the path to the iso and the name of the iso.

    UbuntuStudio booted up nicely and ran quickly, using the "Try" option. It was very quick. Accelerated.
    Ctrl+Alt allowed you to uncapture the mouse so you could drag the window to increase its size. Then, the mouse moved freely in and out of the distro window.

    Sweet! Now I am going to play with a few distros.

    I had been experimenting with screen recording my Minecraft play using SimpleScreenRecorder and guvcview to capture me with the webcam. A big problem was getting my voice to be part of the video and, secondly, adjusting my voice volume so that it didn't continually peg the meter.
    pactl load-module module-loopback
    allowed my voice to be heard along with the Minecraft music and noises. My voice was so loud in my headset that it would cause feedback studdering. I "sudo alsamixder" and turned off mic boost, jacked mic up to 65 and "Internal" to 51, but your settings could vary. In the playback my voice mixed properly. I decided to not show the small window with my face in it so as not to scare viewers.

    Now that I had made a recording of one session of Minecraft I decided to use Kdenlive to edit it. That's where Marcel Gagne came it. He had a 40 minute drinking party which included a simple example of how to use Kdenlive.
    It also showed him using qemu-kvm to demo Arcolinux. A two-fer!
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    #2
    I switched from VMware to qemu/kvm about 5 years ago, to run my Windows VMs. When it is working correctly, VMware is pretty unbeatable for virtualization. But its module compiler is fragile and brittle, and lags Linux kernel development by years. qemu/kvm had a steep learning curve, at first, but once the setup is mastered, it is solid as granite and totally reliable. It would be a shock if I launched my Windows 10 VM and it didn't start right up -- I don't even think about it anymore.

    Comment


      #3
      Did you install the whole tamale, virt-manager and all? And if so, which virtual HD format do you use? Are you using Btrfs and if so you must have used nocowdata on the directory before you installed your first virtual HD. Or, did you use another Hd formatted with EXT4?

      I was pleasently surprised by how quickly the iso's I tried started up from the CLI, and how quickly they ran with acceleration. The network connection was automatic as well.

      Initially I just installed qemu-kvm and it installed six other dependencies. Running from the CLI doesn't allow for the creation of a virtual HD. So, I installed virt-manager and everything it pulled in, about 50 packages. Then, I got the whole tamale.

      When I ran virt-manager it was like using the VirtualBox GUI. During the setup phase it asked which kind of HD I wanted to create and defaulted to the qcow2. At that point, since I am running Btrfs, I rolled back to the @/@home snapshots I took a few minutes before I began experimenting. I thought about it last night and decided that I could shrink the Brtfs on /dev/sdc HD in half and format the other half as EXT4, and use it as the storage location for the virtual HDs. About 400GB would allow me to play with about half a dozen distros and store changes, additions, etc. Still thinking about it. May do it, or may not.

      A side note: adding qemu-kvm and virt-manager and all its stuff didn't change how my Linux kernel 4.18 boots or the systemd-analyze load times.
      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
      – John F. Kennedy, February 26, 1962.

      Comment


        #4
        I installed everything, including virt-manager. At the time, the online guidance wasn't what one would like -- kind of scattered, incomplete, and in some cases obsolete. So, figuring out all the needed packages was part of the challenge, and I had never done bridge networking so there was some more learning.

        Then there was the issue of Windows hard drive and video drivers, which led me to the virtio ISO files at Redhat. Also the issue of "IDE is way slow, but SCSI is way fast" so there was a little kubuki dance to convert a virtual IDE drive to a virtual SCSI drive. But eventually I got a very fast running Win 8. That was my "experimental" installation. When I was confident I knew what I was doing, I bought a Win 10 license and installed that, and then my required Windows software on it, and it was all good.

        Having a large SSD, I chose to install the Win 10 VM on an ext4 partition on the SSD. I do have a large (2 TB) dual-drive BTRFS filesystem, with default RAID configuration and compression, and I did not want to screw around dividing it up so I could set part of it to "nocow" for the VM. But, I do regularly back up the VM to the BTRFS filesystem, along with other backups.

        The Win 10 VM, launched from virt-manager, is pretty much as fast as Win 10 on a cheap laptop. You can use virt-manager to connect a USB stick that is inserted, but not mounted, in the Linux host. The bridged network allows internet access to the VM. I see there are techniques to set up host-guest filesystem sharing, but it looks rather complicated and it's not important to my use case, so I haven't done that.

        EDIT: My virtual hdd is qcow2 format.
        Last edited by dibl; Nov 08, 2018, 02:55 AM. Reason: Answer the rest of the question.

        Comment


          #5
          Nice info, thanks!
          I will probably go with virt-manager to create a persistant storage.
          "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
          – John F. Kennedy, February 26, 1962.

          Comment


            #6
            Well, I resized my sdc1 Btrfs partiton down 150GB and then ran fdisk and resized its physical partition down 100GB. Then I formated the raw 100GB partiton that was created as EXT4. I resized the Btrfs partition to max value, filling up all the remaining partition as part of the Btrfs subvolume. I ran partprobe so that the kernel would pick up the new partition.

            I edited fstab to add a line to boot sdc2 (using its UUID) as /vmhd :
            UUID=987905f1-3b42-48bb-afd5-fa2e1c30b9ab /vmhd ext4 defaults 0 2
            I set the group : owner of /vmhd to jerry:jerry.

            I downloaded and installed virt-manager and about every other virt tool in the repository. I edited the virt groups to make sure I was a member and I edited my user entry to make me a member of all virt groups.

            I logged out and logged back in.

            I fired up virt-manager, which found libvertd without a problem, and went to the Connections settings and added /vmhd as a location to store images. Then I created a VM using the latest KDE Neon User Edition 18.04 ISO, pointing to /vmhd/images as the destination for its 30GB qcow2 HD. I installed Neon onto that VMHD and when it was done I rebooted the VM. Neon came up beautifully. I got a notice about 137 updates so I fired up the Konsole and put apt to work. About 10-15 minutes later I had a new, highly polished Neon installation. (I was reminded of how slow a spinning disk is compared to an SSD drive)

            qemu-kvm is awesome! Bye, bye Ellison. I ain't using your VirtualBox any more!
            Last edited by GreyGeek; Nov 08, 2018, 12:03 PM.
            "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
            – John F. Kennedy, February 26, 1962.

            Comment


              #7
              Wow -- Congratulations -- you definitely made that look easy!

              Comment


                #8
                Originally posted by dibl View Post
                Wow -- Congratulations -- you definitely made that look easy!
                Oshunluver made it easy, I just followed his tutorial on shrinking Btrfs subvolumes and the rest.
                "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                – John F. Kennedy, February 26, 1962.

                Comment

                Working...
                X