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

Upload is not working #4432

Closed
kaji-bikash opened this issue Sep 23, 2016 · 33 comments · Fixed by #4593
Closed

Upload is not working #4432

kaji-bikash opened this issue Sep 23, 2016 · 33 comments · Fixed by #4593

Comments

@kaji-bikash
Copy link

We are on latest snap package and 🚀 chat is at Version: 0.40.1

Here's the background:
It was working previously in 0.38 version. It stopped working after the upgrade of a snap package. Actually, I was fiddling with settings on AVATAR upload path and I remember setting to FILESYSTEM with /opt/avatar and I broke it. Since server itself was not starting up, I had to change things from backend through MongoDB console in rocketchat.settings collection ( reverted to GridFS).

We started experiencing this as well. Symptoms are almost the same but the scenarios are different.

When "upload" settings are tied to "Filesystem", the progress bar would freeze at 100% and nothing happens at all no matter the time. We get following in the log

ufs: cannot write file "zkb9tX9CKP8zLkX2W" (EROFS: read-only file system, open '/zkb9tX9CKP8zLkX2W.gif') { [Error: EROFS: read-only file system, open '/zkb9tX9CKP8zLkX2W.gif']
  errno: -30,
  code: 'EROFS',
  syscall: 'open',
  path: '/zkb9tX9CKP8zLkX2W.gif' }
Exception while invoking method 'ufsComplete' Error: EROFS: read-only file system, open '/zkb9tX9CKP8zLkX2W.gif'
    at Object.Future.wait (/snap/rocketchat-server/45/node_modules/fibers/future.js:449:15)
    at [object Object].ufsComplete (meteor://💻app/packages/jalik:ufs/ufs-methods.js:62:20)
    at [object Object].methodsMap.(anonymous function) (meteor://💻app/packages/rocketchat:lib/server/lib/debug.js:17:26)
    at maybeAuditArgumentChecks (meteor://💻app/packages/ddp-server/livedata_server.js:1711:12)
    at meteor://💻app/packages/ddp-server/livedata_server.js:711:19
    at [object Object]._.extend.withValue (meteor://💻app/packages/meteor/dynamics_nodejs.js:56:1)
    at meteor://💻app/packages/ddp-server/livedata_server.js:709:40
    at [object Object]._.extend.withValue (meteor://💻app/packages/meteor/dynamics_nodejs.js:56:1)
    at meteor://💻app/packages/ddp-server/livedata_server.js:707:46
    at Session.method (meteor://💻app/packages/ddp-server/livedata_server.js:681:23)
    at meteor://💻app/packages/ddp-server/livedata_server.js:551:43
    - - - - -
    at Error (native)
ufs: cannot delete temp file "/tmp/ufs/zkb9tX9CKP8zLkX2W" (ENOENT: no such file or directory, unlink '/tmp/ufs/zkb9tX9CKP8zLkX2W')

As for GridFS case, upload shows it worked fine but we get the blank placeholder of zero-byte / an empty file. However, nothing gets vomited in logs in this case.
screen shot 2016-09-23 at 11 17 29

@graywolf336
Copy link
Contributor

@geekgonecrazy Was this resolved in the #ubuntu-snap channel or is this still ongoing?

@geekgonecrazy
Copy link
Contributor

Ongoing. Couple other reports in non snap installs. Trying to get to the bottom of it still

@rodripf
Copy link

rodripf commented Sep 26, 2016

I am experimenting the same problem using the latest #ubuntu-snap

@kaji-bikash
Copy link
Author

@rodripf experimenting or experiencing ? For former, thank you :) and for the latter, kudos for validating my case 👍

@tlaerm
Copy link

tlaerm commented Oct 6, 2016

I am on snap 0.41 and I am experiencing this too.

@jGleitz
Copy link

jGleitz commented Oct 8, 2016

I’m experiencing this issue too. Here are some details about the behaviour on my side:

I’m also running the latest snap. Avatar images and file uploads are both set to GridFS. In both cases, I get an empty file after upload (just like OP) and no warning or error message.

However, both file upload and avatar images work if I start the server directly in Node JS (without running it through Snap), e.g. like this:

cd /snap/rocketchat-server/current/
export ROOT_URL=http://localhost PORT=3000 MONGO_URL=mongodb://localhost:27017/parties
./bin/node main.js

So the issue seems very snap specific.

I noted that for me, uploading files only doesn’t work for image files (e.g. pdf is okay). Furthermore, Avatar images work if I disable resizing them.

Does Rocket.Chat try to resize uploaded images? (Or run them through graphicsmagick for any other reason?) If yes, can this be disabled? Because that could be a workaround.

If the issue is really because of graphicsmagick, my wild guess would be that Rocket.Chat cannot find the gm executable in its Snap container.

To summarize, the situation on my server is like this:

Running through snap Running directly through Node JS
Avatar upload with resizing No Yes
Avatar upload without resizing Yes Yes
Image upload No Yes
Other File upload Yes Yes

@falkowich
Copy link

@jGleitz It looks like it uses $SNAP/usr/bin/convert.

vim stable/snapcraft.yaml

stage-packages:
  - imagemagick
organize:
   usr/bin/convert-im6: usr/bin/convert

@jGleitz
Copy link

jGleitz commented Oct 8, 2016

It looks like it uses $SNAP/usr/bin/convert.

Good hint. But if it’s using its own binary, then why is there a difference between running inside the snap and “outside”?

I thought Rocket.Chat would use gm because that’s mentioned in this bug:

Rocket.Chat uses GraphicsMagick for resizing, so you'd have to have that installed on your box.

Is that outdated info?

@geekgonecrazy
Copy link
Contributor

Both imagemagick and graphicsmagick provide the convert command. Rocket.Chat works with either one of them. We install imagemagick and include it in the snap.

Snaps are a isolated environment. Its packaged up with all of its dependencies. Also its restricted on which files and folders it can access. It can just access any file or folder it wishes. They are tightly controlled by the snap platform. This is one of the big benefits to using snaps.

So it appears for some reason its trying to use a file or folder it doesn't have access to on file upload.

@tlaerm
Copy link

tlaerm commented Oct 10, 2016

I can confirm @jGleitz's findings. Exact same symptoms for me.

@geekgonecrazy
Copy link
Contributor

In the latest snap it should be fixed.

We used to work with imagemagick or graphicsmagick. Something changed and if using imagemagick it seems to screw things up. So Graphicsmagick is required.

@tlaerm
Copy link

tlaerm commented Oct 21, 2016

And so it is. Thanks for your efforts.

@maxlath
Copy link

maxlath commented Apr 12, 2017

I encountered that exact same issue.
Rocket.Chat Version: 0.54.2
Ubuntu 16.04 / snap install

Can't it be due to file system access restriction inherent to snaps?

@geekgonecrazy
Copy link
Contributor

@maxlath if you have it setup to point to a filesystem path. Then yes absolutely. What path do you have specified?

@maxlath
Copy link

maxlath commented Apr 12, 2017

@geekgonecrazy I let the path field unaltered

@geekgonecrazy
Copy link
Contributor

@maxlath could you grab the value and paste it here? Its possible this value got messed up and maybe something we need to address.

@maxlath
Copy link

maxlath commented Apr 13, 2017

Step to reproduce:

  • Installed a fresh Rocket.Chat Version: 0.54.2 snap
  • After signing up, changed File Upload > Storage Type to FileSystem, without change anything else.
  • Back in the general room, trying to upload a small image displays the Upload File? modal correctly but once hitting Send, a message notify you of an internal server error:
ufs: cannot delete temp file at /tmp/ufs/WmDJcA9nSB24rn697 (ENOENT: no such file or directory, unlink '/tmp/ufs/WmDJcA9nSB24rn697')
ufs: cannot write file "WmDJcA9nSB24rn697" (EROFS: read-only file system, open '/WmDJcA9nSB24rn697.jpg') { [Error: EROFS: read-only file system, open '/WmDJcA9nSB24rn697.jpg']
  errno: -30,
  code: 'EROFS',
  syscall: 'open',
  path: '/WmDJcA9nSB24rn697.jpg' }
Exception while invoking method 'ufsComplete' Error: EROFS: read-only file system, open '/WmDJcA9nSB24rn697.jpg'
  at Object.Future.wait (/snap/rocketchat-server/580/node_modules/fibers/future.js:449:15)
  at [object Object].Meteor.methods.ufsComplete (/snap/rocketchat-server/580/programs/server/packages/jalik_ufs.js:824:24)
  at [object Object].methodsMap.(anonymous function) (/snap/rocketchat-server/580/programs/server/packages/rocketchat_lib.js:1095:26)
  at maybeAuditArgumentChecks (/snap/rocketchat-server/580/programs/server/packages/ddp-server.js:1817:12)
  at /snap/rocketchat-server/580/programs/server/packages/ddp-server.js:905:20
  at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
  at /snap/rocketchat-server/580/programs/server/packages/ddp-server.js:904:41
  at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
  at /snap/rocketchat-server/580/programs/server/packages/ddp-server.js:903:46
  at [object Object]._.extend.protocol_handlers.method (/snap/rocketchat-server/580/programs/server/packages/ddp-server.js:876:21)
  at /snap/rocketchat-server/580/programs/server/packages/ddp-server.js:755:85
    - - - - -
  at Error (native)
ufs: cannot delete temp file "/tmp/ufs/WmDJcA9nSB24rn697" (ENOENT: no such file or directory, unlink '/tmp/ufs/WmDJcA9nSB24rn697')

@geekgonecrazy
Copy link
Contributor

@maxlath what is the value of the filesystem path? Snaps are only allowed to write to certain places. So this is an important​ piece to verify

@maxlath
Copy link

maxlath commented Apr 13, 2017

@geekgonecrazy the input[name='FileUpload_FileSystemPath'] value is empty, is there another place I should check or is that the value you are looking for?

@geekgonecrazy
Copy link
Contributor

That's the value. It should be something like: /var/snap/rocketchat-server/common/uploads

@maxlath
Copy link

maxlath commented Apr 13, 2017

yep, it works when setting the path to /var/snap/rocketchat-server/common/uploads, you just need to mkdir /var/snap/rocketchat-server/common/uploads first

@geekgonecrazy
Copy link
Contributor

@maxlath I'll take a look at prepopulating the setting 👍

@rrepolona
Copy link

rrepolona commented Apr 19, 2017

I have the same issue :(

using the latest ubuntu lts, rocketchat version and snap version


Rocket.Chat version 0.55.0

snap-confine/xenial-updates,now 2.22.6 amd64 [installed,automatic]
snapd/xenial-updates,now 2.22.6 amd64 [installed]``


still i got the same error
```Apr 19 13:54:04 server-1011871-1 snap[3218]: Exception in callback of async function: Error: EROFS: read-only file system, mkdir '/var/rocketchat'```

/var/rocketchat is existing, and already make it chmod 777 just to test, since the error is read-only file system. /var/rocketchat is where our emoji is located

is there any updates for this error? 

@geekgonecrazy
Copy link
Contributor

@rrepolona it looks like from that you are trying to set the path to /var/rocketchat. Snaps are isolated environments with restricted access to the filesystem for security. That folder is not accessible by the snap

@rrepolona
Copy link

@geekgonecrazy

i see, actually had the transition from the manual installation to snap (by restoring mongo db to parties)
rocket.chat system went well for the whole week having this configuration '/var/rocketchat' it only acts i believe when our team made some update to integration. (but not sure if this is related)

currently running it like this (as mention by @jGleitz )

cd /snap/rocketchat-server/current/
export ROOT_URL=http://localhost PORT=3000 MONGO_URL=mongodb://localhost:27017/parties
./bin/node main.js

but i will check this, and remove the setting. ill give you feedback. thanks

@oliver-bowman
Copy link
Contributor

oliver-bowman commented May 11, 2017

I am still getting this error, with the latest build of RocketChat, this isnt a snap but a manual install. Any help?

 errno: -2,
 code: 'ENOENT',
 syscall: 'open',
 path: '/tmp/ufs/BsBPqk4hDPjHDEDbp' }
[Error: FileNotFound: no file with id BsBPqk4hDPjHDEDbp found]
Exception while invoking method 'ufsComplete' Error: ENOENT: no such file or directory, open '/tmp/ufs/BsBPqk4hDPjHDEDbp'
 at Object.Future.wait (/srv/rocketchat-builds/rc-0.55.1/programs/server/node_modules/fibers/future.js:449:15)
 at [object Object].Meteor.methods.ufsComplete (/srv/rocketchat-builds/rc-0.55.1/programs/server/packages/jalik_ufs.js:818:24)
 at [object Object].methodsMap.(anonymous function) (/srv/rocketchat-builds/rc-0.55.1/programs/server/packages/rocketchat_lib.js:1069:26)
 at [object Object].methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30)
 at maybeAuditArgumentChecks (/srv/rocketchat-builds/rc-0.55.1/programs/server/packages/ddp-server.js:1823:12)
 at /srv/rocketchat-builds/rc-0.55.1/programs/server/packages/ddp-server.js:905:20
 at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
 at /srv/rocketchat-builds/rc-0.55.1/programs/server/packages/ddp-server.js:904:41
 at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
 at /srv/rocketchat-builds/rc-0.55.1/programs/server/packages/ddp-server.js:903:46
 at [object Object]._.extend.protocol_handlers.method (/srv/rocketchat-builds/rc-0.55.1/programs/server/packages/ddp-server.js:876:21)
 at /srv/rocketchat-builds/rc-0.55.1/programs/server/packages/ddp-server.js:755:85

   - - - - -
 at Error (native)

@geekgonecrazy
Copy link
Contributor

@oliver-bowman you are using multiple instances right? If so please follow #6926

@dti-andre
Copy link

@maxlath Perfect!!!!!!!

@vishur98
Copy link

vishur98 commented Apr 2, 2019

Hi Guys, I
1
am also facing the same issue with the latest snap, with connecting it through Google cloud storage, it says "Internal server error 500"

@vishur98
Copy link

vishur98 commented Apr 2, 2019

-- Logs begin at Mon 2019-04-01 21:08:19 UTC. --
Apr 02 12:22:29 rocket-chat rocketchat-server.rocketchat-server[27507]: at Generator.next ()
Apr 02 12:22:29 rocket-chat rocketchat-server.rocketchat-server[27507]: at /snap/rocketchat-server/1367/programs/server/npm/node_modules/google-auth-library/build/src/auth
/oauth2client.js:22:71
Apr 02 12:22:29 rocket-chat rocketchat-server.rocketchat-server[27507]: at new Promise ()
Apr 02 12:22:29 rocket-chat rocketchat-server.rocketchat-server[27507]: at __awaiter (/snap/rocketchat-server/1367/programs/server/npm/node_modules/google-auth-library/bui
ld/src/auth/oauth2client.js:18:12)
Apr 02 12:22:29 rocket-chat rocketchat-server.rocketchat-server[27507]: at JWT.getRequestHeaders (/snap/rocketchat-server/1367/programs/server/npm/node_modules/google-auth
-library/build/src/auth/oauth2client.js:250:16)
Apr 02 12:22:29 rocket-chat rocketchat-server.rocketchat-server[27507]: at GoogleAuth. (/snap/rocketchat-server/1367/programs/server/npm/node_modules/google-aut
h-library/build/src/auth/googleauth.js:582:42)
Apr 02 12:22:29 rocket-chat rocketchat-server.rocketchat-server[27507]: at Generator.next ()
Apr 02 12:22:29 rocket-chat rocketchat-server.rocketchat-server[27507]: at fulfilled (/snap/rocketchat-server/1367/programs/server/npm/node_modules/google-auth-library/bui
ld/src/auth/googleauth.js:19:58)
Apr 02 12:22:29 rocket-chat rocketchat-server.rocketchat-server[27507]: at /snap/rocketchat-server/1367/programs/server/npm/node_modules/meteor/promise/node_modules/meteor
-promise/fiber_pool.js:43:40
Apr 02 12:22:29 rocket-chat rocketchat-server.rocketchat-server[27507]: ufs: cannot delete temp file "/tmp/ufs/gWCxrJv7xH3ErNA7p" (ENOENT: no such file or directory, unlink '/
tmp/ufs/gWCxrJv7xH3ErNA7p')

@Meloman-zz
Copy link

Meloman-zz commented Aug 29, 2019

yep, it works when setting the path to /var/snap/rocketchat-server/common/uploads, you just need to mkdir /var/snap/rocketchat-server/common/uploads first

worked for me with "FileSystem" storage type in admin interface.

(Ubuntu 18.04, Snap latest version)

@vishur98
Copy link

Hey @Meloman-zz, thanks for the help but I am using rocket chat with docker now. Could you please help me with the same in docker? as my primary disk is full & I am adding a new one for media storage.

@Alan-Capital
Copy link

yep, it works when setting the path to /var/snap/rocketchat-server/common/uploads, you just need to mkdir /var/snap/rocketchat-server/common/uploads first

Worked for me with "FileSystem" storage type in admin interface.

(Ubuntu 22.04, Snap latest stable version 5.0.2)

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

Successfully merging a pull request may close this issue.