caligula icon indicating copy to clipboard operation
caligula copied to clipboard

Silent failure when passing a directory as input

Open 9999years opened this issue 2 months ago • 1 comments

Describe the bug

When I run caligula burn ..., it exits with code 101 and no diagnostic information. Also the logs are very hard to find.

To Reproduce

Run something like this:

sudo caligula burn --force --compression none --hash skip -o /dev/sda /nix/store/qzmyanh0r4nax7ipyl2n54liy10cck8y-nixos-25.11.20251112.c5ae371-x86_64-linux.iso

Running outside of sudo or using the interactive dialogues to select options has the same failure, right when the burning should start.

Expected behavior

The ISO is burned successfully.

Log files

# cat caligula-43428-1763410312286/log/*
2025-11-17T20:11:52.286854Z  INFO caligula::tty: attempting to store terminal state before program started
2025-11-17T20:11:52.286871Z DEBUG caligula::ui::main: Starting primary process
2025-11-17T20:11:52.287015Z DEBUG do_setup_wizard:confirm_write: caligula::ui::simple_ui::ask_outfile: Skipping confirm because of --force
2025-11-17T20:11:52.287019Z DEBUG caligula::ui::herder::socket: Creating socket socket_name="/tmp/caligula-43428-1763410312286/caligula.sock"
2025-11-17T20:11:52.287045Z DEBUG try_start_burn:start_writer: caligula::ui::herder::herder: Directly spawning child process with command: Command { envs: [("__CALIGULA_RUN_MODE", "writer")], proc: "/nix/store/8a5v44kqk5d72436q6x6fc682lp42wmf-caligula-0.4.10/bin/caligula", args: ["/tmp/caligula-43428-1763410312286/log/writer-0.log", "/tmp/caligula-43428-1763410312286/caligula.sock", "{\"dest\":\"/dev/sda\",\"src\":\"/nix/store/qzmyanh0r4nax7ipyl2n54liy10cck8y-nixos-25.11.20251112.c5ae371-x86_64-linux.iso\",\"verify\":true,\"compression\":\"Identity\",\"target_type\":\"Disk\",\"block_size\":512}"] }
2025-11-17T20:11:52.287140Z DEBUG try_start_burn:start_writer: caligula::ui::herder::herder: Waiting for pipe to be opened...
2025-11-17T20:11:52.287697Z DEBUG try_start_burn:start_writer: caligula::ui::herder::herder: Read raw result from child first_msg=InitSuccess(InitialInfo { input_file_bytes: 9223372036854775807 })
2025-11-17T20:11:52.287701Z DEBUG caligula::ui::start: Opening TUI
2025-11-17T20:11:52.287703Z DEBUG caligula::ui::start: Using fancy interactive TUI
2025-11-17T20:11:52.288202Z  INFO show:on_event:on_status: caligula::ui::writer_tracking: Received error notification
2025-11-17T20:11:52.288472Z ERROR show: caligula::logging: panicked at /build/caligula-0.4.10-vendor/ratatui-0.26.3/src/widgets/gauge.rs:101:9:
Ratio should be between 0 and 1 inclusively.
2025-11-17T20:11:52.288554Z  INFO caligula::tty: restoring terminal state to what it was before program started
2025-11-17T20:11:52.287553Z  INFO caligula::childproc_common: We are in child process mode socket_path="/tmp/caligula-43428-1763410312286/caligula.sock" args=WriterProcessConfig { dest: "/dev/sda", src: "/nix/store/qzmyanh0r4nax7ipyl2n54liy10cck8y-nixos-25.11.20251112.c5ae371-x86_64-linux.iso", verify: true, compression: Identity, target_type: Disk, block_size: Some(512) }
2025-11-17T20:11:52.287576Z  INFO caligula::writer_process: Opening socket /tmp/caligula-43428-1763410312286/caligula.sock
2025-11-17T20:11:52.287586Z  INFO caligula::writer_process: Opening file /nix/store/qzmyanh0r4nax7ipyl2n54liy10cck8y-nixos-25.11.20251112.c5ae371-x86_64-linux.iso
2025-11-17T20:11:52.287590Z  INFO caligula::writer_process: Got input file size size=9223372036854775807
2025-11-17T20:11:52.287592Z  INFO caligula::writer_process: Opening /dev/sda for writing
2025-11-17T20:11:52.288180Z  INFO caligula::writer_process: Completed final_msg=Error(UnknownChildProcError("Is a directory (os error 21)"))

OS/Environment

  • Terminal emulator: WezTerm over SSH
  • OS: Linux
  • Version: caligula 0.4.10
  • Distribution channel: Nixpkgs nixos-unstable

Additional context

  • Log paths aren't printed anywhere, so you have to use strace or read the source code to find them.
  • Unclear what final_msg=Error(UnknownChildProcError("Is a directory (os error 21)")) means; something like the fs_err crate might help here.
  • There's no way to manually select between the fancy and non-fancy UIs.

9999years avatar Nov 17 '25 20:11 9999years

So apparently when you build the config.system.build.isoImage attribute on a NixOS configuration, Nix builds a store path that ends with .iso but is a directory; the actual path I needed to burn was /nix/store/qzmyanh0r4nax7ipyl2n54liy10cck8y-nixos-25.11.20251112.c5ae371-x86_64-linux.iso/iso/nixos-25.11.20251112.c5ae371-x86_64-linux.iso.

Once I got the actual path, the burn worked fine.

New issues: "is a directory" error message hidden instead of being displayed to the user, caligula didn't detect that the input ISO wasn't actually an ISO (can we use file or something for this?).

9999years avatar Nov 17 '25 20:11 9999years