Installing Debian8 on a Ubiquity AirVision [Unifi-Video] NVR.

posted in: Allgemein | 0

This assumes that you do not have another working NVR to DD [clone] the HDD from.
In my case the HDD died and of course I had no backup image.

1. Ok, first things first, do not believe these instructions.
Use at your own risk, there are no warranties that this procedure wonĂ­t Bork your NVR.
There is no reason it should Bork your NVR, or do anything else undesirable, but…
Remember Murphy’s Law – Anything that can go wrong, will go wrong.
You mileage may vary.

Ok, these are my cookbook instructions…. sometimes it assumes you know, sometimes it assumes you may not know.
I suggest you follow these instructions once to see that it does work, then roll your own.
You will have to interpolate here and there where the situation requires it.
I am not going into HTTP Proxy and other spelunking – just the basics.
Soup to nuts following this rant is a good hour plus after you get past step #2, finding the ISO & FW driver.
Oh yes, since the AirVision NVR is a minimal system there is no built-in CD/DVD drive.
I used my trusty Samsung SE-208 – Slim Portable DVD Writer – USB Flash ISO’s can be a pain for simple things.

2. D/L the Debian8 Lite Installer ISO and burn it to a CD/DVD or USB Flash Drive if you are adventurous.
I do not know why the Lite installer works better, it just does [at least for me…].
I found “debian-8.0.0-amd64-netinst.iso”, you might find others.

You will also need the Realtek driver for the NIC.
A simple Google Search for “Missing FW rtl_nic/rtl8168e-3.fw” will locate the Firmware Driver – D/L the tar.gz
I found “firmware-nonfree_0.36+wheezy.1.tar.gz”, you might find others.
After D/L’ing the tar.gz file, open it and copy “rtl_nic/rtl8186e-3.fw” to a USB Flash Drive.

3. Power on the NVR, tapping F11 to select the boot device, select the USB Boot Device from the list.
Select Install, do not use the Graphical Installer – It’s a PITA and slower.
United States
American English

4. Loading Additional Components
Wait, wait, wait.

5. Detect Network Hardware – YES.
Missing FW rtl_nic/rtl8168e-3.fw error is displayed.
Insert that USB Flash Drive from the second half of step #2 – press ENTER.
You can remove the USB Flash drive in a minute or so.

6. Configure the Network – enter the following…
Hostname what you want to call your NVR [DebianVision, etc.] Domain talk to your IT if you do not know.
Root Password
Root Password confirmation – just in case your fingers tend to betray you.
Full User Name [John Q. Public, etc.] Username for your account this is normally the lower case of the first word from above.
User Password
User Password confirmation – see above.
Time Zone

7. Partition Disk
Guided – Use Entire Disk.
Accept the displayed information.
All files in one partition. I’ve gotten adventurous here and it usually screws up when you
choose others.
Finish partitioning – Write Changes – YES.
Wait, wait, wait.

8. Package Downloader
Select the first one – if that fails, select another.

HTTP Proxy – just press enter unless you have one.
Wait, wait, wait

Confirm Popularity Contest – participate – Yes / No.

9. Software Selection
Note – the NVR in the box from UBNT is headless and the GUI just makes it unstable as well as using resources.
Note – I’ve tried them all and Cinnamon is probably the best [make sure to assign 64MB or more to the Video in BIOS]

Make sure to select SSH if you want to administer it via SSH.
Note – Root access via SSH is disabled by default in Debian8.

The Standard System Utilities should be selected.
Wait, wait, wait

10. Install GRUB Boot Loader – YES
Select the device shown [make sure that the USB Flash Drive is not connected] CD/DVD ejects.
The NVR Reboots.

11. Log into the NVR at the console – root / pswd [from step # 6 above] [I have not tried this with v3.1.4, but it should work]


apt-get update

dpkg -i unifi-video_3.1.2~Debian7_amd64.deb
*** note – you will receive errors here for Java, Mogodb, etc…. that’s ok.

apt-get -f install
*** note – this will install the missing items from the failed line above – yes it’s screwy, just do it. [consider it a Nike Deal]

dpkg -i unifi-video_3.1.2~Debian7_amd64.deb
*** note – this time it will install properly.

shutdown -r now

12. From a workstation https://ip.of.your.nvr:7443 ex.
Set Super User Email Address, Password & Time zone
Some other tidbits…

The NVR defaults to a DHCP address.
You should examine /etc/networking/interfaces example

auto lo
iface lo inet loopback

# network this line is usually not necessary
# broadcast ditto
You should also examine /etc/resolv.conf example

nameserver public Google DNS
nameserver ditto
Debian/Unifi-Video installed this way also has an empty Firewall.
I strongly suggest the you install iptables-persistent.

apt-get install iptables-persistent

A sample iptables configuration – add these lines to the minimal iptable created

iptables -A INPUT -p tcp -m tcp –dport 6666 -j ACCEPT only needed with Gen2 cameras
iptables -A INPUT -p tcp -m tcp –dport 7080 -j ACCEPT
iptables -A INPUT -p tcp -m tcp –dport 7443 -j ACCEPT
iptables -A INPUT -p tcp -m tcp –dport 7445 -j ACCEPT video over HTTP
iptables -A INPUT -p tcp -m tcp –dport 7446 -j ACCEPT video over HTTPS
iptables -A INPUT -p tcp -m tcp –dport 7447 -j ACCEPT RSTP

iptables -A INPUT -s -j ACCEPT assumes your cameras are in the same 192.168.1.x range.
add other ranges or static ips as necessary.
Some extra iptables tidbits…

iptables -L command to display the existing iptables.
this is useful if you have fumble fingers like me.

iptables-save > /etc/iptables/rules.v4 allow your firewall to auto-loaded when the NVR boots.
iptables-restore < /etc/iptables/rules.v4 allows you to restore your firewall settings.

Remember to use “iptables-save > /etc/iptables/rules.v4” everytime you change your iptables.
I have found that the default NVR setting for disk space is a screwed up function, at least while using this Debian8 config.
I have tested this on several configurations and the NVR always goes stupid or hangs as disk space approaches critical.
Do yourself a favor and set Time Based Purging to OFF and set a hard minimum limit of about 50GB.

Failing that, as disk space gets tight, the NVR goes stupid and can stop recording, especially the “Always Record” cameras.
At that point you can real-time a camera, but rebooting does not always help recording until the disk space is freed up.
Another way to alleviate other problems with the NVR going stupid and stopping recording is to force a daily restart.
A simple CRON entry to restart at midnight is helpful.

crontab -e

** you will need to select your editor, I like NANO. [use ctrl o, enter, crtl x, to exit]

0 0 * * * /sbin/shutdown -r now