Config files on USB Flash drive?
-
@vealmike said in Config files on USB Flash drive?:
I'm currently putting together a system on a Pi4 that I intend to keep for myself, and clone to some old Pi3s to give away.
fyi, pi3 and pi4 have neccesarily different core options and emulator defaults. can cause issues.
-
@dankcushions Thankyou, I understand this. I'm not concerned if some games on some consoles don't work. I don't expect Pi4 performance from a Pi3.
The vast majority of Mame, and 8/16 bit console games should be fine on either system (Pi3 / Pi4) without config tweaks. -
Is anyone able to answer this please?
Or point me in the right direction?Thanks,
-
@vealmike There's no support for it in RetroPie, in the same way as ROMs from an USB drive works. The easiest way would to use a backup/restore script and configure a set of files to be backed-up/restored to/from the
config
folder. -
@mitu Thanks for your time. It is genuinely appreciated.
OK so if anyone is interested, I think what I need to do is this:
On the system I'm copying from:0/ Create a backup of /opt/configs
1/ Move everything from /opt/configs to a new directory /media/usb0/RetropieConfigs
mv /opt/configs /media/usb/RetropieConfigs2/ Create a symbolic link from opt/configs to /media/usb0/RetropieConfigs on the USB mounted drive.
ln -s /media/usb/RetropieCofigs/ /opt/configs3/ Restart Retropie and check everything works.
Then on a PC I should be able to clone the USB drive.
Finally on the target system (the one I'm copying to):
4/ Delete contents of /opt/configs5/ Create a symbolic link as step 2/
6/ Restart retropie and check everything works.
I'll try it and see what happens.
-
OK, a quick progress report for anyone that cares...
First a reminder that mitu says this is unsupported.
Working only with my Pi4 setup, I wanted to move the configs directory from it's default location to the USB drive. I did the following:
sudo cp -a -r /opt/retropie/configs /media/usb0/retropie-mount sudo mv /opt/retropie/configs /opt/retropie/oldconfigs sudo ln -s /media/usb/retropie-mount/configs /opt/retropie/configs
The first command copied most stuff from configs to the usb drive, but failed on some files. More detail in a mo.
The second command simply renames the default configs directory, so emulation station & retropie can't find or use it.
And the third command creates a symbolic link from the USB drive copy of configs to the place where emulation station and Retropie expect to find the files.
Most stuff works. Emulation station has all the game lists, my controllers work. Most of the consoles work.
However, Amiga games fall over. I'm using Amiberry. And this leads me to the copy command failures.
The failures were as follows:cp: cannot create symbolic linkl '/media/usb0/retropie-mount/all/retroarch-joypads': Operation not permitted cp: cannot create symbolic linkl '/media/usb0/retropie-mount/amiga/amiberry/conf/retroarch.cfg': Operation not permitted cp: cannot create symbolic linkl '/media/usb0/retropie-mount/amiga/amiberry/whdboot/save-data/Kickstarts/kick33180.A500': Operation not permitted cp: cannot create symbolic linkl '/media/usb0/retropie-mount/amiga/amiberry/whdboot/save-data/Kickstarts/kick34005.A500': Operation not permitted cp: cannot create symbolic linkl '/media/usb0/retropie-mount/amiga/amiberry/whdboot/save-data/Kickstarts/kick37175.A500': Operation not permitted cp: cannot create symbolic linkl '/media/usb0/retropie-mount/amiga/amiberry/whdboot/save-data/Kickstarts/kick39106.A1200': Operation not permitted cp: cannot create symbolic linkl '/media/usb0/retropie-mount/amiga/amiberry/whdboot/save-data/Kickstarts/kick40068.A1200': Operation not permitted
7 errors, but 1280 files moved without issues. Not too shabby!
Sure enough, when I check in /opt/retropie/configs/amiga/amiberry/whdboot/save-dat/Kickstarts/ these files are symbolic links. They're defined as full paths rather than relative paths, but for some reason sudo cp -a doesn't want to copy them. Don't know why.
Clearly I could go and make these symbolic links manually, but I was looking for a simple solution. I don't want to have to handle a list of exception cases, like these symbolic links. I could script it I suppose.
I also don't know if Amiberry is the only emulator that will have issues with this process. All I can say for sure is that it is the only console in my setup that has issues!
-
A further update.
Result:
I now have a Pi4 working with all config files on the USB rather than the system drive. My next step will be to clone the setup to a.n.other Pi.Problems encountered:
The files that were not copying needed to be dereferenced. That is, instead of creating a new symbolic link to the original file, the original file itself is copied over.There were other symbolic links in the /opt/retropie/configs directory, so I first did a cp -P (no dereference), then a cp-u- -L (update, dereference).Command list:
The list of commands is:sudo cp -P -r /opt/retropie/configs /media/usb0/retropie-mount sudo cp -u -L -r /opt/retropie/configs /media/usb0/retropie-mount sudo mv /opt/retropie/configs /opt/retropie/oldconfigs sudo ln -s /media/usb/retropie-mount/configs /opt/retropie/configs
Systems:
I have tested with the following consoles. Amiga, Arcade, Mame, Megadrive, N64, Ports, Playstation, ZX Spectrum.Will post back again when I've copied the config to another system.The goal here is to be able to take the USB stick out of my Emulation Station, to copy it and plug it into another system & have all the games and configs appear on the 2nd system. By doing this, I can clone my ES, give it away, and then easily update the cloned system with any changes I've made to my unit.
It feels like I'm halfway there. It also feels like I'm typing into the void and I'm the only person who wants to do this...I posted too soon. Amiberry isn't working with the linked configs directory. Some games aren't seeing the kickstart files.
-
@vealmike You could try to mount the usb directory instead of linking to it. Mounts are somewhate more transparent to the system, so they might work in cases where symlinks don't.
You can
mount
a directory onto another directory with the--bind
option.sudo mount --bind /media/usb/retropie-mount/configs /opt/retropie/configs
Mind that the mount point
/opt/retropie/configs
has to exist for this. The mount will hide anything inside it, so it hasn't actually to be empty, but its (then hidden) contents will still take up space on the sd card.The mount will only last until a reboot. To let it be re-mounted at every system start, you'll have to put it in the
/etc/fstab
like this:/media/usb/retropie-mount/configs /opt/retropie/configs none bind 0 0
One possible problem could arise if the system tries to mount the
bind
before the usb drive, i.e. before/media/usb/retropie-mount/configs
exists. You could then trybind,bg
instead ofbind
, the system will then try to make the bind mount in the background until its parent mount becomes available. But then again, it may be mounted too late for Emulation Station. You'll have to experiment with it. -
@clyde Thanks, I'll give it a go.
-
@Vealmike I may be a little late to the party, but had a similar need this week. Following @Clyde 's suggestion, I tried bind mounting the USB stick via
/etc/fstab
, but the timings were off and the bind mount was done before the USB stick was actually available.What I ended up doing, and is working is actually hook into the
autostart.sh
script. Essentially adding this:# Wait at most 1 minute for the USB drive to be mounted # And link the config folder ATTEMPTS=6 USB_DRIVE='/media/usb0' i=0 until [ "$i" -ge "$ATTEMPTS" ]; do grep -q -s "$USB_DRIVE" /proc/mounts && \ sudo mount --bind /media/usb0/retropie-mount/configs /opt/retropie/configs && \ break i=$((i+1)) wait 10 done
at the beginning of the script. It has some basic logic just to attempt 6 times with 10 seconds delay between each until the stick is detected to be mounted, and then proceeds to do the bind mount of the configs folder, before actually starting
emulationstation
(or whatever is defined to auto start).I know it's been three years since your post, but maybe this will help someone (like me) in the future 😁
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.