Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/tests/installer: add bcachefs tests #156071

Merged
merged 2 commits into from
May 9, 2022

Conversation

Madouura
Copy link
Contributor

@Madouura Madouura commented Jan 21, 2022

Motivation for this change

In relation to #153095 per Mic92's request.
I'm not entirely sure how the installer tests work, so if there's any changes that would be better let me know!

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Jan 21, 2022
@Madouura Madouura added 0.kind: enhancement Add something new 8.has: module (update) This PR changes an existing module in `nixos/` labels Jan 21, 2022
@Madouura Madouura requested a review from chkno January 21, 2022 16:30
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jan 21, 2022
nixos/tests/installer.nix Outdated Show resolved Hide resolved
@Madouura Madouura force-pushed the dev/bcachefs-installer branch from 105e7b3 to fc684d1 Compare January 22, 2022 00:24
@github-actions github-actions bot removed the 8.has: module (update) This PR changes an existing module in `nixos/` label Jan 22, 2022
@chkno
Copy link
Member

chkno commented Jan 22, 2022

Changing the installer tests is extra confusing right now because all the installer tests are currently broken due to #149532 (comment) :(

@Madouura
Copy link
Contributor Author

I picked an interesting time to add installer tests then, huh.

@chkno
Copy link
Member

chkno commented Jan 22, 2022

I created #156213 to fix the installer tests.

@chkno
Copy link
Member

chkno commented Jan 24, 2022

Oh, and it looks like my original bcache test had an error that was masked by the test just running really fast until 1640359 from #142747 slightly changed the timing of test command execution. I created #156251 to fix this, which makes the bcache test pass again.

Afer patching in those two PRs, and then this one on top of them, it's now possible to actually try out this change. Thanks for your patience.

When I run the bcachefsSimple test, it fails in the nixos-install step during grub install, giving this error message:

machine # updating GRUB 2 menu...
machine # installing the GRUB 2 boot loader on /dev/vda...
machine # Installing for i386-pc platform.
machine # /nix/store/hl45qmhb3cdn9b5g7gj7rc7gj54y8rnb-grub-2.06/sbin/grub-install: error: unknown filesystem.
machine # /nix/store/if5r20zqsxzy73yryghd74wvzdk85qj9-install-grub.pl: installation of GRUB on /dev/vda failed: No such file or directory

When I run the bcachefsMulti test, it hangs during nixos-install with several kernel messages like this:

machine # [ 4364.384944] INFO: task nix-build:1385 blocked for more than 1245 seconds.
machine # [ 4364.386583]       Tainted: P           O      5.15.16 #1-NixOS
machine # [ 4364.391295] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
machine # [ 4364.393171] task:nix-build       state:D stack:    0 pid: 1385 ppid:  1171 flags:0x00004000
machine # [ 4364.408252] Call Trace:
machine # [ 4364.408927]  <TASK>
machine # [ 4364.409361]  __schedule+0x2dd/0x1470
machine # [ 4364.423964]  ? mutex_lock+0xe/0x30
machine # [ 4364.425034]  schedule+0x44/0xa0
machine # [ 4364.425805]  __closure_sync+0x81/0x210
machine # [ 4364.426529]  bch2_btree_update_start.constprop.0+0x3e4/0x7c0 [bcachefs]
machine # [ 4364.435388]  ? irq_cpu_rmap_notify+0x20/0x20
machine # [ 4364.436453]  bch2_btree_split_leaf+0x61/0x150 [bcachefs]
machine # [ 4364.437777]  ? __bch2_create+0x283/0x460 [bcachefs]
machine # [ 4364.445321]  bch2_trans_commit_error+0x103/0x3a0 [bcachefs]
machine # [ 4364.449637]  ? bch2_trans_iter_exit+0x2a/0x40 [bcachefs]
machine # [ 4364.450968]  __bch2_trans_commit+0x73b/0x920 [bcachefs]
machine # [ 4364.480296]  __bch2_create+0x283/0x460 [bcachefs]
machine # [ 4364.482119]  ? __bch2_create+0xea/0x460 [bcachefs]
machine # [ 4364.483170]  ? bch2_create+0x27/0x50 [bcachefs]
machine # [ 4364.484166]  bch2_create+0x27/0x50 [bcachefs]
machine # [ 4364.491576]  path_openat+0xe35/0x10b0
machine # [ 4364.492385]  do_filp_open+0xa9/0x150
machine # [ 4364.493230]  do_sys_openat2+0x97/0x160
machine # [ 4364.494089]  __x64_sys_openat+0x54/0x90
machine # [ 4364.495991]  do_syscall_64+0x3b/0x90
machine # [ 4364.496819]  entry_SYSCALL_64_after_hwframe+0x44/0xae
machine # [ 4364.508575] RIP: 0033:0x7fd013d63688
machine # [ 4364.509385] RSP: 002b:00007fcfd67fa360 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
machine # [ 4364.510986] RAX: ffffffffffffffda RBX: 00000000000800c1 RCX: 00007fd013d63688
machine # [ 4364.524106] RDX: 00000000000800c1 RSI: 00007fcf8c012770 RDI: 00000000ffffff9c
machine # [ 4364.525764] RBP: 00007fcf8c012770 R08: 0000000000000000 R09: 00007fcf8c00f216
machine # [ 4364.527694] R10: 00000000000001b6 R11: 0000000000000293 R12: 00007fcfd67fa550
machine # [ 4364.529340] R13: 00007fcfd67fa400 R14: 00007fcfd67fa3f0 R15: 00007fcfd67fb3a0
machine # [ 4364.539272]  </TASK>

@Madouura
Copy link
Contributor Author

Strange, when I ran the tests they worked fine.
I'll retest and see what the issue is tomorrow when I have time.

@Madouura Madouura force-pushed the dev/bcachefs-installer branch from fc684d1 to 3e1a8de Compare January 28, 2022 14:40
@Madouura
Copy link
Contributor Author

I can't seem to replicate the errors you're getting, even on the latest master.
Only problem I have is nixos-install copying channels forever without finishing, which is true for both tests.

@Madouura
Copy link
Contributor Author

Madouura commented Jan 28, 2022

Note that I am using this command for the tests, in my local nixpkgs.

nix-build . -A nixosTests.installer.bcachefsMulti
nix-build . -A nixosTests.installer.bcachefsSimple

@chkno
Copy link
Member

chkno commented Jan 29, 2022

#156213 was just merged, so you can rebase on master instead of continuing to patch that in, if you like.

Yes, copying channels does take a very long time. This test runs for 2 hours (on a 2.60GHz i5-3320M) before emitting this error message, and it happens awhile after the channel-copying step.

$ nix-build . -A nixosTests.installer.bcachefsSimple -I nixpkgs-overlays=/var/empty
...
machine: must succeed: nixos-install < /dev/null >&2
machine # copying channel...
machine # [  935.088741] systemd[1]: Starting Cleanup of Temporary Directories...
machine # [  937.161560] systemd[1]: systemd-tmpfiles-clean.service: Deactivated successfully.
machine # [  937.181053] systemd[1]: Finished Cleanup of Temporary Directories.
machine # building the configuration in /mnt/etc/nixos/configuration.nix...
machine # these 230 derivations will be built:
...
machine # these 361 paths will be fetched (0.00 MiB download, 1237.93 MiB unpacked):
...
machine # installing the boot loader...
machine # setting up /etc...
machine # /etc/tmpfiles.d/journal-nocow.conf:26: Failed to resolve specifier: uninitialized /etc detected, skipping
machine # All rules containing unresolvable specifiers will be skipped.
machine # updating GRUB 2 menu...
machine # installing the GRUB 2 boot loader on /dev/vda...
machine # Installing for i386-pc platform.
machine # /nix/store/k337pspx293idb80340jhkyfvxfq21q8-grub-2.06/sbin/grub-install: error: unknown filesystem.
machine # /nix/store/mdafvgivvfw45hnw3vnch0006x90aa0q-install-grub.pl: installation of GRUB on /dev/vda failed: No such file or directory
machine: output:
Test "Perform the installation" failed with error: "command `nixos-install < /dev/null >&2` failed (exit code 1)"
cleanup
kill machine (pid 8)

I get the same error from both of these ways of running the test:

nix-build nixos/tests/installer.nix -A bcachefsSimple -I nixpkgs-overlays=/var/empty
nix-build . -A nixosTests.installer.bcachefsSimple -I nixpkgs-overlays=/var/empty

I'm using -I nixpkgs-overlays=/var/empty just to make sure that none of my ~/.config/nixpkgs/overlays are affecting the way the test runs.

@Madouura
Copy link
Contributor Author

Ah right, Grub doesn't support bcachefs yet, so I'll just increase the efi partition size and make that /mnt/boot.

@Madouura Madouura force-pushed the dev/bcachefs-installer branch from 3e1a8de to 0c9dc67 Compare January 29, 2022 03:09
@Madouura
Copy link
Contributor Author

It seems to be working, at least the simple variant, I'll have to test the multi variant tomorrow considering how long this takes.
I do get an error on the boot stage, but I'm not sure what it's about, and seems to be unrelated to bcachefs.

boot-after-install: connected to guest root shell
boot-after-install: (connecting took 0.06 seconds)
(finished: waiting for the VM to finish booting, in 0.11 seconds)
Test "Assert that /boot get mounted" failed with error: "[Errno 32] Broken pipe"
cleanup
(finished: cleanup, in 0.00 seconds)
boot-after-install # GRUB loading
kill vlan (pid 7)
builder for '/nix/store/f8hclfnnmb3c8s2xah0zp37cn68wd4lx-vm-test-run-installer-bcachefs-simple.drv' failed with exit code 1
error: build of '/nix/store/f8hclfnnmb3c8s2xah0zp37cn68wd4lx-vm-test-run-installer-bcachefs-simple.drv' failed

@Madouura
Copy link
Contributor Author

Multi also works, sans the weird issue mentioned above.

@chkno
Copy link
Member

chkno commented Jan 30, 2022

I thought EFI partitions were required to be FAT-32?

@Madouura
Copy link
Contributor Author

It's not an EFI partition, I'm just dumb.
What /boot is in this test is a bios boot partition with ext3.

@Madouura
Copy link
Contributor Author

Madouura commented Mar 13, 2022

Thanks to @JJJollyjim, we should be able to enable the encryption test as well for this.

@Madouura Madouura force-pushed the dev/bcachefs-installer branch from 0c9dc67 to 7a80aed Compare March 25, 2022 20:39
@Madouura
Copy link
Contributor Author

I got -Simple and -Multi working, unfortunately I haven't even the slightest clue what to do about -Encrypted though.
cc @JJJollyjim for some help on this one, as you seem to understand this quite a bit better.

@Madouura Madouura changed the title nixos/tests/installer: add bcachefs tests (WIP) nixos/tests/installer: add bcachefs tests Mar 25, 2022
@Madouura Madouura force-pushed the dev/bcachefs-installer branch 2 times, most recently from b32effe to bcc95cb Compare April 10, 2022 16:26
@Madouura
Copy link
Contributor Author

Madouura commented Apr 10, 2022

Yeah, it always stops right here.

boot-after-install # <<< NixOS Stage 1 >>>
boot-after-install # 
boot-after-install # loading module virtio_balloon...
boot-after-install # loading module virtio_console...
boot-after-install # loading module virtio_rng...
boot-after-install # loading module dm_mod...
boot-after-install # [    0.305132] device-mapper: ioctl: 4.45.0-ioctl (2021-03-22) initialised: [email protected]
boot-after-install # running udev...
boot-after-install # Starting version 249.7
boot-after-install # [    0.337524] rtc_cmos 00:05: RTC can wake from S4
boot-after-install # [    0.340005] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
boot-after-install # [    0.343127] serio: i8042 KBD port at 0x60,0x64 irq 1
boot-after-install # [    0.343424] serio: i8042 AUX port at 0x60,0x64 irq 12
boot-after-install # [    0.344377] rtc_cmos 00:05: registered as rtc0
boot-after-install # [    0.344641] rtc_cmos 00:05: alarms up to one day, y3k, 242 bytes nvram, hpet irqs
boot-after-install # [    0.362190] Floppy drive(s): fd0 is 2.88M AMI BIOS
boot-after-install # [    0.373846] FDC 0 is a S82078B
boot-after-install # [    0.382553] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0
boot-after-install # [    0.390823] SCSI subsystem initialized
boot-after-install # [    0.398064] ACPI: \_SB_.LNKC: Enabled at IRQ 11
boot-after-install # [    0.417220] ACPI: \_SB_.LNKD: Enabled at IRQ 10
boot-after-install # [    0.418678] scsi host0: ata_piix
boot-after-install # [    0.423674] scsi host1: ata_piix
boot-after-install # [    0.423895] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc100 irq 14
boot-after-install # [    0.424274] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc108 irq 15
boot-after-install # [    0.435306] ACPI: \_SB_.LNKA: Enabled at IRQ 10
boot-after-install # [    0.447185] ACPI: \_SB_.LNKB: Enabled at IRQ 11
boot-after-install # [    0.582279] ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
boot-after-install # [    0.583557] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     2.5+ PQ: 0 ANSI: 5
boot-after-install # [    0.593416] virtio_blk virtio3: [vda] 16777216 512-byte logical blocks (8.59 GB/8.00 GiB)
boot-after-install # [    0.597429]  vda: vda1 vda2 vda3
boot-after-install # [    0.606978] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
boot-after-install # [    0.607379] cdrom: Uniform CD-ROM driver Revision: 3.20
boot-after-install # kbd_mode: KDSKBMODE: Inappropriate ioctl for device
boot-after-install # %Gstarting device mapper and LVM...
boot-after-install # [    0.828444] clocksource: Switched to clocksource acpi_pm

At first I thought it might be the same issue I had between using the unstable channel's bcachefs packages on the stable system, but it seems to be something entirely different, as I get the same issue even when running on release-21.11.
So, in the meantime, I'm commenting out bcachefsEncrypted and until we find a fix, go ahead and submit this for merge.

@Madouura Madouura changed the title (WIP) nixos/tests/installer: add bcachefs tests nixos/tests/installer: add bcachefs tests Apr 10, 2022
@Madouura
Copy link
Contributor Author

cc @chkno

@Madouura
Copy link
Contributor Author

Madouura commented May 3, 2022

cc @Mic92

nixos/tests/installer.nix Outdated Show resolved Hide resolved
@Madouura Madouura force-pushed the dev/bcachefs-installer branch from bcc95cb to 39b9cf3 Compare May 5, 2022 00:27
@Madouura
Copy link
Contributor Author

Madouura commented May 5, 2022

All tests now functional.

@Artturin
Copy link
Member

Artturin commented May 5, 2022

please add these to bcachefs-tools passthru.tests

@Madouura
Copy link
Contributor Author

Madouura commented May 5, 2022

Done.

@Artturin
Copy link
Member

Artturin commented May 5, 2022

@ofborg build bcachefs-tools.tests

@Madouura
Copy link
Contributor Author

Madouura commented May 9, 2022

Should ofborg be taking this long to test this?
Maybe we're really backed up at the moment?

@Artturin
Copy link
Member

Artturin commented May 9, 2022

Should ofborg be taking this long to test this? Maybe we're really backed up at the moment?

it has already run them

@Artturin
Copy link
Member

Artturin commented May 9, 2022

i don't know antyhing about bcachefs but since the tests run i assume the tests are ok

@Artturin Artturin merged commit 4ae23f5 into NixOS:master May 9, 2022
@Madouura Madouura deleted the dev/bcachefs-installer branch May 9, 2022 16:48
@Madouura
Copy link
Contributor Author

Madouura commented May 9, 2022

Ah okay, I was thinking the pending ofborg tasks were what you were telling ofborg to do.

@Artturin
Copy link
Member

Artturin commented May 9, 2022

they are but the nixos test vm's aren't run on darwin so they would just be skipped once the queue got to them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: enhancement Add something new 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants