-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating and running the VM via quickemu #26
Conversation
pre-commit.ci run |
You have written the quick emu installer script in python. As we will need propably some more installer scripts, I would prefer to select a uniform programming language for all such scripts. So we should discuss which language we should select. I am personal fine with python (easy and fast script writing). The only downside is that integrating the installer into the winapps executable would be easier if it is also written in rust. |
pre-commit.ci run |
Yeah, this is just a temporary solution to test on several machines with. There's also a nix package available for quickemu, but I don't know how reliable that is dependency-wise. However, if that works, we could just distribute winapps itself over nix, which would be the easiest way to start with (also mentioned that in #23) |
Also, I wanted the quickemu install script to be independant for now since we can always link to it for people who are having trouble with the legacy way of setting up the VM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pub(crate) fn get_data_dir() in the winapps/src/quickemu.rs file seems a bit strange. I think we can just change it to pub fn get_data_dir().
For controlling the vm with quickemu are we aiming for a demon like process? |
Quickemu doesn't need a daemon |
@oskardotglobal Does quickemu shutdown the VM once you quit the application or does it snapshot the state and writes it to disk to avoid rebooting it ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's my first review ever, so if you believe any of my suggestion aren't necessary feel free to let me know, I can also work on them on this draft PR, if you're too busy to apply these changes.
Thanks for your draft work on this, it looks pretty good as a base.
I don't know, it fully boots when you start up the VM but it boots up very quickly so there might be some pausing going on |
I just saw an issue affect quickemu breaking W10 VMs, we might want to watch it out, there is a workaround but no upstream fix yet, I believe : quickemu-project/quickemu#654 |
@AkechiShiro It seems like this issue is only when upgrading quickemu. However it seems like it was one time event and does not affect new installs. |
@oskardotglobal But does the vm start in background without any window? The idea was to run the vm in headless mode, after the vm setup. However to make the vm run in background we may need a demon that does stuff like shutdowns, reboots or startups (on deman or at boot). If we have no demon we would (if I am not wrong) have a floating spice or terminal window. |
I do agree with @LDprg for having tested quickly quickemu a terminal windows or the spice floating windows will be shown, I do not know if quickemu can be launched headless using a specific flag or some special configuration files But that daemon is already libvirtd systemd service no ? |
@AkechiShiro quickemu can be launched in a headless with Therfore I suggested a custom demon, because quickemu not directly uses the libvirt demon (you cant see quickemu in virt manager). It seems like it only uses its interface/libary. Quickemu simply runs as long as the display app or the terminal command (in headless mode). At least that is what I think it is doing based on some testing. |
@LDprg do you have any idea of a daemon library/crate in Rust that we could use, or should I try and search for that ? |
Daemonize seems like a good option. |
It looks a bit abandoned in terms of maintainship @LDprg (last commit to main/master 5 years ago, this doesn't look good to rely on such, unless we plan to maintain a fork ourselves) And I thought that the daemon would be in Rust, not in Python, but I believe we will have a blend of both in the final software, perhaps ? Maybe, we could have some input from @oskardotglobal as well, if he agrees to go with this ? Or if he feels this isn't necessary, why ? |
I would recommend we'd use something like this @LDprg https://pagure.io/python-daemon/commits/main, last commit (6 months ago) But there might be better solution |
@AkechiShiro The libary is for Rust, there is a python libary out there which has the same name and a similar interface. For the daemon I would use some compiled language because of the performance overhead. |
@LDprg you meant thus that we'd use this : https://docs.rs/daemonize/latest/daemonize/ |
yes |
Daemonize looks perfect; from what I understand this daemonizes the current process though, right? I would just suggest daemonizing the winapps-created vm directly via the OS init system (systemd, rc.d, openrc) |
Looking into this again realizing we don't need a daemon; if you run quickemu with |
So turns out quickemu just provides a pidfile, so I've now implemented killing; the question remains if that is the proper way to shut down the vm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's looking pretty good so far, do we need to test this branch on our system before merging ?
Thanks for the amazing work @oskardotglobal
Anything you'd like to mention @LDprg ?
Yeah, It'd be a good idea if at least one of you builds and tests it locally, because on my fedora 37 system XDG_CONFIG_HOME and XDG_DATA_HOME are unset, so I don't know if they work. |
@oskardotglobal is vm creation working on your side ? I tested the branch, it worked alright but there were a few issues :
Not sure why, but I believe, some debugging is needed to get to the root of the issue here, there is something wrong with the save_config/load_config function ?
Future upgrades too :
|
@AkechiShiro Check is not implemented yet, @LDprg is working on that. The panic you're getting means that the config file couldn't be written or serialized which might have to do with file permissions or the ~/.config/winapps folder not being created properly |
@AkechiShiro maybe just remove the config, so it gets recreated. The check command is only partially implemented, so it may not work due to some testing code. |
I removed the config file and starting the VM works, but we need to do some work to automatically do the installation, perhaps ? I've seen also quick warnings on two things :
Tested so far :
|
@LDprg can you re-review this so we can get it merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Just some minor changes.
I began working on this (it isn't complete yet), but wanted to already open a PR to get some feedback and to discuss some stuff (and to check if pre-commit.ci will check this).
At first, I was worried that we would have to daemonize the VM but this isn't needed because quickemu runs the VM in the background. Sadly, there's no easy way to send shell commands, so we're best off creating our own scripts to replace
quickget
and then install some kind of ssh server.After running quickget, you get a folder structure which contains an "unattended" folder used for unattended install, which contains a file "unattended.xml". We can use this to run commands on startup.