-
Notifications
You must be signed in to change notification settings - Fork 24
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
Show how to move mkosi WorkspaceDirectory to /tmp(fs) #116
base: main
Are you sure you want to change the base?
Conversation
mkosi_tmpl_portable/optional.tmpl
Outdated
# remount,size=newsize after buying a decent amount of RAM), or comment this | ||
# out. | ||
# | ||
# Warning 2: mkosi version v15 and v16 cannot use /tmp/ for this. (cpio |
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.
According to https://repology.org/project/mkosi/versions, only Fedora 39 shipped version 16. Fedora 39 is EOL now.
mkosi_tmpl_portable/optional.tmpl
Outdated
# mkosi-workspace is located on /var/tmp/ by default (why?), which is usually | ||
# persistent and slow storage which wears out. On success, mkosi-workspace is | ||
# deleted at the end of the build so it really does not need to be located on | ||
# persistent storage. So, move it to /tmp which is usually tmpfs. Moving to |
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.
Debian 13 (2025?) will finally move /tmp to tmpfs
https://lists.debian.org/debian-devel/2024/05/msg00456.html?ref=news.itsfoss.com
Maybe Ubuntu will eventually switch too?
https://ubuntu.com/blog/data-driven-analysis-tmp-on-tmpfs
https://askubuntu.com/questions/62928/why-doesnt-tmp-use-tmpfs
mkosi_tmpl_portable/optional.tmpl
Outdated
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.
This configuration option was first added in mkosi v10 commit https://github.com/systemd/mkosi/commits/59d8d913a5f67d9
At the time, mkosi.md
documented it like this: mkosi.workspace/
else $TMPDIR
else /var/tmp
. It relied on tmp_dir()
.
mkosi_tmpl_portable/optional.tmpl
Outdated
@@ -0,0 +1,31 @@ | |||
# mkosi-workspace is located on /var/tmp/ by default (why?), which is usually |
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.
This is a simplifcation. Since v19, mkosi is trying to default to somewhere in /home
in order to use reflinks systemd/mkosi@94c1e78a496713e0
In my experience across multiple versions, tmpfs
is just faster - especially when qbuild
is symlinked to /tmp/qbuild.real
too.
@davejiang found a failure with v24.3, looking into it. |
In case there are instances where mkosi leaves behind a |
So this setting is incompatible with v24 commit systemd/mkosi@f4eba02dd3ca08
Bubblewrap does a lot of weird things with bind mounts and what not. v25 replaced Bubblewrap and works again. I think I found a workaround. Will that workaround be compatible with other, random mkosi versions? Maybe not. Maybe the best is to make this opt-in. Easy enough to just copy this file to a different place. |
So this is what seems to happen. I looked into this just to make sure the workaround does not work by chance/accident.
So the workaround is very simple; simply add one directory level:
I don't want to debug issues like this again so the next force push will make this opt-in. Everyone can use it or not without polluting their |
I've been selfishly enjoying this major optimization for a while; time to share it. mkosi-workspace is located on /var/tmp/ by default, which usually does not run out of RAM but is persistent and slow storage which wears out. On success, mkosi-workspace is deleted at the end of the build so it really does not need to be located on persistent storage. So, show how to move it to /tmp which is usually tmpfs. Also document some of the pitfalls discovered so far. On one of my systems, moving to tmpfs lowers the build time from 4 min to 1 min! If you ever wondered how I could git bisect mkosi faster than reading its release notes: that's how. Signed-off-by: Marc Herbert <[email protected]>
I've been selfishly enjoying this major optimization for a while; time to share it. Very small hence very easy to comment out or even revert if needed.
mkosi-workspace is located on /var/tmp/ by default, which is usually persistent and slow storage which wears out. On success, mkosi-workspace is deleted at the end of the build so it really does not need to be located on persistent storage. So, move it to /tmp which is usually tmpfs.
On one of my systems, moving to tmpfs lowers the build time from 4 min to 1 min! If you ever wondered how I could git bisect mkosi faster than reading its release notes: that's how.