Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Add snapctl wrapper to check connected interfaces #82

Merged
merged 2 commits into from
Mar 15, 2023
Merged

Conversation

farshidtz
Copy link
Member

@farshidtz farshidtz commented Mar 13, 2023

Testing instructions

Reproduce the error

Create a UC model assertion that installs first the config provider, then device virtual (--edge).
Add appropriate connection to the gadget to connect the provider and consumer.
Install and look for expected errors: error installing config file: open /var/snap/edgex-device-virtual/180/config/device-virtual/res/configuration.toml: read-only file system

Test

Build device virtual from edgexfoundry/device-virtual-go#354
Upload to a branch and change the model assertion to use that instead.
Repeat as above and make sure the error is NOT there.

Enable debugging logs: snap set edgex-device-virtual debug=true

Copy link
Contributor

@MonicaisHer MonicaisHer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the test instructions, and the error disappeared as expected.
Additionally, I would like to check the log for is-connected from the install hook by enabling debugging logs. However, in the Ubuntu Classic environment I cannot find a way to enable it prior to running snap install and after snap install the install hook will not be called anymore.

@farshidtz
Copy link
Member Author

in the Ubuntu Classic environment I cannot find a way to enable it prior to running snap install and after snap install the install hook will not be called anymore.

Right. The provider isn't from the same publisher so the connection can only be done manually after installation. A refresh trick mentioned above (now removed) calls the refresh hook which isn't what we want.

@MonicaisHer
Copy link
Contributor

MonicaisHer commented Mar 14, 2023

I followed the test instructions to build a UC image with the following modifications, and as expected, the error disappeared:
(gadget.yaml)

connections:
  - plug: AmKuVTOfsN0uEKsyJG34M8CaMfnIqxc0:device-virtual-config
    slot: WWPGZGi1bImphPwrRfw46aP7YMyZYl6w:device-virtual-config
defaults:
  AmKuVTOfsN0uEKsyJG34M8CaMfnIqxc0: # edgex-device-virtual
    debug: true

(model.yaml)

  - name: edgex-config-provider-example
    type: app
    default-channel: latest/edge
    id: WWPGZGi1bImphPwrRfw46aP7YMyZYl6w
  - name: edgex-device-virtual
    type: app
    default-channel: latest/edge/pr-354
    id: AmKuVTOfsN0uEKsyJG34M8CaMfnIqxc0

However, I am unable to reproduce the error, and the following error presents while running the image in QEMU:

/usr/share/subiquity/console-conf-wrapper: line 32: snap: command not found
Press enter to configure.
(When I enter, it returns to the above message again)

@farshidtz
Copy link
Member Author

farshidtz commented Mar 14, 2023

Something is breaking the installation. As usual, you need to enable the debugging to know what. This works on core20: https://gist.github.com/farshidtz/12256b08964a5358a4901fe197c11d76

Alternatively, I think you can remove device-virtual from the model or set its presence field to optional and then install it manually via SSH to find possible installation errors interactively. Note that I am not 100% sure whether this approach would allow you to perform the test.

@MonicaisHer
Copy link
Contributor

I am confused. Did the error disappear or you could not reproduce it?

I think something has failed the installation. As usual, you need to enable the debugging to know more. This works on core20: https://gist.github.com/farshidtz/12256b08964a5358a4901fe197c11d76

Alternatively, I think you can remove device-virtual from the model or set its presence field to optional and then install it manually via SSH to find possible installation errors.

With the modification from this PR mentioned above, the installation error regarding the config file has been resolved and everything is functioning properly.

With the original setup, a new error, /usr/share/subiquity/console-conf-wrapper: line 32: snap: command not found, arises instead of reproducing the previous one.

I attempted to reproduce the installation error by removing device-virtual from the model and installing it later via SSH, and it didn't reproduce the previous installation error.

To further investigate this new error, I have enabled debugging and reviewed the error details:

snap-failure[3520]: snapmgr.go:378: cannot read snap info of snap "snapd" at revision 18357: cannot find installed snap "snapd" at revision 18357: missing file /snap/snapd/18357/meta/snap.yaml
...
systemd[1]: Finished Start the snapd services from the snapd snap.

@MonicaisHer
Copy link
Contributor

@farshidtz I identified the anticipated error in the logs and verified that this PR resolves the expected installation issue:

Mar 15 08:11:19 ubuntu systemd[1]: Started snap.edgex-device-virtual.hook.install.7c3c27b6-1230-40fe-bbc8-46852ff93e22.scope.
Mar 15 08:11:19 ubuntu edgex-device-virtual.install[2699]: Error installing config files: open /var/snap/edgex-device-virtual/563/config/device-virtual/res/configuration.toml: read-only file system

@farshidtz farshidtz merged commit 3e5be34 into main Mar 15, 2023
@farshidtz farshidtz deleted the is-connected branch March 15, 2023 09:26
MonicaisHer added a commit to MonicaisHer/device-mqtt-go that referenced this pull request Mar 17, 2023
MonicaisHer added a commit to MonicaisHer/app-rfid-llrp-inventory that referenced this pull request Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants