Skip to content

mktemp not found when running boot.loader.grub.extraInstallCommands in nixos-rebuild #2

@00Asgaroth00

Description

@00Asgaroth00

Hi,

First of all, thank you for this script!!

I'm (very) new to nixos and used your script to build zfs on my boot disk, installed nixos (using flake) and then rebooted, all good, everything comes up. However, if i try to update my configuration, the switch fails with the following messages:

[nix-shell:~/git_repos/nixos-config]$ sudo nixos-rebuild switch --flake .#$(hostname -s)
building the system configuration...
updating GRUB 2 menu...
/nix/store/dd8bfvhsxfjnb14r62ans5aprjvsk5my-install-grub.sh: line 5: mktemp: command not found
warning: error(s) occurred while switching to the new configuration

mktemp appears to be installed on the system (within the nix-shell):

[nix-shell:~/git_repos/nixos-config]$ which mktemp
/nix/store/bblyj5b3ii8n6v4ra0nb37cmi3lf8rz9-coreutils-9.3/bin/mktemp

as the super user on the system

[root@thanos:~]# command -v mktemp
/run/current-system/sw/bin/mktemp

The content of the install-grub.sh script is as follows:

[nix-shell:~/git_repos/nixos-config]$ cat /nix/store/dd8bfvhsxfjnb14r62ans5aprjvsk5my-install-grub.sh 
#!/nix/store/q1c2flcykgr4wwg5a6h450hxbk4ch589-bash-5.2-p15/bin/bash
set -e

/nix/store/lnaxkqj8hg37q9mb4cv5l8zgb919baw2-perl-5.38.0-env/bin/perl /nix/store/75qbm0iq2qdc5kkijmyymf3mzswjivrc-install-grub.pl /nix/store/9g2vb0ppkx6npbihl3dqf6qcy4vzxb6j-grub-config.xml $@
ESP_MIRROR=$(mktemp -d)
cp -r /boot/efi/EFI $ESP_MIRROR
for i in /boot/efis/*; do
  cp -r $ESP_MIRROR/EFI $i
done
rm -rf $ESP_MIRROR

The modifications I made to your script when installing the system can be seen HERE, the changes I made were:

[1] DISK variable
[2] ROOTPW variable
[3] Forced creation of boot pool (added -f on line 118)
[4] Forced creation of root pool (added -f on line 135)

Any thoughts on this, have you encountered this issue when using the script?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions