Page 1 of 1

What the Hell? Something ate my binaries

PostPosted: Fri Mar 10, 2017 6:18 pm
by RiotNrrrd
OK Jonathan, here's a doozy.

I was running procexp for several days without an issue, then just now I quit out of it to look at something in the filesystem.

And when I did, I didn't recognize where I was.

All of your /tmp binaries had vanished without a trace. Look at this!

Code: Select all
[root@NSA-listening-station lib]# cd /tmp
[root@NSA-listening-station tmp]# ls                                                                                                                                                                                       
-bash: /tmp/bin/ls: No such file or directory                                                                                                                                                                           
[root@NSA-listening-station tmp]# echo *                                                                                                                                                                             
com.apple.purplebuddy.sentinel tar

[root@NSA-listening-station share]# cd /usr/share                                                                                                                                                                         
[root@NSA-listening-station share]# echo *                                                                                                                                                                                 
firmware icu langid mecabra misc progressui terminfo tokenizer zoneinfo zoneinfo.default
[root@NSA-listening-station share]# cd terminfo                                                                                                                                                                           
-bash: cd: terminfo: No such file or directory

Where did all my /tmp/bin and /tmp/sbin contents go?!?

The Apple TV 4 was not rebooted, as I said procexp was running the whole time. Now it's gone, too:

Code: Select all
[root@NSA-listening-station share]# procexp                                                                                                                                                                               
-bash: /tmp/usr/local/bin/procexp: No such file or directory

What in blazes is going on? :shock:

The only thing I can think of: the other day I ran Xcode on the Mac mini connected to the Apple TV and I selected it in the Devices pane. It says "Device setup was successful", but it "Could not find the Developer Disk Image" (because I'm not using Xcode 8).

Could that have wiped out "/tmp"?? :o

Re: What the Hell? Something ate my binaries

PostPosted: Fri Mar 10, 2017 7:37 pm
by Siguza
I remember reading that since iOS 5 (tvOS is still very similar to iOS), the system can clean out applications' "Cache" folders and /tmp at any time if running low on space. I don't remember where I picked it up, but there are enough articles out there, just search for "iOS app cleaning".
And well, /tmp is for temporary files after all. I'd move them to something like /var/local if I wanted to keep them around for longer than a day (just, best pick a location on the data partition that doesn't exist on stock iOS, as to not interfere with anything).

Re: What the Hell? Something ate my binaries

PostPosted: Sat Mar 11, 2017 12:32 am
by RiotNrrrd
Siguza wrote:And well, /tmp is for temporary files after all. I'd move them to something like /var/local if I wanted to keep them around for longer than a day


Agreed, I was going to suggest to Jonathan/Morpheus____ that he use "/var/tmp" instead of "/tmp" for the bundle of binaries so they'd stick around.

Re: What the Hell? Something ate my binaries

PostPosted: Sat Mar 11, 2017 10:59 am
by Siguza
RiotNrrrd wrote:Agreed, I was going to suggest to Jonathan/Morpheus____ that he use "/var/tmp" instead of "/tmp" for the bundle of binaries so they'd stick around.

I think you're missing something...
Code: Select all
Cameo:~ mobile$ ls -la /tmp
lrwxr-xr-x 1 root admin 15 Jul  1  2016 /tmp -> private/var/tmp/

You didn't think /tmp was actually on the rootFS, did you? :P

Re: What the Hell? Something ate my binaries

PostPosted: Sat Mar 11, 2017 11:51 pm
by RiotNrrrd
Siguza wrote:
Code: Select all
Cameo:~ mobile$ ls -la /tmp
lrwxr-xr-x 1 root admin 15 Jul  1  2016 /tmp -> private/var/tmp/

You didn't think /tmp was actually on the rootFS, did you? :P

Weird ... I thought it would be in /private/tmp or maybe mounted as an MFS like the way Linux and Solaris do it.

At any rate, something blew away my /tmp and whatever else ... guess I have to reboot and re-JB ...

Re: What the Hell? Something ate my binaries

PostPosted: Sun Mar 12, 2017 1:56 pm
by morpheus
So, Siguza is correct. /tmp and /var/tmp are the same directory. If you don't want your binaries eaten up periodically, *FOLLOW THE FAQ* and copy the binaries from /tmp/bin to /bin, /tmp/usr/local/bin to /usr/local/bin, etc , EXERCISING CARE SO AS TO NOT OVERWRITE EXISTING BINARIES (use cp -i and common sense!).