Open cjroebuck opened 5 years ago
@cjroebuck, I can't speak for @dimkir but I worked through this tutorial to get Cypress (which also uses Electron) running on AWS Lambda, and that is all I did to create the patched binary -- changed /dev/shm
to /tmp/shm
-- and combined with doing mkdir /tmp/shm
at function runtime, that did the trick.
(Thanks @dimkir for the great tutorial, it saved me a ton of time!)
@stuartsan - thanks for that it's helpful.
But I was also wondering how you would regenerate the electron binary, for example, to get an updated version of electron/chromium.
@cjroebuck, what I did was first look for instances of the string dev/shm
in the binary:
$ strings /path/to/electron | grep 'dev\/shm'
/dev/shm/
/dev/shm
/dev/shm. Try 'sudo chmod 1777 /dev/shm' to fix.
I snagged the position of each of the first two instances of dev/shm
and used dd
to substitute in tmp/shm
. The third instance seems to be an error message, so I ignored it.
The first:
position=$(strings -t d /path/to/electron | grep '/dev\/shm\/' | cut -d' ' -f1)
echo -n '/tmp/shm/' | dd bs=1 of=/path/to/electron seek="$position" conv=notrunc
And the second:
position=$(strings -t d /path/to/electron | grep '/dev\/shm' -m 1 | cut -d' ' -f1)
echo -n '/tmp/shm' | dd bs=1 of=/path/to/electron seek="$position" conv=notrunc
(Coulda consolidated it all into one command but lazy)
And now the binary is patched:
$ strings /path/to/electron | grep 'dev\/shm'
/dev/shm. Try 'sudo chmod 1777 /dev/shm' to fix.
$ strings /path/to/electron | grep 'tmp\/shm'
/tmp/shm/
/tmp/shm
In case it's useful, much more context can be found in my post on the subject.
Bookmarked! Thank you!
Hi @dimkir, great repo, thanks for sharing. I just wondered about the electron binary and how you would go about regenerating the patched binary that you have in the pack.
I'm assuming you patched /dev/shm to /tmp/shm in the electron binary, but is there anything else that needs to be done to re-create the electron binary itself? There isn't really any mention of this step in the tutorial, or if there is I haven't found it yet!