Samuel Dionne-Riel 7d112134de nixosTests.installer: Fix grub1 test being unreliable
The kernel sometimes assigns `/dev/sdb` to the 8GiB disk. This, in turn,
means the test will fail because we're targeting the wrong disk.

```
machine # [    0.000000] sd 2:0:0:0: [sda] 16777216 512-byte logical blocks: (8.59 GB/8.00 GiB)
machine # [    0.000000] sd 3:0:0:0: [sdb] 1048576 512-byte logical blocks: (537 MB/512 MiB)
```

```
machine # [    0.000000] sd 2:0:0:0: [sdb] 16777216 512-byte logical blocks: (8.59 GB/8.00 GiB)
machine # [    0.000000] sd 3:0:0:0: [sda] 1048576 512-byte logical blocks: (537 MB/512 MiB)
```

Note how the "sd x:0:0:0:` ID is stable. That is because QEMU **is**
told to give specific identifiers to the disks. So using the
dev/disk/by-id/ identifiers is stable.

* * *

Tested by forcing the sda/sdb swap this way:

    diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix
    index 24c55081f9a..2eee224351b 100644
    --- a/nixos/tests/installer.nix
    +++ b/nixos/tests/installer.nix
    @@ -702,12 +702,19 @@ in {
               + " mkpart primary linux-swap 1M 1024M"
               + " mkpart primary ext2 1024M -1s",
               "udevadm settle",
    +      )
    +      print(machine.succeed("find /dev/disk/ '!' -type d -printf '%p → %l\n' | sort"))
    +      machine.succeed(
               "mkswap ${grubDevice}-part1 -L swap",
               "swapon -L swap",
               "mkfs.ext3 -L nixos ${grubDevice}-part2",
               "mount LABEL=nixos /mnt",
               "mkdir -p /mnt/tmp",
           )
    +      machine.succeed("echo success")
    +      machine.succeed(
    +          'if [[ "$(find ${grubDevice} -printf \'%l\')" != "../../sdb" ]]; then exit 22; else true; fi'
    +      )
         '';
         grubVersion = 1;
         # /dev/sda is not stable, even when the SCSI disk number is.

And ran this way:

     $ until (clear; tmux clear ; time env -i nix-build nixos/release-combined.nix -A nixos.tests.installer.grub1.x86_64-linux); do echo derp; done
2021-04-25 19:59:29 -04:00
..
2020-11-09 22:50:17 +01:00
2020-06-30 17:12:03 +02:00
2021-04-04 01:43:46 +02:00
2021-02-12 06:54:20 +01:00
2021-03-15 19:25:49 +00:00
2021-04-22 12:48:48 +02:00
2020-05-22 11:23:31 +02:00
2021-02-22 02:17:24 -05:00
2019-11-04 23:51:10 +01:00
2021-03-27 14:43:33 +03:00
2020-12-09 13:24:48 +01:00
2020-10-25 11:01:31 +01:00
2021-04-01 21:27:50 +02:00
2021-01-24 10:50:56 +01:00
2021-04-05 13:55:44 +02:00
2020-05-04 15:56:06 -07:00
2020-08-23 10:31:58 +02:00
2021-03-23 14:42:40 +01:00
2019-11-22 20:38:56 +01:00
2019-11-22 20:38:56 +01:00
2020-09-07 11:21:26 +02:00
2021-02-23 19:28:51 +01:00
2021-04-11 13:39:39 +02:00
2021-04-09 14:57:33 +00:00
2020-12-22 01:39:03 +01:00
2021-01-18 16:12:52 +00:00
2020-07-06 18:35:34 +02:00
2019-11-22 20:38:56 +01:00
2021-03-22 14:52:13 +01:00
2019-11-22 20:38:56 +01:00
2019-12-22 08:52:56 +00:00
2021-02-08 15:39:37 +01:00
2019-12-27 01:22:35 +01:00
2020-02-02 10:46:54 +01:00
2020-12-28 00:37:13 +01:00
2020-12-17 16:58:57 +01:00
2019-12-01 00:50:55 +01:00
2020-12-17 09:05:53 -05:00
2019-11-06 12:27:14 +01:00
2021-02-26 20:26:02 -05:00
2021-04-19 11:26:08 -04:00
2020-12-05 11:02:40 +01:00
2020-10-25 11:01:30 +01:00
2020-11-02 08:16:01 -05:00
2020-12-21 19:41:24 +01:00
2020-11-04 20:37:50 -05:00
2020-11-24 12:42:06 -05:00
2019-11-07 11:30:02 +01:00
2021-01-26 18:11:38 +01:00
2021-02-23 15:35:52 +01:00
2020-11-12 20:00:50 +01:00
2019-11-08 17:11:11 +01:00
2021-03-09 11:03:00 +01:00
2019-11-06 15:56:04 +01:00
2020-06-23 12:02:27 +02:00
2020-04-22 08:36:27 +02:00
2021-03-21 18:47:52 -07:00
2021-03-14 00:58:50 -05:00
2020-10-25 11:01:30 +01:00
2020-10-25 11:01:31 +01:00
2021-01-24 01:49:49 +01:00
2020-09-02 22:18:52 +08:00
2021-03-20 20:43:21 +01:00
2021-02-06 02:36:39 +09:00
2020-08-18 07:59:44 +10:00