Reply
tiaderosa
Tutor

Step by step instructions to get root access on Stora after a factory reset for dummies

Hi,

I’ve decided to do this step by step guide to try to help guys that, like me, are just beginners in linux.

Every think in this guide is not out of my own work, I’m just putting (copying) together parts of somebody else work.

The whole guide is based on steps that worked in my case, so please do not blame me if it is not working with you or if you brick your system following the guide.

Also, there might be not mandatory steps in my guide as well.

I have used a pc with Ubuntu 14 on it. You can use whatever you want but be aware that additional steps (not in my guide) might be necessary in this case.

Log in ubuntu with root access (if you do not know how to do it just google it, it’s very easy). All the steps below are assumed to be executed with root access.

  • In your ubuntu machine install tftp-hpa, nfs-utils, u-boot-tools and wireshark

 

Spoiler

apt-get update

apt-get install tftp-hpa

apt-get install nfs-kernel-server

apt-get install nfs-utils

apt-get install u-boot-tools

apt-get install wireshark

  • Set up your ethernet interface with the ip of 10.0.0.1 and a netmask of 255.0.0.0, its default route (gateway) needs to be the interface address itself, 10.0.0.1   and connect a network cable from your network plug to the stora one
  • Create the following directories /mnt/Axentra/marvell.nfs.rootfs

 

Spoiler

cd /

mkdir /mnt/Axentra

mkdir /mnt/Axentra/marvell.nfs.rootfs

  • Download Debian-5.2.9-kirkwood-tld-1-rootfs-bodhi.tar.bz2 from here and store it in the above directory
  • Extract these file there

 

Spoiler

cd /mnt/Axentra/marvell.nfs.rootfs

tar xvjf Debian-5.2.9-kirkwood-tld-1-rootfs-bodhi.tar.bz2

  • Edit /mnt/Axentra/marvell.nfs.rootfs/etc/fstab and set/replace with following lines (thanks to Karlchang). I used gedit to do it

 

Spoiler

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
#LABEL=rootfs / ext3 noatime,errors=remount-ro 0 1
10.0.0.1:/mnt/Axentra/marvell.nfs.rootfs / nfs nfsvers=3,wsize=2048,tcp 0 0
tmpfs /tmp tmpfs defaults 0 0

 

  • Generate the uImage with DTB embedded inside

 

Spoiler

cd /mnt/Axentra/marvell.nfs.rootfs/boot

cp -a zImage-5.2.9-kirkwood-tld-1 zImage.fdt

cat dts/kirkwood-netgear_stora_ms2000.dtb >> zImage.fdt

mv uImage uImage.orig

mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-5.2.9-kirkwood-tld-1 -d zImage.fdt uImage

sync

  • Configure nfs-utils to use nfsv2 and UDP (ubuntu 14 has it already)
  • Configure your nfs server by adding the following (one) line in the /etc/exports file:
Spoiler
/mnt/Axentra/marvell.nfs.rootfs/ 10.0.0.0/8(rw,sync,insecure,no_root_squash,no_subtree_check,nohide)
  • Restart the nfs server running:
Spoiler
service nfs-kernel-server restart
  • Check if nfs server is running with the right protocol by running:
Spoiler
rpcinfo -p localhost

      if you see in the output something like the following then is ok.

 

Spoiler

100003    3   tcp   2049  nfs

 100003    2   tcp   2049  nfs

 100227    3   tcp   2049

 100003    2   udp   2049  nfs

 100227    3   udp   2049  nfs       

  • Change the file /etc/default/tftpd-hpa and set the following options:

 

Spoiler

# /etc/default/tftpd-hpa

 

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/mnt/Axentra/marvell.nfs.rootfs/boot"

TFTP_ADDRESS=":69"

TFTP_OPTIONS="--secure"

RUN_DAEMON="yes"

OPTIONS="-l -s /tftpboot

 

  • Copy uImage file to /var/lib/tftpboot

 

Spoiler

cp -af /mnt/Axentra/marvell.nfs.rootfs/boot/uImage /var/lib/tftpboot

 

  •  Restart the daemon
Spoiler
/etc/init.d/tftpd-hpa restart
  • Check if needed service are up and running
Spoiler
service --status-all

        if you find the highlighted lines in the output then it is ok and you can go ahead

 

Spoiler

[ - ]  alsa-utils

 [ - ]  anacron

 [ + ]  avahi-daemon

  …………

 [ + ]  nfs-kernel-server

  …………

 [ + ]  tftpd-hpa

  …………

  • Startup wireshark and start listening to ethx, your network port you have set to 10.0.0.1. If you do not know which one is, run ifconfig to find out

 

  • While holding down the small reset button on the stora with a paper clip, turn on the stora. You'll need to hold in the reset button for quite some time. The green lights on the front panel will go through three cycles. Eventually, you will see the tftp transfer in wireshark, and at this point you can release the reset button. After the tftp transfer, there will be a couple of arp requests, and then you should see the nfs activity. Your Stora boots with the nfs mounted alternate filesystem.

 

  • Once the Stora is booted (wait  for a couple of minutes, at least), you will be able to log into it. By running:
Spoiler
ssh root@10.x.x.x

        where x.x.x denotes the ip of the Stora found in wireshark. The password will be “root

  • Mount the Stora's regular root filesystem, by running the following commands while logged into the Stora:
Spoiler
ubiattach /dev/ubi_ctrl -m 2 -O 2048 && mount -t ubifs /dev/ubi0_0 /mnt/

The Stora's regular file system is now mounted on /mnt/

 

  • Create and add your ssh keys by opening a new terminal in your ubuntu machine.Generate your key in your ubuntu pc by running:cd /

 

Spoiler

> cd /

> ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key /root/.ssh/id_rsa): [Press enter key]

Created directory '/home/tecmint/.ssh'.

Enter passphrase (empty for no passphrase): [Press enter key]

Enter same passphrase again: [Press enter key]

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

5f:ad:40:00:8a:d1:9b:99:b3:b0:f8:08:99:c3:ed:d3 tecmint@tecmint.com

The key's randomart image is:

+--[ RSA 2048]----+

|        ..oooE.++|

|         o. o.o  |

|          ..   . |

|         o  . . o|

|        S .  . + |

|       . .    . o|

|      . o o    ..|

|       + +       |

|        +.       |

+-----------------+

 

  •  Copy the generated keys to NFS rootfs by running:

 

Spoiler

cp -af /root/.ssh/* /mnt/Axentra/marvell.nfs.rootfs/root/.ssh

 

  • Go to the ssh logged to stora terminal and place the public key(id_rsa.pub) to the Stora “authorized_keys”  by running:

 

Spoiler

cp -af /root/.ssh/id_rsa.pub /mnt/root/.ssh/authorized_keys

chmod 700 /mnt/root/.ssh/authorized_keys

 

 

  • To enable root login, you'll want to edit the /mnt/etc/ssh/ssh_config  file on the stora and add the line "PermitRootLogin yes"

 

  • The configuration is completed and now you can shutdown your Stora by running:

 

Spoiler

shutdown -h now

The stora will then shutdown and turn itself off.

Now you can move the Stora back to your regular network, start it again and ssh into it as root by running:

 

Spoiler

ssh root@your_stora_ip

 

Model: MS2000|Media Server|EOL
Message 1 of 10
KarlChang
Tutor

Re: Step by step instructions to get root access on Stora after a factory reset for dummies

It's perfect
Thank you for sorting out more details.
I believe that with your kind assistance, more Stora bricks will be resurrected.

Model: MS2000|Media Server|EOL
Message 2 of 10
dijsil
Aspirant

Re: Step by step instructions to get root access on Stora after a factory reset for dummies

May I add that you need to install the below as the one you installed seems to be the client (sorry I am also new to all this)

 

apt-get install tftpd-hpa

 

also in TFTP config when I have the below command the tftpd-hpa was not able to start and I had to remove the below line

 

OPTIONS="-l -s /tftpboot

 

After pressing the reset button and powering it up I am getting the requests in wireshark however if I give it few minutes and I try to login ssh I am getting connection refused. (video1)

 

If after few minutes I remove the power of the stora and give it power back is starts to load however  it gets ip with 169 (check video2)

 

Video 1:

https://youtu.be/Vht4tQ7l6GM

 

Video2:

https://youtu.be/LPo9oeqGWvw

Message 3 of 10
dijsil
Aspirant

Re: Step by step instructions to get root access on Stora after a factory reset for dummies

after connecting it to the home network again it seems that it is still with the software of stora for some reason it is not pulling the image from the linux server when I am resetting it Smiley Frustrated

 

Any ideas ?

Message 4 of 10
dijsil
Aspirant

Re: Step by step instructions to get root access on Stora after a factory reset for dummies

in the TFTP configuration there is a missing " in the last line

 

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/mnt/Axentra/marvell.nfs.rootfs/boot"

TFTP_ADDRESS=":69"

TFTP_OPTIONS="--secure"

RUN_DAEMON="yes"

OPTIONS="-l -s /tftpboot"

 

however I am still having issues in wireshark it seems that there are some logs with tftp but after giving some time and rebooting it is still loading with its default software. I am starting to give up :/

Message 5 of 10
dijsil
Aspirant

Re: Step by step instructions to get root access on Stora after a factory reset for dummies

This is what wireshark is picking up however after giving it even an hour, I cannot login to telnet and if I reboot the nas it gets booted with factory image

 

https://youtu.be/Cv5KcZOhU4o

Message 6 of 10
Neo__40
Aspirant

Re: Step by step instructions to get root access on Stora after a factory reset for dummies

Hello,
Thank you for this instructions. Everything is all right but when i enter ssh root@IP i have port 22 connection refused and impossible to continue. Do you have some ideas?
Message 7 of 10
dijsil
Aspirant

Re: Step by step instructions to get root access on Stora after a factory reset for dummies

probably you are having the same error as I do. If you connect the NAS back to a router try accessing it via the ip address and probably you still haev the factory image.

Message 8 of 10
Neo__40
Aspirant

Re: Step by step instructions to get root access on Stora after a factory reset for dummies

I will try but it seems to be the same problem. I don't now why because i try different computers and use switch and direct link and i often have this error...
Message 9 of 10
ossienet
Aspirant

Re: Step by step instructions to get root access on Stora after a factory reset for dummies

Not sure if this is the best place to ask.

I have a working Stora with root access, but have had to replace the Hard Disk with a new one. (Old one is gone). Not trying to recover any data, just set up a 'new' Stora. 

How can this be achieved without access to the web interface please? 

I tried with a newly-formatted drive - the Stora is accessible, drive light is orange, and cannot see any shared folders (not surprising with new disk), bit cannot see any way to make the Stora recognise the new disk and create a 'FamilyLibrary' . 

I can SSH to the Stora. 

Message 10 of 10
Top Contributors
Discussion stats
  • 9 replies
  • 730 views
  • 1 kudo
  • 5 in conversation
Announcements