📜 ⬆️ ⬇️

Replacing HDD on NetUP tape drive and installing firmware




Prehistory


Recently, one of the NetUP streamers stopped broadcasting. "Hangs," I thought (they have such a "feature"), and went to reboot it. Since these streamers do not have a power on-off button or a reset button; they are reset only by pulling out the power cord.

Some time later, after I returned the power to him, the streamer displayed an inscription on the LCD panel: “Checking HDD filesystem ...”. Left it in this state with the thought that it will check the disk and start. However, this did not happen an hour or two later. On the tape drive continued to show the inscription about checking HDD. It was not possible to connect via the console cable. Also, no subsequent reloads led to anything. I decided to get the hard drive and check it on the bad block. There was not a small number of sectors for which Remap or Erase could not be made.
')
The conclusion is simple: you need to change the hard drive. There are no problems with the replacement itself, I did not pull out the worker, I installed the worker. But now we have a bare piece of hardware without an OS (firmware).

How to install the firmware from scratch and will continue the story.

Vyrianty


Personally, I see only the 3rd option how to do it:
  1. Contact NETUP technical support
  2. Clone HDD from another tape drive
  3. Deal with the firmware, what it is, and how to install it

The first option is suitable for those who bought this product less than a year ago, because technical support is provided within a year after purchase. And also to those who pay technical support NetUP. This option does not suit me, because I bought more than a year ago, but I don’t see any reason to pay a year of technical support for an hour of work.

The second option is quite acceptable. It is only necessary to redeem one of the working streamers, to clone its disk with some program. But I did not want to dismantle another streamer from the rack, and secondly, I did not want to stop broadcasting other channels (subscribers do not like it).

The third option suited me perfectly for all the above enumerated criteria. Plus, it's just interesting and informative.

Training


To make the tape drive work, we need:
  1. USB flash drive
  2. Console cable
  3. Router
  4. Firmware image
  5. LiveFlash image

Now for each item separately.

USB flash drive fits any size, starting from 128 MB, because LiveFlash image, takes about 100 MB.

Console cable for connecting to a tape drive and changing BIOS settings. There is no video output on the tape drive.

The streamer needs to be connected to the router so that after booting from the USB flash drive you can connect to it via SSH for further work.

The firmware image is downloaded from the site netup.tv, section “My Account> Files> Stable Version”. I used firmware-streamer-standalone.1.11.117.

LiveFlash image is also from the site. Section "My Account> Files> Public Files." There are two images, LiveFlash and LiveCD, but the drive does not have a CD drive. In general, I think any Linux distribution kit that can boot from a flash drive will do. In the image from NetUP, I did not see anything special that would not be in other distributions. But I used it.

Let's start


Firmware

As it turned out, the firmware image is a tar.gz archive. Therefore, unpack the archive.

tar -xvf firmware-streamer-standalone.1.11.117 

There are four files in the archive: filesystem, info, initrd.img and vmlinuz.

The filesystem is, as the name suggests, a file system image packaged in Squashfs.

info - this contains information about the firmware: checksums, version, revision, type and date of creation.

initrd.img and vmlinuz are a ramdisk and a kernel.

All these files will be needed later.

Liveflash

It's simple. We write down the downloaded image on the USB flash drive. I did it through dd:

 dd if=liveflash.img of=/dev/sdb bs=1M 

Loading

You need to connect the console cable, patch cord to the router, insert the USB flash drive into the tape drive and run it.

Now you need to do something that is not in the documentation. We need to boot from USB Flash, for it is in the BIOS you need to specify it first in the boot queue. To see the download process and at the right time, press the "Del" key, connect via a console cable to the tape drive. This can be done via HyperTerminal, putty, etc. I personally used minicom. In the connection parameters, in addition to the COM port number, you must specify the speed / parity / bits 115200 8N1, as well as disable hardware and software flow control. It’s not in the documentation, or rather there is a console cable connection at a speed of 19200 8N1, but with such settings, the POST message port and the BIOS itself will not be seen. So you can connect only to a working tape drive, for example, if it does not have a network connection for SSH access.

After we got into the BIOS and set to boot from USB Flash, we exit the BIOS and save the settings. F4, if I'm not mistaken, or through the menu item "Save & Exit". Now the tape will be loaded from a flash drive. But there is one caveat: the fact is that the “Boot from local harddrive” option is selected by default on the LiveFlash loader menu, which of course does not suit us, because our disk is still empty. With a serial port speed of 115200, the bootloader menu is not visible. Therefore, immediately after the tape drive has gone into reboot, we change the speed to 19200 and see the flash drive bootloader. Select the topmost item “Boot LiveFlash” and press “Enter”.

After the streamer has booted from LiveFlash, you need to go to the router's WEB interface and see what IP address it received. Next, using any SSH client, connect to the tape drive with root username and password netup123 .

Disk

Here we are connected to our streamer via SSH, or rather, to the Live system, which is running on our tape drive.

The first thing we need to do is to partition the hard disk into sections, format and mount them into the necessary directories.

Split as follows: the first partition is 5 GB., The second is everything else (to be honest, it remains a mystery to me, for which NetUP uses 1 TB disks if a maximum of 15 GB of disk space is used). You can partition into sections using the fdisk utility that is present in the system.

 fdisk /dev/sda 

It is quite simple to use fdisk, here I will not describe this, since this is beyond the scope of the article.

Once the partitions are created and the new partition table is written to disk, they need to be formatted:

 mkfs.ext3 /dev/sda1 mkfs.ext3 /dev/sda2 

Now we mount:

 mount /dev/sda1 /mnt/flash mount /dev/sda2 /mnt/hdd 

Everything, we are ready to start installing the firmware on these disks.

Loader

GRUB is used on tape drives. You need to install it with the option --root-directory = / mnt / flash, since It is necessary that the / boot directory and bootloader configuration files be on sda1:

 grub-install --root-directory=/mnt/flash /dev/sda 

The boot loader is installed, then you need to create a menu.lst file in the / mnt / flash / boot / grub directory, which specifies the kernel boot options. Full file content:

menu.lst
default 0
timeout 3

NetUP IPTV title
root (hd0,0)
kernel / boot / vmlinuz root = / dev / ram0 selinux = 0 init = / linuxrc vmalloc = 256m ro netup_flash = sda1 netup_hdd = sda2
initrd /boot/initrd.img

title recovery
root (hd0,0)
kernel / boot / vmlinuz root = / dev / ram0 selinux = 0 init = / recovery ro
initrd /boot/initrd.img

Firmware files

Files files and info files previously extracted from the firmware should be uploaded to the tape drive in the / mnt / flash directory. And the vmlinuz and initrd.img files in / mnt / flash / boot. For this you can use scp for example, personally I used SFTP in Midnight Commander.

Semi final

Actually, this is all. You can type "reboot" in the console of the tape drive, remove the flash drive and wait for our tape drive to load. It will unpack the file system, create a swap file for itself, etc. This will be the standard firmware, with standard settings. If you want to change the default settings, then I will tell you how to do this.

Settings

There are not so many settings:
  1. Interface IP addresses
  2. Routing
  3. Password
  4. Timezone

The firmware uses Aufs, so in order to force the firmware to apply our settings, it is enough to create the appropriate configuration files that will “overlap” the standard configuration files.

Create a directory in which we place our configuration files:

 mkdir /mnt/hdd/netup/sysconfig 


Interface IP addresses

File network.cfg. Record in it looks like:

network.cfg
eth0 10.4.4.176 255.255.255.0 main
eth3 172.16.0.9 255.255.255.0

You can immediately register the addresses that are used on the tape drive, so that later you don’t have to enter the tape drive under standard addresses.

Routing

Routes.cfg file It looks like:

routes.cfg
route add -net "0.0.0.0" gw "172.16.0.1" netmask "0.0.0.0" dev "eth3"

You can also register several routes, one in each line.

Password

The password.cfg file. A password is written here that will be used for access via WEB, SSH and FTP. The password is recorded in clear text.

Timezone

Timezone file Record example:

timezone
Asia / Krasnoyarsk

Total


That's all. As you can see, there is nothing difficult in installing the firmware on a “bare” streamer. It takes very little time, and if you do this through technical support, it will take half a day of talks in the hotline.

So, it's very interesting to do it yourself, quickly and, not least, free of charge.

Source: https://habr.com/ru/post/260727/


All Articles