Commit graph

11 commits

Author SHA1 Message Date
illustris 6a20c13258
nixos/proxmox-image: fix qemu build failure 2023-05-25 16:25:43 +05:30
Mark Ruvald Pedersen 66fb2f539a nixos/proxmox-image: Disable O_DIRECT to fix assert
Context summary:
'vma create' can't otherwise write to tmpfs such as /dev/shm.
This is important when used from non-nixos machines which may
have /build as tmpfs.

VMA is Proxmox's virtual machine image format that wraps QEMU images,
augmenting these with proxmox-specific configuration file.
proxmox-image.nix uses the VMA tool to create vma image files.
The VMA tool exists as a patchset ontop of QEMU.

VMA writes its output with open() and O_DIRECT flag.
O_DIRECT does not work on Linux tmpfs [1]. Thus:
$ vma create ~/output.vma ...  # works, assuming home isn't tmpfs.
$ vma create /dev/shm/output.vma ...  # fails since /dev/shm is tmpfs
Failure results in assert(*errp == NULL).

O_DIRECT is a cache performance hint.
But it currently blocks our usage of nixos-generate -f proxmox from
Non-NixOS hosts and Docker.

The patch here simply removes O_DIRECT:
vma-writer.c later performs memalign due to O_DIRECT, but this is
safe to do with or without O_DIRECT.
Ideally, this should be fixed in upstream Proxmox: Perhaps by falling
back to open without O_DIRECT.

Another attempt to fix this SIGABRT is [2], which writes the vma file
directory to $out/ folder -- however that may still be tmpfs mounted
which it is in our case.

[1] https://lore.kernel.org/lkml/45A29EC2.8020502@tmr.com/t/
[2] https://github.com/NixOS/nixpkgs/pull/224282
2023-05-08 12:33:41 +02:00
Alan Strohm 121fddc901 nixos/proxmox-image: don't assume virtio0 is using local-lvm storage 2023-03-31 18:42:01 -07:00
figsoda 6bb0dbf91f nixos: fix typos 2022-12-17 19:31:14 -05:00
Oto Petřík 4729d5d7f6 nixos/proxmox-image: allow building UEFI images
Allow building other than Legacy-BIOS-only Proxmox images.
Default is unchanged.

To build UEFI proxmox image use:
  proxmox.qemuConf.bios = "ovmf";
(default is "seabios")

To build image bootable using both "seabios" and "ovmf" use:
  partitionTableType = "hybrid";
BIOS can be switched in Proxmox between "seabios" and "ovmf" and VM still boots.
(GRUB2-only, systemd-boot does not boot under "seabios")

To build systemd-boot UEFI image:
  proxmox.qemuConf.bios = "ovmf";
  boot.loader.systemd-boot.enable = true;
2022-11-09 03:19:42 +01:00
illustris e7ec55a72d
nixos/proxmox-image: fix broken build, reduce build time 2022-09-08 08:26:02 +05:30
illustris 9cf89797e6 nixos/proxmox-image: add hydra-build-products definition 2022-08-22 14:57:57 -04:00
illustris 265e6a668e nixos/proxmox-image: qemu 6.2.0 -> 7.0.0 and fix failing build 2022-08-22 14:57:57 -04:00
pennae 6039648c50 nixos/*: automatically convert option docs 2022-08-19 22:40:58 +02:00
illustris f60f165501 nixos/proxmox-image: use qemu 6.2 for building VMA 2022-07-13 10:44:41 +02:00
illustris 8d197bffd8
nixos/proxmox-image: init (#144013)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2021-11-07 16:02:54 +01:00