Bug 1805472
Summary: | grafana-cli is causing grafana-server logins to fail when used before grafana.db is created | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | Jan Kurik <jkurik> | ||||
Component: | grafana | Assignee: | Andreas Gerstmayr <agerstmayr> | ||||
Status: | CLOSED DUPLICATE | QA Contact: | Jan Kurik <jkurik> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 8.2 | CC: | agerstmayr, jkurik, mgoodwin, nathans | ||||
Target Milestone: | rc | Keywords: | Bugfix, Reopened, Triaged | ||||
Target Release: | 8.3 | ||||||
Hardware: | All | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | No Doc Update | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2020-06-23 04:24:35 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Jan Kurik
2020-02-20 20:44:30 UTC
Hi Jan, I've verified what you've seen. Since the grafana installation %post scripts create a grafana user and group (if none already exist), a simple work-around is to run grafana-cli as the grafana user, e.g. sudo -u grafana grafana-cli admin reset-admin-password SuperSecretPassword A fix would be in the grafana-cli wrapper to check the user is either root or grafana and then exec the grafana-cli binary via sudo -u grafana (works for both root and the grafana user) as in the above example. Alternatively, perhaps grafana-cli could check if the grafana service is running (and/or the db already exists) and abort if not. Given there are work-arounds (either the chown or the sudo method), should we target RHEL8.3 for this fix (via rebase when the time comes), and work with upstream in the mean-time? Also - the grafana-server doesn't crash - the login UI page reports an error that the db is read-only, then returns to the login prompt. So I've edited the BZ summary to reflect this. Hi Mark, I had some permission issues with "su" or "sudo" commands and then I have realized the $HOME of grafana is not writeable for grafana user after installation: # grep grafana /etc/passwd grafana:x:993:990:grafana user account:/usr/share/grafana:/sbin/nologin # ls -ld /usr/share/grafana drwxr-xr-x. 5 root root 43 Feb 21 00:12 /usr/share/grafana IMO the "/usr/share/grafana" should be owned by grafana:grafana. Regarding the crash - see the attached grafana.log. There is a clear message: runtime error: invalid memory address or nil pointer dereference When I use "strace" to trace the grafana process, I can see that one of the grafana's worker treads gets SIGSEGV signal, and then the worker thread crashes. Signal handler for SIGSEGV signal generates the message in grafana.log file. The message I see in web browser is as follows (it is shown as HTML gibberish): <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width"> <meta name="theme-color" content="#000"> <title>Grafana - Error</title> <base href="/" /> <link rel="stylesheet" href="public/build/grafana.dark.69fae754221074f118fc.css"> <link rel="icon" type="image/png" href="public/img/fav32.png"> <link rel="mask-icon" href="public/img/grafana_mask_icon.svg" color="#F05A28"> </head> <body class="theme-dark"> <div class="main-view"> <div class="page-container"> <div class="page-header"> <div class="page-header__inner"> <span class="page-header__logo"> <i class="page-header__icon fa fa-frown-o"></i> </span> <div class="page-header__info-block"> <h1 class="page-header__title"> <a class="text-link" href="login">Grafana</a><span> / Server Error</span><span></span> </h1> <div class="page-header__sub-title">Sadly something went wrong</div> </div> </div> </div> </div> <div class="page-container page-body ng-scope" style="padding: 2rem"> <div class="alert"> <div class="alert-icon"><i class="fa fa-exclamation-triangle"></i></div> <div class="alert-body"> <div class="alert-title">Server Error</div> </div> </div> <br /> <div style="padding: 2rem 0 0"> <p>Check the Grafana server logs for the detailed error message.</p> </div> </div> </div> </body> </html> Filtering out, it says: Server Error Sadly something went wrong Check the Grafana server logs for the detailed error message. But anyway, whatever fixes the issue works for me. RHEL-8.3 is fine from my perspective as I do not believe there will be many customers playing with grafana-cli utility before the very first start of grafana-server. Fixed in the Grafana 6.7.3 rebase *** This bug has been marked as a duplicate of bug 1807323 *** This is not fixed in grafana-6.7.4-1.el8 build. The grafana.db should be created with the corrent user + permissions (as part of the CVE fix). The reason grafana doesn't start are other files/directories afaics, as mentioned here: https://bugzilla.redhat.com/show_bug.cgi?id=1843170 Imho we can mark this bug as duplicate? (In reply to Andreas Gerstmayr from comment #5) > [...] Imho we can mark this bug as duplicate? +1 *** This bug has been marked as a duplicate of bug 1843170 *** |