What is the problem you are having with rclone?
I am getting bad file descriptor when duping stdout/stderr to files on rclone mount and sending output to the file descriptors.
I originally tried a cached remote. I saw that cached remotes were deprecated so I tried again with rclone mount.
I am not sure if this should work or if this type of operation is not supported.
What is your rclone version (output from rclone version
)
rclone v1.52.0
- os/arch: linux/386
- go version: go1.14.3
Which OS you are using and how many bits (eg Windows 7, 64 bit)
CentOS Linux release 7.3.1611 (Core) 64-bit
Linux 3.10.0-514.el7.x86_64
Which cloud storage system are you using? (eg Google Drive)
Box
The command you were trying to run (eg rclone copy /tmp remote:tmp
)
cat test_io.sh
#!/bin/bash
[[ $SH_DEBUG == true ]] && set -x
function get_string() {
local str=$(tr -dc A-z-a-z0-9 < /dev/urandom | head -c 80)
echo $str
}
if [[ $# -ne 2 ]]
then
echo "Test requires two arguments: log_file and log_errfile"
exit 1
fi
log_file=${1}
log_errfile=${2}
touch "$log_file"
exec 6>&1 # Link file descriptor #6 with stdout. Saves stdout.
exec > "$log_file" # stdout replaced with file $log_file.
touch "$log_errfile"
exec 7>&2 # Link file descriptor #7 with stderr. Saves stderr.
exec 2> "$log_errfile" # stderr replaced with file $log_errfile.
for i in {1..10}
do
printf "%s\n" $(get_string)
printf "%s\n" $(get_string) 1>&2
done
# cd /opt/mysql-test/backup/rclone/box_hnd_mount_cache/mount/test_io
# test_io.sh log_file log_errfile
# ls -l
total 0
-rw-r--r-- 1 root root 0 Jun 9 07:45 log_errfile
-rw-r--r-- 1 root root 0 Jun 9 07:45 log_file
The rclone config contents with secrets removed.
[box_hnd]
type = box
allow-other = 1
buffer-size = 1G
dir-cache-time = 5m0s
log-file = /opt/mysql-test/backup/rclone/box_hnd_mount_cache/box_hnd_mount_cache.log
max-read-ahead = 128k
vfs-cache-mode = full
vfs-read-chunk-size = 64M
vfs-read-chunk-size-limit = 2G
write-back-cache = 1
uid = 54363
gid = 20
rc = 1
rc-addr = 127.0.0.1:5572
2020/06/09 07:40:38 DEBUG : rclone: Version "v1.52.0" starting with parameters ["rclone" "-vv" "--config" "/opt/mysql_backup/scripts/rclone.conf" "mount" "box_hnd:RB_DASHBOARD_BACKUP/automysqlbackup" "/opt/mysql-test/backup/rclone/box_hnd_mount_cache/mount" "--log-file=/opt/mysql-test/backup/rclone/box_hnd_mount_cache/box_hnd_mount_cache.log" "--daemon"]
A log from the command with the -vv
flag
2020/06/09 07:45:11 DEBUG : test_io/: >Attr: attr=valid=1s ino=0 size=0 mode=drwxr-xr-x, err=<nil>
2020/06/09 07:45:11 DEBUG : test_io/log_file: Open: flags=OpenWriteOnly
2020/06/09 07:45:11 DEBUG : test_io/log_file: Open: flags=O_WRONLY
2020/06/09 07:45:11 DEBUG : test_io/log_file: >Open: fd=test_io/log_file (w), err=<nil>
2020/06/09 07:45:11 DEBUG : test_io/log_file: >Open: fh=&{test_io/log_file (w)}, err=<nil>
2020/06/09 07:45:11 DEBUG : test_io/log_file: Setattr: a=Setattr [ID=0x56 Node=0xb Uid=0 Gid=0 Pid=175761] size=0 handle=INVALID-0x0 lockowner
2020/06/09 07:45:11 DEBUG : test_io/log_file: Truncating 1 file handles
2020/06/09 07:45:11 DEBUG : test_io/log_file: >Setattr: err=<nil>
2020/06/09 07:45:11 DEBUG : test_io/log_file: Attr:
2020/06/09 07:45:11 DEBUG : test_io/log_file: >Attr: a=valid=1s ino=0 size=0 mode=-rw-r--r--, err=<nil>
2020/06/09 07:45:11 DEBUG : &{test_io/log_file (w)}: Flush:
2020/06/09 07:45:11 DEBUG : test_io/log_file: WriteFileHandle.Flush unwritten handle, writing 0 bytes to avoid race conditions
2020/06/09 07:45:11 DEBUG : &{test_io/log_file (w)}: >Flush: err=<nil>
2020/06/09 07:45:11 DEBUG : test_io/: Lookup: name="log_errfile"
2020/06/09 07:45:11 DEBUG : test_io/: >Lookup: node=<nil>, err=no such file or directory
2020/06/09 07:45:11 DEBUG : test_io/: Create: name="log_errfile"
2020/06/09 07:45:11 DEBUG : test_io/log_errfile: Open: flags=O_WRONLY|O_CREATE|0x800
2020/06/09 07:45:11 DEBUG : test_io/log_errfile: >Open: fd=test_io/log_errfile (w), err=<nil>
2020/06/09 07:45:11 DEBUG : test_io/: >Create: node=test_io/log_errfile, handle=&{test_io/log_errfile (w)}, err=<nil>
2020/06/09 07:45:11 DEBUG : test_io/log_errfile: Attr:
2020/06/09 07:45:11 DEBUG : test_io/log_errfile: >Attr: a=valid=1s ino=0 size=0 mode=-rw-r--r--, err=<nil>
2020/06/09 07:45:11 DEBUG : &{test_io/log_errfile (w)}: Flush:
2020/06/09 07:45:11 DEBUG : test_io/log_errfile: WriteFileHandle.Flush unwritten handle, writing 0 bytes to avoid race conditions
2020/06/09 07:45:11 DEBUG : &{test_io/log_errfile (w)}: >Flush: err=<nil>
2020/06/09 07:45:11 DEBUG : test_io/log_errfile: Setattr: a=Setattr [ID=0x5b Node=0xc Uid=0 Gid=0 Pid=175764] atime=2020-06-09 07:45:11.341778273 -0700 PDT atime=now mtime=2020-06-09 07:45:11.341778273 -0700 PDT mtime=now handle=INVALID-0x0
2020/06/09 07:45:11 DEBUG : test_io/log_errfile: >Setattr: err=<nil>
2020/06/09 07:45:11 DEBUG : test_io/log_errfile: Attr:
2020/06/09 07:45:11 DEBUG : test_io/log_errfile: >Attr: a=valid=1s ino=0 size=0 mode=-rw-r--r--, err=<nil>
2020/06/09 07:45:11 DEBUG : &{test_io/log_errfile (w)}: Flush:
2020/06/09 07:45:11 DEBUG : box root 'RB_DASHBOARD_BACKUP/automysqlbackup': File to upload is small (0 bytes), uploading instead of streaming
2020/06/09 07:45:12 DEBUG : test_io/log_errfile: SHA-1 = da39a3ee5e6b4b0d3255bfef95601890afd80709 OK
2020/06/09 07:45:12 INFO : test_io/log_errfile: Copied (new)
2020/06/09 07:45:12 DEBUG : test_io/log_errfile: File._applyPendingModTime OK
2020/06/09 07:45:12 DEBUG : &{test_io/log_errfile (w)}: >Flush: err=<nil>
2020/06/09 07:45:12 DEBUG : &{test_io/log_errfile (w)}: Release:
2020/06/09 07:45:12 DEBUG : test_io/log_errfile: WriteFileHandle.Release nothing to do
2020/06/09 07:45:12 DEBUG : &{test_io/log_errfile (w)}: >Release: err=<nil>
[...]
2020/06/09 07:45:15 DEBUG : test_io/log_file: >Attr: a=valid=1s ino=0 size=0 mode=-rw-r--r--, err=<nil>
2020/06/09 07:45:15 DEBUG : &{test_io/log_file (w)}: Write: len=81, offset=0
2020/06/09 07:45:15 ERROR : test_io/log_file: WriteFileHandle.Write: error: Bad file descriptor
2020/06/09 07:45:15 DEBUG : &{test_io/log_file (w)}: >Write: written=0, err=bad file descriptor
2020/06/09 07:45:15 DEBUG : test_io/log_errfile: Attr:
2020/06/09 07:45:15 DEBUG : test_io/log_errfile: >Attr: a=valid=1s ino=0 size=0 mode=-rw-r--r--, err=<nil>
2020/06/09 07:45:15 DEBUG : &{test_io/log_errfile (w)}: Write: len=88, offset=0
2020/06/09 07:45:15 ERROR : test_io/log_errfile: WriteFileHandle.Write: error: Bad file descriptor
2020/06/09 07:45:15 DEBUG : &{test_io/log_errfile (w)}: >Write: written=0, err=bad file descriptor
2020/06/09 07:45:15 DEBUG : &{test_io/log_file (w)}: Flush:
2020/06/09 07:45:15 DEBUG : test_io/log_file: WriteFileHandle.Flush nothing to do