Skip to content

Instantly share code, notes, and snippets.

@JarbasAl
Last active November 19, 2024 14:40
Show Gist options
  • Select an option

  • Save JarbasAl/cb8f2fcacdc918a9830288a9712a16ac to your computer and use it in GitHub Desktop.

Select an option

Save JarbasAl/cb8f2fcacdc918a9830288a9712a16ac to your computer and use it in GitHub Desktop.

Monitoring log files

to monitor all log files live in the terminal

tail -f ~/.local/state/mycroft/*.log

or to monitor individual services separately

tail -f ~/.local/state/mycroft/audio.log   
tail -f ~/.local/state/mycroft/bus.log
tail -f ~/.local/state/mycroft/gui.log     
tail -f ~/.local/state/mycroft/phal.log
tail -f ~/.local/state/mycroft/skills.log
tail -f ~/.local/state/mycroft/voice.log

Monitoring systemd logs

Most of the time OVOS is running as a system service, typically this includes ovos-shell which doesn't write logs to file and would be missing using the previous approach

to list running service files

systemctl --user list-units | grep ovos

Example output if you used ovos-installer

  ovos-audio.service              loaded active running   Open Voice OS - Audio
  ovos-core.service               loaded active running   Open Voice OS - Core (skills)
  ovos-ggwave-listener.service    loaded active running   Open Voice OS - ggwave listener
  ovos-gui-websocket.service      loaded active running   Open Voice OS - GUI websocket
  ovos-gui.service                loaded active running   Open Voice OS - GUI
  ovos-listener.service           loaded active running   Open Voice OS - Listener
  ovos-messagebus.service         loaded active running   Open Voice OS - Message bus service
  ovos-phal.service               loaded active running   Open Voice OS - PHAL
  ovos.service                    loaded active exited    Open Voice OS - Meta service

You can monitor service logs via journalctl

journalctl --user -u ovos-gui.service -n 50 -f

Explanation:

  • --user: Targets user-managed services instead of system-wide ones.
  • -u ovos-gui.service: Specifies the service to monitor (ovos-gui.service in this case).
  • -n 50: Shows the last 50 log lines initially.
  • -f: Follows the log in real-time, updating as new entries appear.

Some logs (such as subprocess calls) might not get written to file but will show in journalctl, this approach is more informative when compared to tailing .log files


Listing All OVOS Packages

To view all installed OVOS-related packages (those with "ovos-" or "skill-" in their names):

pip list | grep -E 'ovos-|skill-'

Explanation

  • pip list: Lists all installed Python packages.
  • grep -E 'ovos-|skill-': Filters the list to include only packages containing "ovos-" or "skill-".

Creating a requirements.txt from Installed OVOS Packages

To save a list of OVOS-related packages (for example, for use in setting up other environments), you can create a requirements.txt file that includes only these specific packages with their current versions:

pip list --format=freeze | grep -E 'ovos-|skill-' > requirements.txt

Explanation

  • pip list --format=freeze: Outputs each installed package in package==version format, which is suitable for creating a requirements.txt file.
  • grep -E 'ovos-|skill-': Filters for packages containing "ovos-" or "skill-" in their names.
  • > requirements.txt: Redirects the output to requirements.txt.

After running this, requirements.txt will contain only OVOS-related packages, formatted for easy reinstallation with version constraints.


Updating All OVOS Packages

To update all OVOS-related packages, we first create a list of package names (without version constraints) and then use pip to update them.

Step 1: Create a List of Package Names (without Versions)

pip list --format=freeze | grep -E 'ovos-|skill-' | cut -d '=' -f 1 > requirements.txt
  • cut -d '=' -f 1: Splits each line at == and keeps only the part before it, removing the version numbers.

Step 2: Update the Packages with pip

pip install -r requirements.txt -U --pre
  • -r requirements.txt: Reads the package list from requirements.txt.
  • -U: Ensures all packages in the file are updated to the latest versions.
  • --pre: Includes pre-release versions, which can be useful if you're working with cutting-edge OVOS packages.

For more control over dependencies, you can use:

pip install -r requirements.txt -U --pre --no-deps
  • --no-deps: Installs the specified packages without installing their dependencies. Useful if you want to manually handle dependencies to avoid conflicts.

Updating all skills

A variation of the above

You can combine these commands into a single command using a subshell to avoid creating an intermediate file:

pip install -U --pre $(pip list --format=freeze | grep -E 'skill-' | cut -d '=' -f 1)
  • $(...): Captures the output of the inner command, which lists the "skill-" packages without versions, and feeds it directly to pip install.
  • -U --pre: Ensures packages are updated to the latest versions, including pre-releases.

This one-liner will update all packages containing "skill-" in their names without needing an intermediate requirements.txt file.


Uninstalling All Skills

To uninstall all packages containing "skill" in their names, use the following command:

pip list | grep skill | awk '{print $1}' | xargs pip uninstall -y

Explanation

  • pip list | grep skill: Lists all installed packages and filters for those containing "skill" in the name.
  • awk '{print $1}': Extracts just the package names (first column).
  • xargs pip uninstall -y: Feeds the package names to pip uninstall, automatically confirming each uninstallation with -y.

This will uninstall all skill packages without requiring individual confirmation.


Changing Release Channels

Release channels are defined via constraints files under ovos-releases repository

the direct urls for each release channel are:

First create a requirements.txt with your currently installed ovos packages as described in the section above

pip list --format=freeze | grep -E 'ovos-|skill-' | cut -d '=' -f 1 > requirements.txt

Then use the following one-liner to download the constraints file and update already installed ovos packages in a single command:

curl -sSL <URL> -o constraints.txt && pip install -r requirements.txt -c constraints.txt

for stable packages this corresponds to

curl -sSL https://raw.githubusercontent.com/OpenVoiceOS/ovos-releases/main/constraints-stable.txt -o constraints.txt && pip install -r requirements.txt -c constraints.txt -U

for testing packages this corresponds to

curl -sSL https://raw.githubusercontent.com/OpenVoiceOS/ovos-releases/main/constraints-testing.txt -o constraints.txt && pip install -r requirements.txt -c constraints.txt -U

for alpha packages this corresponds to

curl -sSL https://raw.githubusercontent.com/OpenVoiceOS/ovos-releases/main/constraints-alpha.txt -o constraints.txt && pip install -r requirements.txt -c constraints.txt --pre -U

Explanation:

  1. curl -sSL <URL> -o constraints.txt:

    • Downloads the file from <URL> and saves it as constraints.txt.
    • -s: Silent mode, suppresses progress bar output.
    • -S: Shows errors if they occur.
    • -L: Follows redirects, ensuring the correct file is downloaded.
  2. &&:

    • Ensures the pip install command only runs if the curl command succeeds.
  3. pip install -r requirements.txt -c constraints.txt:

    • Installs packages from requirements.txt, respecting version constraints specified in constraints.txt.

Replace <URL> with the actual URL of the constraints file.


Finding skills settings.json

skills user configurable settings are populated to /home/ovos/.config/mycroft/skills/

listing the folders in this directory will tell you which skills are configurable

ls /.config/mycroft/skills/

example output

ovos-skill-alerts.openvoiceos                ovos-skill-ip.openvoiceos            ovos-skill-wikihow.openvoiceos           skill-ovos-homescreen.openvoiceos       skill-ovos-volume.openvoiceos
ovos-skill-application-launcher.openvoiceos  ovos-skill-iss-location.openvoiceos  skill-easter-eggs.openvoiceos            skill-ovos-icanhazdadjokes.openvoiceos  skill-ovos-wallpapers.openvoiceos
ovos-skill-camera.openvoiceos                ovos-skill-laugh.openvoiceos         skill-ovos-audio-recording.openvoiceos   skill-ovos-local-media.openvoiceos      skill-ovos-weather.openvoiceos
ovos-skill-cmd.forslund                      ovos-skill-moviemaster.openvoiceos   skill-ovos-boot-finished.openvoiceos     skill-ovos-naptime.openvoiceos          skill-ovos-wikipedia.openvoiceos
ovos-skill-color-picker.krisgesling          ovos-skill-number-facts.openvoiceos  skill-ovos-date-time.openvoiceos         skill-ovos-news.openvoiceos             skill-ovos-wolfie.openvoiceos
ovos-skill-confucius-quotes.openvoiceos      ovos-skill-personal.OpenVoiceOS      skill-ovos-ddg.openvoiceos               skill-ovos-parrot.openvoiceos           skill-ovos-wordnet.openvoiceos
ovos-skill-days-in-history.openvoiceos       ovos-skill-pyradios.openvoiceos      skill-ovos-fallback-chatgpt.openvoiceos  skill-ovos-randomness.openvoiceos       skill-ovos-youtube-music.openvoiceos
ovos-skill-dictation.openvoiceos             ovos-skill-screenshot.openvoiceos    skill-ovos-fallback-unknown.openvoiceos  skill-ovos-somafm.openvoiceos           skill-randomness.mikejgray
ovos-skill-ggwave.openvoiceos                ovos-skill-speedtest.openvoiceos     skill-ovos-hello-world.openvoiceos       skill-ovos-spelling.openvoiceos

you can then edit settings with your favorite text editor

nano ~/.config/mycroft/skills/ovos-skill-cmd.forslund/settings.json 

To ensure that your changes are valid JSON, use the jq command-line tool:

jq . ~/.config/mycroft/skills/ovos-skill-cmd.forslund/settings.json

If the JSON is valid, jq will pretty-print it. Otherwise, it will return an error indicating where the issue lies.


Finding skills GUI resources

when skills load the GUI resource files are populated to /home/ovos/.cache/ovos_gui/

listing the folders in this directory will tell you which skills have a UI

ls /home/ovos/.cache/ovos_gui/

example output

ovos.common_play                 skill-ovos-date-time.openvoiceos    skill-ovos-naptime.openvoiceos    skill-ovos-wolfie.openvoiceos
ovos_gui_plugin_shell_companion  skill-ovos-ddg.openvoiceos          skill-ovos-parrot.openvoiceos     system
ovos-skill-alerts.openvoiceos    skill-ovos-homescreen.openvoiceos   skill-ovos-weather.openvoiceos
ovos-skill-ip.openvoiceos        skill-ovos-local-media.openvoiceos  skill-ovos-wikipedia.openvoiceos

Checking Disk Usage for Logs and Cache

Monitor how much disk space logs and cache are consuming :

du -h ~/.local/state/mycroft/ ~/.cache/ovos_gui | sort -h
  • du -h: Displays human-readable disk usage.
  • sort -h: Sorts the output by size.

Backing Up Skill Settings

To create a backup of all skill configuration files:

tar -czvf skill_configs_backup.tar.gz ~/.config/mycroft/skills/

To restore the backup:

tar -xzvf skill_configs_backup.tar.gz -C ~/.config/mycroft/skills/

Checking Microphone and Speaker Status

Test if OVOS can record audio from your microphone and play audio:

Test Microphone:

arecord -d 5 test-mic.wav && aplay test-mic.wav

Test Speaker:

aplay /usr/share/sounds/alsa/Front_Center.wav

Restoring Default Skill Settings

If a skill isn't behaving as expected, restore its default configuration by deleting its settings.json file. For example:

rm ~/.config/mycroft/skills/skill-ovos-weather.openvoiceos/settings.json

The skill will regenerate this file the next time it loads.


Listing Outdated Packages

pip list --outdated | grep -E 'ovos-|skill-'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment