After some thinking, I did this:
Started with nano /proc/meminfo
Changed MemTotal
, MemFree
, MemAvailable
, SwapTotal
and SwapFree
to desired values and saved to ~./meminfo
Gave the user boinc password sudo passwd boinc
and shell -- sudo nano /etc/passwd
, found the line boinc:x:129:141:BOINC core client,,,:/var/lib/boinc-client:/usr/sbin/nologin
and changed the /usr/sbin/nologin
part to /bin/bash
Then I faked RAM info using examples from here Recover from faking /proc/meminfo
unshare -m bash #unshares mount spaces, for specific program "bash" only (and for whatever you want to launch from it)
mount --bind ~./meminfo /proc/meminfo #substitutes real meminfo data with fake one
and confirmed with free
that it worked
total used free shared buff/cache available
Mem: 2321456 21456 2300000 0 0 2300000
Swap: 5000000 1000000 4000000
Then switched to user su - boinc
and just launched the program with
boinc --check_all_logins --redirectio --dir /var/lib/boinc-client
BOINC Manager can be launched then as usual
Total success, tasks which previously refused to run, started to download and then ran with no complications
/proc/meminfo
but could you start from creating a swap file if you have enough disk space available?/proc/meminfo
you can simply edit the binary and replace the/proc/meminfo
with some other path having the same length. Eg.perl -pe 's,/proc/meminfo,/etc/bmeminfo,' -i /path/to/that/binary
. This is MUCH better than having to set up namespaces or mess up your system in other ways. With a little bit of assembly knowledge, you can also change that check to always return true, so you don't even have to create a fakememinfo
file.