1

我有一个运行良好的备份脚本。我最近更新了我的操作系统(到 Ubuntu 19.10)并尝试安装所有依赖项,但出现错误。

我的脚本是这样的:

export PASSPHRASE="passphrase"
PATH=$PATH:/home/jeremy/.boto
export HOME='/home/jeremy/'

DATE=`date +%Y-%m-%d:%H:%M:%S`

echo "Running backup at $DATE" >> /home/jeremy/.backup/log

duplicity --full-if-older-than 1M \
          --archive-dir /home/jeremy/.cache/duplicity/ \
          /home/jeremy \
          gs://x1_carbon_backup >> /home/jeremy/.backup/log

我创建了.boto文件gsutil并且可以gsutil成功使用,因此身份验证似乎正在工作。

回溯看起来像一个编码/解码问题,但我不知道这是我做事方式的问题还是boto错误duplicity

Traceback (innermost last):
  File "/usr/bin/duplicity", line 107, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 93, in with_tempdir
    fn()
  File "/usr/lib/python3/dist-packages/duplicity/dup_main.py", line 1522, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/duplicity/commandline.py", line 1200, in ProcessCommandLine
    globals.backend = backend.get_backend(args[0])
  File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 225, in get_backend
    obj = get_backend_object(url_string)
  File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 211, in get_backend_object
    return factory(pu)
  File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 173, in __init__
    self.resetConnection()
  File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 199, in resetConnection
    location=self.my_location)
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/gs/connection.py", line 95, in create_bucket
    data=get_utf8_value(data))
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 659, in make_request
    auth_path = self.calling_format.build_auth_path(bucket, key)
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 94, in build_auth_path
    path = '/' + bucket
 TypeError: can only concatenate str (not "bytes") to str

我尝试按照此处的建议解码存储桶变量。

现在我得到一个SSLCertVerificationError,如下:

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 163, in <module>
    if u"Forced assertion for testing" in util.uexc(e):
  File "/usr/lib/python3/dist-packages/duplicity/util.py", line 120, in uexc
    return fsdecode(m)
  File "/usr/lib/python3.7/os.py", line 822, in fsdecode
    filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not int
Backup complete. Checking for old backups to remove
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 107, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 93, in with_tempdir
    fn()
  File "/usr/lib/python3/dist-packages/duplicity/dup_main.py", line 1522, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/duplicity/commandline.py", line 1200, in ProcessCommandLine
    globals.backend = backend.get_backend(args[0])
  File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 225, in get_backend
    obj = get_backend_object(url_string)
  File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 211, in get_backend_object
    return factory(pu)
  File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 173, in __init__
    self.resetConnection()
  File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 199, in resetConnection
    location=self.my_location)
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/gs/connection.py", line 95, in create_bucket
    data=get_utf8_value(data))
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 671, in make_request
    retry_handler=retry_handler
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 1071, in make_request
    retry_handler=retry_handler)
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 1030, in _mexe
    raise ex
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 943, in _mexe
    request.body, request.headers)
  File "/usr/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/https_connection.py", line 131, in connect
    ca_certs=self.ca_certs)
  File "/usr/lib/python3.7/ssl.py", line 1238, in wrap_socket
    suppress_ragged_eofs=suppress_ragged_eofs
  File "/usr/lib/python3.7/ssl.py", line 423, in wrap_socket
    session=session
  File "/usr/lib/python3.7/ssl.py", line 870, in _create
    self.do_handshake()
  File "/usr/lib/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 163, in <module>
    if u"Forced assertion for testing" in util.uexc(e):
  File "/usr/lib/python3/dist-packages/duplicity/util.py", line 120, in uexc
    return fsdecode(m)
  File "/usr/lib/python3.7/os.py", line 822, in fsdecode
    filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not int
4

0 回答 0