[GH-ISSUE #539] Question: ... How to fix Permission denied: '/data' #3363

Closed
opened 2026-03-14 22:23:43 +03:00 by kerem · 30 comments
Owner

Originally created by @Prn-Ice on GitHub (Nov 16, 2020).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/539

I'm following the setup instructions using docker-compose.

When I run docker-compose run archivebox init
I get

[i] [2020-11-16 13:38:31] ArchiveBox v0.4.21: archivebox init
    > /data

Traceback (most recent call last):
  File "/usr/local/bin/archivebox", line 33, in <module>
    sys.exit(load_entry_point('archivebox', 'console_scripts', 'archivebox')())
  File "/app/archivebox/cli/__init__.py", line 123, in main
    run_subcommand(
  File "/app/archivebox/cli/__init__.py", line 63, in run_subcommand
    module.main(args=subcommand_args, stdin=stdin, pwd=pwd)    # type: ignore
  File "/app/archivebox/cli/archivebox_init.py", line 33, in main
    init(
  File "/app/archivebox/util.py", line 113, in typechecked_function
    return func(*args, **kwargs)
  File "/app/archivebox/main.py", line 259, in init
    is_empty = not len(set(os.listdir(out_dir)) - ALLOWED_IN_OUTPUT_DIR)
PermissionError: [Errno 13] Permission denied: '/data'

Please how can I fix this?

Originally created by @Prn-Ice on GitHub (Nov 16, 2020). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/539 I'm following the setup instructions using `docker-compose`. When I run `docker-compose run archivebox init` I get ```sh [i] [2020-11-16 13:38:31] ArchiveBox v0.4.21: archivebox init > /data Traceback (most recent call last): File "/usr/local/bin/archivebox", line 33, in <module> sys.exit(load_entry_point('archivebox', 'console_scripts', 'archivebox')()) File "/app/archivebox/cli/__init__.py", line 123, in main run_subcommand( File "/app/archivebox/cli/__init__.py", line 63, in run_subcommand module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore File "/app/archivebox/cli/archivebox_init.py", line 33, in main init( File "/app/archivebox/util.py", line 113, in typechecked_function return func(*args, **kwargs) File "/app/archivebox/main.py", line 259, in init is_empty = not len(set(os.listdir(out_dir)) - ALLOWED_IN_OUTPUT_DIR) PermissionError: [Errno 13] Permission denied: '/data' ``` Please how can I fix this?
Author
Owner

@pirate commented on GitHub (Nov 16, 2020):

sudo chmod -R 777 data

<!-- gh-comment-id:728132198 --> @pirate commented on GitHub (Nov 16, 2020): `sudo chmod -R 777 data`
Author
Owner

@Prn-Ice commented on GitHub (Nov 16, 2020):

I get chmod: changing permissions of 'data/': Operation not permitted
I tried with sudo, but still get the same error when I run docker-compose run archivebox init

<!-- gh-comment-id:728140620 --> @Prn-Ice commented on GitHub (Nov 16, 2020): I get `chmod: changing permissions of 'data/': Operation not permitted` I tried with sudo, but still get the same error when I run `docker-compose run archivebox init`
Author
Owner

@kodxana commented on GitHub (Nov 19, 2020):

@Prn-Ice had that same issue. First delete existing data folder the create it again with mkdir data command :)

<!-- gh-comment-id:730558080 --> @kodxana commented on GitHub (Nov 19, 2020): @Prn-Ice had that same issue. First delete existing data folder the create it again with ```mkdir data``` command :)
Author
Owner

@pirate commented on GitHub (Nov 19, 2020):

that should not be necessary. I don't know why a sudo chmod -R 777 data doesn't work. What user are you running the docker-compose commands as, and what OS are you on?

<!-- gh-comment-id:730582186 --> @pirate commented on GitHub (Nov 19, 2020): that should not be necessary. I don't know why a `sudo chmod -R 777 data` doesn't work. What user are you running the docker-compose commands as, and what OS are you on?
Author
Owner

@Prn-Ice commented on GitHub (Nov 26, 2020):

I'm using docker on Fedora 33.

<!-- gh-comment-id:734387773 --> @Prn-Ice commented on GitHub (Nov 26, 2020): I'm using docker on Fedora 33.
Author
Owner

@pirate commented on GitHub (Nov 26, 2020):

What user are you running the docker-compose commands as?

<!-- gh-comment-id:734426837 --> @pirate commented on GitHub (Nov 26, 2020): > What user are you running the docker-compose commands as?
Author
Owner

@junpet commented on GitHub (Nov 27, 2020):

Similar here. I set 777 to the volume folder, but I got:

> docker-compose run archivebox init
Creating archivebox_archivebox_run ... done
[i] [2020-11-27 10:20:48] ArchiveBox v0.4.24: archivebox init
    > /data

[+] Initializing a new ArchiveBox collection in this folder...
    /data
------------------------------------------------------------------

[+] Building archive folder structure...
Traceback (most recent call last):
  File "/usr/local/bin/archivebox", line 33, in <module>
    sys.exit(load_entry_point('archivebox', 'console_scripts', 'archivebox')())
  File "/app/archivebox/cli/__init__.py", line 123, in main
    run_subcommand(
  File "/app/archivebox/cli/__init__.py", line 63, in run_subcommand
    module.main(args=subcommand_args, stdin=stdin, pwd=pwd)    # type: ignore
  File "/app/archivebox/cli/archivebox_init.py", line 33, in main
    init(
  File "/app/archivebox/util.py", line 113, in typechecked_function
    return func(*args, **kwargs)
  File "/app/archivebox/main.py", line 295, in init
    Path(SOURCES_DIR).mkdir(exist_ok=True)
  File "/usr/local/lib/python3.8/pathlib.py", line 1287, in mkdir
    self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/data/sources'

My docker-compose.yml. I've tried with and without OUTPUT_PERMISSIONS, no luck.

version: "3.8"

services:
  archivebox:
    image: archivebox/archivebox
    container_name: archivebox
    restart: always
    # security_opt:
    #   - no-new-privileges:true
    environment:
      - SUBMIT_ARCHIVE_DOT_ORG=False
      # - OUTPUT_PERMISSIONS=777
    volumes:
      - archivebox-data:/data
    networks:
      - traefik2-network
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.archivebox-rtr.entrypoints=https"
      - "traefik.http.routers.archivebox-rtr.rule=Host(`ab.$CLOUDFLARE_DOMAINNAME`)"
      - "traefik.http.routers.archivebox-rtr.tls=true"
      ## Middlewares
      # - "traefik.http.routers.archivebox-rtr.middlewares=no-auth-chain@file" # No Authentication
      # - "traefik.http.routers.archivebox-rtr.middlewares=basic-auth-chain@file" # Basic Authentication
      - "traefik.http.routers.authelia-rtr.middlewares=authelia-chain@file" # Authelia SSO
      ## HTTP Services
      - "traefik.http.routers.archivebox-rtr.service=archivebox-svc"
      - "traefik.http.services.archivebox-svc.loadbalancer.server.port=8000"

volumes:
  archivebox-data:
    driver: local-persist
    driver_opts:
      mountpoint: ${DOCKER_VOLUMES}/archivebox

networks:
  traefik2-network:
    external: true

After setting 777.
Edit (I'd like to clarify I did use -R):

sudo chmod -R 777 ${DOCKER_VOLUMES}/archivebox
drwxrwxrwx  2 root             root             4.0K Nov 27 06:01 archivebox

After running docker-compose run archivebox init

drwxr-xr-x  2 root             root             4.0K Nov 27 06:01 archivebox

I run with my user the docker-compose commands. Hope this helps.

<!-- gh-comment-id:734763614 --> @junpet commented on GitHub (Nov 27, 2020): Similar here. I set `777` to the volume folder, but I got: ``` > docker-compose run archivebox init Creating archivebox_archivebox_run ... done [i] [2020-11-27 10:20:48] ArchiveBox v0.4.24: archivebox init > /data [+] Initializing a new ArchiveBox collection in this folder... /data ------------------------------------------------------------------ [+] Building archive folder structure... Traceback (most recent call last): File "/usr/local/bin/archivebox", line 33, in <module> sys.exit(load_entry_point('archivebox', 'console_scripts', 'archivebox')()) File "/app/archivebox/cli/__init__.py", line 123, in main run_subcommand( File "/app/archivebox/cli/__init__.py", line 63, in run_subcommand module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore File "/app/archivebox/cli/archivebox_init.py", line 33, in main init( File "/app/archivebox/util.py", line 113, in typechecked_function return func(*args, **kwargs) File "/app/archivebox/main.py", line 295, in init Path(SOURCES_DIR).mkdir(exist_ok=True) File "/usr/local/lib/python3.8/pathlib.py", line 1287, in mkdir self._accessor.mkdir(self, mode) PermissionError: [Errno 13] Permission denied: '/data/sources' ``` My `docker-compose.yml`. I've tried with and without `OUTPUT_PERMISSIONS`, no luck. ```yml version: "3.8" services: archivebox: image: archivebox/archivebox container_name: archivebox restart: always # security_opt: # - no-new-privileges:true environment: - SUBMIT_ARCHIVE_DOT_ORG=False # - OUTPUT_PERMISSIONS=777 volumes: - archivebox-data:/data networks: - traefik2-network labels: - "traefik.enable=true" ## HTTP Routers - "traefik.http.routers.archivebox-rtr.entrypoints=https" - "traefik.http.routers.archivebox-rtr.rule=Host(`ab.$CLOUDFLARE_DOMAINNAME`)" - "traefik.http.routers.archivebox-rtr.tls=true" ## Middlewares # - "traefik.http.routers.archivebox-rtr.middlewares=no-auth-chain@file" # No Authentication # - "traefik.http.routers.archivebox-rtr.middlewares=basic-auth-chain@file" # Basic Authentication - "traefik.http.routers.authelia-rtr.middlewares=authelia-chain@file" # Authelia SSO ## HTTP Services - "traefik.http.routers.archivebox-rtr.service=archivebox-svc" - "traefik.http.services.archivebox-svc.loadbalancer.server.port=8000" volumes: archivebox-data: driver: local-persist driver_opts: mountpoint: ${DOCKER_VOLUMES}/archivebox networks: traefik2-network: external: true ``` After setting `777`. Edit (I'd like to clarify I did use `-R`): ``` sudo chmod -R 777 ${DOCKER_VOLUMES}/archivebox ``` ``` drwxrwxrwx 2 root root 4.0K Nov 27 06:01 archivebox ``` After running `docker-compose run archivebox init` ``` drwxr-xr-x 2 root root 4.0K Nov 27 06:01 archivebox ``` I run with my user the `docker-compose` commands. Hope this helps.
Author
Owner

@Prn-Ice commented on GitHub (Dec 1, 2020):

I tried setting 777 on the parent archivebox folder and no luck.

<!-- gh-comment-id:736166907 --> @Prn-Ice commented on GitHub (Dec 1, 2020): I tried setting 777 on the parent archivebox folder and no luck.
Author
Owner

@fs111 commented on GitHub (Dec 4, 2020):

I am trying on debian stable and I have the same issue. Any pointers?

<!-- gh-comment-id:739044403 --> @fs111 commented on GitHub (Dec 4, 2020): I am trying on debian stable and I have the same issue. Any pointers?
Author
Owner

@pirate commented on GitHub (Dec 4, 2020):

sudo chmod -R 777 data outside the container should fix it, don't just set 777 on the parent folder, you have to recursively set it with -R.

<!-- gh-comment-id:739047521 --> @pirate commented on GitHub (Dec 4, 2020): `sudo chmod -R 777 data` outside the container should fix it, don't just set 777 on the parent folder, you have to recursively set it with `-R`.
Author
Owner

@Prn-Ice commented on GitHub (Dec 5, 2020):

I switched to manjaro, followed the same steps, got

[+] Building archive folder structure...
Traceback (most recent call last):
  File "/usr/local/bin/archivebox", line 33, in <module>
    sys.exit(load_entry_point('archivebox', 'console_scripts', 'archivebox')())
  File "/app/archivebox/cli/__init__.py", line 123, in main
    run_subcommand(
  File "/app/archivebox/cli/__init__.py", line 63, in run_subcommand
    module.main(args=subcommand_args, stdin=stdin, pwd=pwd)    # type: ignore
  File "/app/archivebox/cli/archivebox_init.py", line 33, in main
    init(
  File "/app/archivebox/util.py", line 113, in typechecked_function
    return func(*args, **kwargs)
  File "/app/archivebox/main.py", line 299, in init
    Path(SOURCES_DIR).mkdir(exist_ok=True)
  File "/usr/local/lib/python3.8/pathlib.py", line 1287, in mkdir
    self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/data/sources'

Then deleted the data folder and created it again mkdir data.
After that docker-compose run archivebox init ran successfully.

<!-- gh-comment-id:739097564 --> @Prn-Ice commented on GitHub (Dec 5, 2020): I switched to manjaro, followed the same steps, got ```sh [+] Building archive folder structure... Traceback (most recent call last): File "/usr/local/bin/archivebox", line 33, in <module> sys.exit(load_entry_point('archivebox', 'console_scripts', 'archivebox')()) File "/app/archivebox/cli/__init__.py", line 123, in main run_subcommand( File "/app/archivebox/cli/__init__.py", line 63, in run_subcommand module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore File "/app/archivebox/cli/archivebox_init.py", line 33, in main init( File "/app/archivebox/util.py", line 113, in typechecked_function return func(*args, **kwargs) File "/app/archivebox/main.py", line 299, in init Path(SOURCES_DIR).mkdir(exist_ok=True) File "/usr/local/lib/python3.8/pathlib.py", line 1287, in mkdir self._accessor.mkdir(self, mode) PermissionError: [Errno 13] Permission denied: '/data/sources' ``` Then deleted the data folder and created it again `mkdir data`. After that `docker-compose run archivebox init` ran successfully.
Author
Owner

@junpet commented on GitHub (Dec 5, 2020):

@pirate I've used sudo chmod -R 777 data in the first place, please see my error above. By the way I use Debian on my server, but I won't change my OS...

<!-- gh-comment-id:739146686 --> @junpet commented on GitHub (Dec 5, 2020): @pirate I've used `sudo chmod -R 777 data` in the first place, please see my error above. By the way I use Debian on my server, but I won't change my OS...
Author
Owner

@bdelwood commented on GitHub (Dec 21, 2020):

I am having the same issue on Arch. I have a similar setup to junpet; using a local-driver named volume. After running docker-compose up -d or docker-compose run archivebox init the mountpoint ownership will change to root:root no matter what it was before.

<!-- gh-comment-id:748847064 --> @bdelwood commented on GitHub (Dec 21, 2020): I am having the same issue on Arch. I have a similar setup to junpet; using a local-driver named volume. After running `docker-compose up -d` or `docker-compose run archivebox init` the mountpoint ownership will change to `root:root` no matter what it was before.
Author
Owner

@HeinWinToe commented on GitHub (Jan 8, 2021):

@bdelwood @junpet

You need to change owner.

Try it with sudo chown {uid}:{gid} -R data. You can find your UID and GID using id command.

<!-- gh-comment-id:756547301 --> @HeinWinToe commented on GitHub (Jan 8, 2021): @bdelwood @junpet You need to change owner. Try it with `sudo chown {uid}:{gid} -R data`. You can find your UID and GID using `id` command.
Author
Owner

@pirate commented on GitHub (Jan 8, 2021):

I'm going to investigate changing the archivebox docker user in the Dockerfile to reduce problems like this with volume ownership. I've looked at how a few other projects do it and I think there's a way to fix the UID/GID within docker to be the same as the external user at runtime.

<!-- gh-comment-id:756732146 --> @pirate commented on GitHub (Jan 8, 2021): I'm going to investigate changing the archivebox docker user in the Dockerfile to reduce problems like this with volume ownership. I've looked at how a few other projects do it and I think there's a way to fix the UID/GID within docker to be the same as the external user at runtime.
Author
Owner

@bdelwood commented on GitHub (Jan 8, 2021):

@HeinWinToe I think this is an issue with the container changing permissions. I already chown'ed the directories, but recreating the container sets ownership to root:root

@pirate Great. If I have time I may look into it. For example, linuxserver.io has some custom scripts to ensure permissions. From the build repo for linuxserver/plex, for instance, they have a script to ensure correct permissions.

<!-- gh-comment-id:756860036 --> @bdelwood commented on GitHub (Jan 8, 2021): @HeinWinToe I think this is an issue with the container changing permissions. I already `chown`'ed the directories, but recreating the container sets ownership to `root:root` @pirate Great. If I have time I may look into it. For example, linuxserver.io has some custom scripts to ensure permissions. From the build repo for linuxserver/plex, for instance, [they have a script](https://github.com/linuxserver/docker-plex/blob/49843cd51988ee3aad4b5bce4e80503b2b36d546/root/etc/cont-init.d/40-chown-files#L22) to ensure correct permissions.
Author
Owner

@junpet commented on GitHub (Jan 9, 2021):

@HeinWinToe Still does not work. I set the correct owner and rights, I wrote above, but as @bdelwood mentioned, the container messes up everything and does not start.

[+] Initializing a new ArchiveBox collection in this folder...
    /data
------------------------------------------------------------------

[+] Building archive folder structure...
Traceback (most recent call last):
  File "/usr/local/bin/archivebox", line 33, in <module>
    sys.exit(load_entry_point('archivebox', 'console_scripts', 'archivebox')())
  File "/app/archivebox/cli/__init__.py", line 129, in main
    run_subcommand(
  File "/app/archivebox/cli/__init__.py", line 69, in run_subcommand
    module.main(args=subcommand_args, stdin=stdin, pwd=pwd)    # type: ignore
  File "/app/archivebox/cli/archivebox_init.py", line 33, in main
    init(
  File "/app/archivebox/util.py", line 112, in typechecked_function
    return func(*args, **kwargs)
  File "/app/archivebox/main.py", line 305, in init
    Path(SOURCES_DIR).mkdir(exist_ok=True)
  File "/usr/local/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/data/sources'
<!-- gh-comment-id:757120558 --> @junpet commented on GitHub (Jan 9, 2021): @HeinWinToe Still does not work. I set the correct owner and rights, I wrote above, but as @bdelwood mentioned, the container messes up everything and does not start. ``` [+] Initializing a new ArchiveBox collection in this folder... /data ------------------------------------------------------------------ [+] Building archive folder structure... Traceback (most recent call last): File "/usr/local/bin/archivebox", line 33, in <module> sys.exit(load_entry_point('archivebox', 'console_scripts', 'archivebox')()) File "/app/archivebox/cli/__init__.py", line 129, in main run_subcommand( File "/app/archivebox/cli/__init__.py", line 69, in run_subcommand module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore File "/app/archivebox/cli/archivebox_init.py", line 33, in main init( File "/app/archivebox/util.py", line 112, in typechecked_function return func(*args, **kwargs) File "/app/archivebox/main.py", line 305, in init Path(SOURCES_DIR).mkdir(exist_ok=True) File "/usr/local/lib/python3.9/pathlib.py", line 1312, in mkdir self._accessor.mkdir(self, mode) PermissionError: [Errno 13] Permission denied: '/data/sources' ```
Author
Owner

@Mist-Hunter commented on GitHub (Jan 9, 2021):

Just chiming in to say I'm having the same issue on Debian + Docker. I'd be curious to hear from someone who has gotten it to work, as it fails immediately with 100% reliability when just following the quick-start instructions.

Thank you for your work on this, I'm only posting this comment in the event it helps, not as a complaint. I'm excited to try this out as I've been looking for a replacement for HTTrack for quite a while :)

<!-- gh-comment-id:757342862 --> @Mist-Hunter commented on GitHub (Jan 9, 2021): Just chiming in to say I'm having the same issue on Debian + Docker. I'd be curious to hear from someone who has gotten it to work, as it fails immediately with 100% reliability when just following the quick-start instructions. Thank you for your work on this, I'm only posting this comment in the event it helps, not as a complaint. I'm excited to try this out as I've been looking for a replacement for HTTrack for quite a while :)
Author
Owner

@Mist-Hunter commented on GitHub (Jan 9, 2021):

It might not be relevant, as I'm no expert. But I notice that the quickstart guide shows
docker run -v $PWD:/data -it archivebox/archivebox init
docker run -v $PWD:/data -it archivebox/archivebox --version

Which could be root, and if I run:
docker run -v $PWD:/data --user 1000:1000 -it archivebox/archivebox init
It fails to init. Is it possible that running the init as root, and then the main docker as user could have anything to do with this problem?

<!-- gh-comment-id:757346054 --> @Mist-Hunter commented on GitHub (Jan 9, 2021): It might not be relevant, as I'm no expert. But I notice that the quickstart guide shows `docker run -v $PWD:/data -it archivebox/archivebox init ` `docker run -v $PWD:/data -it archivebox/archivebox --version` Which could be root, and if I run: `docker run -v $PWD:/data --user 1000:1000 -it archivebox/archivebox init` It fails to init. Is it possible that running the init as root, and then the main docker as user could have anything to do with this problem?
Author
Owner

@Mist-Hunter commented on GitHub (Jan 9, 2021):

In case this helps anyone understand what I'm doing wrong (or right). Here's the code I ran to get it working for me.

ab_path="$docker/archivebox/data"
docker container rm $LABEL
LABEL="ArchiveBox"
rm -rd $docker/archivebox
mkdir -p $ab_path && cd $ab_path
chown -R 1000:1000 $ab_path
chmod -R 0755 $ab_path
docker run --name $LABEL -v $ab_path:/data -it archivebox/archivebox init
docker container rm $LABEL
docker run --name $LABEL -v $ab_path:/data -it archivebox/archivebox --version
docker container rm $LABEL
docker run --name $LABEL -v $ab_path:/data -it archivebox/archivebox manage createsuperuser
docker container rm $LABEL
docker run -d --name $LABEL -v $ab_path:/data -p 8008:8000 archivebox/archivebox server 0.0.0.0:8000

Note: Port 8000 is taken on my computer, I'm not using /root ($PWD) for my data, and I've added a label and a remove statement at each step because otherwise I'm ending up with orphaned containers and random names at every step (docker run). I can't get it to work with --user 1000:1000, but it is now running (not ideally) as root. Add a -d flag so I get my command prompt back.

<!-- gh-comment-id:757351273 --> @Mist-Hunter commented on GitHub (Jan 9, 2021): In case this helps anyone understand what I'm doing wrong (or right). Here's the code I ran to get it working for me. ``` ab_path="$docker/archivebox/data" docker container rm $LABEL LABEL="ArchiveBox" rm -rd $docker/archivebox mkdir -p $ab_path && cd $ab_path chown -R 1000:1000 $ab_path chmod -R 0755 $ab_path docker run --name $LABEL -v $ab_path:/data -it archivebox/archivebox init docker container rm $LABEL docker run --name $LABEL -v $ab_path:/data -it archivebox/archivebox --version docker container rm $LABEL docker run --name $LABEL -v $ab_path:/data -it archivebox/archivebox manage createsuperuser docker container rm $LABEL docker run -d --name $LABEL -v $ab_path:/data -p 8008:8000 archivebox/archivebox server 0.0.0.0:8000 ``` Note: Port 8000 is taken on my computer, I'm not using /root ($PWD) for my data, and I've added a label and a remove statement at each step because otherwise I'm ending up with orphaned containers and random names at every step (docker run). I can't get it to work with --user 1000:1000, but it is now running (not ideally) as root. Add a -d flag so I get my command prompt back.
Author
Owner

@pirate commented on GitHub (Jan 13, 2021):

FYI @Mist-Hunter you can use docker run --rm ... instead of having to label and then manually rm after each step.

I usually run docker commands as root in a root-owned dir on Ubuntu, or as non-root in a non-root dir on macOS, so it's possible it only works in those two cases and I neglected to test non-root docker on Linux. Will report back once I have it fixed, a bit swamped this week with other work though.

<!-- gh-comment-id:759451689 --> @pirate commented on GitHub (Jan 13, 2021): FYI @Mist-Hunter you can use `docker run --rm ...` instead of having to label and then manually rm after each step. I usually run docker commands as root in a root-owned dir on Ubuntu, or as non-root in a non-root dir on macOS, so it's possible it only works in those two cases and I neglected to test non-root docker on Linux. Will report back once I have it fixed, a bit swamped this week with other work though.
Author
Owner

@alanfranz commented on GitHub (Jan 18, 2021):

I'm experiencing the same issue as @junpet on Ubuntu 18.04, latest docker-ce (20.10.2) and latest docker-compose.

I think that the underlying issue is that the docker entrypoint file https://github.com/ArchiveBox/ArchiveBox/blob/dev/bin/docker_entrypoint.sh tries to do some magic to drop privileges. But it probably gets something wrong and/or sharing the volumes between multiple containers does something bad to the permissions.

My workaround includes using POSIX ACLs, so you can retain access from the current user

id -u
docker run  -it archivebox/archivebox:latest /usr/bin/id -u

Annotate the two uids. They are 122 and 999 on my box, substitute as necessary.

mkdir data
setfacl -R -m u:122:rwx data
setfacl -d -m u:122:rwx data
setfacl -R -m u:999:rwx data
setfacl -d -m u:999:rwx data

Everything should work properly now.

<!-- gh-comment-id:762463494 --> @alanfranz commented on GitHub (Jan 18, 2021): I'm experiencing the same issue as @junpet on Ubuntu 18.04, latest docker-ce (20.10.2) and latest docker-compose. I think that the underlying issue is that the docker entrypoint file https://github.com/ArchiveBox/ArchiveBox/blob/dev/bin/docker_entrypoint.sh tries to do some magic to drop privileges. But it probably gets something wrong and/or sharing the volumes between multiple containers does something bad to the permissions. My workaround includes using POSIX ACLs, so you can retain access from the current user ``` id -u docker run -it archivebox/archivebox:latest /usr/bin/id -u ``` Annotate the two uids. They are 122 and 999 on my box, substitute as necessary. ``` mkdir data setfacl -R -m u:122:rwx data setfacl -d -m u:122:rwx data setfacl -R -m u:999:rwx data setfacl -d -m u:999:rwx data ``` Everything should work properly now.
Author
Owner

@johnmaguire commented on GitHub (Jan 20, 2021):

setfacl -R -m u:122:rwx data
setfacl -d -m u:122:rwx data
setfacl -R -m u:999:rwx data
setfacl -d -m u:999:rwx data

Thank you so much, this is exactly what I was hoping for.

@pirate I'd love if it supported PGID/PUID env vars like some other Dockerfiles do (e.g. I think all linuxserver ones? Maybe a good reference)

<!-- gh-comment-id:763263317 --> @johnmaguire commented on GitHub (Jan 20, 2021): > ``` > setfacl -R -m u:122:rwx data > setfacl -d -m u:122:rwx data > setfacl -R -m u:999:rwx data > setfacl -d -m u:999:rwx data > ``` Thank you so much, this is exactly what I was hoping for. @pirate I'd love if it supported PGID/PUID env vars like some other Dockerfiles do (e.g. I think all linuxserver ones? Maybe a good reference)
Author
Owner

@pirate commented on GitHub (Feb 1, 2021):

This should be fixed now in the latest v0.5.4 release (including PGID/PUID support), please give it a try. Report back here if you have any problems and I can reopen the issue.

<!-- gh-comment-id:770731445 --> @pirate commented on GitHub (Feb 1, 2021): This should be fixed now in the latest v0.5.4 release (including PGID/PUID support), please give it a try. Report back here if you have any problems and I can reopen the issue.
Author
Owner

@junpet commented on GitHub (May 3, 2021):

Sorry for late answer, I had no time. Just tried to spin up, and its working (well, I haven't done anything, just running the container). Time to read the docs. Thanks your hard work!

<!-- gh-comment-id:831352677 --> @junpet commented on GitHub (May 3, 2021): Sorry for late answer, I had no time. Just tried to spin up, and its working (well, I haven't done anything, just running the container). Time to read the docs. Thanks your hard work!
Author
Owner

@eightfiftytwo commented on GitHub (May 29, 2021):

Hello. I'm a new user following the quick start guide. Still having this issue on Fedora Server 34. Tried every solution in this thread but nothing worked. I'm a noob to docker so I have no idea where to even begin.
docker: moby-engine 20.10.6
docker-compose: 1.28.6

<!-- gh-comment-id:850803877 --> @eightfiftytwo commented on GitHub (May 29, 2021): Hello. I'm a new user following the quick start guide. Still having this issue on Fedora Server 34. Tried every solution in this thread but nothing worked. I'm a noob to docker so I have no idea where to even begin. docker: moby-engine 20.10.6 docker-compose: 1.28.6
Author
Owner

@eightfiftytwo commented on GitHub (May 29, 2021):

I tried it with SELinux disabled and it works now. Not sure whether or where to open an issue about this...

<!-- gh-comment-id:850834392 --> @eightfiftytwo commented on GitHub (May 29, 2021): I tried it with SELinux disabled and it works now. Not sure whether or where to open an issue about this...
Author
Owner

@snowshoes commented on GitHub (Mar 11, 2023):

same error nowadays, macOS Monterey 12.5, have tried everything mentioned in the post, but the problem persists.

I've already checked this post

https://github.com/ArchiveBox/ArchiveBox/issues/948

<!-- gh-comment-id:1464863662 --> @snowshoes commented on GitHub (Mar 11, 2023): same error nowadays, macOS Monterey 12.5, have tried everything mentioned in the post, but the problem persists. I've already checked this post https://github.com/ArchiveBox/ArchiveBox/issues/948
Author
Owner

@ctp9 commented on GitHub (Jan 6, 2025):

Same issue here - setup script is unable to complete due to permissions error. And no, I am not logged in as root (I made a new account just for ArchiveBox and am logged in with default access permissions):

Python 3.9.2
pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9)
3.1.14
3.1.14
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/dist-packages/archivebox/__main__.py", line 7, in <module>
    from .cli import main
  File "/usr/local/lib/python3.9/dist-packages/archivebox/cli/__init__.py", line 11, in <module>
    from ..config import OUTPUT_DIR, check_data_folder, check_migrations
  File "/usr/local/lib/python3.9/dist-packages/archivebox/config.py", line 1153, in <module>
    CONFIG = load_all_config()
  File "/usr/local/lib/python3.9/dist-packages/archivebox/config.py", line 1148, in load_all_config
    CONFIG = load_config(section_config, CONFIG)
  File "/usr/local/lib/python3.9/dist-packages/archivebox/config.py", line 755, in load_config
    config_file_vars = config_file_vars or load_config_file(out_dir=out_dir)
  File "/usr/local/lib/python3.9/dist-packages/archivebox/config.py", line 652, in load_config_file
    if config_path.exists():
  File "/usr/lib/python3.9/pathlib.py", line 1407, in exists
    self.stat()
  File "/usr/lib/python3.9/pathlib.py", line 1221, in stat
    return self._accessor.stat(self)
PermissionError: [Errno 13] Permission denied: '/root/ArchiveBox.conf'
[X] Django and ArchiveBox were not found after installing!
    Check to see if a previous step failed.
<!-- gh-comment-id:2572751720 --> @ctp9 commented on GitHub (Jan 6, 2025): Same issue here - setup script is unable to complete due to permissions error. And no, I am **not** logged in as root (I made a new account just for ArchiveBox and am logged in with default access permissions): ```python Python 3.9.2 pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9) 3.1.14 3.1.14 Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.9/dist-packages/archivebox/__main__.py", line 7, in <module> from .cli import main File "/usr/local/lib/python3.9/dist-packages/archivebox/cli/__init__.py", line 11, in <module> from ..config import OUTPUT_DIR, check_data_folder, check_migrations File "/usr/local/lib/python3.9/dist-packages/archivebox/config.py", line 1153, in <module> CONFIG = load_all_config() File "/usr/local/lib/python3.9/dist-packages/archivebox/config.py", line 1148, in load_all_config CONFIG = load_config(section_config, CONFIG) File "/usr/local/lib/python3.9/dist-packages/archivebox/config.py", line 755, in load_config config_file_vars = config_file_vars or load_config_file(out_dir=out_dir) File "/usr/local/lib/python3.9/dist-packages/archivebox/config.py", line 652, in load_config_file if config_path.exists(): File "/usr/lib/python3.9/pathlib.py", line 1407, in exists self.stat() File "/usr/lib/python3.9/pathlib.py", line 1221, in stat return self._accessor.stat(self) PermissionError: [Errno 13] Permission denied: '/root/ArchiveBox.conf' [X] Django and ArchiveBox were not found after installing! Check to see if a previous step failed. ```
Author
Owner

@pirate commented on GitHub (Jan 6, 2025):

You have to run ArchiveBox inside a new empty dir, you can't run it from inside your /root home folder @ctp9.

mkdir -p ~/archivebox/data
cd ~/archivebox/data
archivebox init
archivebox setup

Please open a new issue for any futher help as this one is very old ans was originally opened for an issue on v0.5.

<!-- gh-comment-id:2572809939 --> @pirate commented on GitHub (Jan 6, 2025): You have to run ArchiveBox inside a new empty dir, you can't run it from inside your `/root` home folder @ctp9. ```bash mkdir -p ~/archivebox/data cd ~/archivebox/data archivebox init archivebox setup ``` Please open a new issue for any futher help as this one is *very* old ans was originally opened for an issue on v0.5.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#3363
No description provided.