How can I change the UUID of my nixos OS partition, and update the bootloader?












1














So essentially I've got an exact clone of my partition (I've changed the UUID though), and I'd now like to change over the bootloader to load the new partition.



What I tried:



I naively (while booted / running on the original partition) tried to modify the hardware-configuration.nix (on the original partition) with the new UUID and then tried to:




  1. sudo nixos-rebuild switch

  2. sudo nixos-rebuild boot


Both which fails** at the point of mounting the drives (I think).



updating GRUB 2 menu...
lsblk: /dev/mapper/no*[0-9]: not a block device
lsblk: /dev/mapper/raid*[0-9]: not a block device
lsblk: /dev/mapper/disks*[0-9]: not a block device
Found Arch Linux on /dev/sdb3


Also, I'd assume I'd possibly need to mount this new partition somewhere (unless, this isn't required to actually boot into it (after a reboot)?).



** Actually although it appears to 'fail', when I reboot, and select the usual nixos grub entry, I see the following (the UUID mentioned is the UUID that does exist - and it's the new partition):



enter image description here





Worst case scenario, it seems I'd be able to use a nixos live USB to mount the new partition to /mnt and then just follow the usual nixos-install (which has worked in the past - with only the /etc/nixos directory present though)?










share|improve this question





























    1














    So essentially I've got an exact clone of my partition (I've changed the UUID though), and I'd now like to change over the bootloader to load the new partition.



    What I tried:



    I naively (while booted / running on the original partition) tried to modify the hardware-configuration.nix (on the original partition) with the new UUID and then tried to:




    1. sudo nixos-rebuild switch

    2. sudo nixos-rebuild boot


    Both which fails** at the point of mounting the drives (I think).



    updating GRUB 2 menu...
    lsblk: /dev/mapper/no*[0-9]: not a block device
    lsblk: /dev/mapper/raid*[0-9]: not a block device
    lsblk: /dev/mapper/disks*[0-9]: not a block device
    Found Arch Linux on /dev/sdb3


    Also, I'd assume I'd possibly need to mount this new partition somewhere (unless, this isn't required to actually boot into it (after a reboot)?).



    ** Actually although it appears to 'fail', when I reboot, and select the usual nixos grub entry, I see the following (the UUID mentioned is the UUID that does exist - and it's the new partition):



    enter image description here





    Worst case scenario, it seems I'd be able to use a nixos live USB to mount the new partition to /mnt and then just follow the usual nixos-install (which has worked in the past - with only the /etc/nixos directory present though)?










    share|improve this question



























      1












      1








      1







      So essentially I've got an exact clone of my partition (I've changed the UUID though), and I'd now like to change over the bootloader to load the new partition.



      What I tried:



      I naively (while booted / running on the original partition) tried to modify the hardware-configuration.nix (on the original partition) with the new UUID and then tried to:




      1. sudo nixos-rebuild switch

      2. sudo nixos-rebuild boot


      Both which fails** at the point of mounting the drives (I think).



      updating GRUB 2 menu...
      lsblk: /dev/mapper/no*[0-9]: not a block device
      lsblk: /dev/mapper/raid*[0-9]: not a block device
      lsblk: /dev/mapper/disks*[0-9]: not a block device
      Found Arch Linux on /dev/sdb3


      Also, I'd assume I'd possibly need to mount this new partition somewhere (unless, this isn't required to actually boot into it (after a reboot)?).



      ** Actually although it appears to 'fail', when I reboot, and select the usual nixos grub entry, I see the following (the UUID mentioned is the UUID that does exist - and it's the new partition):



      enter image description here





      Worst case scenario, it seems I'd be able to use a nixos live USB to mount the new partition to /mnt and then just follow the usual nixos-install (which has worked in the past - with only the /etc/nixos directory present though)?










      share|improve this question















      So essentially I've got an exact clone of my partition (I've changed the UUID though), and I'd now like to change over the bootloader to load the new partition.



      What I tried:



      I naively (while booted / running on the original partition) tried to modify the hardware-configuration.nix (on the original partition) with the new UUID and then tried to:




      1. sudo nixos-rebuild switch

      2. sudo nixos-rebuild boot


      Both which fails** at the point of mounting the drives (I think).



      updating GRUB 2 menu...
      lsblk: /dev/mapper/no*[0-9]: not a block device
      lsblk: /dev/mapper/raid*[0-9]: not a block device
      lsblk: /dev/mapper/disks*[0-9]: not a block device
      Found Arch Linux on /dev/sdb3


      Also, I'd assume I'd possibly need to mount this new partition somewhere (unless, this isn't required to actually boot into it (after a reboot)?).



      ** Actually although it appears to 'fail', when I reboot, and select the usual nixos grub entry, I see the following (the UUID mentioned is the UUID that does exist - and it's the new partition):



      enter image description here





      Worst case scenario, it seems I'd be able to use a nixos live USB to mount the new partition to /mnt and then just follow the usual nixos-install (which has worked in the past - with only the /etc/nixos directory present though)?







      nix nixos






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 14:59







      Chris Stryczynski

















      asked Nov 21 '18 at 22:34









      Chris StryczynskiChris Stryczynski

      3,79753061




      3,79753061
























          2 Answers
          2






          active

          oldest

          votes


















          2














          Firstly, get the system in working order again by changing the UUID back in hardware-configuration.nix and making sure it boots OK.



          Next, change the UUID in hardware-configuration.nix, like you have done before, but this time run sudo nixos-rebuild boot.



          When you reboot you'll have a new entry in your systemd-boot or GRUB2 menu. The new entry will boot NixOS from the new partition.






          share|improve this answer





















          • I've updated the question with the error message, the nixos-rebuild boot seems to run into the same error.
            – Chris Stryczynski
            Nov 22 '18 at 14:40





















          0














          I tried using the nixos-install route.



          I had issues with my existing hardware-configuration.nix it seems as I ran into the exact same issue waiting for device....



          Finally I ran nixos-generate-config --root /mnt which generated a new config which had the following differences:



          diff -u nixos.backup/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
          --- nixos.backup/hardware-configuration.nix 2018-11-22 20:18:01.361647120 +0000
          +++ /etc/nixos/hardware-configuration.nix 2018-11-22 20:18:41.818644420 +0000
          @@ -8,8 +8,8 @@
          [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
          ];

          - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
          - boot.kernelModules = [ "kvm-intel" ];
          + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
          + boot.kernelModules = [ "kvm-amd" ];
          boot.extraModulePackages = [ ];

          fileSystems."/" =
          @@ -20,6 +20,4 @@
          swapDevices = [ ];

          nix.maxJobs = lib.mkDefault 4;
          - powerManagement.cpuFreqGovernor = "powersave";
          }
          -


          So probably the nvme bit. Also add that I had kvm-intel as my CPU stayed the same (which is an AMD).






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421374%2fhow-can-i-change-the-uuid-of-my-nixos-os-partition-and-update-the-bootloader%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Firstly, get the system in working order again by changing the UUID back in hardware-configuration.nix and making sure it boots OK.



            Next, change the UUID in hardware-configuration.nix, like you have done before, but this time run sudo nixos-rebuild boot.



            When you reboot you'll have a new entry in your systemd-boot or GRUB2 menu. The new entry will boot NixOS from the new partition.






            share|improve this answer





















            • I've updated the question with the error message, the nixos-rebuild boot seems to run into the same error.
              – Chris Stryczynski
              Nov 22 '18 at 14:40


















            2














            Firstly, get the system in working order again by changing the UUID back in hardware-configuration.nix and making sure it boots OK.



            Next, change the UUID in hardware-configuration.nix, like you have done before, but this time run sudo nixos-rebuild boot.



            When you reboot you'll have a new entry in your systemd-boot or GRUB2 menu. The new entry will boot NixOS from the new partition.






            share|improve this answer





















            • I've updated the question with the error message, the nixos-rebuild boot seems to run into the same error.
              – Chris Stryczynski
              Nov 22 '18 at 14:40
















            2












            2








            2






            Firstly, get the system in working order again by changing the UUID back in hardware-configuration.nix and making sure it boots OK.



            Next, change the UUID in hardware-configuration.nix, like you have done before, but this time run sudo nixos-rebuild boot.



            When you reboot you'll have a new entry in your systemd-boot or GRUB2 menu. The new entry will boot NixOS from the new partition.






            share|improve this answer












            Firstly, get the system in working order again by changing the UUID back in hardware-configuration.nix and making sure it boots OK.



            Next, change the UUID in hardware-configuration.nix, like you have done before, but this time run sudo nixos-rebuild boot.



            When you reboot you'll have a new entry in your systemd-boot or GRUB2 menu. The new entry will boot NixOS from the new partition.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 22 '18 at 10:14









            Emmanuel RosaEmmanuel Rosa

            8,2392618




            8,2392618












            • I've updated the question with the error message, the nixos-rebuild boot seems to run into the same error.
              – Chris Stryczynski
              Nov 22 '18 at 14:40




















            • I've updated the question with the error message, the nixos-rebuild boot seems to run into the same error.
              – Chris Stryczynski
              Nov 22 '18 at 14:40


















            I've updated the question with the error message, the nixos-rebuild boot seems to run into the same error.
            – Chris Stryczynski
            Nov 22 '18 at 14:40






            I've updated the question with the error message, the nixos-rebuild boot seems to run into the same error.
            – Chris Stryczynski
            Nov 22 '18 at 14:40















            0














            I tried using the nixos-install route.



            I had issues with my existing hardware-configuration.nix it seems as I ran into the exact same issue waiting for device....



            Finally I ran nixos-generate-config --root /mnt which generated a new config which had the following differences:



            diff -u nixos.backup/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
            --- nixos.backup/hardware-configuration.nix 2018-11-22 20:18:01.361647120 +0000
            +++ /etc/nixos/hardware-configuration.nix 2018-11-22 20:18:41.818644420 +0000
            @@ -8,8 +8,8 @@
            [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
            ];

            - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
            - boot.kernelModules = [ "kvm-intel" ];
            + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
            + boot.kernelModules = [ "kvm-amd" ];
            boot.extraModulePackages = [ ];

            fileSystems."/" =
            @@ -20,6 +20,4 @@
            swapDevices = [ ];

            nix.maxJobs = lib.mkDefault 4;
            - powerManagement.cpuFreqGovernor = "powersave";
            }
            -


            So probably the nvme bit. Also add that I had kvm-intel as my CPU stayed the same (which is an AMD).






            share|improve this answer


























              0














              I tried using the nixos-install route.



              I had issues with my existing hardware-configuration.nix it seems as I ran into the exact same issue waiting for device....



              Finally I ran nixos-generate-config --root /mnt which generated a new config which had the following differences:



              diff -u nixos.backup/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
              --- nixos.backup/hardware-configuration.nix 2018-11-22 20:18:01.361647120 +0000
              +++ /etc/nixos/hardware-configuration.nix 2018-11-22 20:18:41.818644420 +0000
              @@ -8,8 +8,8 @@
              [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
              ];

              - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
              - boot.kernelModules = [ "kvm-intel" ];
              + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
              + boot.kernelModules = [ "kvm-amd" ];
              boot.extraModulePackages = [ ];

              fileSystems."/" =
              @@ -20,6 +20,4 @@
              swapDevices = [ ];

              nix.maxJobs = lib.mkDefault 4;
              - powerManagement.cpuFreqGovernor = "powersave";
              }
              -


              So probably the nvme bit. Also add that I had kvm-intel as my CPU stayed the same (which is an AMD).






              share|improve this answer
























                0












                0








                0






                I tried using the nixos-install route.



                I had issues with my existing hardware-configuration.nix it seems as I ran into the exact same issue waiting for device....



                Finally I ran nixos-generate-config --root /mnt which generated a new config which had the following differences:



                diff -u nixos.backup/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
                --- nixos.backup/hardware-configuration.nix 2018-11-22 20:18:01.361647120 +0000
                +++ /etc/nixos/hardware-configuration.nix 2018-11-22 20:18:41.818644420 +0000
                @@ -8,8 +8,8 @@
                [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
                ];

                - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
                - boot.kernelModules = [ "kvm-intel" ];
                + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
                + boot.kernelModules = [ "kvm-amd" ];
                boot.extraModulePackages = [ ];

                fileSystems."/" =
                @@ -20,6 +20,4 @@
                swapDevices = [ ];

                nix.maxJobs = lib.mkDefault 4;
                - powerManagement.cpuFreqGovernor = "powersave";
                }
                -


                So probably the nvme bit. Also add that I had kvm-intel as my CPU stayed the same (which is an AMD).






                share|improve this answer












                I tried using the nixos-install route.



                I had issues with my existing hardware-configuration.nix it seems as I ran into the exact same issue waiting for device....



                Finally I ran nixos-generate-config --root /mnt which generated a new config which had the following differences:



                diff -u nixos.backup/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
                --- nixos.backup/hardware-configuration.nix 2018-11-22 20:18:01.361647120 +0000
                +++ /etc/nixos/hardware-configuration.nix 2018-11-22 20:18:41.818644420 +0000
                @@ -8,8 +8,8 @@
                [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
                ];

                - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
                - boot.kernelModules = [ "kvm-intel" ];
                + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
                + boot.kernelModules = [ "kvm-amd" ];
                boot.extraModulePackages = [ ];

                fileSystems."/" =
                @@ -20,6 +20,4 @@
                swapDevices = [ ];

                nix.maxJobs = lib.mkDefault 4;
                - powerManagement.cpuFreqGovernor = "powersave";
                }
                -


                So probably the nvme bit. Also add that I had kvm-intel as my CPU stayed the same (which is an AMD).







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 22 '18 at 20:33









                Chris StryczynskiChris Stryczynski

                3,79753061




                3,79753061






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421374%2fhow-can-i-change-the-uuid-of-my-nixos-os-partition-and-update-the-bootloader%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    404 Error Contact Form 7 ajax form submitting

                    How to know if a Active Directory user can login interactively

                    TypeError: fit_transform() missing 1 required positional argument: 'X'