Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project cannot be deleted because it is not in the default project directory: '/root/GNS3/projects' #3638

Open
jlamsens opened this issue Sep 26, 2024 · 5 comments
Labels

Comments

@jlamsens
Copy link

jlamsens commented Sep 26, 2024

GNS3 Version: v2.2.49
Operating System: Linux Mint 21.3

Please bear with me, while I do my best to accurately describe the steps to get this issue.

Clean OS

  1. Fully up-to-date clean install of Linux Mint 21.3 (user created during installation: "guru")

Pre-check1
guru@hp:~$ id
uid=1000(guru) gid=1000(guru) groups=1000(guru),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),115(lpadmin),136(sambashare)
-> user "guru" memberships

Install some tools
2. sudo apt install openssh-server -y
3. sudo apt install tree -y
4. sudo apt install apt-transport-https ca-certificates curl gnupg -y

Install GNS3
5. sudo add-apt-repository ppa:gns3/ppa
6. sudo apt update
7. sudo apt install gns3-gui gns3-server -y
a. ubridge question: yes
b. dumpcap question: yes
c. Use Systemd to automatically launch the GNS3 server at boot: yes

Post-check1
guru@hp:~$ ps faux | grep gns[3]
root 12548 0.2 0.1 211276 50236 ? Ss 11:12 0:01 /usr/share/gns3/gns3-server/bin/python /usr/bin/gns3server --local
-> server process running as root

Post-check2
guru@hp:~$ ls
Desktop Documents Downloads Music Pictures Public Templates Videos
-> no GNS3 folder yet

Start GNS3 (wizard starts)
8. Run appliances on my local computer (I do not need any virtual machine)
9. Accept default settings
10. Connection to the local GNS3 server has been successful!
11. Summary: finish

Post-check3
guru@hp:~$ ps faux | grep gns[3]
guru 13142 1.6 0.4 1461548 152096 ? Sl 11:19 0:02 | _ /usr/share/gns3/gns3-gui/bin/python /usr/bin/gns3
root 12548 0.3 0.1 368476 59748 ? Ssl 11:12 0:01 /usr/share/gns3/gns3-server/bin/python /usr/bin/gns3server --local
-> server process running as root
-> GUI running as "guru", the currently logged in user

Create project
12. File -> New Blank Project
13. Name: Test1 (Location suggested is /home/guru/GNS3/projects/Test1)

Post-check4
guru@hp:~$ ls
Desktop Documents Downloads GNS3 Music Pictures Public Templates Videos
-> directory "GNS3" is created

guru@hp:~$ tree -pug GNS3/
[drwxr-xr-x root root ] GNS3/
└── [drwxr-xr-x root root ] projects
└── [drwxr-xr-x root root ] Test1
└── [-rw-r--r-- root root ] Test1.gns3

2 directories, 1 file
-> but the "owner" of that folder, including subfolders is "root"

  1. File -> Delete project
    -> Error while closing project b1f89d8f-a34b-49ae-bc65-f4d03d07f9c9: Project 'Test1' cannot be deleted because it is not in the default project directory: '/root/GNS3/projects'

  2. Close GNS3

  3. guru@hp:~$ sudo chown -R guru:guru GNS3/

guru@hp:~$ tree -pug GNS3
[drwxr-xr-x guru guru ] GNS3
└── [drwxr-xr-x guru guru ] projects
└── [drwxr-xr-x guru guru ] Test1
├── [drwxr-xr-x guru guru ] project-files
│   └── [drwxr-xr-x guru guru ] images
└── [-rw-r--r-- guru guru ] Test1.gns3
-> change ownership and check

  1. Start GNS3 and open project "Test1"

  2. guru@hp:~$ tree -pug GNS3
    [drwxr-xr-x guru guru ] GNS3
    └── [drwxr-xr-x guru guru ] projects
    └── [drwxr-xr-x guru guru ] Test1
    ├── [drwxr-xr-x guru guru ] project-files
    │   └── [drwxr-xr-x guru guru ] images
    └── [-rw-r--r-- root root ] Test1.gns3
    -> only the ownership of projectfile "Test1.gns3" changes back to "root"

This is because of the ownership (see Post-check4) that should be "guru" and not "root", right?

Best regards,
Jurgen L.

@jlamsens jlamsens added the Bug label Sep 26, 2024
@jlamsens
Copy link
Author

Update: when you do a reboot, both services get started with ownership of "guru" now...:

guru@hp:~$ ps faux | grep gns[3]
guru 2047 7.4 0.4 1585068 141396 ? Sl 15:56 0:00 | _ /usr/share/gns3/gns3-gui/bin/python /usr/bin/gns3
guru 2064 8.4 0.1 512740 56476 ? Sl 15:56 0:00 | _ /usr/share/gns3/gns3-server/bin/python /usr/bin/gns3server --local --log=/home/guru/.config/GNS3/2.2/gns3_server.log --pid=/home/guru/.config/GNS3/2.2/gns3_server.pid

New projects then get the correct permissions (and you can delete them).

@grossmj
Copy link
Member

grossmj commented Sep 30, 2024

Thanks for the report. Looks like there is something wrong with how we install the systemd service.

@jlamsens
Copy link
Author

I wrote earlier, that after a reboot, I could once see that the gns3server service got started with ownership of "guru". The problem is, I cannot reproduce this a second time on a clean Linux Mint 21.3 using the exact same steps. The gns3-server process stays owned by "root". Very strange...

Anyway, editing the gns3server.service systemd file and adding "User=guru" (in my case the current logged in user) under the "[Service] section + reboot solved the problem. Then the service gets started under "guru" and I can delete my own projects now.

Thanks for looking into this and have a nice day.

@grossmj
Copy link
Member

grossmj commented Oct 1, 2024

Anyway, editing the gns3server.service systemd file and adding "User=guru" (in my case the current logged in user) under the "[Service] section + reboot solved the problem. Then the service gets started under "guru" and I can delete my own projects now.

This is a way to do it I think.

As for the setting up the systemd service when installing the gns3-server package Do you think we should automatically create a "gns3" user and "gns3" group if they don't exist and then add User=gns3 Group=gns3 in the gns3server.service systemd file or try to update that file to add the user who installed the package?

I looked at using a user systemd service (https://www.baeldung.com/linux/systemd-create-user-services) instead however I think it does not really fit the use case for gns3-server. Especially, by default user services are shutdown at the end of the last session.

Please let me know if you have another idea.

@jlamsens
Copy link
Author

jlamsens commented Oct 1, 2024

Hmm, good question. I'm not an expert in this.

I would not add the user who installs the package to the gns3server.service systemd file; when you create another user, for example "guru2" and login with that user and start the GNS3 client (GUI), you get errors because it cannot connect to the server process that is still running as "guru"...

So multiple users should be able to connect the client (GUI) to the server process, but the individual project files that they create, should be owned by the user creating them. Preferably, the server process should not run as root, I guess?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants