Botspot / pi-apps

Raspberry Pi App Store for Open Source Projects
GNU General Public License v3.0
1.95k stars 204 forks source link

QEMU #276

Closed Itai-Nelken closed 3 years ago

Itai-Nelken commented 3 years ago

QEMU.zip the repository's QEMU is several releases old, and is a pretty bad experience compared to this version (5.2.50). it takes over an hour to compile QEMU, and I still haven't found all build dependencies because I'm on TwisterOS that has a lot of preinstalled things. packaged using my QEMU2DEB script.

Botspot commented 3 years ago

Is this arm QEMU or x86 QEMU?

Itai-Nelken commented 3 years ago

Is this arm QEMU or x86 QEMU?

it's all systems. I am using it to run MacOS 9.2.1 (PowerPC) and Windows98. when packaging I also inluded all systems, but haven't tested all of them yet. so far I tested qemu-system-ppc and qemu-system-x86_64 and both work flawlesly. in the screenshot bellow I am using the installation from the same deb: image

Botspot commented 3 years ago

Will this interfere with box86's binfmt stuff?

Itai-Nelken commented 3 years ago

Will this interfere with box86's binfmt stuff?

so far I don't have any problem with box86, it still gets called to run any x86 binary.

Pythonic456 commented 3 years ago

I am using it to run MacOS 9.2.1 (PowerPC) and Windows98.

I have tried to run Ubuntu 10.04 with QEMU which I compiled myself, and the performace makes it unusable. It's only using one core. How did you get it to run fast for you?

Itai-Nelken commented 3 years ago

I have tried to run Ubuntu 10.04 with QEMU which I compiled myself, and the performace makes it unusable. It's only using one core. How did you get it to run fast for you?

I have no idea, I just compiled it like this:

git clone https://git.qemu.org/git/qemu.git
cd qemu
git submodule init
git submodule update --recursive
./configure --enable-sdl  --enable-opengl --enable-virglrenderer --enable-system --enable-modules --audio-drv-list=pa --enable-kvm
make -j4 #takes over an hour
sudo make install

and followed the instructions here to install MacOS 9.2. Windows 98 is still perfectly usable, but a bit slow. I also tried MacOS X 10.0 Cheetah, and its so slow that I only booted it up twice.

I think all modern OS's will be to slow to be usable unless they are really light (maybe RPiOS).

Pythonic456 commented 3 years ago

--enable-kvm

Pretty sure I didn't have that, I will try to rebuild or use yours.

Itai-Nelken commented 3 years ago

QEMU.zip added install-64 (I just compiled and packaged the 64bit deb).

Itai-Nelken commented 3 years ago

Pretty sure I didn't have that, I will try to rebuild or use yours.

I think KVM is to let QEMU work as a VM and not a emulator so you can use the same hardware as the host system and I don't know if it'll work on the pi but even GPU passthrough. that means you can only use it with OS's that are the same architecture as the host.

Itai-Nelken commented 3 years ago

@Botspot can it be added? here is the newest zip: QEMU.zip (same zip as here: https://github.com/Botspot/pi-apps/issues/276#issuecomment-767755250)

Botspot commented 3 years ago

@Itai-Nelken

Installing QEMU with install-32 script
--2021-01-26 20:45:33--  https://archive.org/download/macos_921_qemu_rpi/qemu_5.2_armhf.deb
Resolving archive.org (archive.org)... 207.241.224.2
Connecting to archive.org (archive.org)|207.241.224.2|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://ia801405.us.archive.org/26/items/macos_921_qemu_rpi/qemu_5.2_armhf.deb [following]
--2021-01-26 20:45:33--  https://ia801405.us.archive.org/26/items/macos_921_qemu_rpi/qemu_5.2_armhf.deb
Resolving ia801405.us.archive.org (ia801405.us.archive.org)... 207.241.228.145
Connecting to ia801405.us.archive.org (ia801405.us.archive.org)|207.241.228.145|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-01-26 20:45:34 ERROR 404: Not Found.

Failed to Download QEMU!

Failed to install QEMU with install-32 script!

Close this window to exit.
Itai-Nelken commented 3 years ago

QEMU.zip @Botspot I forgot to update the link, should work now.

Botspot commented 3 years ago

QEMU.zip @Botspot I forgot to update the link, should work now.

Nope, still didn't work. Same 404 error.

Itai-Nelken commented 3 years ago

QEMU.zip here, this is the link being used for 32bit: https://archive.org/download/macos_921_qemu_rpi/qemu-5.2.50-armhf.deb

Botspot commented 3 years ago

Better, I think?

Installing QEMU with install-32 script
--2021-01-27 10:54:40--  https://archive.org/download/macos_921_qemu_rpi/qemu-5.2.50-armhf.deb
Resolving archive.org (archive.org)... 207.241.224.2
Connecting to archive.org (archive.org)|207.241.224.2|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://ia801405.us.archive.org/26/items/macos_921_qemu_rpi/qemu-5.2.50-armhf.deb [following]
--2021-01-27 10:54:41--  https://ia801405.us.archive.org/26/items/macos_921_qemu_rpi/qemu-5.2.50-armhf.deb
Resolving ia801405.us.archive.org (ia801405.us.archive.org)... 207.241.228.145
Connecting to ia801405.us.archive.org (ia801405.us.archive.org)|207.241.228.145|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 132913916 (127M) [application/x-debian-package]
Saving to: ‘qemu-5.2.50-armhf.deb’

qemu-5.2.50-armhf.d 100%[===================>] 126.76M   672KB/s    in 2m 34s  

2021-01-27 10:57:15 (845 KB/s) - ‘qemu-5.2.50-armhf.deb’ saved [132913916/132913916]

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'qemu' instead of './qemu-5.2.50-armhf.deb'
The following NEW packages will be installed:
  qemu
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/133 MB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 /home/pi/qemu-5.2.50-armhf.deb qemu armhf 5.2.50 [133 MB]
Selecting previously unselected package qemu.
(Reading database ... 267645 files and directories currently installed.)
Preparing to unpack /home/pi/qemu-5.2.50-armhf.deb ...
Unpacking qemu (5.2.50) ...
dpkg: error processing archive /home/pi/qemu-5.2.50-armhf.deb (--unpack):
 trying to overwrite '/usr/share/openbios/openbios-ppc', which is also in package openbios-ppc 1.1.git20181001-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /home/pi/qemu-5.2.50-armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Failed to install QEMU!

Failed to install QEMU with install-32 script!

Close this window to exit.
Itai-Nelken commented 3 years ago

@Botspot I think that happens when you have other QEMU related packages installed, in the case of the output you sent its openbios-ppc 1.1.git20181001-1

did you compile QEMU before?

also apt thinks you're downgrading from 1.3.1 to 5.2.50 (makes no sense), so you have to hold the updates for QEMU.

I'll rewrite the scripts, but I have no idea why sometimes I get that error and sometimes I don't.

Itai-Nelken commented 3 years ago

@Botspot ignore my last comment, its messed up. I found the problem, it's caused by a older version of QEMU and its components that dpkg can't overwrite. the solution: apt purge anything related to qemu (qemu-system-*, openbios-ppc, qemu-utils, and anything else you find), then run sudo apt autoremove and try to install QEMU again using my scripts.

In the control file in the DEB I put all the QEMU parts I could find as conflicting packages, but if you compiled QEMU from source, you have to force dpkg to overwrite the files somehow (sudo make uninstall doesn't work for QEMU when trying to remove the compiled version).

maybe installing the deb like this will work:

sudo apt install -f -y ./qemu-5.2.50-armhf.deb
#maybe will fail here
sudo apt install -f -y
sudo apt autoremove -y
sudo apt install -f -y ./qemu-5.2.50-armhf.deb

or maybe using sudo dpkg -i --force-all package.deb.

what do you think is best?

if someone can help me find all the QEMU packages available from apt (including packages like openbios-ppc) I'll add them to the 'conflicting packages' in the deb's control file.

once all the conflicting packages are found, running sudo apt --fix-broken install qemu-5.2.50-armhf.deb will remove any conflicting packages installed by apt.

another solution is that I write a preinst script for the DEB that will check for all the QEMU files that the DEB installs and remove them if they are present, I think that will be the easiest solution. but it will probably cause errors with apt.

I'm sorry this is so long and hard to read...

Itai-Nelken commented 3 years ago

QEMU.zip ok, so I added all the QEMU packages I found in the RPi repos (http://archive.raspberrypi.org/debian/pool/main/q/qemu/) as conflicting packages in the DEB's control file. I hope it fixes the error @Botspot had. I also updated the install scripts to hold qemu from being updated, otherwise the next time the user would run apt upgrade apt would downgrade the package because it thinks 5.2.50 is older than 1.3.1. the uninstall script onholds it. here is the link to download the armhf deb: https://archive.org/download/macos_921_qemu_rpi/qemu-5.2.50-armhf.deb and the arm64 one: https://archive.org/download/macos_921_qemu_rpi/qemu_5.2.50-1_arm64.deb

Itai-Nelken commented 3 years ago

QEMU.zip updated the link becasue I fixed the apt downgrading problem (without holding the package from updates). (https://unix.stackexchange.com/questions/631805/how-to-hold-package-from-updating-with-postinst-script-in-deb)

Botspot commented 3 years ago

Using your latest zip:

Installing QEMU with install-32 script
--2021-01-31 21:34:16--  https://archive.org/download/macos_921_qemu_rpi/qemu-5.2.50-armhf.deb
Resolving archive.org (archive.org)... 207.241.224.2
Connecting to archive.org (archive.org)|207.241.224.2|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://ia801405.us.archive.org/26/items/macos_921_qemu_rpi/qemu-5.2.50-armhf.deb [following]
--2021-01-31 21:34:16--  https://ia801405.us.archive.org/26/items/macos_921_qemu_rpi/qemu-5.2.50-armhf.deb
Resolving ia801405.us.archive.org (ia801405.us.archive.org)... 207.241.228.145
Connecting to ia801405.us.archive.org (ia801405.us.archive.org)|207.241.228.145|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 132968220 (127M) [application/x-debian-package]
Saving to: ‘qemu-5.2.50-armhf.deb’

qemu-5.2.50-armhf.d 100%[===================>] 126.81M  1.19MB/s    in 2m 53s  

2021-01-31 21:37:09 (750 KB/s) - ‘qemu-5.2.50-armhf.deb’ saved [132968220/132968220]

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'qemu' instead of './qemu-5.2.50-armhf.deb'
The following packages will be REMOVED:
  openbios-ppc openbios-sparc seabios
The following NEW packages will be installed:
  qemu
0 upgraded, 1 newly installed, 3 to remove and 0 not upgraded.
Need to get 0 B/133 MB of archives.
After this operation, 3,543 kB disk space will be freed.
Get:1 /home/pi/qemu-5.2.50-armhf.deb qemu armhf 1:5.2.50 [133 MB]
(Reading database ... 271642 files and directories currently installed.)
Removing openbios-ppc (1.1.git20181001-1) ...
Removing openbios-sparc (1.1.git20181001-1) ...
Removing seabios (1.12.0-1) ...
(Reading database ... 271600 files and directories currently installed.)
Preparing to unpack /home/pi/qemu-5.2.50-armhf.deb ...
Unpacking qemu (1:5.2.50) ...
dpkg: error processing archive /home/pi/qemu-5.2.50-armhf.deb (--unpack):
 trying to overwrite '/usr/share/openhackware/ppc_rom.bin', which is also in package openhackware 0.4.1+git-20140423.c559da7c-4.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /home/pi/qemu-5.2.50-armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Failed to install QEMU!
Itai-Nelken commented 3 years ago

question @Botspot: how did you install QEMU before trying my scripts/deb, probably apt install qemu, right? it will help me create a similar system to yours (in terms of how you installed QEMU) and then be able to find all the conflicting packages myself.

anyway I added openhackware to the control file as a conflicting package and will package and upload the deb later today.

Itai-Nelken commented 3 years ago

ok, I uploaded the new deb, its the same link (https://archive.org/download/macos_921_qemu_rpi/qemu-5.2.50-armhf.deb).

Itai-Nelken commented 3 years ago

I found a few more packages that will probably conflict. edit: just finished packaging and uploading, same link: https://archive.org/download/macos_921_qemu_rpi/qemu-5.2.50-armhf.deb

Botspot commented 3 years ago
dpkg: error processing archive /home/pi/qemu-5.2.50-armhf.deb (--unpack):
 trying to overwrite '/usr/share/ovmf/OVMF.fd', which is also in package ovmf 0~20181115.85588389-3+deb10u2

And this is after I had to purge openhackware manually.

Itai-Nelken commented 3 years ago

weird, maybe I uploaded the wrong deb.

Itai-Nelken commented 3 years ago

@Botspot here is the line of the conflicting packages, apt should uninstall them when installing the deb:

Conflicts:qemu-utils, qemu-system-common, qemu-system-gui, qemu-system-ppc, qemu-block-extra, qemu-guest-agent, qemu-kvm, qemu-system-arm, qemu-system-common, qemu-system-mips, qemu-system-misc, qemu-system-sparc, qemu-system-x86, qemu-system, qemu-user-binfmt, qemu-user-static, qemu-user, qemu, openbios-sparc, openbios-ppc, openbios-sparc, seabios, openhackware, qemu-slof, ovmf 

openhackware and ovmf are there.

Botspot commented 3 years ago

I figured it out. It turns out that every time the script failed, it left behind a qemu-5.2.50-armhf.deb file.

then the next time wget tried to download it again, it would rename the new file to qemu-5.2.50-armhf.deb.1, qemu-5.2.50-armhf.deb.2, etc.

I add a rm command to the script, before downloading, and now qemu installed successfully.

Itai-Nelken commented 3 years ago

I figured it out. It turns out that every time the script failed, it left behind a qemu-5.2.50-armhf.deb file.

then the next time wget tried to download it again, it would rename the new file to qemu-5.2.50-armhf.deb.1, qemu-5.2.50-armhf.deb.2, etc.

I add a rm command to the script, before downloading, and now qemu installed successfully.

yay! I was thinking I have to reasearch debian package control files again.

Itai-Nelken commented 3 years ago

@Botspot can you uninstall qemu (sudo apt purge qemu -y), install openhackware (sudo apt install openhackware -y), and install the deb again? I want to see if the conflicting packages get removed. if they do, the app is ready in my opinion.

Botspot commented 3 years ago

@Botspot can you uninstall qemu (sudo apt purge qemu -y), install openhackware (sudo apt install openhackware -y), and install the deb again? I want to see if the conflicting packages get removed. if they do, the app is ready in my opinion.

dpkg: warning: while removing qemu, directory '/usr/local/share' not empty so not removed
dpkg: warning: while removing qemu, directory '/usr/local/lib' not empty so not removed
dpkg: warning: while removing qemu, directory '/usr/local/bin' not empty so not removed

That message suggests to me that your deb is incorrectly set up.

Itai-Nelken commented 3 years ago
dpkg: warning: while removing qemu, directory '/usr/local/share' not empty so not removed
dpkg: warning: while removing qemu, directory '/usr/local/lib' not empty so not removed
dpkg: warning: while removing qemu, directory '/usr/local/bin' not empty so not removed

That message suggests to me that your deb is incorrectly set up.

My guess is that because there are some files in /usr/local/bin, /usr/local/lib, and /usr/local/share apt wants to delete the whole folder but doesn't do it because it has other files the deb didn't install. I have no idea how to fix it and I don't think its a big deal, I have had this warning with some apt packages.

Itai-Nelken commented 3 years ago

@Botspot according to here the warning are no big deal and can be safely ignored. maybe there is a way to hide warnings from dpkg so not to scare people that something is wrong (like what happened to me when I first saw that warning a few months back).

Botspot commented 3 years ago

I'd be curious how the official QEMU package hides that error.

Itai-Nelken commented 3 years ago

I'd be curious how the official QEMU package hides that error.

I'll download it and try to find out.

Itai-Nelken commented 3 years ago

I didn't find any qemu official debs, but I'll check the arm64 one I created with checkinstall.

Itai-Nelken commented 3 years ago

the checkinstall deb is the same, but puts everything in /usr/local/xxx and has a doc folder.

Itai-Nelken commented 3 years ago

@Botspot can it be added? or is there something you want to add/remove/fix?

Botspot commented 3 years ago

@Botspot can it be added? or is there something you want to add/remove/fix?

I've been thinking about it. While QEMU is not usually something a beginner user would use, I think this QEMU app saves enough time for those it does help, to make it worthwhile to add.

And sorry for the long delay, I've both been sick and been very busy with classes.

Itai-Nelken commented 3 years ago

it's ok, happy you are well again!

Botspot commented 3 years ago

Added with commit f05e436f80df6d2fccdf17855a39164192aebead.

it's ok, happy you are well again!

Still not 100%.

Itai-Nelken commented 3 years ago

hope you get well!