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

Permission denied: '/media/data/fact_fw_data/91' #34

Open
dwairlk opened this issue Nov 17, 2022 · 3 comments
Open

Permission denied: '/media/data/fact_fw_data/91' #34

dwairlk opened this issue Nov 17, 2022 · 3 comments

Comments

@dwairlk
Copy link

dwairlk commented Nov 17, 2022

Hi all.
I have been trying to test the solution but I'm getting this error when I upload a file.

[2022-11-17 04:10:44][fail_safe_file_operations][ERROR]: Could not write file: [Errno 13] Permission denied: '/media/data/fact_fw_data/91'
fact-backend_1 | Traceback (most recent call last):
fact-backend_1 | File "/usr/local/lib/python3.8/dist-packages/common_helper_files/fail_safe_file_operations.py", line 61, in write_binary_to_file
fact-backend_1 | create_dir_for_file(file_path)
fact-backend_1 | File "/usr/local/lib/python3.8/dist-packages/common_helper_files/file_functions.py", line 50, in create_dir_for_file
fact-backend_1 | Path(file_path).resolve().parent.mkdir(parents=True, exist_ok=True)
fact-backend_1 | File "/usr/lib/python3.8/pathlib.py", line 1288, in mkdir
fact-backend_1 | self._accessor.mkdir(self, mode)
fact-backend_1 | PermissionError: [Errno 13] Permission denied: '/media/data/fact_fw_data/91'
fact-backend_1 | Process Unpacking-Worker-0:
fact-backend_1 | Traceback (most recent call last):
fact-backend_1 | File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
fact-backend_1 | self.run()
fact-backend_1 | File "/opt/FACT_core/src/helperFunctions/process.py", line 56, in run
fact-backend_1 | raise exception
fact-backend_1 | File "/opt/FACT_core/src/helperFunctions/process.py", line 51, in run
fact-backend_1 | Process.run(self)
fact-backend_1 | File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
fact-backend_1 | self._target(*self._args, **self._kwargs)
fact-backend_1 | File "/opt/FACT_core/src/scheduler/unpacking_scheduler.py", line 64, in unpack_worker
fact-backend_1 | extracted_objects = unpacker.unpack(fo)
fact-backend_1 | File "/opt/FACT_core/src/unpacker/unpack.py", line 37, in unpack
fact-backend_1 | file_path = self._generate_local_file_path(current_fo)
fact-backend_1 | File "/opt/FACT_core/src/unpacker/unpack.py", line 93, in _generate_local_file_path
fact-backend_1 | local_path = self.file_storage_system.generate_path(file_object.uid)
fact-backend_1 | File "/opt/FACT_core/src/storage/fsorganizer.py", line 30, in generate_path
fact-backend_1 | return self.generate_path_from_uid(file_object.uid)
fact-backend_1 | AttributeError: 'str' object has no attribute 'uid'

From the webserver, it shows upload successfully. However, If click on the analysis page, it shoes the file does not exist.

I followed this instructions:
$ docker pull ghcr.io/fkie-cad/fact-core-frontend:4.0.1
$ docker pull ghcr.io/fkie-cad/fact-core-backend:4.0.1
$ docker pull ghcr.io/fkie-cad/fact-core-scripts:4.0.1
$ ./start.py pull
$ ./start.py compose-env
--firmware-file-storage-dir path_to_fw_data_dir
# Have a look if it looks right
$ eval $(./start.py compose-env --firmware-file-storage-dir path_to_fw_data_dir)
$ export FACT_DOCKER_POSTGRES_PASSWORD=mypassword
$ docker volume create fact_postgres_data
$ docker-compose up -d database

Wait some seconds until the db is ready

$ ./start.py initialize-db
--network fact_docker_fact-network
$ docker-compose up

The last command shos this warning:

fact-backend_1 | [2022-11-17 04:09:22][start_fact_backend][WARNING]: Could not change permissions of docker-mount-base-dir. Ignoring.

My Linux system is
Linux 5.15.0-53-generic #59-Ubuntu SMP Mon Oct 17 18:53:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux.

I appreciate any indication/help

Thank you.

@maringuu
Copy link
Collaborator

What did you set path_to_fw_data_dir to?
Maybe it is not clear but path_to_fw_data_dir in the instructions shall be replaced by some path on your system.
E.g. $HOME/fact-firmwres (which you have to create before ofc).

fact-backend_1 | [2022-11-17 04:09:22][start_fact_backend][WARNING]: Could not change permissions of docker-mount-base-dir. Ignoring.

This warning can be ignored if I'm not mistaken. The docker-mount-base-dir is a directory in which all files that shall be mounted by docker must be placed by FACT. If you didn't change this in the default configuration this should be fine as the permissions are set right by start.py.

@dwairlk
Copy link
Author

dwairlk commented Nov 24, 2022

Hi @maringuu
Thank you for your answer.
I have created a local path at /media/data/.
The user is part of docker group.
I changed the permissions to 777. No ideal but I am able to test it.
chmod -R 777 /media/data/
I had to change the permission to 777 at /tmp/fact-docker-mount-base-dir
chmod 777 -R /tmp/fact-docker-mount-base-dir

The tool is working now.

Thanks

@maringuu
Copy link
Collaborator

The tool is working now.

Nice to hear!

Changing to 777 should really not be necessarry.
When I have time I'll investigate further what the problem ist.

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

No branches or pull requests

2 participants