FreeBSD 12.1 on a QNAP TS-251

I had recently gotten such a NAS for dirt cheap (they didn’t know what they had!), and wanted to put it into useful service. The specifications include a Celeron J1800, and mine had been upgraded to 8 GB of RAM in its past life.

The OS on these things (QTS) is bizarre; basically a homelab in a box, but it’s sludge. The UI is some fake desktop thing, in the vein of eyeOS/YouOS of old. There are servers for things like LDAP, MariaDB (recommending you use phpMyAdmin…) and RADIUS, but I’m not sure who would even use them. There’s even an X server running, for some reason – with IR remote support! This thing is really a low-end SMB-for-SMB and Plex box through and through. I didn’t really like the OS though, so I decided to load something else on.

I decided on FreeBSD because I didn’t really have a FreeBSD box, and ZFS is very tempting. The built-in disk-on-module is only a paltry 512 MB and I didn’t want to remove the old OS in case I wanted to resell it. I haven’t looked into replacing the DOM. I looked inside and it seems removable, but I’m not sure with what. Let me know in the comments if you’ve found anything out!

I installed FreeBSD onto a 256 GB USB stick, that I use as my boot device in lieu of the DOM. While you could install from a memstick image/DVD, I chose to install onto the USB stick from VMware so I didn’t have to get out another CD drive and easily do any possible tweaks from my desktop.

One gotcha I had was that it would reliably hang booting once installed on the NAS. It would hang just before the kernel had a chance to load, like the image below. If you disabled ACPI, it would panic on boot that it couldn’t find any APICs. The workaround here is to make sure you’re using EFI (with GPT partitions) for the install, and disable USB Legacy in firmware to help. It works fine on the USB 3 ports, so you don’t have to use USB 2.

Failed BIOS-based boot

Once I had got it to boot, FreeBSD came up, but couldn’t find the root partition. This was simply a matter of different device enumeration; the root partition was da0p2 in VMware, but da1p2 on the NAS, because the DOM had enumerated as da0. I had to just enter ufs:da1p2 at the mountroot prompt, and then once booted, change it in /etc/fstab too. Likewise, I had to change rc.conf and snmpd.conf in /etc to change references from em0 to igb0 (or igb1, depending on what port you use – the bottom ethernet port seems to be igb1), because the ethernet controller that VMware emulates is different from what’s on the NAS.

My dmesg output is as follows:

---<<BOOT>>---
Copyright (c) 1992-2020 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.2-RELEASE r366954 GENERIC amd64
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
VT(efifb): resolution 640x480
CPU: Intel(R) Celeron(R) CPU  J1800  @ 2.41GHz (2416.72-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x30678  Family=0x6  Model=0x37  Stepping=8
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x41d8e3bf<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,TSCDLT,RDRAND>
  AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
  AMD Features2=0x101<LAHF,Prefetch>
  Structured Extended Features=0x2282<TSCADJ,SMEP,ERMS,NFPUSG>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
  TSC: P-state invariant, performance statistics
real memory  = 8589934592 (8192 MB)
avail memory = 8168144896 (7789 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <ALASKA A M I >
WARNING: L1 data cache covers fewer APIC IDs than a core (0 < 1)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s)
random: unblocking device.
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Gpe0Block: 128/32 (20200430/tbfadt-748)
WARNING: Bogus Interrupt Polarity. Assume CONFORMS
ioapic0 <Version 2.0> irqs 0-86 on motherboard
Launching APs: 1
Timecounter "TSC-low" frequency 1208362401 Hz quality 1000
random: entropy device external interface
kbd0 at kbdmux0
000.000023 [4336] netmap_init               netmap: loaded module
[ath_hal] loaded
module_register_init: MOD_LOAD (vesa, 0xffffffff81115e40, 0) error 19
random: registering fast source Intel Secure Key RNG
random: fast provider: "Intel Secure Key RNG"
nexus0
efirtc0: <EFI Realtime Clock> on motherboard
efirtc0: registered as a time-of-day clock, resolution 1.000000s
cryptosoft0: <software crypto> on motherboard
acpi0: <ALASKA A M I > on motherboard
acpi0: Power Button (fixed)
unknown: I/O range not supported
cpu0: <ACPI CPU> on acpi0
atrtc0: <AT realtime clock> port 0x70-0x77 on acpi0
atrtc0: Warning: Couldn't map I/O.
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff irq 8 on acpi0
Timecounter "HPET" frequency 14318180 Hz quality 950
Event timer "HPET" frequency 14318180 Hz quality 450
Event timer "HPET1" frequency 14318180 Hz quality 440
Event timer "HPET2" frequency 14318180 Hz quality 440
attimer0: <AT timer> port 0x40-0x43,0x50-0x53 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pcib0: Length mismatch for 3 range: 40000000 vs 40000001
pci0: <ACPI PCI bus> on pcib0
vgapci0: <VGA-compatible display> port 0xe080-0xe087 mem 0xd0000000-0xd03fffff,0xc0000000-0xcfffffff irq 16 at device 2.0 on pci0
vgapci0: Boot video device
sdhci_pci0: <Intel Bay Trail SDXC Controller> mem 0xd093d000-0xd093dfff,0xd093c000-0xd093cfff irq 17 at device 17.0 on pci0
sdhci_pci0: 1 slot(s) allocated
mmc0: <MMC/SD bus> on sdhci_pci0
sdhci_pci1: <Generic SD HCI> mem 0xd093b000-0xd093bfff,0xd093a000-0xd093afff irq 18 at device 18.0 on pci0
sdhci_pci1: 1 slot(s) allocated
ahci0: <AHCI SATA controller> port 0xe070-0xe077,0xe060-0xe063,0xe050-0xe057,0xe040-0xe043,0xe020-0xe03f mem 0xd0939000-0xd09397ff irq 19 at device 19.0 on pci0
ahci0: AHCI v1.30 with 2 3Gbps ports, Port Multiplier not supported
xhci0: <Intel BayTrail USB 3.0 controller> mem 0xd0900000-0xd090ffff irq 20 at device 20.0 on pci0
xhci0: 32 bytes context size, 64-bit DMA
xhci0: Port routing mask set to 0xffffffff
usbus0 on xhci0
usbus0: 5.0Gbps Super Speed USB v3.0
sdhci_pci2: <Intel Bay Trail eMMC 4.5 Controller> mem 0xd0938000-0xd0938fff,0xd0937000-0xd0937fff irq 23 at device 23.0 on pci0
sdhci_pci2: 1 slot(s) allocated
mmc1: <MMC/SD bus> on sdhci_pci2
pci0: <base peripheral, DMA controller> at device 24.0 (no driver attached)
pci0: <serial bus> at device 24.1 (no driver attached)
pci0: <serial bus> at device 24.2 (no driver attached)
pci0: <serial bus> at device 24.3 (no driver attached)
pci0: <serial bus> at device 24.4 (no driver attached)
pci0: <serial bus> at device 24.5 (no driver attached)
pci0: <serial bus> at device 24.6 (no driver attached)
pci0: <serial bus> at device 24.7 (no driver attached)
pci0: <encrypt/decrypt> at device 26.0 (no driver attached)
hdac0: <Intel BayTrail HDA Controller> mem 0xd0914000-0xd0917fff irq 22 at device 27.0 on pci0
pcib1: <ACPI PCI-PCI bridge> irq 16 at device 28.0 on pci0
pcib1: [GIANT-LOCKED]
pci1: <ACPI PCI bus> on pcib1
ahci1: <ASMedia ASM1062 AHCI SATA controller> port 0xd050-0xd057,0xd040-0xd043,0xd030-0xd037,0xd020-0xd023,0xd000-0xd01f mem 0xd0810000-0xd08101ff irq 16 at device 0.0 on pci1
ahci1: AHCI v1.20 with 2 6Gbps ports, Port Multiplier supported
ahci1: quirks=0xc00000<NOCCS,NOAUX>
ahcich2: <AHCI channel> at channel 0 on ahci1
ahcich3: <AHCI channel> at channel 1 on ahci1
pcib2: <ACPI PCI-PCI bridge> irq 17 at device 28.1 on pci0
pcib2: [GIANT-LOCKED]
pcib3: <ACPI PCI-PCI bridge> irq 18 at device 28.2 on pci0
pcib3: [GIANT-LOCKED]
pci2: <ACPI PCI bus> on pcib3
igb0: <Intel(R) PRO/1000 PCI-Express Network Driver> port 0xc000-0xc01f mem 0xd0700000-0xd077ffff,0xd0780000-0xd0783fff irq 18 at device 0.0 on pci2
igb0: Using 1024 TX descriptors and 1024 RX descriptors
igb0: Using 2 RX queues 2 TX queues
igb0: Using MSI-X interrupts with 3 vectors
igb0: Ethernet address: 00:08:9b:e5:ba:f4
igb0: netmap queues/slots: TX 2/1024, RX 2/1024
pcib4: <ACPI PCI-PCI bridge> irq 19 at device 28.3 on pci0
pcib4: [GIANT-LOCKED]
pci3: <ACPI PCI bus> on pcib4
igb1: <Intel(R) PRO/1000 PCI-Express Network Driver> port 0xb000-0xb01f mem 0xd0600000-0xd067ffff,0xd0680000-0xd0683fff irq 19 at device 0.0 on pci3
igb1: Using 1024 TX descriptors and 1024 RX descriptors
igb1: Using 2 RX queues 2 TX queues
igb1: Using MSI-X interrupts with 3 vectors
igb1: Ethernet address: 00:08:9b:e5:ba:f5
igb1: netmap queues/slots: TX 2/1024, RX 2/1024
pci0: <base peripheral, DMA controller> at device 30.0 (no driver attached)
pci0: <serial bus> at device 30.1 (no driver attached)
pci0: <serial bus> at device 30.2 (no driver attached)
uart2: <Intel ValleyView LPIO1 HSUART#1> mem 0xd0922000-0xd0922fff,0xd0921000-0xd0921fff irq 18 at device 30.3 on pci0
uart3: <Intel ValleyView LPIO1 HSUART#2> mem 0xd0920000-0xd0920fff,0xd091f000-0xd091ffff irq 19 at device 30.4 on pci0
pci0: <serial bus> at device 30.5 (no driver attached)
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
acpi_button0: <Power Button> on acpi0
acpi_button1: <Sleep Button> on acpi0
acpi_tz0: <Thermal Zone> on acpi0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: console (115200,n,8,1)
uart1: <16550 or compatible> port 0x2f8-0x2ff irq 3 on acpi0
est0: <Enhanced SpeedStep Frequency Control> on cpu0
Timecounters tick every 1.000 msec
ugen0.1: <0x8086 XHCI root HUB> at usbus0
uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
mmc0: No compatible cards found on bus
mmc1: No compatible cards found on bus
hdacc0: <Intel Valleyview2 HDA CODEC> at cad 2 on hdac0
hdaa0: <Intel Valleyview2 Audio Function Group> at nid 1 on hdacc0
pcm0: <Intel Valleyview2 (HDMI/DP 8ch)> at nid 4 on hdaa0
Trying to mount root from ufs:/dev/da1p2 [rw]...
Root mount waiting for: usbus0
uhub0: 7 ports with 7 removable, self powered
Root mount waiting for: usbus0
ugen0.2: <Asmedia ASM107x> at usbus0
uhub1 on uhub0
uhub1: <Asmedia ASM107x, class 9/0, rev 2.10/1.00, addr 1> on usbus0
uhub1: MTT enabled
uhub1: 4 ports with 4 removable, self powered
Root mount waiting for: usbus0
ugen0.3: <SIGMACHIP USB Keyboard> at usbus0
ukbd0 on uhub0
ukbd0: <SIGMACHIP USB Keyboard, class 0/0, rev 1.10/1.10, addr 2> on usbus0
kbd1 at ukbd0
Root mount waiting for: usbus0
ugen0.4: <vendor 0x1005 USB DISK MODULE> at usbus0
umass0 on uhub0
umass0: <vendor 0x1005 USB DISK MODULE, class 0/0, rev 2.00/1.00, addr 3> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:2:0: Attached to scbus2
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: < USB DISK MODULE PMAP> Removable Direct Access SCSI device
da0: Serial Number 1900464D25AC0301
da0: 40.000MB/s transfers
da0: 492MB (1007616 512 byte sectors)
da0: quirks=0x3<NO_SYNC_CACHE,NO_6_BYTE>
Root mount waiting for: usbus0
ugen0.5: <Asmedia ASM107x> at usbus0
uhub2 on uhub0
uhub2: <Asmedia ASM107x, class 9/0, rev 3.00/1.00, addr 4> on usbus0
uhub2: 4 ports with 4 removable, self powered
Root mount waiting for: usbus0
ugen0.6: <Samsung Flash Drive> at usbus0
umass1 on uhub2
umass1: <Samsung Flash Drive, class 0/0, rev 3.10/11.00, addr 5> on usbus0
umass1:  SCSI over Bulk-Only; quirks = 0x4000
umass1:3:1: Attached to scbus3
da1 at umass-sim1 bus 1 scbus3 target 0 lun 0
da1: <Samsung Flash Drive 1100> Removable Direct Access SPC-4 SCSI device
da1: Serial Number 0374620100008468
da1: 400.000MB/s transfers
da1: 244752MB (501253132 512 byte sectors)
da1: quirks=0x2<NO_6_BYTE>
mountroot: waiting for device /dev/da1p2...
WARNING: / was not properly dismounted
ZFS filesystem version: 5
ZFS storage pool version: features support (5000)
ig4iic0: <Intel BayTrail Serial I/O I2C Port 1> mem 0xd0935000-0xd0935fff,0xd0934000-0xd0934fff irq 19 at device 24.1 on pci0
ig4iic0: Using MSI
iicbus0: <Philips I2C bus (ACPI-hinted)> on ig4iic0
ig4iic1: <Intel BayTrail Serial I/O I2C Port 2> mem 0xd0933000-0xd0933fff,0xd0932000-0xd0932fff irq 18 at device 24.2 on pci0
ig4iic1: Using MSI
iicbus1: <Philips I2C bus (ACPI-hinted)> on ig4iic1
ig4iic2: <Intel BayTrail Serial I/O I2C Port 3> mem 0xd0931000-0xd0931fff,0xd0930000-0xd0930fff irq 16 at device 24.3 on pci0
ig4iic2: Using MSI
iicbus2: <Philips I2C bus (ACPI-hinted)> on ig4iic2
ig4iic3: <Intel BayTrail Serial I/O I2C Port 4> mem 0xd092f000-0xd092ffff,0xd092e000-0xd092efff irq 17 at device 24.4 on pci0
ig4iic3: Using MSI
iicbus3: <Philips I2C bus (ACPI-hinted)> on ig4iic3
ig4iic4: <Intel BayTrail Serial I/O I2C Port 5> mem 0xd092d000-0xd092dfff,0xd092c000-0xd092cfff irq 19 at device 24.5 on pci0
ig4iic4: Using MSI
iicbus4: <Philips I2C bus (ACPI-hinted)> on ig4iic4
ig4iic5: <Intel BayTrail Serial I/O I2C Port 6> mem 0xd092b000-0xd092bfff,0xd092a000-0xd092afff irq 18 at device 24.6 on pci0
ig4iic5: Using MSI
iicbus5: <Philips I2C bus (ACPI-hinted)> on ig4iic5
ig4iic6: <Intel BayTrail Serial I/O I2C Port 7> mem 0xd0929000-0xd0929fff,0xd0928000-0xd0928fff irq 16 at device 24.7 on pci0
ig4iic6: Using MSI
iicbus6: <Philips I2C bus (ACPI-hinted)> on ig4iic6
lo0: link state changed to UP
igb0: link state changed to UP
uhid0 on uhub0
uhid0: <SIGMACHIP USB Keyboard, class 0/0, rev 1.10/1.10, addr 2> on usbus0
Security policy loaded: MAC/ntpd (mac_ntpd)

I’m still waiting for the disks I had ordered to come, but at least FreeBSD is up. If my disk enumeration changes as a result of the disks occurs, I’ll update this post.

One thought on “FreeBSD 12.1 on a QNAP TS-251

Leave a Reply

Your email address will not be published. Required fields are marked *