Howto write to an external drive with GNURoot Debian on an Android device
Learn how to write to an external drive on an Android device when using GNURoot Debian
It Can Be A Nightmare
I’ve spent all day on this and there’s frustrating very little information available on Google about it – so here’s what I’ve discovered.
You have an Android device connected to your TV and you want to install SickRage onto it and have SickRage process the TV files on to an external hard-drive. For these purposes I’m using the nice little cheapy box the KII Pro Hybrid which comes with Android 5.1 pre-installed and Kodi. Initially I had setup SickRage on a seperate machine and that was networked to an external USB disk via the router, which shared it via a Windows Network. The problem is, copying gigabytes of TV Show at a time is incredibly slow and impacts severely on your wireless network while it’s happening. So, I wanted to install SickRage (and NZBGet or SABnzbd) onto the Android device.
I found GNURoot Debian by Corbin Champion – which did almost exactly what I wanted straight out of the box. There’s myriad articles on the net about how to install SickRage onto a Debian machine and that’s all well and good if you want the folders it downloads to be internal Android storage. Most Android devices come with a woefully small amount of storage space – particularly if you’re talking video files. No drama thought I, I’ll plug in my USB WD Passport and set SickRage’s paths to point to it.
First problem – Android supports only VFAT for external USB drives. This means your video files are instantly limited to 2bytes under 4Gig. That’s not a drama for me cos I’m not into Ultra High Definition videos anyway, so mine should come in within that limit.
Second problem – Find where Android has mounted your VFAT USB drive… It’s not obvious and I suspect it varies by Android release and possibly even device. GNURoot might rationalise this though, I don’t know. I employed a quick trick to find it… I put the WD Passport drive onto my Mac and created a file called findme.rtf with Texteditor. I then unplugged the drive, plugged it into the KII Pro Hybrid and from the GNURoot command line issued the command ‘find / -name findme.rtf’ (without the quotes).
My device was located under /host-rootfs/storage/udisk0 – yours may not be though, so if it isn’t just follow the tip above.
This was great – I now had access to my USB drive. Or so I thought. I installed SickRage and tried to point it to use the above path to download TV shows. Uh oh, when SickRage tries to write it gets Permission Denied. So I tried it myself from the GNURoot command line (incidentally, install DropBear SSH server if you’re planning on doing much command line work – it’s much easier to work with than the GNURoot terminal emulator) using ‘touch fred’…. Same problem, Permission Denied. The filesystem is mounted RW – but the permissions forbid writing by you.
This is puzzling because you appear to be root. But you’re not. You’re some random UID that the Android device assigns and GNURoot (through the use of PRoot I suspect) makes it LOOK like you’re root. Let me re-iterate – you are NOT root. This means a lot of things can and will be restricted on your Android box.
After MUCH playing around I have discovered that Android will let you write to an external USB device IF you first pre-create a folder designated for the purpose. This folder depends on the package name of the application that’s trying to write to the disk, which in this case I took a punt on from other Google searches as being com.gnuroot.debian.
So – before you plug your VFAT partitioned USB drive into your Android box – plug it in to Windows or a Mac and create the following directory structure;
ANDROID / data / com.gnuroot.debian
VFAT filesystems are actually case insensitive so the capitalization may well not be important but that’s the spec I discovered and I went with it.
GNURoot processes, such as DropBear or the Terminal Emulator can now read, write, create or delete any file under that directory – including sub-directories.
Meaning you can create installations such as SickRage which can manipulate your media on your large external disk to your hearts content!
Hi Steve, I try do something similar. I try send and received information of arduino with GNURoot, i liked this possibility because i can run a springBoot backend inside of a cellphone haha, like a central of command for anothers devices inside oq the same network. You think this is possible? I try list all devices plug in my android with commands in terminal and this is not worked. =/
Have Your Say:
This site is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites. We may also participate in other Affiliate programs. For further information please see our Affiliate Disclosure