You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: remove PM2 dependency, add universal process manager support
Replace PM2-specific restart/stop logic with universal approach:
- Desktop mode (Electron): app.relaunch() + app.quit()
- Server mode: process.exit(0) for clean restart, exit(1) for stop
- Wait for HTTP response via res.on('finish') before exit
Changes:
- Add handleRestart() and handleStop() replacing controlPm2()
- Fix shutdown/reboot: detect sudo password errors, show helpful message
- Update translations: RESTART→REBOOT, add CONFIRM_RESTARTMM
- Improve MINIMIZE hint: "restart to restore" instead of "cannot undo"
- Add missing translation keys (FULLSCREEN, MINIMIZE, DEVTOOLS)
- Update docs (README, FAQ with sudo setup guide, swagger.json)
- Remove all PM2 references from code and documentation
- Add error logging in catch blocks for better debugging
The `pm2ProcessName` config option is no longer used (silently ignored).
Restart now works automatically with any process manager (systemd, PM2,
Docker, etc.) configured to restart on exit code 0.
4. Restart your MagicMirror² (i.e. `pm2 restart MagicMirror`).
92
+
4. Restart MagicMirror².
93
93
94
94
5. Access the remote interface on [http://192.168.xxx.xxx:8080/remote.html](http://192.168.xxx.xxx:8080/remote.html) (replace with IP address of your RaspberryPi).
95
95
@@ -149,15 +149,15 @@ For example you can use [MMM-ModuleScheduler](https://forum.magicmirror.builders
149
149
150
150
### Examples
151
151
152
-
- Example for a REST API GET request to trigger a RaspberryPi restart:
152
+
- Example for a REST API GET request to trigger a system reboot:
153
153
154
-
`http://192.168.xxx.xxx:8080/api/restart`
154
+
`http://192.168.xxx.xxx:8080/api/reboot`
155
155
156
-
- Example to trigger a RaspberryPi restart in your module:
156
+
- Example to trigger MagicMirror² restart in your module:
| RESTART | Restart MagicMirror² (Electron relaunch or clean process exit for process managers like systemd/PM2/Docker) |
182
+
| STOP | Stop MagicMirror² without restarting (exits with error code, process managers won't auto-restart) |
182
183
| REFRESH | Refresh mirror page |
183
184
| UPDATE | Update MagicMirror² and any of it's modules |
184
185
| SAVE | Save the current configuration (show and hide status of modules, and brightness), will be applied after the mirror starts |
185
186
| BRIGHTNESS | Change mirror brightness, with the new value specified by `value`. `100` equals the default (full brightness), possible range is between `0` (black) and `100`. |
Copy file name to clipboardExpand all lines: docs/guide/faq.md
+27-11Lines changed: 27 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,23 +2,39 @@
2
2
3
3
## System Issues
4
4
5
-
### RPi not shutting down? Getting "Interactive Authorization" error
5
+
### Shutdown or Reboot not working? "System requires password" error
6
6
7
-
You need passwordless sudo for shutdown commands. See [this guide](https://askubuntu.com/questions/168879/shutdown-from-terminal-without-entering-password).
7
+
Your system requires a password for shutdown/reboot commands. To fix this:
8
8
9
-
### MagicMirror instance isn't restarting
9
+
1. Open the sudoers file (safely):
10
+
11
+
```bash
12
+
sudo visudo
13
+
```
10
14
11
-
You probably don't have PM2 installed, or the process name is different.
15
+
2. Add this line at the end (replace `pi` with your username):
12
16
13
-
1. Check if PM2 is running: `pm2 list`
14
-
2. If your process name isn't `mm`, add to config:
15
-
```js
16
-
config: {
17
-
pm2ProcessName:'MagicMirror', // your process name
18
-
}
17
+
```bash
18
+
pi ALL=(ALL) NOPASSWD: /sbin/shutdown
19
19
```
20
20
21
-
See [MagicMirror Docs](https://docs.magicmirror.builders/configuration/autostart.html) for PM2 setup.
21
+
3. Save and exit (Ctrl+X, then Y, then Enter)
22
+
23
+
Now shutdown and reboot should work without password prompts.
24
+
25
+
See also: [Ubuntu guide on passwordless shutdown](https://askubuntu.com/questions/168879/shutdown-from-terminal-without-entering-password)
26
+
27
+
### MagicMirror instance isn't restarting
28
+
29
+
The restart function depends on your process manager setup.
30
+
31
+
1. In Desktop mode (with Electron), restart uses `app.relaunch()` and `app.quit()`
32
+
2. In Server mode, the process exits cleanly and your process manager (systemd, PM2, Docker, etc.) should restart it
33
+
3. Make sure your process manager is configured to restart on clean exit (exit code 0)
34
+
35
+
For example, with systemd set `Restart=on-success`, or with PM2 use the default auto-restart behavior.
36
+
37
+
See [MagicMirror Docs](https://docs.magicmirror.builders/configuration/autostart.html) for setup instructions.
Copy file name to clipboardExpand all lines: docs/swagger.json
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -459,7 +459,7 @@
459
459
"/api/restart": {
460
460
"get": {
461
461
"tags": ["Mirror Control", "API"],
462
-
"summary": "Restart your MagicMirror² instance if using PM2 to control it.",
462
+
"summary": "Restart your MagicMirror² instance (Electron relaunch or process manager restart).",
463
463
"security": [
464
464
{
465
465
"apikey": []
@@ -623,11 +623,11 @@
623
623
"MONITOROFF": "Turn monitor OFF",
624
624
"MONITORON": "Turn monitor ON",
625
625
"MONITORTIMED": "Turn monitor ON briefly",
626
-
"RESTART": "Restart",
626
+
"REBOOT": "Reboot System",
627
627
"RESTARTMM": "Restart MagicMirror²",
628
628
"SHUTDOWN": "Shutdown",
629
629
"FULLSCREEN": "Toggle Fullscreen",
630
-
"MINIMIZE": "Minimize Browser",
630
+
"MINIMIZE": "Minimize Browser (restart to restore)",
631
631
"DEVTOOLS": "Open DevTools",
632
632
"SHOWALL": "All",
633
633
"HIDEALL": "All",
@@ -658,7 +658,8 @@
658
658
"PANIC": "Never mind.",
659
659
"NO_RISK_NO_FUN": "No risk no fun!",
660
660
"CONFIRM_SHUTDOWN": "The system will shut down.",
661
-
"CONFIRM_RESTART": "The system will restart.",
661
+
"CONFIRM_REBOOT": "The system will restart.",
662
+
"CONFIRM_RESTARTMM": "MagicMirror² will restart.",
662
663
"LOAD_ERROR": "If you see this message, an error occurred when loading the javascript file. Please go to the following link and see if this a known problem with your browser:",
0 commit comments