Closed iam-TJ closed 9 months ago
@iam-TJ For technical reasons the workspace directory simply cannot be located inside the source directory that we're running from. Instead of bind mounting everything inside the current working directory, why not simply specify the directory you're mounting as the workspace directory?
why not simply specify the directory you're mounting as the workspace directory? Would that be sufficient to enable CoW if it points directly to
`/var/lib/machines/
?
Update: answering myself - the first part at least seems to:
...
Create subvolume '/var/lib/machines/mkosi-workspacehvpt4ebs/root'
...
Update 2:
...
‣ /home/tj/iam/mkosi/systemd-builder/mkosi.output/debian-testing-amd64_0.8 size is 419.4M.
‣ Increasing last component of version by one, bumping '0.8' → '0.9'.
...
$ sudo btrfs subvol list /var/lib/machines
ID 316 gen 2041 top level 5 path lineage-builder
ID 317 gen 698 top level 316 path lineage-builder/home
ID 318 gen 698 top level 316 path lineage-builder/srv
ID 319 gen 698 top level 316 path lineage-builder/var
ID 320 gen 698 top level 319 path lineage-builder/var/tmp
ID 321 gen 698 top level 319 path lineage-builder/var/lib/machines
ID 479 gen 2442 top level 5 path .mkosi.cache
ID 544 gen 2678 top level 5 path debian-bookworm-amd64-0.6
ID 546 gen 2759 top level 5 path debian-testing-amd64_0.8
Latest build here was 0.8 so yes, that does work - thank-you.
But the image is not usable by systemd-machined
due to the old bug about hyphens in machine names ( I also notice lib
and cache
have been left behind!):
$ machinectl list-images
NAME TYPE RO USAGE CREATED MODIFIED
cache directory no Sat 2024-02-10 13:36:12 GMT -
debian-bookworm-amd64 subvolume no Sun 2023-07-23 08:29:58 BST -
debian-bookworm-amd64-0.6 subvolume no Sun 2023-07-23 08:29:58 BST -
debian-bookworm-amd64_0.7 directory no Sat 2024-02-10 13:59:29 GMT -
debian-testing-amd64_0.8 subvolume no Sat 2024-02-10 15:17:42 GMT -
lib directory no Sat 2024-02-10 13:36:12 GMT -
lineage-builder subvolume no Sat 2022-10-22 12:36:44 BST -
linux-builder subvolume no Thu 2021-08-12 01:30:41 BST -
8 images listed.
$ machinectl start debian-testing-amd64_0.8
Invalid machine name debian-testing-amd64_0.8.
to deal with the lib
and cache
issue I changed to:
WorkspaceDirectory=/var/lib/machines/mkosi.workspace
and this seems to work with one exception; if mkosi
creates that directory it does not also remove it afterwards, so machinectl list-images
then lists it:
$ machinectl list-images
...
mkosi.workspace directory no Sat 2024-02-10 16:10:05 GMT -
The original issue is fixed so I'm closing this, please open new issues for any other problems.
I seem to be playing catch-up once more! This warning message is confusing. For at least 15 minutes I understood it to mean the workspace directory cannot be found in the current working directory but as it plainly is there I was busy reporting a bug!
Then, on re-reading the source in
mkosi/__init__.py::check_workspace_directory()
I realised that yet again the semantics of directory layouts have changed without explanation and that the use of./mkosi.workspace
has been removed.So, there are two things here:
WorkspaceDirectory=
to take advantage of BTRFS Copy-on-Write?I have a wrapper script around
mkosi
to configure the build environment forsystemd-nspawn
containers to use the BTRFS at/var/lib/machines/
. As part of that it bind-mounts that BTRFS somkosi
can use Copy-on-Write.In respect of (2) my wrapper script aims for portability so it can be deployed in any source tree on any host to build that source using
mkosi
and for that reason needs all directories to be relative to the source tree, and then does bind mounts as commanded.This is what the wrapper reports just prior to executing
mkosi
(using python debugging andmkosi
in its source-code repository):And the captured log reports:
The config fragment for
Output
: