Signal-desktop: signal-desktop 1.15.0 crashes due to /tmp mounted noexec

Created on 3 Aug 2018  路  21Comments  路  Source: signalapp/Signal-Desktop

* [x] I have searched open and closed issues for duplicates

Bug description

signal-desktop 1.15.0 (ubuntu 16.04 packages from PPA) crashes on startup due to /tmp being mounted noexec.

Steps to reproduce

  1. sudo mount -o remount,noexec /tmp
  2. signal-desktop

Actual result:

A JavaScript error occurred in the main process
Uncaught Exception:
Error: /tmp/.org.chromium.Chromium.WVtpuO: Fehler beim Mappen des Shared Objects
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
    at Object.Module._extensions..node (module.js:671:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:186:18)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (module.js:586:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/opt/Signal/resources/app.asar/node_modules/@journeyapps/sqlcipher/lib/sqlite3.js:4:15)
    at Object.<anonymous> (/opt/Signal/resources/app.asar/node_modules/@journeyapps/sqlcipher/lib/sqlite3.js:190:3)

Expected result:

the app should start without errors. worked with 1.14.4 before.

IIRC this is the third return of /tmp mounted noexec killing the application. could you add something like a unit test for that?

Platform info

Signal-Desktop version: 1.15.0

Operating System:

ubuntu 16.04

Bug Upstream Change Needed

Most helpful comment

This obvious bug is still present in 1.34.1 (2 years later)
Why do users still have to deal with it?

/tmp never was intended to keep executable files
(and I have 35+ years of experience with *nix variants).
The noexec flag is correct.

Having said that, 2 things should be done:

  1. escalate the problem to the right person, so that it is finally fixed
  2. Ship the signal-desktop with a start script that creates a dedicated directory in the users home directory, e.g.

!/bin/bash

export TMPDIR=$HOME/.cache/signal-tmp
mkdir -p $TMPDIR
exec signal-desktop

Extend this script by correct error handling.

All 21 comments

Confirmed still issue with 15.1.1

yes, this is still broken in 1.15.1.

i find it odd that this particular issue reappears again and again. i've been using /tmp mounted noexec for many years now, and so far there were only two cases which needed some attention: package upgrades (you can configure apt to remount /tmp exec temporarily during installation) and some R packages during compilation. this is the first program that wants to execute code in /tmp all the time.

1.15.2 still broken

problem still unresolved on version 1.15.2

We'll include something in the release notes if we've attempted to fix this issue - no need to mention new versions.

while it's far from a fix, there is a workaround:
since the signal-desktop respects the TMPDIR enviroment, you can have a decticated tempdir for the signal app without having to have the main /tmp mounted exec
(i would still prefer for it to work without a exec mounted tempdir, as i see little reason why that should be nececesary)

since the signal-desktop respects the TMPDIR enviroment, you can have a decticated tempdir for the signal app without having to have the main /tmp mounted exec

ah, that's helping -- starting the app with TMPDIR=/some/other/dir signal-desktop makes it start.

however, i'm now stuck at the "loading messages" display which won't finish even after hours. here's an excerpt from what i see on the terminal a lot:

{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"queueEnvelope error handling envelope +[REDACTED]893.6 1533379877674 : MessageCounterError: Message key not found. The counter was repeated or the key was not filled.\n    at file://[REDACTED]/app.asar/js/libtextsecure.js:36404:25\n    at <anonymous>","time":"2018-08-10T09:44:56.573Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"message from +[REDACTED]123.1 1533379881638","time":"2018-08-10T09:44:56.573Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"Top-level unhandled promise rejection: MessageCounterError: Message key not found. The counter was repeated or the key was not filled.","time":"2018-08-10T09:44:56.573Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"background onError: MessageCounterError: Message key not found. The counter was repeated or the key was not filled.\n    at file://[REDACTED]/app.asar/js/libtextsecure.js:36404:25\n    at <anonymous>","time":"2018-08-10T09:44:56.574Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"queueEnvelope error handling envelope +[REDACTED]123.1 1533379881638 : MessageCounterError: Message key not found. The counter was repeated or the key was not filled.\n    at file://[REDACTED]/app.asar/js/libtextsecure.js:36404:25\n    at <anonymous>","time":"2018-08-10T09:44:56.574Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"message from +[REDACTED]123.1 1533379883532","time":"2018-08-10T09:44:56.574Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"Top-level unhandled promise rejection: MessageCounterError: Message key not found. The counter was repeated or the key was not filled.","time":"2018-08-10T09:44:56.575Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"background onError: MessageCounterError: Message key not found. The counter was repeated or the key was not filled.\n    at file://[REDACTED]/app.asar/js/libtextsecure.js:36404:25\n    at <anonymous>","time":"2018-08-10T09:44:56.575Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"queueEnvelope error handling envelope +[REDACTED]123.1 1533379883532 : MessageCounterError: Message key not found. The counter was repeated or the key was not filled.\n    at file://[REDACTED]/app.asar/js/libtextsecure.js:36404:25\n    at <anonymous>","time":"2018-08-10T09:44:56.575Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"message from +[REDACTED]893.6 1533379886174","time":"2018-08-10T09:44:56.575Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"Top-level unhandled promise rejection: MessageCounterError: Message key not found. The counter was repeated or the key was not filled.","time":"2018-08-10T09:44:56.575Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"background onError: MessageCounterError: Message key not found. The counter was repeated or the key was not filled.\n    at file://[REDACTED]/app.asar/js/libtextsecure.js:36404:25\n    at <anonymous>","time":"2018-08-10T09:44:56.576Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"queueEnvelope error handling envelope +[REDACTED]893.6 1533379886174 : MessageCounterError: Message key not found. The counter was repeated or the key was not filled.\n    at file://[REDACTED]/app.asar/js/libtextsecure.js:36404:25\n    at <anonymous>","time":"2018-08-10T09:44:56.576Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"message from +[REDACTED]893.6 1533379892618","time":"2018-08-10T09:44:56.576Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"Top-level unhandled promise rejection: MessageCounterError: Message key not found. The counter was repeated or the key was not filled.","time":"2018-08-10T09:44:56.576Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"background onError: MessageCounterError: Message key not found. The counter was repeated or the key was not filled.\n    at file://[REDACTED]/app.asar/js/libtextsecure.js:36404:25\n    at <anonymous>","time":"2018-08-10T09:44:56.578Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"queueEnvelope error handling envelope +[REDACTED]893.6 1533379892618 : MessageCounterError: Message key not found. The counter was repeated or the key was not filled.\n    at file://[REDACTED]/app.asar/js/libtextsecure.js:36404:25\n    at <anonymous>","time":"2018-08-10T09:44:56.578Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"delivery receipt from +[REDACTED]123.2 1533379987459","time":"2018-08-10T09:44:56.578Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":50,"msg":"Top-level unhandled promise rejection: MessageCounterError: Message key not found. The counter was repeated or the key was not filled.","time":"2018-08-10T09:44:56.578Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"No message for delivery receipt +[REDACTED]123 1533379987459","time":"2018-08-10T09:44:59.058Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"delivery receipt from +[REDACTED]123.1 1533379987459","time":"2018-08-10T09:44:59.058Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"No message for delivery receipt +[REDACTED]123 1533379987459","time":"2018-08-10T09:44:59.232Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"Sending a keepalive message","time":"2018-08-10T09:45:31.130Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"Remove all notifications","time":"2018-08-10T09:46:06.286Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"Update notifications: {\"shouldClearNotifications\":false,\"shouldPlayNotificationSound\":false,\"shouldShowNotifications\":false,\"type\":\"disabled\",\"isNotificationGroupingSupported\":true}","time":"2018-08-10T09:46:07.286Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"Sending a keepalive message","time":"2018-08-10T09:46:26.244Z","v":0}
{"name":"log","hostname":"wierd","pid":20935,"level":30,"msg":"Sending a keepalive message","time":"2018-08-10T09:47:21.353Z","v":0}

@unDocUMeantIt depending on the exact version you are currently using, this sounds like https://github.com/signalapp/Signal-Desktop/issues/2642

@adengg i'm running signal-desktop 1.15.3 on kubuntu 16.04

I would guess that it's more like https://github.com/signalapp/Signal-Desktop/issues/2647 - and we'll need more of the log to figure out what's going on. The 'Message key is not found' error usually comes from trying to reprocess already-decrypted messages. My guess is that you have some entries like this in your log:

ERROR 2018-08-08T17:35:21.047Z handleRequest error trying to add message to cache: Error: Request to saveUnprocessed timed out

@scottnonnenberg

My guess is that you have some entries like this in your log:

just checked, you're correct.

we'll need more of the log to figure out what's going on.

i've attached a full log to the #2647 thread.

I experienced the same after upgrade to v1.15.5-beta.1. Effective workaround is creating a temporary directory outside of /tmp and setting TMPDIR to that prior to startup.

/tmp is not a place for executable files on Linux.

This obvious bug is still present in 1.34.1 (2 years later)
Why do users still have to deal with it?

/tmp never was intended to keep executable files
(and I have 35+ years of experience with *nix variants).
The noexec flag is correct.

Having said that, 2 things should be done:

  1. escalate the problem to the right person, so that it is finally fixed
  2. Ship the signal-desktop with a start script that creates a dedicated directory in the users home directory, e.g.

!/bin/bash

export TMPDIR=$HOME/.cache/signal-tmp
mkdir -p $TMPDIR
exec signal-desktop

Extend this script by correct error handling.

@pahhur I'd recommend that you file a bug on electron, since we don't do anything with /tmp in our code: https://github.com/electron/electron/issues

since we don't do anything with /tmp in our code:

yet, a library you've decided to use causes problem (incorrect use, bug in the library, ...?)

Why not fixing the issue when a simple solution exists? :

https://github.com/signalapp/Signal-Desktop/issues/2595#issuecomment-635916892

PS: rather than overriding TMPDIR for everyone, do not export it but set it locally for the called app:

TMPDIR=/bla exec signal-desktop

PS: rather than overriding TMPDIR for everyone, do not export it but set it locally for the called app:

@breznak
The export command in my script above does not affect a setting of anyone else, it just makes the TMPDIR settings permanent for all further processes that are forked from the given shell and from the exec'd signal-desktop executable.

@pahhur I'd recommend that you file a bug on electron, since we don't do anything with /tmp in our code: https://github.com/electron/electron/issues

Bug filed in electron/electron#24242.

Unfortunately the full Signal app is too large of a repro case to be useful. Can you perhaps replicate the behavior using Fiddle?

Could someone help me to create such a fiddle?

@scottnonnenberg-signal @unDocUMeantIt @breznak @pahhur maybe?

I posted a comment in that bug. Let's wait for his answer.

@scottnonnenberg-signal Signal is using electron wrongly. See their answer in https://github.com/electron/electron/issues/24242#issuecomment-648914819.

This issue is solvable (and should be solved) on the apps side of things. The issue is the app in question is packaging their native modules _into_ an ASAR file (normally app.asar). You can't load a native module from an ASAR so Electron tries to help you out by extracting the native module (effectively a shared library) to the temporary directory and load it from there. In the case where /tmp has noexec this isn't going to work.

Each app should ensure that native modules aren't packed into the ASAR and are instead stored / shipped in app.asar.unpacked.

Thanks for filing that bug for us - we have a task on our backlog now for moving native binaries out of the .asar.

Was this page helpful?
0 / 5 - 0 ratings