scripts icon indicating copy to clipboard operation
scripts copied to clipboard

repush.sh script stuck for ever

Open GBZH opened this issue 4 years ago • 7 comments

Hi, I have installed your scripts on my laptop running under Linux Ubuntu 20.04. I enabled the USB Web UI on the remarkable 2 tablet. Typing the following command: reMarkable/scripts/host/repush.sh -r xxx.xxx.x.xx wcs.pdf [email protected]'s password: with good IP address and password, nothing happens, no error message and no file copied on the tablet. It stays there forever. After killing the command with CTRL c, I get an error message if I try to rerun the command w/o restarting the reMarkable 2 tablet: repush: Port 9000 is already used by a different process!

Any hints on how to solve this problem is very welcome. Thanks, Gilles

GBZH avatar Feb 11 '21 15:02 GBZH

This is probably issue #31, you can try the fix in the PR: https://github.com/reHackable/scripts/pull/35

trou avatar Feb 11 '21 23:02 trou

Hi,

Many thanks, downloading your new script solved the problem when the tablet is connected to the laptop and when copying with the following command : repush.sh file.pdf But the command is still stuck after entering password when tablet is connected and using : repush.sh -r xxx.xxx.x.xx file.pdf

De: "Raphaël Rigo" [email protected] À: "reHackable/scripts" [email protected] Cc: "Gilles Quéméner" [email protected], "Author" [email protected] Envoyé: Vendredi 12 Février 2021 00:02:24 Objet: Re: [reHackable/scripts] repush.sh script stuck for ever (#34)

This is probably issue [ https://github.com/reHackable/scripts/issues/31 | #31 ] , you can try the fix in the PR: [ https://github.com/reHackable/scripts/pull/35 | #35 ]

— You are receiving this because you authored the thread. Reply to this email directly, [ https://github.com/reHackable/scripts/issues/34#issuecomment-777850697 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AAQU2CZEM7VVKKS7BLQYOUTS6ROYBANCNFSM4XPBCBKQ | unsubscribe ] .

GBZH avatar Feb 12 '21 08:02 GBZH

It's probably because the Web UI is disabled when the rM is disconnected. Can you post the output of bash -x repush.sh -r x.x.x.x file.pdf ?

trou avatar Feb 12 '21 08:02 trou

Here are the outputs that you want :

  1. First test: tablet is connected to laptop and USB interface is OFF

~$ bash -x reMarkable/scripts/host/repush.sh -r xxx.xxx.x.xx wcs.pdf

  • VERSION=4.1
  • SSH_ADDRESS=10.11.99.1
  • WEBUI_ADDRESS=10.11.99.1:80
  • PORT=9000
  • shopt -s nullglob
  • getopts :vhdr:p:o: opt
  • case "$opt" in
  • SSH_ADDRESS=xxx.xxx.x.xx
  • REMOTE=1
  • getopts :vhdr:p:o: opt
  • shift 2
  • '[' -z wcs.pdf ']'
  • for f in "$@"
  • check_file wcs.pdf ++ file -F '|' wcs.pdf
  • file_cmd_output='wcs.pdf| PDF document, version 1.1'
  • echo 'wcs.pdf| PDF document, version 1.1'
  • grep -q '| directory'
  • '[' '!' -e wcs.pdf ']'
  • '[' -z ']'
  • echo 'wcs.pdf| PDF document, version 1.1'
  • grep -q '| PDF'
  • '[' -z ']'
  • echo wcs.pdf
  • grep -qi '.pdf$'
  • echo wcs.pdf
  • grep -q '"'
  • return 1
  • '[' 1 -eq 0 ']'
  • '[' 1 ']'
  • nc -z localhost 9000
  • echo 'repush: Port 9000 is already used by a different process!' repush: Port 9000 is already used by a different process!
  • exit -1
  1. Second test: tablet is connected to laptop and USB interface is ON

~$ bash -x reMarkable/scripts/host/repush.sh -r xxx.xxx.x.xx wcs.pdf

  • VERSION=4.1
  • SSH_ADDRESS=10.11.99.1
  • WEBUI_ADDRESS=10.11.99.1:80
  • PORT=9000
  • shopt -s nullglob
  • getopts :vhdr:p:o: opt
  • case "$opt" in
  • SSH_ADDRESS=xxx.xxx.x.xx
  • REMOTE=1
  • getopts :vhdr:p:o: opt
  • shift 2
  • '[' -z wcs.pdf ']'
  • for f in "$@"
  • check_file wcs.pdf ++ file -F '|' wcs.pdf
  • file_cmd_output='wcs.pdf| PDF document, version 1.1'
  • echo 'wcs.pdf| PDF document, version 1.1'
  • grep -q '| directory'
  • '[' '!' -e wcs.pdf ']'
  • '[' -z ']'
  • echo 'wcs.pdf| PDF document, version 1.1'
  • grep -q '| PDF'
  • '[' -z ']'
  • echo wcs.pdf
  • grep -qi '.pdf$'
  • echo wcs.pdf
  • grep -q '"'
  • return 1
  • '[' 1 -eq 0 ']'
  • '[' 1 ']'
  • nc -z localhost 9000
  • echo 'repush: Port 9000 is already used by a different process!' repush: Port 9000 is already used by a different process!
  • exit -1
  1. Third test: tablet is not connected to laptop and therefore USB interface is OFF by default

~$ bash -x reMarkable/scripts/host/repush.sh -r xxx.xxx.x.xx wcs.pdf

  • VERSION=4.1
  • SSH_ADDRESS=10.11.99.1
  • WEBUI_ADDRESS=10.11.99.1:80
  • PORT=9000
  • shopt -s nullglob
  • getopts :vhdr:p:o: opt
  • case "$opt" in
  • SSH_ADDRESS=xxx.xxx.x.xx
  • REMOTE=1
  • getopts :vhdr:p:o: opt
  • shift 2
  • '[' -z wcs.pdf ']'
  • for f in "$@"
  • check_file wcs.pdf ++ file -F '|' wcs.pdf
  • file_cmd_output='wcs.pdf| PDF document, version 1.1'
  • echo 'wcs.pdf| PDF document, version 1.1'
  • grep -q '| directory'
  • '[' '!' -e wcs.pdf ']'
  • '[' -z ']'
  • echo 'wcs.pdf| PDF document, version 1.1'
  • grep -q '| PDF'
  • '[' -z ']'
  • echo wcs.pdf
  • grep -qi '.pdf$'
  • echo wcs.pdf
  • grep -q '"'
  • return 1
  • '[' 1 -eq 0 ']'
  • '[' 1 ']'
  • nc -z localhost 9000
  • echo 'repush: Port 9000 is already used by a different process!' repush: Port 9000 is already used by a different process!
  • exit -1

Gilles

De: "Raphaël Rigo" [email protected] À: "reHackable/scripts" [email protected] Cc: "Gilles Quéméner" [email protected], "Author" [email protected] Envoyé: Vendredi 12 Février 2021 09:33:49 Objet: Re: [reHackable/scripts] repush.sh script stuck for ever (#34)

It's probably because the Web UI is disabled when the rM is disconnected. Can you post the output of bash -x repush.sh -r x.x.x.x file.pdf ?

— You are receiving this because you authored the thread. Reply to this email directly, [ https://github.com/reHackable/scripts/issues/34#issuecomment-778055590 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AAQU2CYWZXA4W7CA7ACO373S6TRW3ANCNFSM4XPBCBKQ | unsubscribe ] .

GBZH avatar Feb 12 '21 08:02 GBZH

As the script outputs: repush: Port 9000 is already used by a different process!, you have a leftover SSH session, kill it.

trou avatar Feb 12 '21 08:02 trou

So, I have killed the ssh (not the ssh-agent from the list of ps -u command) and reran your command. I was asked a first time for the password, but connection was refused, then I have entered it a second time and it worked (note however that it was correctly typed the first time).

~$ bash -x reMarkable/scripts/host/repush.sh -r xxx.xxx.x.xx wcs.pdf

  • VERSION=4.1
  • SSH_ADDRESS=10.11.99.1
  • WEBUI_ADDRESS=10.11.99.1:80
  • PORT=9000
  • shopt -s nullglob
  • getopts :vhdr:p:o: opt
  • case "$opt" in
  • SSH_ADDRESS=xxx.xxx.x.xx
  • REMOTE=1
  • getopts :vhdr:p:o: opt
  • shift 2
  • '[' -z wcs.pdf ']'
  • for f in "$@"
  • check_file wcs.pdf ++ file -F '|' wcs.pdf
  • file_cmd_output='wcs.pdf| PDF document, version 1.1'
  • echo 'wcs.pdf| PDF document, version 1.1'
  • grep -q '| directory'
  • '[' '!' -e wcs.pdf ']'
  • '[' -z ']'
  • grep -q '| PDF'
  • echo 'wcs.pdf| PDF document, version 1.1'
  • '[' -z ']'
  • grep -qi '.pdf$'
  • echo wcs.pdf
  • echo wcs.pdf
  • grep -q '"'
  • return 1
  • '[' 1 -eq 0 ']'
  • '[' 1 ']'
  • nc -z localhost 9000
  • ssh -o ConnectTimeout=5 -M -S remarkable-ssh -q -f -L 9000:10.11.99.1:80 [email protected] -N [email protected]'s password:
  • SSH_RET=0
  • WEBUI_ADDRESS=localhost:9000
  • '[' 0 -ne 0 ']'
  • for f in "$@" ++ basename wcs.pdf pdf
  • uuid_of_root_file wcs.
  • RET_UUID=
  • rmtgrep lF '"visibleName": "wcs."' '~/.local/share/remarkable/xochitl/*.metadata'
  • escaped_regex='"visibleName": "wcs."' ++ ssh -S remarkable-ssh [email protected] 'grep -lF ""visibleName": "wcs."" ~/.local/share/remarkable/xochitl/*.metadata' Control socket connect(remarkable-ssh): Connection refused [email protected]'s password:
  • RET_MATCH=
  • matches_by_name=
  • '[' -z '' ']'
  • return
  • '[' '!' -z ']'
  • rm -rf /tmp/repush
  • mkdir -p /tmp/repush
  • OUTPUT_UUID=
  • '[' '' ']'
  • TOTAL=0
  • SUCCESS=0
  • for f in "$@"
  • ROOT_UUID=
  • push wcs.pdf
  • (( TOTAL++ )) ++ file -F '|' wcs.pdf
  • file_cmd_output='wcs.pdf| PDF document, version 1.1'
  • echo 'wcs.pdf| PDF document, version 1.1'
  • grep -q '| (PDF|directory)'
  • extension=pdf
  • echo 'wcs.pdf| PDF document, version 1.1'
  • grep -q '| directory'
  • directory= ++ basename wcs.pdf .pdf
  • placeholder_basename=wcs
  • '[' ']'
  • placeholder=/tmp/repush/wcs
  • [[ pdf == \p\d\f ]]
  • create_placeholder_pdf /tmp/repush/wcs
  • echo %PDF-1.
  • echo '1 0 obj<</Pages 2 0 R>>endobj'
  • echo '2 0 obj<</Kids[3 0 R]/Count 1>>endobj'
  • echo '3 0 obj<</Parent 2 0 R>>endobj'
  • echo -n 'trailer <</Root 1 0 R>>'
  • true
  • curl --connect-timeout 2 --silent --output /dev/null --form 'file=@"/tmp/repush/wcs"' http://localhost:9000/upload

Gilles

De: "Raphaël Rigo" [email protected] À: "reHackable/scripts" [email protected] Cc: "Gilles Quéméner" [email protected], "Author" [email protected] Envoyé: Vendredi 12 Février 2021 09:52:21 Objet: Re: [reHackable/scripts] repush.sh script stuck for ever (#34)

As the script outputs: repush: Port 9000 is already used by a different process! , you have a leftover SSH session, kill it.

— You are receiving this because you authored the thread. Reply to this email directly, [ https://github.com/reHackable/scripts/issues/34#issuecomment-778064179 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AAQU2C37TRHLTTPPPODJ4ITS6TT4LANCNFSM4XPBCBKQ | unsubscribe ] .

GBZH avatar Feb 12 '21 09:02 GBZH

the script does not work without the cable

trou avatar Feb 12 '21 14:02 trou