Comments (9)
Has this been solved?
from larinfo.
I got the same issue.. is it related to virtualization support of the device??
because I use Windows 10 and AMD chipset where chipset supports it but ACER bios have not given an update regarding it...
from larinfo.
i had added this code in vendor\linfo\linfo\src\Linfo\OS\Windows.php
public function getVirtualization(){
// Time?
if (!empty($this->settings['timer'])) {
$t = new Timer('Determining virtualization type');
}
// OpenVZ host?
if (is_file('/proc/vz/version')) {
return array('type' => 'host', 'method' => 'OpenVZ');
}
// OpenVZ guest?
elseif (is_file('/proc/vz/veinfo')) {
return array('type' => 'guest', 'method' => 'OpenVZ');
}
// Veertu guest?
if (Common::getContents('/sys/devices/virtual/dmi/id/bios_vendor') == 'Veertu') {
return array('type' => 'guest', 'method' => 'Veertu');
}
// LXC guest?
if (strpos(Common::getContents('/proc/mounts'), 'lxcfs /proc/') !== false) {
return array('type' => 'guest', 'method' => 'LXC');
}
// Docker guest?
if (is_file('/.dockerenv') || is_file('/.dockerinit') || strpos(Common::getContents('/proc/1/cgroup'), 'docker') !== false) {
return array('type' => 'guest', 'method' => 'Docker');
}
// Try getting kernel modules
$modules = [];
if (preg_match_all('/^(\S+)/m', Common::getContents('/proc/modules', ''), $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$modules[] = $match[1];
}
}
// Sometimes /proc/modules is missing what is in this dir on VMs
foreach (@glob('/sys/bus/pci/drivers/*') as $name) {
$modules[] = basename($name);
}
// VMware guest. Tested on debian under vmware fusion for mac...
if (Common::anyInArray(array('vmw_balloon', 'vmwgfx', 'vmw_vmci'), $modules)) {
return array('type' => 'guest', 'method' => 'VMWare');
}
// VMware Host! tested on rhel6 running vmware..workstation?
if (Common::anyInArray(array('vmnet', 'vmci', 'vmmon'), $modules)) {
return array('type' => 'host', 'method' => 'VMWare');
}
// Looks like it might be xen...
if (Common::anyInArray(array('xenfs', 'xen_gntdev', 'xen_evtchn', 'xen_blkfront', 'xen_netfront'), $modules) || is_dir('/proc/xen')) {
// Guest or host?
if (Common::anyInArray(array('xen-netback', 'xen_blkback'), $modules) || strpos(Common::getContents('/proc/xen/capabilities', ''), 'control_d') !== false) {
return array('type' => 'host', 'method' => 'Xen');
} else {
return array('type' => 'guest', 'method' => 'Xen');
}
}
// VirtualBox Host! Tested on lucid running vbox..
if (in_array('vboxdrv', $modules)) {
return array('type' => 'host', 'method' => 'VirtualBox');
}
// VirtualBox Guest! Tested on wheezy under mac vbox
if (in_array('vboxguest', $modules)) {
return array('type' => 'guest', 'method' => 'VirtualBox');
}
// Hyper-V guest. Tested with Trusty under Client Hyper-V in Windows 10 Pro. Needs to be checked before KVM/QEMU!
if (Common::anyInArray(array('hid_hyperv', 'hv_vmbus', 'hv_utils'), $modules)) {
return array('type' => 'guest', 'method' => 'Hyper-V');
}
// Looks like it might be KVM HOST!
if (Common::anyInArray(array('kvm_intel', 'kvm_amd'), $modules)) {
return array('type' => 'host', 'method' => 'KVM');
}
// Looks like it might be a KVM or QEMU guest! This is a bit lame since Xen can also use virtio but its less likely (?)
if (Common::anyInArray(array('virtio', 'virtio_balloon', 'virtio_pci', 'virtio-pci', 'virtio_blk', 'virtio_net'), $modules)) {
return array('type' => 'guest', 'method' => 'Qemu/KVM');
}
// idk
return false;
}
and I got solved virtualization error but I got swap memory error so I solved it by editing this function as ...
public function getRam()
{
// Time?
if (!empty($this->settings['timer'])) {
$t = new Timer('Memory');
}
$total_memory = 0;
$free_memory = 0;
foreach ($this->wmi->ExecQuery('SELECT TotalPhysicalMemory FROM Win32_ComputerSystem') as $cs) {
$total_memory = $cs->TotalPhysicalMemory;
break;
}
foreach ($this->wmi->ExecQuery('SELECT FreePhysicalMemory FROM Win32_OperatingSystem') as $os) {
$free_memory = $os->FreePhysicalMemory;
break;
}
return array(
'type' => 'Physical',
'total' => $total_memory,
'free' => $free_memory * 1024,
'swapTotal' => 0,
'swapFree' => 0,
);
}
from larinfo.
it would be great if you can create a PR for this functionality, since I don't have Windows machine.
from larinfo.
I need to discuss few things on this where I can contact you?
from larinfo.
we can discuss it here
from larinfo.
Ok, so I used your code to fix the error as a temporary patch... I don't know is it good or not but it's working.
N I think virtulization method must not to be mandatory in case of operating system varies over different platforms n devices.. n another point I got about swap memory is not exist over application level access in windows... So no use of it... It will require kernel level access.....
Another few things I want to discuss for business... If you would like to add me in LinkedIn.
from larinfo.
from larinfo.
Please check the latest release 3.0. I hope it helps. Closing it for now. If you have any issue, you can reopen this.
from larinfo.
Related Issues (14)
- How do you use this package? HOT 1
- Not installing on Laravel 7.4 HOT 1
- Database [default] not configured when using Larinfo::getDatabaseInfo(). HOT 2
- Method getModel not present. HOT 5
- PHP8 Support HOT 3
- CPU usage? HOT 1
- Add Support MacOS 11 and MacOS 12
- Not working with Fedora Server HOT 10
- Cannot access offset of type string on string at vendor/matriphe/larinfo/src/Entities/SystemInfo.php:71
- Getting error in console
- Non-static method Matriphe\Larinfo\Larinfo::getInfo() should not be called statically HOT 12
- Non-static method Matriphe\Larinfo\Larinfo::getHostIpinfo() cannot be called statically HOT 1
- Update to Laravel 6 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from larinfo.