mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-02-06 11:18:09 -05:00
Inspired by the poor error message here: https://github.com/scottlamb/moonfire-nvr/issues/107#issuecomment-777587727 * print the friendlier Display version of the error rather than Debug. Eg, "EROFS: Read-only filesystem" rather than "Sys(EROFS)". Do this everywhere: on command exit, on syncer retries, and on stream retries. * print the most immediate problem and additional lines for each cause. * print the backtrace or an advertisement for RUST_BACKTRACE=1 if it's unavailable. * also mention RUST_BACKTRACE=1 in the troubleshooting guide. * add context in various places, including pathnames. There are surely many places more it'd be helpful, but this is a start. * allow subcommands to return failure without an Error. In particular, "moonfire-nvr check" does its own error printing because it wants to print all the errors it finds. Printing "see earlier errors" with a meaningless stack trace seems like it'd just confuse. But I also want to get rid of the misleading "Success" at the end and 0 return to the OS.
50 lines
2.3 KiB
Markdown
50 lines
2.3 KiB
Markdown
# Troubleshooting
|
|
|
|
## Logs
|
|
|
|
While Moonfire NVR is running, logs will be written to stderr.
|
|
|
|
* When running the configuration UI, you typically should redirect stderr
|
|
to a text file to avoid poor interaction between the interactive stdout
|
|
output and the logging. If you use the recommended
|
|
`nvr config 2>debug-log` command, output will be in the `debug-log` file.
|
|
* When running detached through Docker, Docker saves the logs for you.
|
|
Try `nvr logs` or `docker logs moonfire-nvr`.
|
|
* When running through systemd, stderr will be redirected to the journal.
|
|
Try `sudo journalctl --unit moonfire-nvr` to view the logs. You also
|
|
likely want to set `MOONFIRE_FORMAT=google-systemd` to format logs as
|
|
expected by systemd.
|
|
|
|
Logging options are controlled by environment variables:
|
|
|
|
* `MOONFIRE_LOG` controls the log level. Its format is similar to the
|
|
`RUST_LOG` variable used by the
|
|
[env-logger](http://rust-lang-nursery.github.io/log/env_logger/) crate.
|
|
`MOONFIRE_LOG=info` is the default.
|
|
`MOONFIRE_LOG=info,moonfire_nvr=debug` gives more detailed logging of the
|
|
`moonfire_nvr` crate itself.
|
|
* `MOONFIRE_FORMAT` selects the output format. The two options currently
|
|
accepted are `google` (the default, like the Google
|
|
[glog](https://github.com/google/glog) package) and `google-systemd` (a
|
|
variation for better systemd compatibility).
|
|
* Errors include a backtrace if `RUST_BACKTRACE=1` is set.
|
|
|
|
If you use Docker, set these via Docker's `--env` argument.
|
|
|
|
## Problems
|
|
|
|
### `Error: pts not monotonically increasing; got 26615520 then 26539470`
|
|
|
|
If your streams cut out with an error message like this one, it might mean
|
|
that your camera outputs [B
|
|
frames](https://en.wikipedia.org/wiki/Video_compression_picture_types#Bi-directional_predicted_.28B.29_frames.2Fslices_.28macroblocks.29).
|
|
If you believe this is the case, file a feature request; Moonfire NVR
|
|
currently doesn't support B frames. You may be able to configure your camera
|
|
to disable B frames in the meantime.
|
|
|
|
### `moonfire-nvr config` displays garbage
|
|
|
|
This happens if your machine is configured to a non-UTF-8 locale, due to
|
|
gyscos/Cursive#13. As a workaround, try setting the environment variable
|
|
`LC_ALL=C.UTF-8`. This should automatically be set with the Docker container.
|