Fake version of Linux uname()
function. Allows replacing the result of Linux uname -a
and Python os.uname commands. Impacts the yum package manager to select packages architecture.
Note
Use linux setarch command instead of such custom tools, e.g: setarch i686
.
All steps in one:
curl -L -o mjaron-fakeuname-all.c https://github.com/mjfryc/mjaron-fakeuname/releases/download/v0.0.5/mjaron-fakeuname-all.c &&
gcc -c -Wall -Werror -fpic mjaron-fakeuname-all.c && gcc -shared -o libmjaron-fakeuname.so mjaron-fakeuname-all.o &&
export LD_PRELOAD=$(pwd)/libmjaron-fakeuname.so
Detailed steps:
- Download the release source code file:
curl -L -o mjaron-fakeuname-all.c https://github.com/mjfryc/mjaron-fakeuname/releases/download/v0.0.5/mjaron-fakeuname-all.c
- Compile the code - make shared library:
gcc -c -Wall -Werror -fpic mjaron-fakeuname-all.c && gcc -shared -o libmjaron-fakeuname.so mjaron-fakeuname-all.o
- Configure and override the system library:
export LD_PRELOAD=$(pwd)/libmjaron-fakeuname.so
env MJARON_FAKEUNAME_PRESET=i686 uname -a
or:
env MJARON_FAKEUNAME_MACHINE=i686 uname -a
or:
export MJARON_FAKEUNAME_CONF=/etc/mjaron-fakenode.conf
/etc/mjaron-fakenode.conf # ...Edit the conf...
uname -a
The library does the following:
- Check if
MJARON_FAKEUNAME_PRESET
is set to use predefined values.- Currently only
i686
value is defined which simulates 32-bit operating system.
- Currently only
- Look for the contiguration file at:
MJARON_FAKEUNAME_CONF
environment variable if set./etc/mjaron-fakeuname.conf
by default, if exists.
- Look for indifivual values and override above configuration:
MJARON_FAKEUNAME_MACHINE
- changes the machine value.
The default location of configration file is /etc/mjaron-fakeuname.conf
and may be changed with export MJARON_FAKEUNAME_CONF=...
.
Current computer configuration may be generated with mjaron-fakeuname-conf.sh
, e.g:
./mjaron-fakeuname-conf.sh
sysname: GNU/Linux
nodename: hostname
release: 6.8.0-48-generic
version: #48-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 14:04:52 UTC 2024
machine: x86_64