doc:appunti:hardware:qnap_ts-120
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:appunti:hardware:qnap_ts-120 [2022/02/11 09:07] – [Dump and restore] niccolo | doc:appunti:hardware:qnap_ts-120 [2025/01/10 11:15] (current) – [USB audio dongle] niccolo | ||
---|---|---|---|
Line 95: | Line 95: | ||
</ | </ | ||
- | ===== Console | + | ===== The Serial |
- | Vedere qui: [[http:// | + | {{ .: |
+ | {{ .: | ||
+ | On the circuit board of the QNAP TS-120 there is a JTAG connector for the serial console. I used an old CD-ROM audio cable because it had the right connector. I wired only the **GND**, **TX** and **RX** pins from to QNAP to a serial-to-USB adapter. The adapter was inserted intp a GNU/Linux computer running the **minicom** program. The speed of the serial line was set to **115200**. The connector pinout is documented in this page: [[http:// | ||
- | ===== Tips ===== | + | ^ Console Pinout |
+ | ^ 1 | TX | | ||
+ | ^ 2 | VCC +3.3 | | ||
+ | ^ 3 | RX | | ||
+ | ^ 4 | GND | | ||
- | | + | This is the boot process captured from the serial line. At the end of the bootstrap you will get a **login prompt**. |
+ | |||
+ | < | ||
+ | | ||
+ | | \/ | __ _ _ ____ | ||
+ | | |\/| |/ _` | '__\ \ / / _ \ | | | ||
+ | | | | | (_| | | \ V / __/ | | | ||
+ | |_| |_|\__, | ||
+ | | ||
+ | | | | | | __ ) ___ ___ | |_ | ||
+ | | | | |___| _ \ / _ \ / _ \| __| | ||
+ | | |_| |___| |_) | (_) | (_) | |_ | ||
+ | | ||
+ | ** MARVELL BOARD: DB-88F6282A-BP LE TS-120 ,PHY=1.8v | ||
+ | |||
+ | U-Boot 1.1.4 (Nov 5 2012 - 17:39:47) Marvell version: 3.5.3 | ||
+ | |||
+ | U-Boot code: 00600000 -> 0067FFF0 | ||
+ | |||
+ | Soc: MV88F6282 Rev 1CPU running @ 1600Mhz L2 running @ 533Mhz | ||
+ | SysClock = 533Mhz , TClock = 200Mhz | ||
+ | </ | ||
+ | ===== Real Time Clock rtc0 ===== | ||
+ | |||
+ | Into the QNAP TS-120 there is a Real Time Clock. You can see the battery on the motherboard and the kernel will print this on the serial console: | ||
+ | |||
+ | < | ||
+ | [ 1.262622] hctosys: unable to open rtc device (rtc0) | ||
+ | [ 1.628724] rtc-s35390a 0-0030: rtc core: registered rtc-s35390a as rtc0 | ||
+ | </ | ||
+ | |||
+ | The problem is that the rtc support is **compiled as a module** and the kernel executes **hctosys** before the module is loaded, so before the **rtc0** device is available. When the **rtc0** device becomes available, the **udev** subsystem is triggered by the file **/ | ||
+ | |||
+ | Historically that script does nothing if **systemd** is running, because it assumes that the system clock was already set from the hardware clock. See Debian bug **[[https:// | ||
+ | |||
+ | A quick and dirty solution is to edit the script **/ | ||
+ | |||
+ | < | ||
+ | #if [ -e / | ||
+ | # exit 0 | ||
+ | #fi | ||
+ | </ | ||
+ | |||
+ | You should also comment-out the **hwclock** commands containing the **%%--systz%%** option, (from the man page: "//It is intended to be used in a startup script on systems with kernels above version 2.6 where you know the System Clock has been set from the Hardware Clock by the kernel during boot//" | ||
+ | |||
+ | < | ||
+ | #/ | ||
+ | ... | ||
+ | #/ | ||
+ | </ | ||
===== Upgrading to 4 Tb Hard Disk ===== | ===== Upgrading to 4 Tb Hard Disk ===== | ||
Line 116: | Line 171: | ||
</ | </ | ||
- | ==== Dump and restore ==== | + | ==== Partition, dump and restore ==== |
To avoid a complete reinstall, I **connected the new disk to a GNU/Linux computer**, then partitioned the disk and performed a dump/ | To avoid a complete reinstall, I **connected the new disk to a GNU/Linux computer**, then partitioned the disk and performed a dump/ | ||
- | For partitioning I used **parted**. Fortunately the hard disk was seen correctly both on the computer and later on the QNAP, I mean in particular | + | For partitioning I used **parted**, see above for the partition schema. I created the ext4 filesystem and performed a dump/ |
+ | |||
+ | <code bash> | ||
+ | mkfs.ext4 /dev/sdb1 | ||
+ | mkswap /dev/sdb2 | ||
+ | blkid /dev/sdb1 | ||
+ | blkid /dev/sdb2 | ||
+ | # Take note of the UUIDs of new partitions. | ||
+ | mount /dev/sdb1 /mnt | ||
+ | cd /mnt | ||
+ | ssh root@qnap.lan 'dump -0 -a -b 64 -f - / | ||
+ | vi / | ||
+ | # Update the UUIDs in fstab. | ||
+ | </ | ||
+ | |||
+ | **WARNING**: | ||
+ | |||
+ | Fortunately the hard disk was seen correctly both on the computer and later on the QNAP, I mean in particular | ||
< | < | ||
Line 127: | Line 199: | ||
Supports 48-bit addressing | Supports 48-bit addressing | ||
Capacity: 1718295.8 MB = 1678.0 GB (-775897424 x 512) | Capacity: 1718295.8 MB = 1678.0 GB (-775897424 x 512) | ||
+ | </ | ||
+ | |||
+ | but from the kernel point of view, everything seems ok: | ||
+ | |||
+ | < | ||
+ | scsi 1:0:0:0: Direct-Access | ||
+ | sd 1:0:0:0: [sda] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB) | ||
+ | sd 1:0:0:0: [sda] 4096-byte physical blocks | ||
+ | sd 1:0:0:0: [sda] Write Protect is off | ||
+ | sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn' | ||
+ | sda: sda1 sda2 sda3 | ||
+ | sd 1:0:0:0: [sda] Attached SCSI disk | ||
</ | </ | ||
==== Beware the UUID of root filesystem ==== | ==== Beware the UUID of root filesystem ==== | ||
- | Beware that the **initramfs** installed into the **flash memory** | + | Once the new disk was partitioned, |
If you forget this step (like I did) you can attach to the **serial console** and fix the problem. | If you forget this step (like I did) you can attach to the **serial console** and fix the problem. | ||
Line 155: | Line 239: | ||
</ | </ | ||
- | The **update-initramsf** on the QNAP will call the **flash-kernel** tool to write the **kernel** and the **initramfs** images to the proper flash partitions. Flashing the images requires some minutes. | + | The **update-initramsf** on the QNAP will call the **flash-kernel** tool to write the **kernel** and the **initramfs** images to the proper flash partitions. Flashing the images requires some minutes. You can verify that the proper //rootfs// device is written into the // |
- | + | ||
- | You can verify that the proper //rootfs// device is written into the // | + | |
< | < | ||
Line 169: | Line 251: | ||
</ | </ | ||
- | Now try to reboot. If the problem is fixed, you may remove the file **/ | + | Now try to reboot. If the problem is fixed, you may remove the file **/ |
+ | |||
+ | ===== USB audio dongle ===== | ||
+ | |||
+ | I use the QNAP also as a **media player** because it stores all my audio files. I attached it to my HiFi amplifier through an **USB audio dongle** and an **audio cable** (3.5 mm jack - RCA stereo plugs). | ||
+ | |||
+ | I faced a problem with that audio USB interface, because at every reboot the device is not working and it does not show in **lsusb** output. The manual workaround was to unplup and re-plug the device into the USB port. | ||
+ | |||
+ | Fortunately it is possibile to force the re-initialization of the USB controller with the following script: | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/sh | ||
+ | # If the USB audio device is missing, try to reset the USB controller. | ||
+ | # USB 2.0 devices may be under / | ||
+ | PATH="/ | ||
+ | lsusb | grep -q ' | ||
+ | RET=$? | ||
+ | if [ " | ||
+ | echo "USB audio device missing, trying to reset the bus." | ||
+ | cd / | ||
+ | echo -n " | ||
+ | sleep 1 | ||
+ | echo -n " | ||
+ | fi | ||
+ | </ | ||
+ | |||
+ | So I created a systemd service to be run when the host reaches the multi-user target. Create the file **/ | ||
+ | |||
+ | < | ||
+ | # / | ||
+ | # | ||
+ | # Service executed once the system has reached the multi-user status. | ||
+ | # | ||
+ | # Type=oneshot | ||
+ | # RemainAfterExit=yes | ||
+ | # when all its processes exited. | ||
+ | # | ||
+ | # Eanble the service with: | ||
+ | # | ||
+ | |||
+ | [Service] | ||
+ | Type=oneshot | ||
+ | RemainAfterExit=yes | ||
+ | ExecStart=/ | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </ | ||
+ | |||
+ | Enable and start the service with: | ||
+ | |||
+ | < | ||
+ | systemctl --now enable usb-audio-dongle-reset.service | ||
+ | </ | ||
doc/appunti/hardware/qnap_ts-120.1644566843.txt.gz · Last modified: 2022/02/11 09:07 by niccolo