Welcome! Log In Create A New Profile

Advanced

Bricked Synology DS218j

Posted by elexidor 
Re: Bricked Synology DS218j
January 12, 2023 07:18AM
I can smell the taste of a working DC218j NAS !

I apologise for my poor Linux skills but I'm happy to learn. :)

The file system thing is little bit strange. I do not have an Ubuntu/Linux machine so I used DiskGenius on Winows for creation of the USB disk partion/filesystem (ext3).

I did it once more to verify and notised that the file system was ext3 but after inserting the USB disk into the DS218j box it was changed to ext4 after the boot and the file check procedure was completed.?!?

Because of that I changed the approach. I don't want to use my working DS220j for format/partioning with the risk of ending up with a wiped drive ... so I decided to take a second USB disk and formated it in the DS218j box from the maintinance shell according to to your guide. After that it stays with ext3 and I assume it's ok then.

This is the printout:
The partition table has been altered.
Calling ioctl() to re-read partition table.
[  619.697106][ T3141]  sda: sda1
Syncing disks.

[  619.707729][ T1728]  sda: sda1
root@debian:~# lsblk
lsblk
NAME      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda         8:0    1  239G  0 disk 
`-sda1      8:1    1  239G  0 part 
sdb         8:16   1 14.5G  0 disk 
`-sdb1      8:17   1 14.5G  0 part /
mtdblock0  31:0    0    4M  0 disk 
mtdblock1  31:1    0    4M  0 disk 
root@debian:~# mkfs.ext3 -L rootfs /dev/sda
mkfs.ext3 -L rootfs /dev/sda
mke2fs 1.44.5 (15-Dec-2018)
Found a gpt partition table in /dev/sda
Proceed anyway? (y,N) y
y
Creating filesystem with 62656641 4k blocks and 15671296 inodes
Filesystem UUID: ea9e7a01-3ce8-4c1c-bebd-9caf88714c21
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done                            
Writing inode tables: 1526/191done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done

root@debian:~# lsblk
lsblk
NAME      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda         8:0    1  239G  0 disk 
sdb         8:16   1 14.5G  0 disk 
`-sdb1      8:17   1 14.5G  0 part /
mtdblock0  31:0    0    4M  0 disk 
mtdblock1  31:1    0    4M  0 disk 
root@debian:~#


So the current status is that the box boots like a charm (as I understand...) with tftpboot using 5.2.9/RS816 and comes to the maintinance shell relatively quick. However, when I run the "reboot" command It boots with the original kernel and DiskRAM with the CRC error.

I don't really understand when it shall repair that or if the idea is to always boot from the USB in some way?

I attach a screen dump of the actual disk format of the USB drive I currently using and a complete log file for the boot and re-boot.

I really appreciate your help bodhi!



Edited 2 time(s). Last edit at 01/12/2023 09:12AM by elexidor.
Attachments:
open | download - synology_ds218j_boot_5_2_9_EXT3_format_linux_boot_reboot.txt (43.1 KB)
open | download - genius_usb_ext3.png (91.7 KB)
Re: Bricked Synology DS218j
January 12, 2023 02:53PM
elexidor,

> The file system thing is little bit strange. I do
> not have an Ubuntu/Linux machine so I used
> DiskGenius on Winows for creation of the USB disk
> partion/filesystem (ext3).

That explained the weird problem. As always, the rootfs must be created natively on a Linux system.

> root@debian:~# lsblk

> sda 8:0 1 239G 0 disk
> `-sda1 8:1 1 239G 0 part

> root@debian:~# mkfs.ext3 -L rootfs /dev/sda

That was wrong. You want to format the partition (sda is the whole disk). Should be

mkfs.ext3 -L rootfs /dev/sda1

> Found a gpt partition table in /dev/sda

That's also not very good. You are still testing the rootfs, so it should be MBR partition. Use GPT only when you know the boot loader can handle it.

However, in this case, you are loading the kernel files via tftp, so once the kernel is running, the rootfs will be mounted OK.

> So the current status is that the box boots like a
> charm (as I understand...) with tftpboot using
> 5.2.9/RS816 and comes to the maintinance shell
> relatively quick.

It should be able to boot all the way to the Debian login prompt if the disk was correctly formatted. So redo it one more time with my correction above.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Bricked Synology DS218j
January 12, 2023 03:19PM
Quote
bodhi
That was wrong. You want to format the partition (sda is the whole disk). Should be
Ahh, of course!

Quote
bodhi
It should be able to boot all the way to the Debian login prompt if the disk was correctly formatted. So redo it one more time with my correction above.
I must have used the wrong expression. It does boot all the way to the login promt.

From synology_ds218j_boot_5_2_9_EXT3_format_linux_boot_reboot.txt:

Debian GNU/Linux 10 debian ttyS0

debian login: root
root

Password: root

Last login: Thu Jan 12 02:52:48 PST 2023 on ttyS0
Linux debian 5.2.9-mvebu-tld-1 #1 SMP PREEMPT Mon Aug 19 12:47:39 PDT 2019 armv7l
Re: Bricked Synology DS218j
January 12, 2023 04:46PM
I have now created a new USB disk entirely from a Linux system.
Attached is a log file from start to finish at the debian login, then a lsblk -f command to show the file system and finally a reboot command.
Attachments:
open | download - synology_ds218j_boot_5_2_9_EXT3_format_partioning_linux_boot_reboot.txt (43.4 KB)
Re: Bricked Synology DS218j
January 12, 2023 07:15PM
elexidor,

> Attached is a log file from start to finish at the
> debian login, then a lsblk -f command to show the
> file system and finally a reboot command.

Congrats! you're almost done.

The reason the reboot does not work because you have not set up the u-boot envs to boot automatically and save them to flash. So at the u-boot prompt you will need to execute them again. Let me write them for you.

But in the mean time, you should be OK to explore and install Debian packages that you want to use. See the Wiki thread for ideas.

And first thing you should do is to create a swap file on this USB rootfs

Quote
Wiki tthread

Memory & Swap Settings

Tuning for low RAM boxes
logrotate examples
How to create and use a Swap file

Create the swap file while you are SSH in from another Linux box (just to see if you can connect).

Find out what this box IP address is from the serial boot log (at the end). You must have copy the log from putty, it is not legible at some section.
ssh root@thisboxIPaddress


====================================================

Here is what I think you should do while waiting for me. And you can do this inside this box now (great to have a running system to play with :).

Use another USB flash drive to create the rootfs again, using the latest rootfs Debian-5.13.8-mvebu-tld-1-rootfs-bodhi.tar.bz2 (28 Sept 2021). See if you can boot it exactly the same way as with your current Debian-5.2.9-mvebu-tld-1-rootfs-bodhi.tar.bz2 rootfs.

If you can boot this successfully, it will save a lot of time upgrading to Debian bullseye (the Debian-5.2.9-mvebu-tld-1-rootfs-bodhi.tar.bz2 is Debian buster)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Bricked Synology DS218j
January 13, 2023 03:26AM
Quote
bodhi
Congrats! you're almost done.

I love that sentence! :))

Quote

The reason the reboot does not work because you have not set up the u-boot envs to boot automatically and save them to flash.

Aha!

Quote

But in the mean time, you should be OK to explore and install Debian packages that you want to use

I have no clue what I want or need. :) At this point I just want to bring up the Synology DSM again. Later on I will use this NAS just as a backup station and probably a Linux system to play/experiment with. :)

Quote

And first thing you should do is to create a swap file on this USB rootfs

I followed the guide and after a reboot it seems to work:
Linux version 5.2.9-mvebu-tld-1 (root@tldDebianVM) (gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)) #1 SMP PREEMPT Mon Aug 19 12:47:39 PDT 2019
Debian 10.0
Fri Jan 13 00:41:49 PST 2023 up 0 minutes
root@debian:~# free -h
free -h
              total        used        free      shared  buff/cache   available
Mem:          493Mi        22Mi       428Mi       1.0Mi        42Mi       352Mi
Swap:            0B          0B          0B
root@debian:~#

Quote

Use another USB flash drive to create the rootfs again, using the latest rootfs Debian-5.13.8-mvebu-tld-1-rootfs-bodhi.tar.bz2 (28 Sept 2021). See if you can boot it exactly the same way as with your current Debian-5.2.9-mvebu-tld-1-rootfs-bodhi.tar.bz2 rootfs.

I created an USB disk from scratch but unfortunately it can't boot with this version. I attach a log file.
Attachments:
open | download - synology_ds218j_boot_5_13_8_EXT3_format_partioning_linux_boot_fail.txt (28.4 KB)
Re: Bricked Synology DS218j
January 13, 2023 03:02PM
elexidor ,

> I have no clue what I want or need. :) At this
> point I just want to bring up the Synology DSM
> again.

OK. I was not aware that is the only goal you are after :)

Then there is no need to do much Debian-wise further. You should look for DSM firmware kernel image and initrd and then write them to flash.

> Swap: 0B 0B 0B

Swap file does not seem to work. Note everything is 0B.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Bricked Synology DS218j
January 15, 2023 09:44AM
Quote
bodhi
You should look for DSM firmware kernel image and initrd and then write them to flash.

Ok, I have found a package from Synology which is not encrypted and will try to create an uImage using the RS816 DTB. I assume that is the best.
Re: Bricked Synology DS218j
January 15, 2023 02:44PM
> Ok, I have found a package from Synology which is
> not encrypted and will try to create an uImage
> using the RS816 DTB. I assume that is the best.

Not really. You need the kernel images from DSM, similar to ones you used before.

tftpboot 0xd00000 zImage
tftpboot 0x800000 rd.bin
tftpboot 0x1000000 dtbdump_3.dtb

Also look for Rescue FW that run from USB upon power up.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
radium
Re: Bricked Synology DS218j
January 18, 2023 05:32PM
Re: Bricked Synology DS218j
January 19, 2023 07:42AM
bodhi Wrote:
-------------------------------------------------------
> > Ok, I have found a package from Synology which
> is
> > not encrypted and will try to create an uImage
> > using the RS816 DTB. I assume that is the best.
>
> Not really. You need the kernel images from DSM,
> similar to ones you used before.
>
>
> tftpboot 0xd00000 zImage
> tftpboot 0x800000 rd.bin
> tftpboot 0x1000000 dtbdump_3.dtb
>
>
Hm. I can't find any dtp-file in the Synology package.

If I use the zImage and rd.bin from the package and the dtbdump_3.dtb I found in this forum the result is pretty the same as my initial post. The box boots and brings up a web-interface where I can start a DSM update. After a while during the update process an error message is shown indicating the file may be corrupt. Log file attached.

If I use the armada-385-synology-rs816.dtb instead the result is the same as in this post. It stops booting at "Uncompressing Linux... done, booting the kernel."
https://forum.doozan.com/read.php?3,133785,133790#msg-133790



Edited 1 time(s). Last edit at 01/19/2023 07:48AM by elexidor.
Attachments:
open | download - synology_ds218j_boot_dsm7.txt (31.5 KB)
Re: Bricked Synology DS218j
January 19, 2023 07:48AM
radium Wrote:
-------------------------------------------------------
> https://www.synology-forum.de/threads/ds218j-blinkt-blau-nach-gescheitertem-fw-update-full-unbrick-user-story.124187/
>
> You can try this


Ok, I'll check it out and mess with the German language a bit :)
Re: Bricked Synology DS218j
February 18, 2023 09:01AM
Hi again!

A lot has come in between, but I thought I'd look further into this now. Unfortunately, I can't find any rescue files that are needed, so I'm unfortunately a bit stuck. Hmm.
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: