yadayada / acd_cli

An unmaintained command line interface and FUSE filesystem for Amazon (Cloud) Drive
Other
1.35k stars 165 forks source link

Making a Snap Package for acd_cli (Issue with FUSE) #531

Open joewashear007 opened 7 years ago

joewashear007 commented 7 years ago

Hello,

I was curious if it would be possible to make a snap package for this. I want to install it on a Ubuntu Core device (i.e. Raspberry Pi 3). I think would be great since people seem to be using this for hooking Amazon Cloud Drive to NextCloud (which has a snap).

I tried to start making it a snap and was successful, except I can't get the mounting to work. The acdcli comand such as sync & ls work. The mount command works, yet the folder is empty even though the system says there is a filesystem mounted there. I did all the testing in devmode so there aren't any confinement issues.

I was curious if someone who know more about mounts and FUSE could give me some pointer on how to debug this. Thanks, Joe

Snapcraft.yaml

version: "0.1"
summary: A test of creating a snap package for acd_cli
description: A test of creating a snap package for acd_cli
confinement: strict
apps:
    acdcli:
        command: acd_cli
        plugs:
            - fuse-support
            - network
            - network-control
            - mount-observe

parts:
    acdcli:
        plugin: python
        source: https://github.com/yadayada/acd_cli/archive/0.3.2.tar.gz

Output of mount command (in debug mode)

root@localhost:# acdcli -d -nl mount -i0 -fg /mnt/testmnt/
17-02-13 01:33:14.115 [INFO] [acd_cli] - Plugin leaf classes: TestPlugin
17-02-13 01:33:14.116 [INFO] [acd_cli] - TestPlugin attached.
17-02-13 01:33:14.117 [INFO] [acd_cli] - Settings path is "/root/snap/acdcli/x1/.config/acd_cli".
17-02-13 01:33:14.121 [DEBUG] [acdcli.utils.conf] - configuration resulting from merging default and acd_cli.ini: {'DEFAULT': {}, 'download': {'keep_corrupt': 'False', 'keep_incomplete': 'True'}}
17-02-13 01:33:14.127 [DEBUG] [acdcli.utils.conf] - configuration resulting from merging default and acd_client.ini: {'DEFAULT': {}, 'proxies': {}, 'transfer': {'chunk_retries': '1', 'connection_timeout': '30', 'fs_chunk_size': '131072', 'idle_timeout': '60', 'dl_chunk_size': '524288000'}, 'endpoints': {'filename': 'endpoint_data', 'validity_duration': '259200'}}
17-02-13 01:33:14.128 [INFO] [acdcli.api.client] - Initializing ACD with path "/root/snap/acdcli/x1/.cache/acd_cli".
17-02-13 01:33:14.130 [INFO] [acdcli.api.oauth] - AppspotOAuthHandler initialized
17-02-13 01:33:14.140 [DEBUG] [acdcli.utils.conf] - configuration resulting from merging default and cache.ini: {'blacklist': {'folders': '[]'}, 'DEFAULT': {}, 'sqlite': {'filename': 'nodes.db', 'journal_mode': 'wal', 'busy_timeout': '30000'}}
17-02-13 01:33:17.091 [INFO] [acdcli.cache.schema] - DB schema version is 2.
17-02-13 01:33:17.093 [DEBUG] [acdcli.cache.db] - Set busy_timeout to 30000. Result: 30000.
17-02-13 01:33:17.094 [DEBUG] [acdcli.cache.db] - Set journal_mode to wal. Result: wal.
17-02-13 01:33:17.097 [INFO] [acd_cli] - Last sync at 2017-02-12 01:19:09.064540.
17-02-13 01:33:17.098 [DEBUG] [acd_cli] - Namespace(acd_client=<acdcli.api.client.ACDClient object at 0x76715670>, action='mount', allow_other=False, allow_root=False, cache=<acdcli.cache.db.NodeCache object at 0x75ec5270>, check=0, color=2, debug=1, foreground=True, func=<function mount_action at 0x75ebc618>, gid=0, interval=0, log=False, modules='', nlinks=False, no_wait=False, nonempty=False, path='/mnt/testmnt/', read_only=False, single_threaded=False, uid=0, umask=18, utf=False, verbose=None)
17-02-13 01:33:17.346 [DEBUG] [acdcli.utils.conf] - configuration resulting from merging default and fuse.ini: {'write': {'timeout': '30', 'buffer_size': '32'}, 'DEFAULT': {}, 'read': {'timeout': '5', 'open_chunk_limit': '10'}}
17-02-13 01:33:17.348 [DEBUG] [acdcli.api.backoff_req] - Retry 0, waiting -3.213944s
17-02-13 01:33:17.349 [INFO] [acdcli.api.backoff_req] - GET "https://cdws.us-east-1.amazonaws.com/drive/v1/account/quota"
17-02-13 01:33:17.365 [DEBUG] [requests.packages.urllib3.connectionpool] - Starting new HTTPS connection (1): cdws.us-east-1.amazonaws.com
send: b'GET /drive/v1/account/quota HTTP/1.1\r\nHost: cdws.us-east-1.amazonaws.com\r\nUser-Agent: acdcli.api/0.9.0 python-requests/2.13.0\r\nConnection: keep-alive\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nAuthorization: Bearer *Token*'
reply: 'HTTP/1.1 200 OK\r\n'
header: Server header: Date header: Content-Type header: Content-Length header: Connection header: x-amzn-RequestId header: Content-Encoding header: Cache-Control header: Pragma header: Vary 17-02-13 01:33:17.637 [DEBUG] [requests.packages.urllib3.connectionpool] - https://cdws.us-east-1.amazonaws.com:443 "GET /drive/v1/account/quota HTTP/1.1" 200 136
17-02-13 01:33:17.642 [DEBUG] [acdcli.api.backoff_req] - x-amzn-RequestId: 65257db7-f18c-11e6-be2f-3bd5aceca19d
17-02-13 01:33:17.750 [DEBUG] [acdcli.acd_fuse] - -> init / ()
17-02-13 01:33:17.752 [DEBUG] [acdcli.acd_fuse] - <- init None
^C
17-02-13 01:33:48.884 [DEBUG] [acdcli.acd_fuse] - -> destroy / ()
17-02-13 01:33:48.885 [DEBUG] [acdcli.acd_fuse] - <- destroy None
root@localhost:~#

Output of mount after running acdcli mount without foreground

root@localhost:~# ls /mnt/testmnt/
root@localhost:~#

root@localhost:~# mount | grep acd
/var/lib/snapd/snaps/acdcli_x1.snap on /snap/acdcli/x1 type squashfs (ro,relatime)
/var/lib/snapd/snaps/acdcli_x1.snap on /writable/system-data/snap/acdcli/x1 type squashfs (ro,relatime)
nsfs on /run/snapd/ns/acdcli.mnt type nsfs (rw)
bgemmill commented 7 years ago

I've encountered similar issues using docker, where I map a host folder into the container, mount acdcli there and can see everything fine from within the container, but see nothing back on the host machine.

If snaps work in a similar way, the issue appears to be mount namespacing in the kernel. If you find a solution to this, please let us know!

tintop2k commented 7 years ago

Have you tried mounting with the allow other flag?

On Wed, 31 May 2017, 01:16 bgemmill, notifications@github.com wrote:

I've encountered similar issues using docker, where I map a host folder into the container, mount acdcli there and can see everything fine from within the container, but see nothing back on the host machine.

If snaps work in a similar way, the issue appears to be mount namespacing in the kernel. If you find a solution to this, please let us know!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yadayada/acd_cli/issues/531#issuecomment-305045149, or mute the thread https://github.com/notifications/unsubscribe-auth/AQTBhBmBwEUiOKspPinY9sxjo2zQz_P-ks5r_LFwgaJpZM4L-t9v .