Issue with Arc on Ubuntu

Hey I am having an issue with file saving.
On windows it works nicely, but then I am trying to run the project on Ubuntu it seems like the folders are not getting created for the uploaded stuff and the file itself is not getting saved.
How can this be fixed?

ok managed to get an error:
# tried 10 times to create an uploaded file at /tmp/plug-1536 but failed. Set PLUG_TMPDIR to a directory with write permission

if i manually add sudo chmod -R 777 on the folders that are required then it is working as intended

Under which app does your phoenix application run and under which your reverse-proxy (if you use one)? Who owns the created temp-file/folder? With what permissions is it created originally?

Hey I use nginx fro reverse proxy, and the app is started from the mix release command output.
well i assume root owns it, so my user cannot write and copy from it.
to make it worse the issue is back

I logged out the conn too, and the part of it that has the data to update looks like this:

params: %{
    "_csrf_token" => "SHZoEW4jB1IaRC9uBAsUNTUKTh8QAAAA04+kETRcM3b4ujpZza70Ag==",
    "_method" => "put",
    "_utf8" => "āœ“",
    "id" => "2",
    "user" => %{
      "avatar" => %Plug.Upload{
        content_type: "image/jpeg",
        filename: "ConceptArt_SneakySneaky_011 (2).jpg",
        path: "/tmp/plug-1536/multipart-1536590148-521595600991125-4"
      },
      "name" => "bencepic",
      "password" => "",
      "role_id" => "1",
      "team_id" => ""
    }
  }

the questionable part here is the avatar since here is shows already that plug.upload, how could i log out the original request with the picture?

other weird thing is that with the get request that gets executed before this is working nicely, doesnt complain about not being logged in - 401

Hey the ā€œsolutionā€ i said before seems to be only temporary, do you maybe know a better solution?

Depends on the answers to my questions, which you havenā€™t given yet.

Iā€™d prefer answers checked in the config or in the filesystem over assumptions.

in the config of the elixir project?

  • User and group the phoenix project does run under, shoulb be in your service file to start the service
  • User and group the reverse proxy runs under, should be in your service file to start the service
  • Owner of the temp folder, just check when its created, also write down permission bits
  • Do you run in a SE linux context? (getenforce and sestatus)

hm sorry I do not understand much of this sadly, I am running it is on ubuntu 18 vps on google compute engine
on the vps i have nginx to reverse proxy the elixir app

i start everything under my user, not root,
how can i see when is it created?

Ok, so lets check first if your user is able to create temporary files at all, please try the following and paste the output (run these as your user please):

$ export TEMP_DIR_TEST=$(mktemp -d)
$ echo "test" > ${TEMP_DIR_TEST}/file.txt
$ cat ${TEMP_DIR_TEST}/file.txt
$ export TEMP_FILE_TEST=$(mktemp)
$ echo "testfile" > ${TEMP_FILE_TEST}
$ cat ${TEMP_FILE_TEST}
$ unset TEMP_DIR_TEST
$ unset TEMP_FILE_TEST
1 Like

i ran them 1by1 and this is how it went:

bence1204@instance-2:~$ export TEMP_DIR_TEST=$(mktemp -d)
bence1204@instance-2:~$ echo "test" > ${TEMP_DIR_TEST}/file.txt
bence1204@instance-2:~$ cat ${TEMP_DIR_TEST}/file.txt
test
bence1204@instance-2:~$ export TEMP_FILE_TEST=$(mktemp)
bence1204@instance-2:~$ echo "testfile" > ${TEMP_FILE_TEST}
bence1204@instance-2:~$ cat ${TEMP_FILE_TEST}
testfile
bence1204@instance-2:~$ unset TEMP_DIR_TEST
bence1204@instance-2:~$ unset TEMP_FILE_TEST
bence1204@instance-2:~$ export TEMP_DIR_TEST=$(mktemp -d)

sorry for the slow response, I am having some connection issues :sweat:
also just or the record i am usinf arc and arc_ecto if that matters

So it seems as if you are able to create files and folders in the temporary area.

Iā€™m not sure though why it doesnā€™t work for plugā€¦

Can you please check the permissions of /tmp and give the output of the SE-linux commands I mentioned above?

Also, please check df -h /tmp to see what kind of filesystem we have for tmp.

how do i check the permissions for /tmp?
that was the output of the commands that i ran, or what other command do you mean?

the

gives this :

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.6G 2.7G 7.0G 28% /

Those commands:

And to check permissions of the folder do ls -ld /tmp.

ok i missed those

getenforce and sestatus
Command ā€˜getenforceā€™ not found, but can be installed with:
apt install selinux-utils
Please ask your administrator.

Command ā€˜sestatusā€™ not found, but can be installed with:
apt install policycoreutils
Please ask your administrator.
so I am not running in se linux context, should i install those?

and

shows this:
drwxrwxrwt 15 root root 4096 Sep 14 15:48 /tmp

No need. But Iā€™m out of ideas nowā€¦