Xen not starting on Centos 7 - linux

I am trying to install xen on Centos 7 following this guide.
When I run the command "xl info" the following error appears:
xc: error: Could not obtain handle on privileged command interface (2 = No such file or directory): Internal error
libxl: error: libxl.c:116:libxl_ctx_alloc: cannot open libxc handle: No such file or directory
cannot init xl context
In the followed guide it says that I should have the following line in module 2 and in mine is not present even thought it clearly says it's a bug on Centos 6.I don't know if this is related or not.
title CentOS (3.4.46-8.el6.centos.alt.x86_64)
root (hd0,0)
kernel /xen.gz dom0_mem=1024M,max:1024M loglvl=all guest_loglvl=all
module /vmlinuz-3.4.46-8.el6.centos.alt.x86_64 ro root=/dev/mapper/vg_xen01-lv_root rd_LVM_LV=vg_xen01/lv_swap rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=uk rd_NO_MD LANG=en_GB rd_LVM_LV=vg_xen01/lv_root SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_DM rhgb quiet
module /initramfs-3.4.46-8.el6.centos.alt.x86_64.img
Thank you for your help.

Is the server booted into the Xen kernel? If you run uname -a you should see something like 3.4.46-8.el6.centos.alt.x86_64. (The 'alt' indicates the Xen kernel.)

Apparently it requires mutiboot2 which RH aren't including because of security issues.
Google your message. You'll find it.

Related

Cannot get custom kernel to boot - mkinitpcio does not add any modules

1. What I am trying to achieve:
Build a custom kernel so I can install and run Anbox-git from AUR on my Arch laptop. Custom kernel is needed for the package to work.
2. What I did to achieve it:
Download Arch Linux kernel v5.8.5-arch1 from here
I followed the guidelines on tradional compilation Arch wiki to create the custom kernel
Via make nconfig I applied the changes mentioned in the Anbox Arch wiki page.
Via make nconfig I changed EFIVAR_FS option from "M" to "*" to resolve an error from earlier attemps.
Via make nconfig under Location: -> Device Drivers-> Multiple devices driver support (RAID and LVM) (MD [=y])-> Device mapper support (BLK_DEV_DM [=y]) I added a few more options (*) because on earlier builds mkinitpcio gave errors for missing modules for DM_CRYPT, and some more DM_ modules which I cannot easily reproduce (will do if necessary for the answer, but I hope it'll be irrelevant).
After creating the config this way I did:
sudo make modules_install
sudo cp -v arch/x86_64/boot/bzImage /boot/vmlinuz-linux58ac
sudo cp /etc/mkinitcpio.d/linux.preset /etc/mkinitcpio.d/linux58ac.preset
Adapted the preset file per Arch wiki instructions
sudo mkinitcpio -p linux58ac
Important: The mkinitpcio runs fine, but keeps giving me a warning:
WARNING: No modules were added to the image. This is probably not what
you want.
sudo grub-mkconfig -o /boot/grub/grub.cfg
3. Expected result:
I am able to reboot, select the new kernel from grub menu, get the usual LVM password prompt, and launch into it without problems.
4. Result I get:
I can reboot and select new kernel from grub but when I select it I get a
Warning: /lib/modules/5.8.5-arch1/modules.devname not found, ignoring.
Starting version 246.4-1-arch
ERROR device 'dev/mapper/vg0-root' not found. Skipping fsck.
mount /new_root: special device /dev/mapper/vg0-root does not exist.
You are being dropped into an emergy shell.
I checked and the /lib/modules/5.8.5-arch1/modules.devnamedoes indeed exist. But I think the actual problem is that mkinitcpio doesn't load the correct modules into the custom kernel, causing it to become unbootable.
Any help appreciated!

How can I solve stdarg.h No such file or directory while compiling out-of-tree Linux kernel module?

I have an out-of-tree Linux kernel module that I need to compile. When I execute "make" in the kernel module directory I am getting:
"fatal error: stdarg.h: No such file or directory"
Before starting the build I installed the header file based on my Linux distribution.
$sudo apt-get install kernel-headers-$(uname -r)
How can I solve this compilation error? (my distribution is Ubuntu 16.04 with linux-headers-4.15.0-42-generic)
I ran a search of stdarg.h with the "locate" command to see if I can sport the file on the system.
I got:
/usr/include/c++/5/tr1/stdarg.h
/usr/lib/gcc/i686-linux-gnu/5/include/cross-stdarg.h
/usr/lib/gcc/i686-linux-gnu/5/include/stdarg.h
...
It tells me there is at least one stdarg.h provided by the compiler.
I tried to include the path "/usr/lib/gcc/i686-linux-gnu/5/include" in the kernel module Makefile so stdarg.h can be picked up. It did not work (while building, another reference to stdarg.h in the official kernel header was not being resolved).
I finally created a symlink directly under:
/usr/src/linux-headers-4.15.0-42-generic/include
$sudo ln -s /usr/lib/gcc/i686-linux-gnu/5/include/stdarg.h stdarg.h
This was just enough to solve the compilation issue.
I am wondering if the kernel headers should come with an implementation of stdarg.h by default (that is the first time I encounter this issue). I have also read that the compiler provide one implementation and most of the time it is better to use the compiler version.
Updated note: if the above solution still does not solve the problem:
Before running make again, do a make clean. Do a ls -la in the folder and look for a ".cache.mk" file. If this is still there, remove it and run "make" again. It should solve the problem.
I had the same issue with CentOS 9, and the other answers didn't work for me. Apparently the problem is that in more recent kernels, it shouldn't be <stdarg.h> but <linux/stdarg.h>. With virtualbox guest additions 6.1.34, it correctly checks for kernel with a version of 5.15.0 or more. But my kernel is the 5.14.xx, meaning the include for stdarg.h is wrong.
Solving the issue
Dependencies
Install all the dependencies for the guest edition
gcc make perl kernel-devel kernel-headers bzip2 dkms
Installation
Run the Guest Addition installation like you would normally. It will fail by saying it is unable to compile the kernel modules. That's expected. It will copy all the file we need to the VM disk.
Editing
We now need to edit the erroneous files.
/opt/VBoxGuestAdditions-6.1.34/src/vboxguest-6.1.34/vboxguest/include/iprt/stdarg.h
/opt/VBoxGuestAdditions-6.1.34/src/vboxguest-6.1.34/vboxsf/include/iprt/stdarg.h
On line 48 (may change for different versions), it check for a version of Linux and select the correct header depending on the version. We need to replace if RTLNX_VER_MIN(5,15,0) with if RTLNX_VER_MIN(5,14,0) in both files.
Compile the kernel modules
We can now compile the kernel modules, and the error should be gone.
sudo rcvboxadd quicksetup all
I personally got an error the first time, but then I recompiled without changing anything and it worked.
Remember that it's just a workaround, it may not work with different versions.
If you using Arch Linux with zen-kernel:
sudo CPATH=/usr/src/linux-zen/include/linux vmware-modconfig --console --install-all
I had the same problem with VirtualBox 6.1.0 running archlinux with kernel 6.1.9.
I downloaded VirtualBoxGuestAdditions_7.2.0.iso file from https://download.virtualbox.org/virtualbox/7.0.2/ link(you may select more appropriate to your VirtualBox version) and assigned as an optical drive to virtualbox machine. After start of the system running blkid command on terminal showed the name of CD rom device which was /dev/sr0. then I created iso folder on
/mnt folder
mkdir /mnt/iso
and mounted cd drive to that folder
mount -o loop /dev/sr0 /mnt/iso
after I cd'ed to /mnt/iso
cd /mnt/iso
and manually run VirtualBoxGuestAdditions.run script
sh ./VirtualBoxGuestAdditions.run
which successfully compiled and istalled required virtualbox guest modules.
Now everytime I update kernel version I redo the same procedure. And it work fine.
It also remove old 6.1.0 guest additons folder.

xen install on centos, getting invalid magic number 9090

I am trying to install Xen on Centos6.5 based on this tutorial (http://wiki.centos.org/HowTos/Xen/Xen4QuickStart), however after installing xen and running the script to edit the grub.conf, i am not able to boot into the new kernel.
I get an error stating -
invalid magic number: 9090
Error 13: Invalid or unsupported executable format
Can someone help me please?
Current suspicion: http://wiki.centos.org/HowTos/Xen/Xen4QuickStart definitely not a 10 minute install for all platforms???
History: there is a Centos Bug on this: centos.org/print_bug_page.php?bug_id=6503
I repeated a similar process:
(1) Install Centos 6.6 (Centos kernel: 2.6.32-504.el6.x86_84) from DVD1, DVD2 with Install using only the CENTOS Repo
(2) Installed Xen (Xen4CentOS kernel:3.10.56-11.el6.centos.alt.X86_64) Issuing the following commands from the centos command line (as root, warnings from readers accepted as correct from a security standpoint) To abate the security concern, no network connection existed as an offline repo would have been used but was not actually needed for the Centos minimal install.
yum install centos-release-xen
yum install xen
/usr/bin/grub-bootxen.sh
from the Xen/Centos reference: http://wiki.centos.org/HowTos/Xen/Xen4QuickStart
I noticed that the /boot/grub/grub.conf file was non-existent and tried to reboot without it. The reference above suggests it should be there, so I am proposing that your grub.conf file was missing or incorrect because my results were similar:
'invalid magic number: 9090
Error 13: Invalid or unsupported executable format
Press any key to continue...'
So as of now I can reproduce the problem. I will be updating this as I discover what will solve it for my solution, post it with hope it fixes it for yours or others who share similar issues.
I noticed something odd, I was using a Combo USB hub and tried to reboot using the other kernel (2.6) and there were considerable failures which were squawking on the startup screen and it would not permit me to start. When I removed it I could not boot into the 3.10, but only into 2.6.
Ok, a quick find on grub.conf revealed a similar version to that shown on the reference link above in /etc. So I copied the grub.conf from /etc to /boot/grub and rebooted. But I too see similar results. The USB hub is off the system and will not be reattached, so there is something else here that needs review. I'm digging into the grub.conf file at this time...
(update) I see that there is a grub.conf file under /boot/efi/EFI/redhat. Oddly in the Centos 'bug archives' there appears to be a related resolved bug for Centos 7: bugs.centos.org/view.php?id=7242 (cannot post this as a link as my reputation is less than 10, my apologies)
Also, as this relates to magic number here are results for my type of files and magic numbers, but I have done this with vi and have some assumptions here about what I saw, so I am retrying this with the help of the other stackoverflow article which uses file-devel package LibMagic... here are the intermittent results.
File.x86_64 Magic number (if two bytes, just use first 2)
vmlinuz-2.6.32.504.el6.x86_64 /0x8c/0x8e/0x8e/0x8e
vmlinuz-3.10.56-11.el6.centos.alt.x86_64 /0x8c/0x8e/0x8e/0x8e
Note: A search of '9090' on centos.org using the provided search engine for words on the site yielded no response on 12/22/14: #wiki.centos.org/Search
There is no mention of installation problems with SELinux, even though I have set:
SELINUX=disabled
in the /etc/sysconfig/selinux file and
yum uninstall xen
yum install xen
/usr/bin/grub-bootxen.sh
No results, and no new grub file in any of the three locations listed above. /etc /boot or /boot/efi/EFI/redhat.
Comparison of the grub.conf files with other sources, show that it is reasonable. Same for the grub-bootxen.sh file based on what I could decipher from bash.
Changing the timeout in grub.conf (all I found) to 15 and removing the hiddenmenu command by #hiddenmenu, did not eliminate the '9090' error. Using: wiki.xen.org/wiki/RHEL6_Xen4_Tutorial which shows the 'kernel' modifier instead of the 'module' and changing the 'module' in front of the .img file to initrd, did not change the results.
OK. Reload.
1) reinstall minmum Centos
2) disable SE Linux
3) reboot
4) correct ifcfg-eth0 (remove NM and allow boot on startup) and service network restart
5) yum import centos-release-xen (accept import of GPG key)
6) yum install xen
7) investigate what occurs with "grub-install hd0" which produces '9090' error!
Ok, I would have to say that the question was not well defined. It is now well defined and can be posed as a question. I will convert this info and my trials to a reasonable question to see if anyone can assist with pointers...

How to modify the kvm module in linux kernel?

I want to make some modifications in the kvm module in my Linux kernel. For this, I did the following:
Obtained the Kernel sources:
apt-get source linux-image-source-$(uname-r)
Modified a function in the file emulate.c - changed some variables and added a printk statement.
Built the kernel:
fakeroot debian/rules clean
fakeroot debian/rules binary-headers binary generic
Installed the packages produced as a result of building:
sudo dpkg -i linux*(version)*.deb
Rebooted the system.
Executed QEMU with kvm enabled.
However the changes I made, didn't seem to reflect when I try to test them in QEMU. Neither did the printk statement execute when I checked with dmesg.
Can anyone please point out which part I am getting wrong?
Installing a new kernel wont necessarily make it boot into it, you may need to change the default in your boot loader. (e.g. grub)
You can check whether the kernel you just compiled and installed is the same as what you booted with using:
cat /proc/version
If this is not as expected, then you need to tweak your Grub config and/or reboot and manually choose the correct kernel.
Having established the correct kernel, you may need to change the level of which messages are reported by the kernel (via dmesg)
This is controlled by a kernel proc file. You can see what the current values are by printing this file:
cat /proc/sys/kernel/printk
Example output:
4 4 1 7
The first argument - messages with severity < 4 (i.e. 0, 1 2 or 3) will be recorded.
The second argument - messages with no specified severity default to 4 and thus not seen by the system in the above example.
So the following will change the log so that all kernel messages are seen:
echo 8 > /proc/sys/kernel/printk
See (for example) http://www.makelinux.net/books/lkd2/ch18lev1sec3 for further information.

Not able to run vnstat unless as root in debian

So, I need to run this command:
vnstat -tr
But as a user I just created, not as root, as root it works fine, but as a regular user I get this:
Error: Unable to get interface "eth0" statistics.
Error: Interface "eth0" not available, exiting.
Operating system: Debian Linux 6.0.6
The problem was grsecurity locking /proc/net/dev from viewing it by users. The solution was to downgrade from ovhs linux core from 3.10.X to 3.8.13.

Resources