Chromebook mount


#1

So rclone actually works quite nicely with ChromeOS in debug mode. I can open a shell and then use rclone just the same as I would on a normal Linux machine.

The problem I have is with the mount command. For example, I might mount my OneDrive folder onto ~/Downloads/OneDrive and I can ls the files and so on.

BUT it doesn’t show in the GUI.

I’m guessing this is because of the heavy use of namespaces used by ChromeOS to protect one app from another. So the mount is available in the shell window namespace, but nowhere else.

Does anyone have any ideas on how to make mounts visible globally?


#2

The Downloads directory is shared between chromeOS and your chroot isn’t it? But if you mount stuff in there it doesn’t appear…

Did you use the --allow-other flag? I suspect that will be needed at minimum.


#3

Well, this is the magic; I’m not using a chroot environment; I’m using the native shell.

chronos@localhost / $ cat /usr/local/bin/onedrive 
#!/bin/sh

DOWN=$HOME/Downloads
BASE=$DOWN/onedrive

echo Mounting at $BASE
sudo /bin/echo
sudo rclone --config $HOME/.config/rclone/rclone.conf mount --allow-other onedrive: $BASE &

echo Entering a subshell at $DOWN
cd $DOWN
bash
echo Unmounting $BASE
sudo umount $BASE

So in operation

chronos@localhost / $ onedrive
Mounting at /home/chronos/user/Downloads/onedrive
Password:

Entering a subshell at /home/chronos/user/Downloads
chronos@localhost ~/Downloads $ ls onedrive
<stuff shows here> 
chronos@localhost ~/Downloads $ mount | grep onedrive
onedrive: on /home/chronos/user/Downloads/onedrive type fuse.rclone (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
chronos@localhost ~/Downloads $ exit
exit
Unmounting /home/chronos/user/Downloads/onedrive
chronos@localhost / $ 

I’m mounting the filesystem as root, I can read it just fine from the shell as the chronos user… but there is nothing visible in the “Files” application; just the empty mountpoint. Which means that things like the “file save” and “file open” dialog boxes can’t see it either :frowning:


#4

Did you try mounting it as a user instead of root? Mounting FUSE filesystems as root can do strange stuff.


#5

Same behaviour. The mount shows it’s owned by “me”…

onedrive: on /home/chronos/user/Downloads/onedrive type fuse.rclone (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000,allow_other)

But it still shows up empty in the file manager.


#6

:frowning: I think you are right - some namespace magic. I’m not familiar with those runes unfortunately…


#7

So… I think this is something just as b0rken, and related to filesystem mounts.

I looked and found 4 directories named “onedrive”

chronos@localhost / $ sudo find / -type d -name onedrive
Password: 
/home/chronos/u-MAGICNUMBER/Downloads/onedrive
/home/chronos/user/Downloads/onedrive
/home/user/MAGICNUMBER/Downloads/onedrive
/home/.shadow/MAGICNUMBER/mount/user/Downloads/onedrive

I don’t know if the “MAGICNUMBER” is unique to my ID or not, so I’ve redacted it.

Now this appears to be related to how the system encrypts files…

chronos@localhost / $ mount | grep chronos
/dev/mapper/encstateful on /home/chronos type ext4 (rw,nosuid,nodev,noexec,noatime,discard,commit=600,data=ordered)
/home/.shadow/MAGICNUMBER/vault on /home/chronos/user type ecryptfs (rw,nosuid,nodev,noexec,...)
/home/.shadow/MAGICNUMBER/vault on /home/chronos/u-MAGICNUMBER type ecryptfs (rw,nosuid,nodev,noexec,...)

And it looks like the ChromeOS file view uses the u-MAGICNUMBER view of the filesystem. So, clearly, mounting on /home/chronos/user/... won’t show up under /home/chronos/u-MAGICNUMBER and that’s why I get the empty view.

If I change my script so it says

HOME=/home/chronos/u-MAGICNUMBER

at the beginning…

Then it works! The mounted drive shows up in the file manager.

Possibly related to https://bugs.chromium.org/p/chromium/issues/detail?id=309556


#8

Nice one!

If the data is mounted in different places with mount --bind then that would explain it, as I don’t think mount --bind mounts submounts if you see what I mean. If you want submounts then you use mount --rbind