Tuesday, 16 April 2013

Upgrade to latest version1.2[English]

Manually update Netdisco to v1.2

This update method is based on that you have our previous installation completed the v1.0 installed and working without problems. This update is tested and SHOULD be working without any kind of problems.

BUT if you do find anything whatso ever worth mention then mail us or comment below

1.Start off by downloading the latest version of netdisco and save it to your computer.
#wget http://sourceforge.net/projects/netdisco/files/netdisco/1.2/netdisco-1.2.tar.gz

The downloaded file is usually saved in /home/USERNAME/Downloads anyway, locate the downloaded file and prompt your way to it.

Start extracting the downloaded file:
#tar -zxvf netdisco-1.2.tar.gz
Prompt into it:
#cd netdisco-1.2

Once inside the extracted folde the netdisco v1.2, we are gonna start copying some files:
#cp netdisco /usr/bin

#cp netdisco.pm /usr/share/perl5/

This will replace the old netdisco files.

2. Now we gonna change set configurations for the new netdisco.conf, start of by entering the file with any editor(we chose vim)
#vim netdisco.conf

Then we gonna locate row 16 and we should see this:
home        = /usr/local/netdisco
Which should be changed into:
home        = /usr/share/netdisco

in the same file locate to a new row, 20 and look for topofile. And you should see this:
topofile        = netdisco-topology.txt
Change it into:
topofile        = /etc/netdisco/netdisco-topology.txt

After that locate the row 70 “daemon_pid” and you should see somthing like this:
daemon_pid    = netdisco_daemon.pid
Go ahead and change it to:
daemon_pid    = /var/run/netdisco_daemon.pid

Then locate row 85 and look for “datadir”, and you should see somthing like this:
datadir        = netdisco
Change it into:
datadir        = /var/log/netdisco

Locate the row 109 and look for the db_Pg_user/pw looks somthing like this:
db_Pg_user      = netdisco
db_Pg_pw        = dbpassword
Change it too:
db_Pg_user      = netdisco
db_Pg_pw        = netdisco

Then locate row 179 still same fil, this row should be empty. And here we are going to add:
outputdir    = /var/lib/netdisco/html

Now your done with the netdisco.conf so save the file and exit it.

3. We are going to edit another file called netdisco_apache.conf so open it upo with any editor(we chose vim)
#vim netdisco_apache.conf

And on row 27 in this file you should see somthing like:
netdisco::config /usr/local/netdisco/netdisco.conf change the directory location to

Then row 38 in the same file, and look for “comp_root” same here change the targeted directory to:

On the row beneth(39) same file we are going to change the “data_dir” location from /usr/local/netdisco/maston to

Next up we gonna go to line 49, which should look like somthing simillar to this:
session_user_name      => 'netdisco',
            session_password       => 'PASSWORDHE
Change it to:
            session_user_name      => 'netdisco',
            session_password       => ‘netdisco',

Move all the way up still in the same file move up to line 8 and 9 and delete both of the configurations.
LoadModule perl_module  libexec/apache2/mod_perl.so
LoadModule apreq_module libexec/apache2/mod_apreq2.so


4. Save and exit the file. Now open up the other apache file with any kind of editor(We chose vim)
#vim netdisco_apache_dir.conf

Only thing needed to be changed in this one is line 4 which should look like this.
Alias /netdisco        “/usr/local/netdisc/html/”
Make sure too change it into:
Alias /netdisco        “/usr/share/netdsco/html/

There is going to another alias which will look abit similar just IGNORE IT and make sure you changed the right one!!!

5. Save and exit the previous file, and make sure your still in the directory you extracted now we gonna copy our new crontab file.
#cp netdisco.crontab /etc/cron.d/netdisco-backend

Then copy the sql to the right place.
#cp -r sql /usr/lib/netdisco

Copy the html to the right location:
#cp -r html /usr/share/netdisco

Copy the pg from the sql file to npg
#cp /usr/lib/netdisco/sql/pg /usr/bin/npg

6. Open up /usr/bin/npg with any kind of editor(we chose vim) locate yourself to line 38 and look for “/netdisco.conf” change that to

and now restart your postgresql:
#service postgresql restart

Upgrade your sql from version 1.0 to 1.1
#/usr/bin/npg /usr/lib/netdisco/sql/upgrade-1.0-to-1.1.sql

And from 1.1 to 1.2 which is the current latest version.
#/usr/bin/npg /usr/lib/netdisco/sql/upgrade-1.1-to-1.2.sq

Now edit the file /usr/bin/netdisco with any kind of editor(we chose vim)
#vim /usr/bin/netdisco

Locate yourself to the line 118 and the sentence which we are going to change is:
Change it into:

7. For the last step we gonna adjust the crontab settings which are default set to /usr/local/netdisco/netdisco but we need to change them just to netdisco, so run this command:

#sed -i s%/usr/local/netdisco/netdisco%netdisco%g /etc/cron.d/netdisco-backend

Reload new crontab to netdisco user
#crontab -u netdisco /etc/cron.d/netdisco-backend

8. Just to be sure, reset rights.

#chown -R netdisco:netdisco /usr/share/netdisco
#chown -R www-data:www-data /usr/share/netdisco/html
#chown -R www-data:www-data /var/lib/netdisco/mason

Now restart your apache2, postgresql and your netdisco and everything should be up-to date.
This guide has been tested couple times on ubuntu and linux mint.

Any problems? Leave a comment or mail


  1. I allways get an Apache error

    [Mon Apr 29 17:01:25 2013] [notice] caught SIGTERM, shutting down
    [Mon Apr 29 17:02:36 2013] [notice] Apache/2.2.22 (Ubuntu) mod_apreq2-20090110/2.8.0 mod_perl/2.0.5 Perl/v5.14.2 configured -- resuming normal operations
    [Mon Apr 29 17:03:36 2013] [error] [client] failed to resolve handler `netdisco::Mason': Can't locate netdisco/Mason.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl . /etc/apache2) at (eval 9) line 2.\n
    [Mon Apr 29 17:03:36 2013] [error] [client] File does not exist: /var/www/favicon.ico
    [Mon Apr 29 17:03:36 2013] [error] [client] File does not exist: /var/www/favicon.ico

  2. Well as it looks it seems as if Netdisco is trying to open Mason in the wrong directory, that beeing netdisco/mason. Check your netdisco_apache2.conf under the line "data_dir" and make sure it is set to /var/lib/netdisco/mason. Just to be sure give it apache2 rights with chown -R www-data:www-data /var/lib/netdisco/mason.
    Also perl might have failed to find Mason in its repository so i recomend running CPAN and install HTML::Mason again.

    Your first "error" is the script trying to reload modules, witch should not dissturb in any way & the favicon is just an icon for the webbrowser witch it is failing to find - also nothing to worry about.

    install HTML::Mason

    Check configuration file /etc/netdisco/netdisco_apache2.conf if the line "data_dir" is correct.

    Cheers friend.

  3. I am experiencing the same error under ubuntu 12.04.2 (clean alternate/CLI install).

    I could find that "perl -MCPAN -e 'force install MasonX::Request::WithApacheSession'" failed, due to a missing "perl -MCPAN -e 'install Digest::SHA1'"

    Running netdisco-install-eng.sh a second after executing "perl -MCPAN -e 'install Digest::SHA1'" time still results in /var/lib/netdisco/mason being empty

    data_dir in /etc/netdisco/netdisco_apache2.conf is set to /var/lib/netdisco/mason and /etc/apache2.conf does include "Include /etc/netdisco/netdisco_apache2.conf"

  4. executing "ln -s HTML/ netdisco" in /usr/local/share/perl/5.14.2 changes the error from

    "failed to resolve handler `netdisco::Mason': Can't locate netdisco/Mason.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl . /etc/apache2) at (eval 10) line 2.\n"

    to simply

    "failed to resolve handler netdisco::Mason"

    ATM, a "ls -la $(locate Mason.pm) produces:

    -r--r--r-- 1 root root 8200 Jul 12 2012 /home/USER/.cpan/build/HTML-Mason-1.50-97oz9h/blib/lib/HTML/Mason.pm
    -rw-r--r-- 1 501 staff 696 Jul 12 2012 /home/USER/.cpan/build/HTML-Mason-1.50-97oz9h/eg/MyApp/Mason.pm
    -rw-r--r-- 1 501 staff 8200 Jul 12 2012 /home/USER/.cpan/build/HTML-Mason-1.50-97oz9h/lib/HTML/Mason.pm
    -r--r--r-- 1 root root 8200 Jul 12 2012 /usr/local/share/perl/5.14.2/HTML/Mason.pm
    -rw-r--r-- 1 root root 373 Feb 7 2012 /usr/share/perl5/Apache/Mason.pm
    -rw-r--r-- 1 root root 492 Feb 7 2012 /usr/share/perl5/Bundle/HTML/Mason.pm
    -rw-r--r-- 1 root root 7665 Feb 7 2012 /usr/share/perl5/HTML/Mason.pm

    netdisco-install-eng.sh was executed in an "sudo -s" environment

    1. This is how I solved the "netdisco/Mason.pm @INC" problem

      create a netdisco.conf file inside /etc/apache2/conf.d folder

      open the file and add the following lines of text to the netdisco.conf file

      Include /etc/netdisco/netdisco_apache2.conf
      Include /etc/netdisco/netdisco_apache2_dir.conf

      hope it solves your problem.

    2. fantastic it works !!

    3. The script puts the Include lines at the top of /etc/apache2/apache.conf instead of in the conf.d directory.

      The conf.d solution above works on Ubuntu 12.04 clean install.

  5. Anyone checked the automatic upgrade to see if it is functional for them? Feedback would be appreciated.


    1. The upgrade script works great. I only had to do the changes to the /etc/apache2/conf.d/netdisco.conf file before running the upgrade

      Thank you for creating the script. The first manual install I did took me 2 days to figure out. I wish I had found your blog sooner.


  6. I don't know if anyone had this problem but I will post it maybe it will help someone.

    Vendor name not showing up next to node MAC address.


    Open /usr/bin/netdisco for editing

    Search for the following text in the PARSE OUI section:
    if ($line =~ /^(.{2}-.{2}-.{2})\s+\(hex\)\s+(.*)\s*$/i){

    Edit so it looks like this:
    if ($line =~ /^\s\s(.{2}-.{2}-.{2})\s+\(hex\)\s+(.*)\s*$/i){

    That is all. Next time you import you OUI.txt it should add the Vendor names.

    Thank you

  7. Hi,

    great scripts. Do you plan to modify or provide instructions to upgrade to netdisco 1.3.2 or to perform a brand new 1.3.2 installation?

    thank you,

    1. Yes i have been thinking of updating the script but nerver got the time to do it, real life keeps me busy haha. Well you were in luck just changing the 1.2 to 1.3 but the script is making changes to the files themselves sence the old netdisco had problems with the new perl. Anyway i shall find time and make another upgrade script from 1.2 to 1.3.2. Cheers all and hope this site has helped you :)

  8. Krossover Networks provides a flexible and enthusiastic approach to its customer base. We take on our role as a key business partner with confidence. Our client base, from single PC sites to a multiple site organization, takes us into businesses in manufacturing, professional services, care, hospitality and tourism.