fkie-cad / fkie-cad/FACT_docker

Permission denied: '/media/data/fact_fw_data/87'&& AttributeError: 'str' object has no attribute 'uid'

Open
#35 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
29
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Hello, thank you very much for providing this tool
I completed the tool deployment according to "Usage" and did not report any errors during the deployment process. However, after uploading the firmware, the following error occurred.
The installation process is as follows:
$ 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 /root/FACT_docker-main/data/
$ eval $(./start.py compose-env --firmware-file-storage-dir /root/FACT_docker-main/data/)
$ 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-main_fact-network
$ docker-compose up

No errors were reported during installation

The error message is as follows:
fact_docker-main-fact-backend-1 | [2023-03-28 02:31:49][fail_safe_file_operations][ERROR]: Could not write file: [Errno 13] Permission denied: '/media/data/fact_fw_data/87'
fact_docker-main-fact-backend-1 | Traceback (most recent call last):
fact_docker-main-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_docker-main-fact-backend-1 | create_dir_for_file(file_path)
fact_docker-main-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_docker-main-fact-backend-1 | Path(file_path).resolve().parent.mkdir(parents=True, exist_ok=True)
fact_docker-main-fact-backend-1 | File "/usr/lib/python3.8/pathlib.py", line 1288, in mkdir
fact_docker-main-fact-backend-1 | self._accessor.mkdir(self, mode)
fact_docker-main-fact-backend-1 | PermissionError: [Errno 13] Permission denied: '/media/data/fact_fw_data/87'
fact_docker-main-fact-frontend-1 | [pid: 24|app: 0|req: 38/188] 172.18.0.1 () {40 vars in 666 bytes} [Tue Mar 28 02:31:49 2023] GET /static/fact_logo_inv.svg => generated 0 bytes in 1 msecs (HTTP/1.1 304) 3 headers in 148 bytes (0 switches on core 1)
fact_docker-main-fact-backend-1 | Process Unpacking-Worker-3:
fact_docker-main-fact-backend-1 | Traceback (most recent call last):
fact_docker-main-fact-backend-1 | File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
fact_docker-main-fact-backend-1 | self.run()
fact_docker-main-fact-backend-1 | File "/opt/FACT_core/src/helperFunctions/process.py", line 56, in run
fact_docker-main-fact-backend-1 | raise exception
fact_docker-main-fact-backend-1 | File "/opt/FACT_core/src/helperFunctions/process.py", line 51, in run
fact_docker-main-fact-backend-1 | Process.run(self)
fact_docker-main-fact-backend-1 | File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
fact_docker-main-fact-backend-1 | self._target(*self._args, **self._kwargs)
fact_docker-main-fact-backend-1 | File "/opt/FACT_core/src/scheduler/unpacking_scheduler.py", line 64, in unpack_worker
fact_docker-main-fact-backend-1 | extracted_objects = unpacker.unpack(fo)
fact_docker-main-fact-backend-1 | File "/opt/FACT_core/src/unpacker/unpack.py", line 37, in unpack
fact_docker-main-fact-backend-1 | file_path = self._generate_local_file_path(current_fo)
fact_docker-main-fact-backend-1 | File "/opt/FACT_core/src/unpacker/unpack.py", line 93, in _generate_local_file_path
fact_docker-main-fact-backend-1 | local_path = self.file_storage_system.generate_path(file_object.uid)
fact_docker-main-fact-backend-1 | File "/opt/FACT_core/src/storage/fsorganizer.py", line 30, in generate_path
fact_docker-main-fact-backend-1 | return self.generate_path_from_uid(file_object.uid)
fact_docker-main-fact-backend-1 | AttributeError: 'str' object has no attribute 'uid'
fact_docker-main-fact-backend-1 | [2023-03-28 02:31:53][process][ERROR]: Exception in Unpacking process:
fact_docker-main-fact-backend-1 | Traceback (most recent call last):
fact_docker-main-fact-backend-1 | File "/opt/FACT_core/src/helperFunctions/process.py", line 51, in run
fact_docker-main-fact-backend-1 | Process.run(self)
fact_docker-main-fact-backend-1 | File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
fact_docker-main-fact-backend-1 | self._target(*self._args, **self._kwargs)
fact_docker-main-fact-backend-1 | File "/opt/FACT_core/src/scheduler/unpacking_scheduler.py", line 64, in unpack_worker
fact_docker-main-fact-backend-1 | extracted_objects = unpacker.unpack(fo)
fact_docker-main-fact-backend-1 | File "/opt/FACT_core/src/unpacker/unpack.py", line 37, in unpack
fact_docker-main-fact-backend-1 | file_path = self._generate_local_file_path(current_fo)
fact_docker-main-fact-backend-1 | File "/opt/FACT_core/src/unpacker/unpack.py", line 93, in _generate_local_file_path
fact_docker-main-fact-backend-1 | local_path = self.file_storage_system.generate_path(file_object.uid)
fact_docker-main-fact-backend-1 | File "/opt/FACT_core/src/storage/fsorganizer.py", line 30, in generate_path
fact_docker-main-fact-backend-1 | return self.generate_path_from_uid(file_object.uid)
fact_docker-main-fact-backend-1 | AttributeError: 'str' object has no attribute 'uid'
fact_docker-main-fact-backend-1 |
fact_docker-main-fact-backend-1 | [2023-03-28 02:31:53][process][WARNING]: restarting Unpacking 3 process

I manually created the "/media/data/fact_fw_data/87" folder and granted read, write, and execute permissions。
At the same time, I manually created the "/tmp/fact docker mount base dir/fact_unpack_e3qdhzga/" folder and the "/media/data/fact_wt_mongodb/" folder and gave them read and write execution permissions

I am using the Kali system, and the system information is as follows:
Linux kali 5.18.0-kali5-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.5-1kali6 (2022-07-07) x86_64 GNU/Lin
The entire installation process is performed using root privileges
Of course, the root user is also added to the docker user group

What is the reason for the error? How on earth should I set it so as not to report errors? Could you please explain it

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the firmware upload with the documented start.py and docker-compose commands, checking the configured storage paths. Read /opt/FACT_core/src/unpacker/unpack.py, /opt/FACT_core/src/storage/fsorganizer.py, and the logged fail_safe_file_operations.py path. Done means unpacking completes without the permission or string/uid exceptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, python
Domain
backend, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.