4.5.0.19: why am I not able to `mv` files to /media/sdcard? `setfilecon` Operation not supported

[defaultuser@Xperia10II-DualSIM ~]$ mv Pictures/AdvancedCam/IMG_20210531_182810.jpg /media/sdcard/3534-3934/Pictures/AdvancedCam/
mv: setfilecon:/media/sdcard/3534-3934/Pictures/AdvancedCam/IMG_20210531_182810.jpg,u:object_r:tmpfs:s0: Operation not supported

:question:

Did the file end up where you wanted to move it? Looks like selinux message about being unable to set attributes/labels/context (probably filesystem not supporting that?)

Sort of. Only 0-byte stubs were created, so no actual file contents was transmitted.

Is there some other non-mv tool that has to be used to work with /media/scard?

You could try ‘mv -Z …’ that should reset the context to default which hopefully for ntfs/fat etc would be none at all (though I would assume this to be default behaviour, does cp work?)

1 Like
[defaultuser@Xperia10II-DualSIM ~]$ mv --help
BusyBox v1.34.1 (2022-09-21 00:00:00 UTC) multi-call binary.

Usage: mv [-finT] SOURCE DEST
or: mv [-fin] SOURCE... { -t DIRECTORY | DIRECTORY }

Rename SOURCE to DEST, or move SOURCEs to DIRECTORY

        -f      Don't prompt before overwriting
        -i      Interactive, prompt before overwrite
        -n      Don't overwrite an existing file
        -T      Refuse to move if DEST is a directory
        -t DIR  Move all SOURCEs into DIR

I don’t see busybox mv having that option :thinking:

Yep, cp -a does better

[defaultuser@Xperia10II-DualSIM ~]$ cp -a Pictures/AdvancedCam/IMG_20210531_182810.jpg /media/sdcard/3534-3934/Pictures/AdvancedCam/
cp: setting attributes for /media/sdcard/3534-3934/Pictures/AdvancedCam/IMG_20210531_182810.jpg

Maybe rsync -avh --remove-source-files is the way to go here.

Oh right, busybox… On jolla C 4.5.0.16 mv to vfat sdcard works normally, will try to get it up to .19

Can’t reproduce on jolla C with 4.5.0.19, moving to sdcard works normally again
Edit: also works fine on XIII though I have here the gnu version of mv/ls (but -Z gives ‘?’ ???) And card is now under /run/media/defaultuser/…, did you symlink it to /media/sdcard? Does it work if you try to mv to /run/media… if so?

1 Like

I’ma guess that your SDCard is formatted FATsomething. It’s normal to have problems like that, and busybox is a bit limited.

Just use cp (do you even need the -a?), then delete the source files, and move on.

You can also install gnu-coreutils , which should remove busybox-symlinks-coreutils, and try again as suggested in post #4

With GNU bash, the way was to illogically remove busybox bash, which pulled GNU bash in. YMMV…

1 Like

Yes, it’s vfat. I may have never thought about alternatives.

2 Tb Memory card working but better Format? - #7 by nephros seems to be a matching thread, but I’m not sure if it’s worth it to start refactoring this card :thinking:

My vfat SD card (512GB) works fine but if formatted with EXT4 no write permission and no way to store something there.

Both X10 / 4.5.0.19 + Volla / 4.4.0.72 the same.

Probably just need to change ownership and/or mount with ‘user’ flag.

Though if you formatted it via GUI I would assume that it does that automagically.

2 Likes

I formatted the SD card on Linux computer and then inserted it into the phone. Thanks for the hint regarding ownership and ‘user’ flag!