gns3-gui icon indicating copy to clipboard operation
gns3-gui copied to clipboard

Permissions error when updating from registry for appliance files (Linux) results in no updates

Open eantowne opened this issue 2 years ago • 1 comments

Before you start Please open an issue only if you suspect there is a bug or any problem with GNS3. Go to https://gns3.com/community for any other questions or for requesting help with GNS3.

You may also post this issue directly on the GNS3 server repository if you know the bug comes from the server: https://github.com/GNS3/gns3-server/issues/new

Describe the bug When attempting to update appliance files, "Update form online registry" fails due to a permissions issue, when run as non-root user. Only root has permissions to change write to these files:

-rw-r--r-- 1 root root is the permissions on the .gns3a files within the directory referenced below.

Debug error presentation: Error while getting appliances list: Could not write appliance file '/usr/share/gns3/gns3-server/lib/python3.10/site-packages/gns3server/appliances/6wind-turbo-router.gns3a': [Errno 13] Permission denied: '/usr/share/gns3/gns3-server/lib/python3.10/site-packages/gns3server/appliances/6wind-turbo-router.gns3a'

Permissions for the default location of appliances files and the applicable permissions:

drwxr-xr-x 2 root root 12288 Jul 25 07:41 appliances

GNS3 version and operating system (please complete the following information):

  • OS: Linux (Pop-OS, Ubuntu derivative, 22.04)
  • GNS3 version: 2.2.33.1, installed via PPA
  • Any use of the GNS3 VM or remote server (ESXi, bare metal etc.): Bare-Metal install on Linux

To Reproduce Steps to reproduce the behavior:

  1. Goto File->New Template
  2. Select "Install an appliance from the GNS3 server (Default)
  3. Click "Next"
  4. Click "Update from online registry" at bottom of window
  5. Error is not presented the second time it is run in the same session, however no updates seem to be happening

Screenshots or videos If applicable, add screenshots (e.g. of the topology and/or error message) or links to videos to help explain the problem. This will help us a lot to quickly find the bug and fix it.

Additional context Either the permissions on the folder and it's contents needs to be changed at install, or a different location needs to be used for storing the files.

eantowne avatar Jul 26 '22 18:07 eantowne

Looks like we should store all the appliance files into ~/GNS3/appliances (by default). I was hoping to migrate to importlib_resources first https://github.com/GNS3/gns3-server/issues/2046 however it doesn't support Python 3.6

grossmj avatar Oct 12 '22 15:10 grossmj

Now the server copy all the built-in appliance files into the GNS3 settings directory (for instance ~/.config/GNS3/2.2/appliances) on first boot.

grossmj avatar Nov 07 '22 13:11 grossmj

Now the server copy all the built-in appliance files into the GNS3 settings directory (for instance ~/.config/GNS3/2.2/appliances) on first boot.

More precise: On each start of the GNS3 server it copies all built-in appliance files, that don't exist in the settings directory, into that directory. The GNS3 server doesn't update existing appliances in the settings directory.

That results in a changed behavior:

Before v2.2.35: The appliances had the revision, that was available at the time of release of the GNS3 server. By updating GNS3 you automatically get an updated version of the appliances.

Now updating GNS3 doesn't update existing appliances. The appliances will stay at the version, when it first got copied to the settings directory. Unless, of course, they get updated from the registry. For example v2.2.35.1 updated extreme-networks-voss.gns3a. But when you previously used v2.2.35, its older version was copied to the settings directory and this appliance won't get the update from v2.2.35.1.

Sad enough I don't know how to improve this. When the GNS3 server encounters a difference between a built-in appliance file and that in the settings directory, it doesn't know what is the latest one. Maybe the appliance in the settings directory was updated from the registry and then GNS3 should not change it. Or the appliance in the settings directory was from an earlier GNS3 installation, then it should get an update. As this situation can't be resolved by the GNS3 server, it doesn't change the appliance in the settings directory. Nevertheless I'm not too happy with this situation.

b-ehlers avatar Nov 10 '22 15:11 b-ehlers

Now updating GNS3 doesn't update existing appliances. The appliances will stay at the version, when it first got copied to the settings directory. Unless, of course, they get updated from the registry. For example v2.2.35.1 updated extreme-networks-voss.gns3a. But when you previously used v2.2.35, its older version was copied to the settings directory and this appliance won't get the update from v2.2.35.1.

Yes, I am not happy about that too. The only solution I see for now is to write the current version number somewhere, the GNS3 would then only copy the appliance files to settings directory (and overwrite or delete them if necessary) if a new version or no version is detected.

grossmj avatar Nov 10 '22 16:11 grossmj