Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Forum for questions and support relating to the 1.26.x releases only.
Locked
rip
Posts: 38
Joined: Sun Sep 02, 2012 8:59 pm

Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Post by rip »

Hello-

I was wondering what the safest way to use Issac Connor's PPA/Package *Thank You, BTW*) when dealing with non-standard locations for images and events.

I have links to a 2TB raid for that stuff, so moving it is a problem. I could make a mountpoint for it as suggested in docs, but would like to minimize changes if I can. FWIW, the OS is running RAID1 (2 drives mirrored).

As expected:

Code: Select all

Aborting installation of zoneminder due to non-default symlinks in
/usr/share/zoneminder for the images and/or events directory, which could
result in loss of data. Please move your data in each of these directories to
/var/cache/zoneminder before installing zoneminder from the package.
dpkg: error processing /var/cache/apt/archives/zoneminder_1.26.5-1_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
I'm assuming the solution I want is probably hacking up the default script for this, but figured I better ask...as I am also making the gross assumption I'm not the only person so situated.

As for preserving the events themselves, I'm ok with loosing them, there is nothing critical there at the moment (fingers crossed, lol), so long as I can preserve the configuration and gracefully groom the database. I have a mix of analog (via blurcherry card) and IP cameras (Mostly Arecont) that took a long time to get dialed in, rather not do that again. :)

Thanks!
B_jare_hotrods
Posts: 6
Joined: Fri Jan 10, 2014 4:38 am

Re: Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Post by B_jare_hotrods »

Im not sure if this will work for you but this is what I did because I am running linux mint 16 kde which is based off of ubuntu 1310 saucy
I did it this way because first of all there is no saucy listing in that repository it only goes up to raring and am having too many issues with apache 2 version 2 4 you can type in the iconnor link and your address bar and check it out if needed but i did the step to add the iconnor repository out ofhttp://www.zoneminder.com/wiki/index.ph ... e_easy_way
then went into my synaptic package manager and you can see the launchpad listing i just edited it from saucy to raring then i also added four new duplicate lines to the main repositories and changed them from saucy to raring then went into the next option out of the menu bar which is preferences and changes the prefered distribution to raring updates repository then reloaded

from here you could use the synaptic package manager to install zoneminder or go back to the terminal and do it this leaves me with apache 2 point 2 because i cant get the live event view to work when it upgrades to apache 2 point 4

one you install you have to follow the install from deb steps in the main documentation section from the wiki

i did all this from a fresh reinstall to clear everything out cause its hard at least for me to try to get some of these to install when it already has the later version installed and also the update manager has an ignore package option for updates i put in apache 2 and php 5 so they wont change

i have live view working just havent been able to get the cameras to move like i have before but hope this temporary solution helps
TheKorn
Posts: 142
Joined: Fri Aug 02, 2013 12:39 pm

Re: Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Post by TheKorn »

rip wrote:I was wondering what the safest way to use Issac Connor's PPA/Package *Thank You, BTW*) when dealing with non-standard locations for images and events.
What, you mean you don't want to chuck everything in /usr/share/zoneminder? How dare you!! (/s)

(...neither did I. :D )
I have links to a 2TB raid for that stuff, so moving it is a problem.
I'm in a much worse case; I have 20TB of ZFS storage, but /usr/ lives on a 120GB SSD! It's physically impossible for me to simply move the data where the original symlinks pointed to!
I'm assuming the solution I want is probably hacking up the default script for this, but figured I better ask...as I am also making the gross assumption I'm not the only person so situated.
I came up with a better method than hacking up the default install script. Seems to have worked, though my upgrade is only a few hours old. Using this method, all old events were preserved and zmaudit doesn't go nuts. Pretty much everything I could have asked for!
  • First, back up your zm database and take a snapshot of wherever your images and events are stored. If your FS doesn't support snapshots, back up the images and events directory, just in case things go horribly wrong.
  • From the web gui, disable all filters that delete events and run in the background. Just in case.
  • From the web gui, disable zmaudit in options. (Again, just in case!)
  • Open a terminal and become root so you don't have to type "sudo" in front of the next fourteen commands.

    sudo su
  • Stop zoneminder

    /etc/init.d/zoneminder stop
  • Now you need to rename your existing symlinks in /usr/share/zoneminder , so that you can put them back after you upgrade.

    cd /usr/share/zoneminder
    mv events events.temp
    mv images images.temp
  • Make the symlinks that the zoneminder script is expecting to find, so it stops complaining.

    ln -s /var/cache/zoneminder/events /usr/share/zoneminder/events
    ln -s /var/cache/zoneminder/images /usr/share/zoneminder/images
  • Add the repository & refresh.

    add-apt-repository ppa:iconnor/zoneminder
    apt-get update
  • Now do the upgrade but prevent zoneminder from restarting.

    RUNLEVEL=1 apt-get install zoneminder

    (hit Y to convert from myisam to innodb. You'll get an error at the end of the process because you prevented zoneminder from restarting by dropping to runlevel 1. This is expected.)

    DON'T RESTART ZONEMINDER YET!!
  • At this point, if you added a sleep command like I did to the zoneminder startup script, go add it back into /etc/init.d/zoneminder .
  • Remove garbage symlinks and replace with your good ones.

    cd /usr/share/zoneminder
    rm events
    rm images
    mv events.temp events
    mv images.temp images
  • Go into web GUI (yes, zoneminder is still stopped, it'll still work) and go into every camera. Change colorspace to 24 or 32BPP. Unless you like B&W, of course!
  • Start zoneminder from either the command prompt or from the web GUI.
  • Give everything a once over, look at all the cameras, etc.
  • Re-enable delete filters and zmaudit. Hold breath for ten minutes. If zmaudit doesn't go crazy deleting everything, success!
I have a mix of analog (via blurcherry card) and IP cameras (Mostly Arecont) that took a long time to get dialed in, rather not do that again.
Welll, you might be in for a rough ride. With 1.25 I had things dialed in so that I didn't get any false alarms pretty much... ever. First few hours with 1.26.5, all of my cameras are now false triggering and I can't figure out why. When I finish this reply I'm going to do some differential analysis in photoshop to see if things are changing in the images that my eye can't see, or if I've hit a nasty bug in 1.26.5 in zma. Stay tuned to the next thread!
pyroman
Posts: 25
Joined: Fri Jan 03, 2014 6:40 pm

Re: Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Post by pyroman »

As stated in a number of posts and documents, it is better not to use symlinks.

The recommended method is to mount the two directories like this (in my system my drive was sdb1):

These lines in fstab could allow you to bind-mount an alternate location

==========================================================
/dev/sdb1 /data_storage ext4 defaults 0 2
/data_storage/zoneminder/images /var/cache/zoneminder/images none bind
/data_storage/zoneminder/events /var/cache/zoneminder/events none bind
===================================================

mount the drive normally, make the required directories, then put the above in /etc/fstab.
Make sure to edit the drive and folders to match your installation.
Then remount the drive.

I used this on ubuntu 10.04
rip
Posts: 38
Joined: Sun Sep 02, 2012 8:59 pm

Re: Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Post by rip »

Thanks for the replies guys. I havn't had time to do this yet, been a rough week.

I do understand that not using symlinks is Zoneminder's perferred method. I know it's an old argument, yet ZMs, IMHO, bad behavior in this regard still persists. It shouldn't care, it's a filesystem level issue. If * exists, leave it alone. I'm not aware of why not doing so would be an advantage here, but then again I don't know everything.

I like the temp directory work around idea (why didn't I think of that moment there, lol.)
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Post by knight-of-ni »

pyroman wrote:As stated in a number of posts and documents, it is better not to use symlinks.

The recommended method is to mount the two directories like this (in my system my drive was sdb1):

These lines in fstab could allow you to bind-mount an alternate location

==========================================================
/dev/sdb1 /data_storage ext4 defaults 0 2
/data_storage/zoneminder/images /var/cache/zoneminder/images none bind
/data_storage/zoneminder/events /var/cache/zoneminder/events none bind
===================================================

mount the drive normally, make the required directories, then put the above in /etc/fstab.
Make sure to edit the drive and folders to match your installation.
Then remount the drive.

I used this on ubuntu 10.04
^ This.

Just mount your video storage directly to the default folder(s) in question.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
TheKorn
Posts: 142
Joined: Fri Aug 02, 2013 12:39 pm

Re: Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Post by TheKorn »

pyroman wrote:The recommended method is to mount the two directories like this (in my system my drive was sdb1):

These lines in fstab could allow you to bind-mount an alternate location

==========================================================
/dev/sdb1 /data_storage ext4 defaults 0 2
/data_storage/zoneminder/images /var/cache/zoneminder/images none bind
/data_storage/zoneminder/events /var/cache/zoneminder/events none bind
===================================================

mount the drive normally, make the required directories, then put the above in /etc/fstab.
Make sure to edit the drive and folders to match your installation.
Then remount the drive.
Finally circling back to this trying to upgrade to 1.27.

Unfortunately this method does not work for all file systems.

My zoneminder images & events are stored on a local ZFS filesystem. ZFS is not managed by fstab, and ZFS filesystems are mounted after everything in fstab is processed. As a result, bind mounts that point somewhere inside a ZFS pool fail to mount on a reboot.

...which then causes ZMaudit to go ape and remove all events from the database (since /var/cache/zoneminder/events is now empty)! Thank God I back up the zoneminder database nightly!!!

So yeah, symlinks it is, forevermore. It's the only reliable way with ZFS!
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Post by mastertheknife »

Symlinks are perfectly fine. I never understood why some people choose to store their events in /usr(/share/zoneminder/www/events) as this is a file system not designed for variable data. In some systems, /usr is even mounted read only!
I have my events in /var/lib/zoneminder/events and images in /var/lib/zoneminder/images, using symlinks.

Also, ZM v1.26.4 and newer includes a script called "zmlinkcontent.sh" that will take care of the symlinks for you. Just make sure to run it after everytime you update ZM (installing ZM can overwrite the symlinks), and before starting ZM, so zmaudit won't delete all the events from the database because it can't find them on the filesystem.
Kfir Itzhak.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Post by knight-of-ni »

This thread is really about a packaging issue specifically with the Ubuntu deb installation script.
What happened was that some user(s) used symlinks in a particular way not anticipated by the script. Consequently, during an upgrade the automated script ended up doing something unintended (deleted events? I forget).

I have not seen this occur with other distros. I believe that is because the upgrade process is manual. It's a trade-off. Automate the entire process such that all the user has to do is "apt-get upgrade" or make the end user manually complete some steps themselves.

If you are using the Ubuntua ppa, I recommend you follow the previously stated alternative to using symlinks. I don't have any suggestions concerning ZFS at the moment. Alternatively, you could try and contact the package maintainer, iconnor, but I know he is already aware of this and considers the previously stated alternative the best approach.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
TheKorn
Posts: 142
Joined: Fri Aug 02, 2013 12:39 pm

Re: Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Post by TheKorn »

knnniggett wrote:Alternatively, you could try and contact the package maintainer, iconnor, but I know he is already aware of this and considers the previously stated alternative the best approach.
I'm all about judicious use of other people's time, and honestly don't think there are enough users of ZFS on Ubuntu to warrant taking up iconnor's time mucking about with the PPA. That said, I still wanted to document it for the 1-in-500 people that do use ZFS on Ubuntu. (Or as it turned out, myself a few months down the road! :) )
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Ubuntu 1.25 to 1.26.5 non-default symlinks [ppa:iconnor]

Post by knight-of-ni »

TheKorn wrote: I'm all about judicious use of other people's time, and honestly don't think there are enough users of ZFS on Ubuntu to warrant taking up iconnor's time mucking about with the PPA. That said, I still wanted to document it for the 1-in-500 people that do use ZFS on Ubuntu. (Or as it turned out, myself a few months down the road! :) )
Absolutely, and thanks for the feedback.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
Locked