View previous topic :: View next topic |
Author |
Message |
xboom31 n00b

Joined: 27 Aug 2024 Posts: 1
|
Posted: Thu Mar 20, 2025 10:54 pm Post subject: Thoughts of building an emerge resume mid package |
|
|
Hello, Gentoo is the best OS ever but comping for days when you decide to do an emptytree is not really fun.
I know emerge --resume is good enough for most people but I really dream of having the option to resume compilation mid-package for things like qtwebengine and so on.
I was thinking what if I could save the state of the emerge and somehow resume it later? Maybe modify portage that when you kill it it prompts you with a question if you want to save it's state?
Would that be something you guys might me interested in or is just something no one cares about and they just use ccache and/or distcc?
I would really like to develop such a thing. How would you guys do it and why isn't it there already? Maybe because of some architectural limitations or nobody bothered? What are your thoughts?
Thanks for your time! |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 55416 Location: 56N 3W
|
Posted: Thu Mar 20, 2025 11:17 pm Post subject: |
|
|
xboom31,
Welcome to Gentoo.
starts from the beginning of the package (or packages) that were interrupted.
The ebuild command sort of lets you ho what you want as you can run the phase functions individually.
Try Code: | ebuild /full/path/to/<package>.ebuild prepare |
Follow that with Code: | ebuild /full/path/to/<package>.ebuild compile |
Nothing is installed yet.
Its intended for debugging. See then play but not with anything you can't afford to break. :) _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
sublogic Guru


Joined: 21 Mar 2022 Posts: 349 Location: Pennsylvania, USA
|
Posted: Fri Mar 21, 2025 12:25 am Post subject: Re: Thoughts of building an emerge resume mid package |
|
|
xboom31 wrote: | I know emerge --resume is good enough for most people but I really dream of having the option to resume compilation mid-package for things like qtwebengine and so on.
I was thinking what if I could save the state of the emerge and somehow resume it later? Maybe modify portage that when you kill it it prompts you with a question if you want to save it's state? |
Outline of a possible solution: if you send a STOP signal to a big, long-running process, it ... stops (but does not crash!) and gradually pages out to swap as other process use up memory. Later when you send a CONT signal, the stopped process faults back in and picks up where it left off.
Now, an emerge is not just one big process. It spawns multiple worker and you have to catch enough of them. Perhaps this ? Code: | # pkill -STOP ebuild | or Code: | # pkill -STOP make; pkill -STOP ninja | depending on the build system running at the time. Or maybe there is a way to pick them up by session ID or cgroup, I don't know. Can someone familiar with portage internals can suggest a better way ? You don't have to get them all, if you stop enough of the build system the running compilations will finish and no new ones will start. The work in progress will stay in /var/tmp/portage/ until you wake the thing up with Code: | # pkill -CONT ebuild # or whatever else you used |
DISCLAIMER: I never tried this. Let us know if it breaks anything ... |
|
Back to top |
|
 |
Hu Administrator

Joined: 06 Mar 2007 Posts: 23635
|
Posted: Fri Mar 21, 2025 12:56 am Post subject: |
|
|
We get questions like this periodically, and the answer is always that you cannot assume that every package has a build system that can reliably recover from being killed in the middle. That then leads to the suggestions here, that you should pause the build, but not terminate it, so that when you unpause, it can resume exactly where it left off.
I would be wary of using SIGSTOP for this. If I wanted to suspend something, I would do it using the cgroup freezing mechanism. A bit of care before starting Portage can ensure that emerge and all its children (and nothing else) are in the same cgroup, making it easy to freeze. |
|
Back to top |
|
 |
|