- # https://wiki.archlinux.org/index.php/Solid_state_drive#Resolving_NCQ_errors
- # evo-870 doesnt get along well with d16 with etiona.
- # the number is based on dmesg errors
- kd) cmdline+=" libata.force=4.00:noncq" ;;
+ kd)
+ fcopy -v /usr/bin/myncq
+
+ cat >$target/etc/systemd/system/myncq.service <<'EOF'
+[Unit]
+Description=fix ncq errors
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/myncq
+TimeoutStartSec=20
+
+[Install]
+# https://www.enricozini.org/blog/2017/debian/systemd-07-devices/
+WantedBy=dev-disk-by\x2did-ata\x2dSamsung_SSD_870_QVO_8TB_S5VUNG0N900656V.device
+EOF
+
+ chroot $FAI_ROOT bash <<'EOFOUTER'
+systemctl enable myncq.service
+/usr/bin/myncq no-upgrub
+EOFOUTER
+
+ ;;