upgrading to LibreNMS 1.53.1

When upgrading to LibreNMS 1.53.1, your website will not load. You’ll see a message saying check the logs. There will be nothing useful in the logs. I checked. Nothing.

This is how I fixed the loading issue.

In this post:

  • FreeBSD 12.0
  • LibreNMS 1.51 running in a jail
  • Upgrading to 1.53.1

First attempts

$ cd /usr/local/www/librenms
$ ./validate.php 

                                                                                                                     
  [ErrorException]                                                                                                   
  rename(/usr/home/dan/.composer/cache/composer-temp.phar,/usr/local/www/librenms/composer.phar): Permission denied  
                                                                                                                     

self-update [-r|--rollback] [--clean-backups] [--no-progress] [--update-keys] [--stable] [--preview] [--snapshot] [--set-channel-only] [--] [<version>]

====================================
Component | Version
--------- | -------
LibreNMS  | 1.53.1
DB Schema | 2019_02_10_220000_add_dates_to_fdb (132)
PHP       | 7.2.20
MySQL     | 5.7.26
RRDTool   | 1.7.2
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Installed from package; no Composer required
[OK]    Database connection successful
[FAIL]  Your database is out of date!
	[FIX]: 
	./lnms migrate
[WARN]  IPv6 is disabled on your server, you will not be able to add IPv6 devices.
[FAIL]  You need to run this script as root or www

Running as www

OK, let’s run that as www.

$ echo ./validate.php | sudo su -fm www
====================================
Component | Version
--------- | -------
LibreNMS  | 1.53.1
DB Schema | 2019_02_10_220000_add_dates_to_fdb (132)
PHP       | 7.2.20
MySQL     | 5.7.26
RRDTool   | 1.7.2
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Installed from package; no Composer required
[OK]    Database connection successful
[FAIL]  Your database is out of date!
	[FIX]: 
	./lnms migrate
[WARN]  IPv6 is disabled on your server, you will not be able to add IPv6 devices.
[dan@besser:/usr/local/www/librenms] $ echo ./lnms migrate | sudo su -fm www
**************************************
*     Application In Production!     *
**************************************

Command Cancelled!

Eh? What?

References

Searching around, I found nothing useful.

I found the code in question:

$ grep -r 'Application In Production' *
vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php:    public function confirmToProceed($warning = 'Application In Production!', $callback = null)

That laravel reference did come up during my search though.

This Whoops, looks like something went wrong. Your database is out of date! was helpful in that it made me think about the www user. It has no shell. The script is asking a question. www can’t reply.

Running as root

Let’s run it as root.

But first: I could have set a shell for www, run this command, then reverted back to the /usr/sbin/nologin shell, but I didn’t. Here is the default for www:

$ grep www /etc/passwd
www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin

Instead, I did this:

$ sudo ./lnms migrate
**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes

Migrating: 2019_05_12_202407_create_mpls_lsps_table
Migrated:  2019_05_12_202407_create_mpls_lsps_table
Migrating: 2019_05_12_202408_create_mpls_lsp_paths_table
Migrated:  2019_05_12_202408_create_mpls_lsp_paths_table
Migrating: 2019_05_30_225937_device_groups_rewrite
Migrated:  2019_05_30_225937_device_groups_rewrite
$

A validation is now sane:

$ echo ./validate.php | sudo su -fm www
====================================
Component | Version
--------- | -------
LibreNMS  | 1.53.1
DB Schema | 2019_05_30_225937_device_groups_rewrite (135)
PHP       | 7.2.20
MySQL     | 5.7.26
RRDTool   | 1.7.2
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Installed from package; no Composer required
[OK]    Database connection successful
[OK]    Database schema correct
[WARN]  IPv6 is disabled on your server, you will not be able to add IPv6 devices.
$ 

Ignore that IPv6. I do have it configured. The code is wrong.

Fixed

Now the website loads.

Hope this helps because everyone upgrading needs to know it.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top