What syscalls i can use that get information about OS Linux? I new in assembler. I write code on nasm.
I have to get the most detailed information about the OS type, version and other information. I know that there is some information in the system files, but I do not understand how to get this information using system calls.
You can use command dmidecode with option --type to see info that you want.
Example:
To see Memory info, run one of these commands:
sudo dmidecode --type "Memory"
sudo dmidecode --type 17
To see System Info, run one of these commands:
sudo dmidecode --type 1
sudo dmidecode --type "System"
If you only want to see OS info, run lsb_release -a
See more option about dmidecode type here.
Related
Problem
I try to run a qcow image with the following configuration:
:~$ sudo ~/Downloads/qemu-7.1.0/bin/debug/native/x86_64-softmmu/qemu-system-x86_64
-L -enable-kvm -cpu host -s -kernel bzImage -m 2048
-hda rootfs.qcow2-append "root=/dev/sda rw
nokaslr" -net nic,model=virtio -net user,hostfwd=tcp::5555-:22
Error Message:
qemu-system-x86_64: CPU model 'host' requires KVM or HVF
But kvm should be fine:
:~$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
What I did:
I'd like to use qemu in version 7.1.0 and installed it following the wiki by using the tar archive.
# Switch to the QEMU root directory.
cd qemu
# Prepare a native debug build.
mkdir -p bin/debug/native
cd bin/debug/native
# Configure QEMU and start the build.
../../../configure --enable-debug
make
# Return to the QEMU root directory.
cd ../../..
The simple test from the wiki works fine.
bin/debug/native/x86_64-softmmu/qemu-system-x86_64 -L pc-bios
The "-L" option needs an argument (a path to the BIOS and other binary files), but you haven't given it one. QEMU's command line parser therefore thinks that you are asking it to look in a directory named "-enable-kvm", and that you haven't given '-enable-kvm' as an option at all. So it's running in TCG, where '-cpu host' is not valid.
You need to fix your command line: either specify the -L option correctly, or if you don't need it then just drop it.
You are also missing a space before '-append'.
If you got this command line from a tutorial, re-check it carefully and make sure you've got it exactly right, including any necessary pieces to add in and that all the spaces and punctuation are matching.
I need to get the size of an InfluxDb on disc. I am able to get the size on the windows cmd(I am in windows 11) using du -sh /var/lib/influxdb2/.
The problem is now that i want to access this data using node.js. Using child process, i can run docker commands and get the ouput e.g. docker ps.
But when i run docker exec -it influxdb du -sh /var/lib/influx2/engine which is the bash command, i am getting "the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'"
Any help or guidance would be highly appreciated.
docker exec -it nameofcontainer -- /bin/bash helps us to login to the container and after that you would be able to use du -sh /var/lib/influx2/engine to check the disk space
I want to get system information and hard disk information using dmideode and fdisk as normal user in Centos 6.4. But i can't get it.Can anybody help me how to do this?.Thanks in advance
If you have a root access to your machine, you could configure sudo to allow specifics binaries for a specific user to be called without typing a password.
To do so:
Type: sudo visudo
Add the line: user ALL=(root) NOPASSWD:/path/of/your/binary
Then you'll be able to call your binary without typing a password:
sudo /path/of/your/binary
What is the best-practiced way to get an unique machine ID in GNU/Linux for i386 architecture?
Are there any good ways except the mac address?
Depending on your kernel, the DMI information may be available via sysfs.
Try those:
# cat /sys/class/dmi/id/board_serial
xxxxxxxxxxxxxxx
# cat /sys/class/dmi/id/product_uuid
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
or using a tool
# dmidecode -s baseboard-serial-number
...
# dmidecode -s system-uuid
...
On modern machines with systemd: machine id is created by systemd-machine-id-setup. The location of machine id is documented - in freedesktop machine-id and man machine-id and machine id has a more standardized format - see RFC4122. Just:
cat /etc/machine-id
You can use lshal. This needs hal (apt-get install hal or yum install hal) to be installed first. This way you can access all the info of dmidecode without root permissions.
A non-root equivalent of
# dmidecode | grep -i uuid
will be
$ lshal |grep -i system.hardware.uuid
And similarly other info as per your needs.
A simple and portable way of computing your own sysid may be to serialize uname(), gethostid() and some inodes like /home or your application homedir (obtained with stat()) etc. in a string and hash It.
Some examples in other systems
ospatches in HPUX-IA64 is "swlist -l fileset"
ospatches in Linux is "/sbin/ifconfig -a"
Network Configuration in Linux is "/sbin/ifconfig -a"
I want a equivalent ospatches and Network conf command for HPUX-PARISC.
As for patches on HP-UX PA-RISC 11.23:
swlist -a patch_state *,c=patch
or for lots of information about the installed patches:
swlist -v patch_state *,c=patch
Update
Actually swlist is in /usr/sbin
/usr/sbin/swlist -a patch_state *,c=patch