How to fix BTRFS error (device mmcblk0p1)?

Yesterday before system upgrade I’ve lost connection on router ports and lan. After restarting router, it was fine.

But today, I am unable to update system, I am even not able to login to basic administration (getting TransportError: Not connected to NETCONF server).

I connected via ssh to router and checked /var/log/messages

There is some BTRFS error:

2016-12-09T17:40:40+01:00 err kernel[]: [63939.534490] BTRFS error (device mmcblk0p1): bad tree block start 0 309260288
2016-12-09T17:40:40+01:00 err kernel[]: [63939.541972] BTRFS error (device mmcblk0p1): bad tree block start 0 309260288
2016-12-09T17:40:40+01:00 err kernel[]: [63939.549250] BTRFS error (device mmcblk0p1): bad tree block start 0 309260288
2016-12-09T17:40:40+01:00 err kernel[]: [63939.556703] BTRFS error (device mmcblk0p1): bad tree block start 0 309260288
...

After searching I’ve found https://btrfs.wiki.kernel.org/index.php/Btrfsck
Can you help me, how can I use that in Omnia Router?

I’ve tried to umount / but I get only target is busy error.

Kernel is stil: 4.4.35-34abcd5e548fc8ed5390269f3a31d173-15

Thank you for any advice.

1 Like

I did 3 LED factory reset, setup same configuration back and it helped.

https://www.turris.cz/doc/en/howto/omnia_factory_reset

I did experience the same issue on my Turris Omnia. Multiple files are not readable anymore (DNS config and others), so the router is no longer usable.

During boot dmesg gives

[   35.902266] BTRFS error (device mmcblk0p1): bad tree block start 3255307777127299137 1096470528
[   35.911235] BTRFS error (device mmcblk0p1): bad tree block start 3255307777127299137 1096470528
[   41.214677] BTRFS error (device mmcblk0p1): bad tree block start 3255307777716015685 1096589312
[   41.223665] BTRFS error (device mmcblk0p1): bad tree block start 3255307777716015685 1096589312
[   41.233122] BTRFS: error (device mmcblk0p1) in __btrfs_cow_block:1156: errno=-5 IO failure
[   41.241432] BTRFS: error (device mmcblk0p1) in btrfs_add_link:6266: errno=-5 IO failure
[   42.456466] BTRFS error (device mmcblk0p1): bad tree block start 3255307778370192707 1096486912
[   42.465439] BTRFS error (device mmcblk0p1): bad tree block start 3255307778370192707 1096486912

(I took only a sample, the total list of errors is longer but comparable.)

Any idea what is causing this? Or how to fix it?
I would prefer to prevent a Omnia 3 LED factory reset as this would result in a loss of all my settings and data on the router.

I want to write a small recap of the steps I performed to get my Omnia back online. Just in case someone else experiences the same issue.

  1. Setup a DHCP and TFTP server serving the next 3 files:
    $ wget https://d-i.debian.org/daily-images/armhf/daily/netboot/vmlinuz
    $ wget https://d-i.debian.org/daily-images/armhf/daily/netboot/initrd.gz
    $ wget https://d-i.debian.org/daily-images/armhf/daily/device-tree/armada-385-turris-omnia.dtb
  2. Connect a network cable to the WAN port of your Omnia. (Make sure the DHCP / TFTP servers are reachable.)
  3. Connect your PC to the serial interface on the Omnia.
    $ screen /dev/tty.SLAB_USBtoUART 115200
  4. Start your Omnia and halt the boot process by pressing any key.
  5. Enter the following commands on the U-Boot prompt (don’t forget to adjust the IP address of your TFTP server)
    mw 0xf1020300 0x403
    dhcp
    setenv serverip 192.168.111.1
    tftpboot 0x01000000 vmlinuz
    tftpboot 0x02000000 armada-385-turris-omnia.dtb
    tftpboot 0x03000000 initrd.gz
    bootz 0x01000000 0x03000000:$filesize 0x02000000
  6. If you receive error message
    Wrong Ramdisk Image Format
    Ramdisk image is corrupt or invalid
    you first have to update the U-Boot bootloader of the Omnia by downloading and serving https://repo.turris.cz/omnia-test/nor_fw/uboot-turris-omnia-spl.kwb on your TFTP server
    and entering these 3 commands on the U-Boot prompt:
    tftpboot 0x1000000 uboot-turris-omnia-spl.kwb
    sf probe
    sf update 0x1000000 0 $filesize
    now reboot your Omnia and start again at step 4.
  7. The Debian installer will start (don’t worry, we won’t install Debian, nor will we make any changes to the Omnia filesystem)
  8. Follow along with the Debian installer until the partitioning step (Do NOT repartition your Omnia or you will lose all data and settings!!!)
  9. Switch to the screen virtual terminal by pressing Ctrl-a-a-2 (We have a screen session in a screen session.)
  10. Now you can enter commands to rescue your Omnia. YMMV, but
    I mounted an external USB drive on /mnt/restore and was able to recover most files using
    btrfs restore -ios /dev/mmcblk0p1 /mnt/restore/
    btrfs check gave a lot of errors (6000+ lines of output)
    btrfs check /dev/mmcblk0p1
    alas repairing was not possible in my case
    btrfs check --repair /dev/mmcblk0p1
  11. I did a 4 LED factory reset and used the restored files on /mnt/restore to reconfigure the router.

I still don’t know what caused this massive filesystem failure (suggestions are always welcome), but my Omnia is back online for a couple of weeks now without any issues.
Try it at your own risk and good luck :slight_smile:

Useful links:

4 Likes