nextcloud / serverinfo

📊 A monitoring app which creates a server info dashboard for admins
GNU Affero General Public License v3.0
94 stars 59 forks source link

[Bug]: Error 500 on serverinfo page due to getNetInterfaces() #629

Closed jcharaoui closed 3 weeks ago

jcharaoui commented 3 weeks ago

⚠️ This issue respects the following points: ⚠️

Bug description

When visiting the /admin/serverinfo page, Nextcloud crashes with an HTTP 500 error and logs Unable to get network interfaces.

Steps to reproduce

  1. Navigate to the /admin/serverinfo page

Expected behavior

It should not show an HTTP 500 error.

Installation method

Community Manual installation with Archive

Nextcloud Server version

29

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MySQL

Is this bug present after an update or on a fresh install?

Updated from a MINOR version (ex. 22.1 to 22.2)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

{"reqId":"55kLp9BONpSYDwbUO2j8","level":3,"time":"2024-06-24T09:56:17-04:00","remoteAddr":"[REDACTED]","user":"jerome","app":"PHP","method":"GET","url":"/nextcloud/index.php/settings/admin/serverinfo","message":"getifaddrs() failed 97: Address family not supported by protocol at /home/nextcloud/www/apps/serverinfo/lib/OperatingSystems/Linux.php#299","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0","version":"29.0.2.2","data":{"app":"PHP"}}
{"reqId":"55kLp9BONpSYDwbUO2j8","level":3,"time":"2024-06-24T09:56:17-04:00","remoteAddr":"[REDACTED]","user":"jerome","app":"index","method":"GET","url":"/nextcloud/index.php/settings/admin/serverinfo","message":"Unable to get network interfaces","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0","version":"29.0.2.2","exception":{"Exception":"RuntimeException","Message":"Unable to get network interfaces","Code":0,"Trace":[{"file":"/home/nextcloud/www/apps/serverinfo/lib/OperatingSystems/Linux.php","line":163,"function":"getNetInterfaces","class":"OCA\\ServerInfo\\OperatingSystems\\Linux","type":"->"},{"file":"/home/nextcloud/www/apps/serverinfo/lib/Os.php","line":103,"function":"getNetworkInterfaces","class":"OCA\\ServerInfo\\OperatingSystems\\Linux","type":"->"},{"file":"/home/nextcloud/www/apps/serverinfo/lib/Settings/AdminSettings.php","line":83,"function":"getNetworkInterfaces","class":"OCA\\ServerInfo\\Os","type":"->"},{"file":"/home/nextcloud/www/apps/settings/lib/Controller/CommonSettingsTrait.php","line":140,"function":"getForm","class":"OCA\\ServerInfo\\Settings\\AdminSettings","type":"->"},{"file":"/home/nextcloud/www/apps/settings/lib/Controller/AdminSettingsController.php","line":93,"function":"formatSettings","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->"},{"file":"/home/nextcloud/www/apps/settings/lib/Controller/CommonSettingsTrait.php","line":165,"function":"getSettings","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->"},{"file":"/home/nextcloud/www/apps/settings/lib/Controller/AdminSettingsController.php","line":77,"function":"getIndexResponse","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->"},{"file":"/home/nextcloud/www/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"index","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->"},{"file":"/home/nextcloud/www/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/nextcloud/www/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/nextcloud/www/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/home/nextcloud/www/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/home/nextcloud/www/index.php","line":49,"function":"handleRequest","class":"OC","type":"::"}],"File":"/home/nextcloud/www/apps/serverinfo/lib/OperatingSystems/Linux.php","Line":301,"message":"Unable to get network interfaces","exception":{},"CustomMessage":"Unable to get network interfaces"}}

Additional info

Unclear if it matters, but on the system PHP is running using php-fpm with the chroot parameter enabled.

kesselb commented 3 weeks ago

Thanks :+1:

Indeed, the try-catch is missing. This should make the page usuable again and drop the second error message. However, the first one is emitted by php and something you have to live with^1.

jcharaoui commented 3 weeks ago

Wow, thanks for the quick fix! I'm fine with the error message popping up in the logs when that page is opened.