Strange problem on Linux involving root and 'HTTP/1.x transport connection broken'

EDIT: OK - I was wrong to think that here we might have a possible rclone bug. At worse, we have a bug or limitation of the program called script. I solved the problem by doing the following.

export rl_UserMain
#shellcheck disable=2155
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u "$rl_UserMain")/bus
if su "$rl_UserMain" "$fullPathToScript"
then
	rl_dropPrivileges_success
else
	rl_dropPrivileges_fail "$fullPathToScript"
fi

[End edit.]

What is the problem you are having with rclone?

I have a library I wrote in bash and several bash scripts that use the library. The purpose of all that stuff is to run backups via rclone. One of my scripts works fine when run normally. However, when run as root, it fails with a 'HTTP/1.x transport connection broken' error. More exactly: when run as root, my script relaunches itself as a normal user - and it is under those circumstances (was root, but then dropped privileges) that I get the problem. I have had a problem a few times now, and on two computers.

The Rclone log suggests that 'typescript' is somehow to blame. So here it is relevant to add the code that I use to re-run my script as another user. That code is as follows.

script -q -c "su $rl_UserMain $fullPathToScript"

What is your rclone version (output from rclone version)

rclone v1.52.3

  • os/arch: linux/amd64
  • go version: go1.14.7

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Linux Mint 20 x64 Cinnamon

Which cloud storage system are you using? (eg Google Drive)

b2

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone sync /home/<me> enc-b2:/X230/current/home/<me> --drive-chunk-size=256K --log-level=DEBUG --checkers 9 --fast-list --local-no-check-updated --one-file-system --retries=3 --timeout=2m --tpslimit 0 --tpslimit-burst 1 --skip-links --transfers 32 --exclude .dropbox-dist/** --filter-from /home/<me>/<myDir>/Backup/BackupSetup/rclone/lists/dots_filter-from --max-depth=7 --max-size 20M --bwlimit=3M --backup-dir=enc-b2:/X230/old/m08d20 --log-file /tmp/rclone_daily_OQA -P --stats=0 --stats-one-line>

The rclone config contents with secrets removed.

[box]
type = box
token = [redacted]

[b2]
type = b2
account = [redacted]
key = [redacted]
hard_delete = true

[enc-b2]
type = crypt
remote = b2:x1-everything
filename_encryption = standard
password = [redacted]
password2 = [redacted]

A log from the command with the -vv flag

EDIT: There was some sort of problem with PasteBin. So here's the log:

2020/08/19 16:08:05 ERROR : typescript: Failed to copy: Post
+"https://pod-000-1144-10.backblaze.com/b2api/v1/b2_upload_file/4569e0e5e4ebb996667b071a/c001_v0001144_t0011": net/http: HTTP/1.x
+transport connection broken: http: ContentLength=24624 with Body length 36912
2020/08/19 16:08:09 ERROR : Encrypted drive 'enc-b2:/X230/current/home/<me>': not deleting files as there were IO errors
2020/08/19 16:08:09 ERROR : Encrypted drive 'enc-b2:/X230/current/home/<me>': not deleting directories as there were IO errors
2020/08/19 16:08:09 ERROR : Attempt 1/3 failed with 1 errors and: Post
+"https://pod-000-1144-10.backblaze.com/b2api/v1/b2_upload_file/4569e0e5e4ebb996667b071a/c001_v0001144_t0011": net/http: HTTP/1.x
+transport connection broken: http: ContentLength=24624 with Body length 36912
2020/08/19 16:10:07 ERROR : typescript: Failed to copy: Post
+"https://pod-000-1013-06.backblaze.com/b2api/v1/b2_upload_file/4569e0e5e4ebb996667b071a/c001_v0001013_t0017": net/http: HTTP/1.x
+transport connection broken: http: ContentLength=36912 with Body length 53296
2020/08/19 16:10:07 ERROR : Encrypted drive 'enc-b2:/X230/current/home/<me>': not deleting files as there were IO errors
2020/08/19 16:10:07 ERROR : Encrypted drive 'enc-b2:/X230/current/home/<me>': not deleting directories as there were IO errors
2020/08/19 16:10:07 ERROR : Attempt 2/3 failed with 1 errors and: Post
-N F- 1/22: <me>               Rclone: script <rclone_daily>; job <sync_dots> - FAILED with code 1                         -- (62%)

How did that solve the problem? That is some weird stuff going on there that I don't understand!

Well, I feel clever now! But I should not. For, I got those export Bash commands from another developer (namely, the one who does this program) and I do not really understand the commands.

I gather though that somehow those commands make a display server thingymebob available to the environment (if that is the right word) created by the su command. With those commands in place, the output from the script run by su appears, as desired, in the terminal. (And the script run by su is the same script as the one that was running before. For, the script relaunches itself, but with fewer privileges. Also, when the relaunched script ends, control returns to the original - privileged - version of the script.)

As to the 'shellcheck' comment line, it stops my editor's linter from complaining about one of the lines.

EDIT: I suppose I should try to explain how the export stuff fixed the 'transport connection' error. Well, that error was caused, I think, by my previous attempt to solve the 'where's my output?' problem. Let me elaborate. That output problem was the fundamental problem. (Sorry if I misled you about that.) My previous attempt to solve the output problem involved the script command; and somehow the script command broke Rclone. Having removed the script command, Rclone works again - as indeed it worked before. Previously, though, Rclone was - while working - showing no output when it was running as-a-normal-user-having-been-relaunched-from-root. Now, with the export stuff, the output always shows. Clear?

Thanks for explaining. There isn't an emoji for dim light of understanding, you'll have to imagine it!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.