date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,436,080,480,000 |
The Linux kernel documentation page for building external modules (https://www.kernel.org/doc/Documentation/kbuild/modules.txt) says this:
=== 2. How to Build External Modules
To build external modules, you must have a prebuilt kernel available
that contains the configuration and header files used in the build.
Also, the kernel must have been built with modules enabled. If you are
using a distribution kernel, there will be a package for the kernel
you are running provided by your distribution.
An alternative is to use the "make" target "modules_prepare." This
will make sure the kernel contains the information required. The
target exists solely as a simple way to prepare a kernel source tree
for building external modules.
My questions are the following:
To build external modules, you must have a prebuilt kernel available
that contains the configuration and header files used in the build
By "prebuilt kernel", does it mean the compiled binary image (generally named vmlinux/vmlinuz)? Why exactly is the binary image needed? Shouldn't the configuration files, header files and compiler be enough?
To build external modules, you must have a prebuilt kernel available that
contains the configuration and header files used in the build.
If by prebuilt kernel it means the binary image, then what is the meaning of "contains the configuration and header files"? I can understand the source tree needing to "contain the configuration and header files", but in case of binary, these files are just used to generate instructions right? What is the meaning of "contain" then? By "prebuilt kernel" does it mean the entire source tree where the kernel was built?
Also, the kernel must have been built with modules enabled.
Are they referring to the "make modules" step here or is it something different?
If you are
using a distribution kernel, there will be a package for the kernel you
are running provided by your distribution.
I suppose they are referring to the kernel-devel package here, which provides the header and configuation files which were used in the kernel building process. Is that correct?
An alternative is to use the "make" target "modules_prepare." This will
make sure the kernel contains the information required.
What is the meaning of this? Does this mean that we don't need to have a built kernel binary in order to be able to build external modules if we do a "make modules_prepare" in the source directory?
|
ad 1. and 2. The kernel image is called vmlinux, that's right, but that's not what you actually need when you want to build external modules. It's the configuration and header files from this kernel that is needed.
ad 3. To build modules, internal or external, you need support for loadable modules in this kernel, you want to build the module for, of course, so the kernel has to be configured with __modules enabled_.
A kernel is configured by one of the configuration programs that help you in creating a .config file, in the kernel source tree or in the $KBUILD_OUTPUT path, for off-tree builds.
ad 4. Where you find such packages or how they named depends on your distribution, but I think it is often called kernel-devel. I don't actually know cause I used my own kernel tree for years.
ad 5. Yes, you actually don't need the kernel binary, to compile an external module, but you suppressed the note below
NOTE: "modules_prepare" will not build Module.symvers even if
CONFIG_MODVERSIONS is set; therefore, a full kernel build needs to be
executed to make module versioning work.
Most kernels use CONFIG_MODVERSIONS, I think. You can see this in your .config file with
$ grep MODVERSIONS .config
CONFIG_MODVERSIONS=y
This means, your built module will only work for that kernel version and configuration you built it for.
So you can build a module for that kernel and kernel version, but you cannot run it without that kernel and kernel version.
That's why you can build an external module for a distribution kernel without the full kernel source tree, if you install the kernel configuration and header files, that distribution kernel was built with.
Actually, most times you just want to build an external module for the kernel you run your system with. If you built the kernel yourself, from the kernel source tree, you will already have a kernel configuration and header files, that match that kernel.
If you run a distribution kernel you have to install that files from the distribution.
| Some questions regarding linux kernel external module build process |
1,436,080,480,000 |
I'm trying to figure out at which point in the boot up process /dev/kmsg gets initialized and can thus be written. On my system the first line that occurs in dmesg is printk(KERN_INFO "Initializing cgroup subsys %s\n", ss->name); from kernel/cgroup.c. I tried to trace backwards and search the kernel but I didn't find the function where /dev/kmsg is beeing initialized.
Does somebody know?
|
The /dev/kmsg represeted by the kmsg_fops structure which has file_operations type that represents standard operations with a file:
const struct file_operations kmsg_fops = {
.open = devkmsg_open,
.read = devkmsg_read,
.write_iter = devkmsg_write,
.llseek = devkmsg_llseek,
.poll = devkmsg_poll,
.release = devkmsg_release,
};
You can find definition of the kmsg_fops and related operations in the printk.c. Its initialization and initialization of other virtual devices as /dev/zero, /dev/null is in the chr_dev_init function.
This function called during Linux kernel initialization process, after the kernel booted and decompressed. Note that after the chr_dev_init function, the:
fs_initcall(chr_dev_init);
macro that expands to the __define_initcall macro:
#define fs_initcall(fn) __define_initcall(fn, 5)
two parameters: function which will initialize char device and initcall level, where 5 is fs:
static char *initcall_level_names[] __initdata = {
"early",
"core",
"postcore",
"arch",
"subsys",
"fs",
"device",
"late",
};
The __define_initcall macro expands to the initcall definition which will be called in the do_initcalls from the init/main.c
| Where in the kernel /dev/kmsg gets initialized? |
1,436,080,480,000 |
I'm trying to understand some kernel level concepts in Linux. I was checking on the difference between shell builtin commands and the other executable commands.
This wonderful answer clearly tells the difference and also specifies the need for shell builtin commands.
Now I know that using type <command-name>, I could check if it is an external or shell builtin command.
So I decided to do some strace'ing on the various commands to understand more of the internals.
I learned this neat little trick to do strace'es on shell builtin commands. I was able to do strace on cd .. as well according to the above answer.
Now when I run type pwd and get the output as, pwd is a shell builtin. So, I expect that I wouldn't be able to run strace on it, since it too is a shell builtin. But when I did an strace on it, I was surprised to see that strace worked without the need to do stty.
I verified strace for echo as well and it worked fine too.
So my understanding is, that strace worked in the case of pwd and echo because the execution of pwd and echo did not change any of the shell's behavior.
Am I correct in my understanding?
|
Because pwd or echo have external commands with the same name, /bin/pwd or /bin/echo. If you look at strace output, you can see:
$ strace pwd
execve("/bin/pwd", ["pwd"], [/* 68 vars */]) = 0
brk(0) = 0x241e000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f80c31b9000
A note that when searching in PATH, strace accepts only regular file with execute bits set.
| strace works for some builtin commands |
1,436,080,480,000 |
I'm connected via SSH to a PC running Linux kernel 3.11.1:
root@alix:~# uname -r
3.11.1
how can I find out which package installed this specific file or kernel version respectively?
I tried
root@alix:/boot# dpkg -S vmlinuz-3.11.1
dpkg-query: no path found matching pattern *vmlinuz-3.11.1*
Other installed kernel versions can be found with dpkg -S:
root@alix:/boot# dpkg -S vmlinuz-3.2.23
linux-image-3.2.23-ath5kmod: /boot/vmlinuz-3.2.23-ath5kmod
My purpose: I would like to install the corresponding Linux headers for version 3.11.1 to compile a kernel module for it. apt-cache search linux-headers lists 15 different header versions but not that one for 3.11.1.
Thank you very much.
|
You can list every installed package with dpkg -l and filter through the results with grep for the kernel packages
dpkg -l | grep 'linux-image'
dpkg -l | grep 'linux-image' | grep '3.11'
To find the kernel headers package for your running kernel:
apt-cache search linux-headers-`uname -r`
| Debian: get package name for installed file |
1,436,080,480,000 |
I downloaded, configured and installed kernel downloaded from kernel.org. While booting up this new kernel for the first time, this error screen shows which is pointing towards a missing or wrongly mentioned root device probably. But I didn't mention it explicitly, installation scripts did it. So if this is the error, can someone please tell how to fix?
Or if the cause may be something else, please tell what it can be?
NOTE: I am using VirtualBox for all this process. Don't want my laptop to become unbootable for this experiment.
NOTES:
Grub entries are fine, as it is same for another kernel running on this system and other kernel is working fine.
DEVTMPS is just creating a warning, I think programmers care about errors only, not warnings, so hopefully this is not the major cause as well.
TSC is giving an error, I investigated, it is probably a clock mode, nothing very related to root device.
Again UUID is not an issue, because other working kernel grub entry is using same ID and booting up correctly.
|
Found it!!! It was the drivers for my hard disk controller, SATA AHCI was not added while configuring kernel before compilation. Now I added, recompiled and viola! new installed kernel booted up. :)
| Newly compiled kernel not booting up (vanilla kernel 3.12.14) |
1,436,080,480,000 |
When a process requires actions that require kernel mode, it uses a system call. So, how are the results returned to the process?
|
NOTE: ALL THE BELOW INFORMATION IS FROM THE REFERENCED SITE
From this link, I found the below information.
A system call is an interface between a user-space application and a service that the kernel provides. Because the service is provided in the kernel, a direct call cannot be performed; instead, you must use a process of crossing the user-space/kernel boundary.
Using the system call
Let's look at what's necessary to use them from a user-space application. There are two ways that you can use new kernel system calls. The first is a convenience method (not something that you'd probably want to do in production code), and the second is the traditional method that requires a bit more work.
With the first method, you call your new functions as identified by their index through the syscall function. With the syscall function, you can call a system call by specifying its call index and a set of arguments. For example, the short application shown below calls your sys_getjiffies using its index.
#include <linux/unistd.h>
#include <sys/syscall.h>
#define __NR_getjiffies 320
int main()
{
long jiffies;
jiffies = syscall( __NR_getjiffies );
printf( "Current jiffies is %lx\n", jiffies );
return 0;
}
As you can see, the syscall function includes as its first argument the index of the system call table to use. Had there been any arguments to pass, these would be provided after the call index. Most system calls include a SYS_ symbolic constant to specify their mapping to the _NR indexes. For example, you invoke the index __NR_getpid with syscall as:
syscall( SYS_getpid )
The syscall function is architecture specific but uses a mechanism to transfer control to the kernel. The argument is based on a mapping of _NR indexes to SYS symbols provided by /usr/include/bits/syscall.h (defined when the libc is built). Never reference this file directly; instead use /usr/include/sys/syscall.h.
| Result from kernel returned to what process? |
1,436,080,480,000 |
GRUB2 doesn't have the menu.lst file.
How do I configure a boot script.
During boot, I hit E on the kernel image that I want to modify and make my modifications. But I would prefer to make the modifications in /grub.d/ folder and then run update-grub command.
Basically, I am including certain modules at boot time, using insmod, there are too many such modules for me to do it every time, and Im unable to edit those different looking scripts GRUB has currently.
I figured that /etc/grub.d/ contains files like
00_header
10_linux
...
but they look like scripts that I should be careful when I modify. Is there a easier way, like using menu.lst to configure grub2
|
The main config file is /boot/grub/grub.cfg. As it says at the top:
DO NOT EDIT THIS FILE
It is automatically generated by grub-mkconfig using templates
from /etc/grub.d and settings from /etc/default/grub
As you can see, /boot/grub/grub.cfg is generated by files from /etc/grub.d.
As mentioned in /etc/grub.d/README, you can add extra files to /etc/grub.d for custom additions to /boot/grub/grub.cfg. I don't know exactly what you want, but for example you could add the insmods you require to a /etc/grub.d/01_custom_header, and after regenerating /boot/grub/grub.cfg using grub-mkconfig, the contents of this file should then appear in /boot/grub/grub.cfg after /etc/grub.d/00_header.
UPDATE: To be clear, the modules that are loaded by grub.cfg are GRUB modules, not kernel modules. These modules are loaded so that GRUB has enough functionality to (for example) handle LVM volumes and read filesystems. This isn't a place where you can put kernel modules. This was prompted by @Stephane's comment. I should have noticed this earlier but didn't.
| GRUB2 Insert additional kernel modules |
1,436,080,480,000 |
I'm trying to loop mount my root filesystem (a loop file) within a busybox initramfs.
I try to run the command:
mount /rootfs.raw /root
... which works on my Ubuntu laptop, however, I simply get
mount: mounting /dev/loop0 on /root failed: Invalid argument
No matter what combination of options I use, (including loading to /loop0 manually and trying to mount it), the system will not mount the loop device.
Why can't I mount it?
|
In order to solve this problem, I had to be more verbose about my mounting command. I ended up using:
modprobe loop
mount -t iso9660 -o loop /bootpart/rootfs.raw /root
This worked properly.
| busybox initramfs loop mount |
1,436,080,480,000 |
First the link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1060268
Since this affects the kernel and other Distros, what does this type of error mean and why it happens?
|
When your PC has more than 4 GB of memory, but has also some devices that support only 32-bit addresses, any I/O from or to these devices must be mapped to somewhere in the low 4 GB range.
Typically, a range of 64 MB is allocated for this.
"Out of SW-IOMMU space" means that either
you are doing so much I/O that you need more than 64 MB of buffers at the same time; or
some driver is buggy and forgets to deallocate its buffers after it's done using them.
Your symptoms indicate that you are suffering from problem 2.
| What does "DMA: Out of SW-IOMMU space" error mean? |
1,436,080,480,000 |
Is it necessary to enable CONFIG_USB_OHCI_HCD on a system that has USB 2.0 port only ?
I'm not sure those devices present , e.g bluetooth , camera use that driver ?
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor
Bus 001 Device 004: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Bus 001 Device 005: ID 04f2:b217 Chicony Electronics Co., Ltd Lenovo Integrated Camera (0.3MP)
Bus 001 Device 006: ID 046d:c058 Logitech, Inc. M115 Mouse
|
Yes, is is needed to have one of OHCI_HCD (Open Host Controller Interface) or UHCI_HCD (Universal Host Controller Driver) depending on your USB controller hardware.
The driver responsible for USB 2.0 communication is EHCI_HCD (Enhanced Host Controller Interface); but EHCI controllers are packaged with "companion" host controllers (OHCI or UHCI) to handle USB 1.1 devices connected to root hub ports. Ports will connect to EHCI if the device is high speed, otherwise they connect to a companion controller. If you configure EHCI, you should probably configure the OHCI (for NEC and some other vendors) USB Host Controller Driver or UHCI (for Via motherboards) Host Controller Driver too.
So, even if all your integrated USB peripherals are 2.0 (using EHCI), it is still needed to have a USB 1.1 driver (OHCI or UHCI) in case you attach a device that does not support High Speed.
You can see what controller type your attached devices are using, by running:
lspci -v
example output:
00:1a.0 USB Controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05) (**prog-if 20 [EHCI]**)
00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 02) (**prog-if 20 [EHCI]**)
04:00.0 USB Controller: ASMedia Technology Inc. ASM1042 SuperSpeed USB Host Controller (**prog-if 30 [XHCI]**)
In the sample XHCI (Extensible Host Controller Interface) is the driver for USB 3.0 support.
| Is it necessary to enable CONFIG_USB_OHCI_HCD , when there's only USB 2.0 ports |
1,436,080,480,000 |
In linux or a library for linux, is there an equivalent to critical section in win32?
I am aware of Mutex, but it is not the same as critical section since a critical section uses user-mode spinlock and an event object internally, and it is must be faster than mutex.
|
If you want something coming from kernel space, then you might want to look at semaphores (sem_overview(7)). You can built higher level constructs from a semaphore, like "event", "condition", "mutex" ("critical sections"). There are the older and newer interfaces in C. Some higher level languages like Python and Perl also expose the interface.
The "Mutex" that you are likely talking about is the pthread's mutex, which will be faster than anything in user space, especially one using a spinlock (which were designed for extremely low level OS level constructs). Some pthread's implementations may use an OS level semaphore or may use other constructs.
| critical section for linux |
1,436,080,480,000 |
I have to program a realtime application on Linux, but don't know whether the standard installation of Ubuntu has CONFIG_HIGH_RES_TIMERS enabled. How can I check this?
I'm using Ubuntu 11.04 64bit.
|
Ubuntu ships the kernel configuration in /boot/config-$version (in the same package as the kernel image /boot/vmlinuz-$version). You can check this file on a live system, or you can download it from the Ubuntu website. There are several images to choose from; the default under amd64 is -generic, and you can download the binary package and extract the file /boot/config-*. The simplest way to open a Debian package if you're not running a dpkg-based distribution is to convert it with alien.
By the way, the answer is yes under 10.04/-generic/amd64 which I happened to have available while writing this answer.
Several other distributions ship a /boot/config-* file. Others make the kernel configuration available in /proc/config or something similar, so that it's easy to see on a live system but doesn't appear in the binary package. In that case, if you don't have a live system, you need to check the source package.
| How to check if CONFIG_HIGH_RES_TIMERS enable? |
1,436,080,480,000 |
Which happens the most, context switches or mode switches?
I have two answers myself, but I do not know which one is correct:
Context switches happen in user mode, but this does not mean that a system call is needed; therefore, mode changes do not happen when a context switch occurs.
Context switches mean a dispatch is needed. I think this is privileged, so a mode change from user to kernel mode is needed to do a context switch. Which means a context switch goes along with a mode switch.
Anyone have a definite answer to this?
|
A context switch between processes always involves entering supervisor mode at the processor level. The scheduler needs to access the process table and the next process's memory map, both of which are not accessible to the old process and therefore require privilege elevation; and then the scheduler needs to point the MMU to the new process's memory map, which still requires elevated privileges.
A context switch between threads of the same process needn't involve the kernel at all.
So which one happens most often depends on whether you have many lightweight threads on your system.
Background reading: beyond Wikipedia, this article (context switches at the Linux Information Project). And of course Understanding the Linux Kernel (chapter 3).
| What happens the most, context switches or mode switches? |
1,436,080,480,000 |
I'm trying to compile a Linux Kernel to run light and paravirtualized on XenServer 5.6 fp1.
I'm using the guide given here: http://www.mad-hacking.net/documentation/linux/deployment/xen/pv-guest-basics.xml
But I'm stumped when I reached the option CONFIG_COMPAT_VDSO.
Where is it exactly in make menuconfig? The site indicated that the options is in the Processor type and features group, but I don't see it:
[*] Tickless System (Dynamic Ticks)
[*] High Resolution Timer Support
[*] Symmetric multi-processing support
[ ] Support for extended (non-PC) x86 platforms
[ ] Single-depth WCHAN output
[*] Paravirtualized guest support --->
[*] Disable Bootmem code (NEW)
[ ] Memtest (NEW)
Processor family (Core 2/newer Xeon) --->
(2) Maximum number of CPUs
[ ] SMT (Hyperthreading) scheduler support
[ ] Multi-core scheduler support
Preemption Model (No Forced Preemption (Server)) --->
[ ] Reroute for broken boot IRQs
[ ] Machine Check / overheating reporting
< > Dell laptop support (NEW)
< > /dev/cpu/microcode - microcode support
<M> /dev/cpu/*/msr - Model-specific register support
<M> /dev/cpu/*/cpuid - CPU information support
[ ] Numa Memory Allocation and Scheduler Support
Memory model (Sparse Memory) --->
[*] Sparse Memory virtual memmap (NEW)
[*] Allow for memory hot-add
[*] Allow for memory hot remove
[ ] Allow for memory compaction
[*] Page migration
[*] Enable KSM for page merging
(65536) Low address space to protect from user allocation (NEW)
[ ] Check for low memory corruption
[ ] Reserve low 64K of RAM on AMI/Phoenix BIOSen
-*- MTRR (Memory Type Range Register) support
[ ] MTRR cleanup support
[*] Enable seccomp to safely compute untrusted bytecode (NEW)
[*] Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)
Timer frequency (100 HZ) --->
[ ] kexec system call
[ ] kernel crash dumps
[*] Build a relocatable kernel (NEW)
-*- Support for hot-pluggable CPUs
[ ] Built-in kernel command line (NEW)
FYI, I'm configuring Gentoo's Kernel v2.6.36-hardened-r9
|
As you had already said, it IS under "Processor Types and Features".
You are compiling Gentoo's hardened kernel source, so the code would have undergone many patches.
A quick search in Google returned this: Gentoo kernel VDSO. It looks like Gentoo has it disabled even several versions before.
Why don't you download directly from kernel.org?
| Where is CONFIG_COMPAT_VDSO in make menuconfig? |
1,436,080,480,000 |
I used zen kernel patchset for a long time which included tp_smapi patch. Recently in zen-stable tp_smapi was removed as "We no longer need tp_smapi as of 2.6.36 - the in-kernel thinkpad acpi support is better.". How to port following code to in-kernel thinkpad acpi:
echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
echo 40 > /sys/devices/platform/smapi/BAT1/start_charge_thresh
echo 60 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh
echo 60 > /sys/devices/platform/smapi/BAT1/stop_charge_thresh
|
It might not be possible. At least there is nothing in the documentation of thinkpad-acpi, nothing in the release notes, nothing in the thinkpad-acpi thinkwiki page and no mentioning of tp_smapi being obsolete in the tp_smapi thinkwiki page.
| Migrating from tp_smapi to 'normal' ACPI support in 2.6.36 |
1,436,080,480,000 |
In https://stackoverflow.com/questions/39614772/how-to-know-the-linux-kernel-run-either-el2-non-secure-or-el3-secure-mode, I saw in recent arm64 linux, the kernel runs at EL2 not EL1. Recently I'm doing linux port on a test board using u-boot-spl falcon mode. There too, when the CPU hardware started from EL3, the linux seems to be run in EL2 (from arm64, see https://elixir.bootlin.com/u-boot/latest/source/arch/arm/lib/spl.c#L55 and https://elixir.bootlin.com/u-boot/latest/source/arch/arm/cpu/armv8/transition.S#L13). My question is, for linux to run in EL2, is there anything I should set in the config, or is linux build agnostic to whether it will run in EL1 or EL2?
|
When we use u-boot as bootloader, (I think it will be the same if we do it using UEFI and grub, or arm reference design) the bootloader runs at EL3 and at the final code sets the elr (address to return to from the exception handling) to the entry address of linux. It then executes eret which makes it jump to linux address kept in elr, and the EL is automatically lowered to EL2 at the same time. In linux, the code examines if FEAT_VHE is implemented (virtualization hardware extension) and if so, it remains in EL2. When VHE is implemented, many accesses to EL1 registers are actually accessing those in EL2 (this part not 100% sure, I remember something like that). So for building linux, we don't have to set anything. (but I think if we turn CONFIG_ARM64_VHE off, it might run in EL1).
| in arm64 linux, when linux is to be run in EL2 (bootloader in EL3), do I have to set something for this during kernel build? |
1,436,080,480,000 |
On CentOS 7.X I use the following command to clean up unused old kernel:
package-cleanup --oldkernels --count=1
But it no longer works on CentOS 8.X, does anyone know the correct command?
|
Have you tried this?
dnf remove --oldinstallonly --setopt installonly_limit=1
Alternatively, you can do
1. rpm -qa kernel // lists kernels
2. rpm -e kernel_name // on which kernel you want to remove
This should also automatically remove grub entries for you.
| Remove old kernels on CentOS 8 |
1,436,080,480,000 |
I generally get how the whole major/minor device number thing works for a given device (though please correct me if I'm way off here), and how a major device number essentially relates to a class of device (be that a block device or character device/character special), while the minor number relates to a specific type of devices under that. From this number, the kernel is able to ascertain what device driver it needs to use to interact with that device. At the file system level, the device number is stored within an inode stat struct, so when you stat a file as a user, it'll return the device ID as a 2 byte value, where the upper and lower bytes represent the major and minor numbers respectively. The stat struct has 2 members for specifying device IDs in this form - st_dev and st_rdev, where st_dev relates to the device which the respective file is on (in the case of an ordinary file on a storage device, st_dev would be the major/minor device for the partition the file is on).
However, if the file is a non-device mount, or a character special, or whatever, the major number in st_dev will be set to 0, the minor number will be set to something and instead, st_rdev may or may not be populated with the device type (depending whether the respective file system implements this). So my question is, what populates the minor device number in this instance, and how does it know what value to use / why does it use the value it does?
e.g.
stat /etc/passwd
=> Device: 801h, with no "Device Type" set -- This is expected major number 8 relates to SCSI devices, and the minor number of 1 relates to the first partition of this file (sda1)
stat /dev/sda1
=> Device: 6h, Device Type: 8,1 -- Here the Device (st_dev) has a major number of 0 (which is expected) and a minor number of 6 - why 6?
stat /dev/null -- Again, minor version of 6
stat /proc/version -- Minor version of 4
What am I missing?
I'm conscious of the fact that I'm referencing structs here, and this question may be better placed in stack overflow, but I feel like it's more a low level Linux question rather than explicitly a dev question - happy to relocate it though.
|
On my system, /proc is 6h, and /dev is 5h.
A quick test:
# for x in a b c d e f g h i j; do mkdir $x; mount -t tmpfs tmpfs $x; done
# stat */.
gave numbers 33h to 3dh with 35h missing from the middle (it was used by /run/user/1000/gvfs). Seems like just dynamic allocation with the first free number used at mount time.
Note that the numbers get reused, so at least in this case you can't reliably use st_dev to detect if the filesystem at a certain path changed.
| How are minor device numbers assigned for unnamed/non-device mounts (major number 0)? |
1,436,080,480,000 |
is it possible to run xfs repair by re-edit the fstab file?
/dev/mapper/vg-linux_root / xfs defaults 0 0
UUID=7de1dc5c-b605-4a6f-bdf1-f1e869f6ffb9 /boot xfs defaults 0 0
/dev/mapper/vg-linux_var /var xfs defaults 0 0
/dev/mapper/vg-linux_swap swap swap defaults 0 0
I am not sure but by replace the last number from 0 to 1 , is it right?
|
No, just editing /etc/fstab cannot cause xfs_repair to be executed.
For other filesystem types, it would work. But XFS is special here.
Changing the 6th field of /etc/fstab to a non-zero value on a XFS filesystem will cause the system to run fsck.xfs, whose man page says:
NAME
fsck.xfs - do nothing, successfully
[...]
However, the system administrator can force fsck.xfs to run xfs_re‐
pair(8) at boot time by creating a /forcefsck file or booting the sys‐
tem with "fsck.mode=force" on the kernel command line.
So, ordinarily fsck.xfs will do nothing at all.
If you really want xfs_repair to run at boot, there are two conditions that both must be satisfied:
a) The 6th field of /etc/fstab must be non-zero for the XFS filesystem in question, so that fsck.xfs will be executed.
b) Either a /forcefsck file must exist on the root filesystem (or perhaps within initramfs, if planning to check the root filesystem), or the kernel command line must have the fsck.mode=force boot option. This will cause fsck.xfs to run xfs_repair instead of doing nothing.
What's so special with xfs_repair, then?
The XFS filesystem and the xfs_repair tool both will assume that the underlying disk is in good condition, or at least is capable of transparently replacing bad blocks with built-in spare blocks (as all modern disks do). If a modern disk has persistent bad blocks visible to the operating system, it usually means that the built-in spare block mechanism has already been overwhelmed by the amount of bad blocks, and the disk is probably going to fail completely soon enough anyway.
The man page of xfs_repair says:
Disk Errors
xfs_repair aborts on most disk I/O errors. Therefore, if you are trying
to repair a filesystem that was damaged due to a disk drive failure,
steps should be taken to ensure that all blocks in the filesystem are
readable and writable before attempting to use xfs_repair to repair the
filesystem. A possible method is using dd(8) to copy the data onto a
good disk.
So, you probably should not set xfs_repair to run automatically in normal circumstances.
If a XFS filesystem has errors, you should always first evaluate the condition of the underlying disk: smartctl -a /dev/<disk device> might be useful, as might be using dd to read the whole contents of the partition/LV to /dev/null and seeing that the command can complete without errors.
If the disk is failing, you should first copy the contents of the partition/LV to a new, error-free disk (perhaps using dd or ddrescue), and only then you should attempt to run xfs_repair on the filesystem on the error-free disk.
Running xfs_repair automatically at boot time might be an appropriate workaround if you know that something is causing filesystem-level errors even when your disks are in good condition. But that is just a workaround, not a fix: you should find out what is causing the filesystem errors, and fix the root cause. (Maybe a filesystem driver bug, requiring an updated kernel package to fix?)
| repair file system by edit the fstab file |
1,436,080,480,000 |
I want to disable swap on several running ubuntu 16.04 servers. I'd like, if possible, not to reboot them. From my research, it seemed that
running swapoff -a to disable swap until the next reboot
and commenting the swap line in /etc/fstab to persist after the next reboot
should do the job. However, it seems that the kernel is re-enabling the swap: a varying amount of time after the swapoff, I see something like that in the /var/log/kern.log log:
Nov 28 12:00:51 srv07 kernel: [ 8049.183480] Adding 62498812k swap on /dev/sda3. Priority:-1 extents:1 across:62498812k FS
Once I had it happen 4 hours after the swapoff, another time 5 minutes.
What's causing this?
This is on Ubuntu 16.04 server, kernel version 4.4.0.
|
The disks were using GPT, and this was due to GPT partition automounting:
On a GPT partitioned disk systemd-gpt-auto-generator(8) will mount partitions following the Discoverable Partitions Specification, thus they can be omitted from fstab.
Another page of the same documentation explains how to disable this:
Start gdisk, e.g.:
$ gdisk /dev/sda
Press p to print the partition table and take note of the partition
number(s) of the for which you want to disable automounting.
Press x extra functionality (experts only).
Press a set attributes. Input the partition number and set the
attribute 63. Under Set fields are: it should now show 63 (do not
automount). Press Enter to end attribute changing. Repeat this for all
partitions you want to prevent from automounting.
When done write the table to disk and exit via the w command.
Alternatively using sgdisk, the attribute can be set using the
-A/--attributes= option; see sgdisk(8) for usage. For example, to set partition attribute 63 "do not automount" on /dev/sda2 run:
$ sgdisk -A 2:set:63 /dev/sda
| Can't disable swap on a GPT-based system |
1,436,080,480,000 |
UPDATED (see below)
After installing the usbip package on client and server, loading the kernel modules on both, I started usbipd on the server:
sudo usbipd
usbipd: info: starting usbipd (usbip-utils 2.0)EDIT: I found better instructions here: https://github.com/torvalds/linux/tree/master/tools/usb/usbip
client:
sudo modprobe vhci-hcd
sudo usbip attach -r 192.168.5.153 -b 1-1
server:
usbipd: info: connection from 192.168.1.2:40942
usbipd: info: received request: 0x8003(4)
usbipd: info: found requested device: 1-1
usbip: info: connect: 1-1
usbipd: info: request 0x8003(4): complete
client:
sudo lsusb
(the expected usb device is not shown and also KDE multimedia tools do not show any new audio devices)
usbipd: info: listening on 0.0.0.0:3240
usbipd: error: socket: :::3240: 97 (Address family not supported by protocol)
I did not look into the above error, and I do not know if it is relevant but I am assuming it is not.
Then I bound my usb device:
sudo usbip bind -b 1-1
Then on the client I attached the device:
sudo usbip attach -r 192.168.1.153 -b 1-1
libusbip: error: udev_device_new_from_subsystem_sysname failed
usbip: error: open vhci_driver
The following messages were shown on the server for usbipd (I tried to connect twice):
usbipd: info: connection from 192.168.1.2:40910
usbipd: info: received request: 0x8005(4)
usbipd: info: exportable devices: 1
usbipd: info: request 0x8005(4): complete
usbipd: info: connection from 192.168.1.2:40912
usbipd: info: received request: 0x8003(4)
usbipd: info: found requested device: 1-1
usbip: info: connect: 1-1
usbipd: info: request 0x8003(4): complete
usbipd: info: connection from 192.168.1.2:40918
usbipd: info: received request: 0x8003(4)
usbipd: info: found requested device: 1-1
usbip: info: connect: 1-1
usbipd: info: request 0x8003(4): complete
lsusb shows that the client did not attach the usb device. The relevant errors on the client are:
libusbip: error: udev_device_new_from_subsystem_sysname failed
usbip: error: open vhci_driver
Both client and server are running these versions:
sudo pacman -Qi usbip
Name : usbip
Version : 4.18-1
Linux 4.18.6-arch1-1-ARCH #1 SMP PREEMPT Wed Sep 5 11:54:09 UTC 2018 x86_64 GNU/Linux
I got installation help from here:
Tutorial – USB/IP » Linux Magazine http://www.linux-magazine.com/Issues/2018/208/Tutorial-USB-IP
UPDATE: I found better instructions here: https://github.com/torvalds/linux/tree/master/tools/usb/usbip
client:
sudo modprobe vhci-hcd
sudo usbip attach -r 192.168.5.153 -b 1-1
server:
usbipd: info: connection from 192.168.1.2:40942
usbipd: info: received request: 0x8003(4)
usbipd: info: found requested device: 1-1
usbip: info: connect: 1-1
usbipd: info: request 0x8003(4): complete
client:
sudo lsusb
(the expected usb device is not shown and also KDE multimedia tools do not show any new audio devices)
The journal on the client shows that the usb device is found but immediate unbound and it is not clear to me why.
# journalctl -r
Sep 23 05:12:20 client kernel: usb 3-1: USB disconnect, device number 4
Sep 23 05:12:20 client kernel: vhci_hcd: disconnect device
Sep 23 05:12:20 client kernel: vhci_hcd: release socket
Sep 23 05:12:20 client kernel: vhci_hcd: stop threads
Sep 23 05:12:20 client kernel: vhci_hcd: connection closed
Sep 23 05:12:20 client krunner[993]: [05::12:20.748] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client org_kde_powerdevil[1022]: [05::12:20.748] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client kdeinit5[954]: [05::12:20.748] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client kate[4517]: [05::12:20.748] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client plasmashell[995]: [05::12:20.748] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client baloo_file[991]: [05::12:20.748] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client systemsettings5[1170]: [05::12:20.748] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client kdeinit5[954]: [05::12:20.748] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client kdeinit5[954]: [05::12:20.748] unknown: QObject::connect: invalid null parameter
Sep 23 05:12:20 client org_kde_powerdevil[1022]: [05::12:20.748] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client krunner[993]: [05::12:20.748] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client plasmashell[995]: [05::12:20.747] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client kate[4517]: [05::12:20.747] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client systemsettings5[1170]: [05::12:20.747] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client baloo_file[991]: [05::12:20.747] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client kdeinit5[954]: [05::12:20.747] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client kdeinit5[954]: [05::12:20.747] unknown: QObject::connect: invalid null parameter
Sep 23 05:12:20 client baloo_file[991]: [05::12:20.747] unknown: QObject::connect: invalid null parameter
Sep 23 05:12:20 client baloo_file[991]: [05::12:20.746] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client org_kde_powerdevil[1022]: [05::12:20.746] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client plasmashell[995]: [05::12:20.746] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client systemsettings5[1170]: [05::12:20.746] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client krunner[993]: [05::12:20.746] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client kate[4517]: [05::12:20.746] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client kdeinit5[954]: [05::12:20.746] unknown: QObject::connect: invalid null parameter
Sep 23 05:12:20 client baloo_file[991]: [05::12:20.746] unknown: QObject::connect: invalid null parameter
Sep 23 05:12:20 client baloo_file[991]: [05::12:20.745] unknown: QObject::connect: invalid null parameter
Sep 23 05:12:20 client kdeinit5[954]: [05::12:20.744] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client baloo_file[991]: [05::12:20.744] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client systemsettings5[1170]: [05::12:20.744] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client org_kde_powerdevil[1022]: [05::12:20.744] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client kdeinit5[954]: [05::12:20.744] unknown: QObject::connect: invalid null parameter
Sep 23 05:12:20 client krunner[993]: [05::12:20.744] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client plasmashell[995]: [05::12:20.744] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client kate[4517]: [05::12:20.744] unknown: UdevQt: unhandled device action "bind"
Sep 23 05:12:20 client baloo_file[991]: [05::12:20.743] unknown: QObject::connect: invalid null parameter
Sep 23 05:12:20 client mtp-probe[5684]: bus: 3, device: 4 was not an MTP device
Sep 23 05:12:20 client mtp-probe[5684]: checking bus 3, device 4: "/sys/devices/platform/vhci_hcd.0/usb3/3-1"
Sep 23 05:12:20 client kernel: hid-generic 0003:0746:3000.0003: hidraw0: USB HID v1.00 Device [ONKYO USB HS Audio Device] on usb-vhci_hcd.0-1/input2
Sep 23 05:12:20 client kernel: hid-generic 0003:0746:3000.0003: No inputs registered, leaving
Sep 23 05:12:20 client kernel: usb 3-1: Manufacturer: ONKYO
Sep 23 05:12:20 client kernel: usb 3-1: Product: USB HS Audio Device
Sep 23 05:12:20 client kernel: usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Sep 23 05:12:20 client kernel: usb 3-1: New USB device found, idVendor=0746, idProduct=3000, bcdDevice=22.04
Sep 23 05:12:20 client kernel: usb 3-1: SetAddress Request (4) to port 0
Sep 23 05:12:20 client kernel: usb 3-1: new high-speed USB device number 4 using vhci_hcd
Sep 23 05:12:20 client kernel: vhci_hcd vhci_hcd.0: devid(65544) speed(3) speed_str(high-speed)
Sep 23 05:12:20 client kernel: vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(3)
Sep 23 05:10:53 client nm-dispatcher[5670]: req:1 'dhcp4-change' [wlan0]: completed: no scripts
Sep 23 05:10:53 client nm-dispatcher[5670]: req:1 'dhcp4-change' [wlan0]: new request (0 scripts)
Sep 23 05:10:53 client systemd[1]: Started Network Manager Script Dispatcher Service.
Sep 23 05:10:53 client dbus-daemon[478]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Sep 23 05:10:53 client systemd[1]: Starting Network Manager Script Dispatcher Service...
Sep 23 05:10:53 client dbus-daemon[478]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-disp>
|
Anytime I've had that error it has been due to a usbip-utils version mismatch between the client and server. Check both by executing usbip version which should return something along the lines of usbip (usbip-utils 2.0)
| usbip error open vhci driver |
1,436,080,480,000 |
I have a VERY simple Ubuntu 16 x64 VM setup on my ESXi host which acts as a fileserver. It has NFS/SMB and MDADM installed. It is fully updated.
Twice in the last week it has hung with an error about “rcu_sched detected stalls on CPUs and something about not enough jiffies.
I took a screen shot this time, but its so bad that ESXi can't kill the VM and after reboot is causing a rebuild of my MDADM Array. I worry this will cause unnecessary damage to my HDD's and wonder what the problem could be? The VM is given plenty of extra resources w/ 1vCPU and 4vThreads w/ 6GB Ram.
Any ideas? The VM is back running now, so I can debug any information requested. I'm thinking about just moving to a RHEL based Distro, but I'd like to figure out the problem vs rebuilding on a different Linux OS.
PS: I am the main user and as far as I remember there were no intensive R/W operations going on at the time.
|
TLDR; About a Week Later I lost a CPU Core likely due to overheating/badly placed heatsink/fan.
If you are using ESXi I would fire up another OS and check on Temp's and/or consider re-seating your CPU heat sink.
This post has got a lot of views, and when I had the issue, google had very little information for me. Please share your experiences in comments or answers!
TimeLine:
I get error about Jiffies
Have to use power button to reboot
MDADM Array Rebuild --> Successful.
I get another error next day
Reboot/Rebuild Successful.
Another error!
Rebuild VM w/ new OS
Stable for about a week
Single Core in CPU dies!
Further research into ESXi showed me that ESXi does NOT gather device Temps without some sort of advanced hardware addition that I didn't have (Possibly because I wasn't use a computer from the "Hardware Compatibility List". (https://communities.vmware.com/thread/547244). If it had, ESXi could have likely throttled my CPU. I now use KVM which checks all my device Temps via normal methods and reacts accordingly. Not just that but my RW speed has greatly increased as my Hypervisor is now also my FileServer vs before I had to passthrough the disks to a FileServer VM since ESXi doesn't support SMB/NFS/MDADM etc. (I'm talking about a 2 or 3 fold increase in RW speeds now that my clients talk directly to the Hypervisor/FileServer).
| “rcu_sched detected stalls on CPUs/tasks” - jiffies - ESXi Ubuntu 16 FileServer Guest |
1,436,080,480,000 |
How can I boot the linux rootfs from u-boot passing rootfs partition by label ?
I'm using u-boot as bootloader and the card is a RedPitaya. The linux is a customized Linux based on the stable ubuntu image available for the card.
U-boot is flashed in the sd card's first partition with the linux kernel and the device tree. I'm trying to boot the root file system on an external usb HDD
I precise that I can boot the HDD if I use the "classic" /dev/sdxn naming convention.
I already tried with the following parameters but they both failed :
console=ttyPS0,115200 root=/dev/disk/by-label/ROOTFS rw rootfstype=ext4 earlyprintk rootwait isolcpus=1
console=ttyPS0,115200 root=LABEL=ROOTFS rw rootfstype=ext4 earlyprintk rootwait isolcpus=1
From what I understood doing researchs, /dev/disk/by-label is populated by udev so it's not available in u-boot when passing the boot arguments to the linux kernel.
Also I found out that the functionality to boot from label is not integrated to linux kernel as you can see in this file do_mounts.c just before dev_t name_to_dev_t(const char *name) function definition.
So from now I would like to find a way to boot the partition labelled as ROOTFS on the external usb HDD.
I see two different solutions there :
1 - Integrate the by-label boot functionality in the linux kernel by adding something like
if (strncmp(name, "LABEL=", 6) == 0) {
name += 6;
res = devt_from_label(name);
if (!res)
goto fail;
goto done;
}
into do_mounts.c and implement the function devt_from_label.
2 - Use a small rootfs on the sd card's second partition to resolve the device name from its label and relaunch the kernel boot with the replaced device name.
What do you think about it ? Which one would be the "simpliest" to implement ?
Maybe I'm forgetting something important or someone already suceed to do the same thing.
Anyway, I would be glad to have some help to achieve it
|
The problem is that LABEL and UUID handling is not done by the Linux Kernel but is done via an initramfs, which you would need to provide as well. If you want to bypass that you need to use PARTUUID which is something that via the part command, U-Boot can determine for you and pass along.
| Pass root file system by label to linux kernel |
1,436,080,480,000 |
I need to create a test that would check if the driver for a specific device was a kernel module(as opposed to statically linked). Is there a way to know this information at run time? Thanks!
|
lsmod will list the currently loaded kernel modules. So, if a driver is not listed there then it was either built-in to the kernel or it isn't loaded. Most distributions should have a config file stored in their /boot directory, which contains the kernel configuration options that were used. If you were to download and unpack the source code for the same kernel version; copy the config file to .config at the top of the source tree; and then run make menuconfig, then you would be able to browse the configuration settings and see how that driver was configured.
In some cases, the kernel configuration is actually built in to the kernel itself, but I would have to look up how to access that :)
Edit:
Another, possibly quicker, option (if it's a pci device) is to run lspci -v. The output of that will tell you the name of the driver that is currently in use. If that isn't listed in lsmod, then you know it must be built-in.
| Is there a way to know at runtime if a driver is a kernel module or if it was statically linked? |
1,436,080,480,000 |
I have a zpool (3x 3TB Western Digital Red) that I scrub weekly for errors that comes up OK, but I have a recurring error in my syslog:
Jul 23 14:00:41 server kernel: [1199443.374677] ata2.00: exception Emask 0x0 SAct 0xe000000 SErr 0x0 action 0x0
Jul 23 14:00:41 server kernel: [1199443.374738] ata2.00: irq_stat 0x40000008
Jul 23 14:00:41 server kernel: [1199443.374773] ata2.00: failed command: READ FPDMA QUEUED
Jul 23 14:00:41 server kernel: [1199443.374820] ata2.00: cmd 60/02:c8:26:fc:43/00:00:f9:00:00/40 tag 25 ncq 1024 in
Jul 23 14:00:41 server kernel: [1199443.374820] res 41/40:00:26:fc:43/00:00:f9:00:00/40 Emask 0x409 (media error) <F>
Jul 23 14:00:41 server kernel: [1199443.374946] ata2.00: status: { DRDY ERR }
Jul 23 14:00:41 server kernel: [1199443.374979] ata2.00: error: { UNC }
Jul 23 14:00:41 server kernel: [1199443.376100] ata2.00: configured for UDMA/133
Jul 23 14:00:41 server kernel: [1199443.376112] sd 1:0:0:0: [sda] tag#25 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Jul 23 14:00:41 server kernel: [1199443.376115] sd 1:0:0:0: [sda] tag#25 Sense Key : Medium Error [current] [descriptor]
Jul 23 14:00:41 server kernel: [1199443.376118] sd 1:0:0:0: [sda] tag#25 Add. Sense: Unrecovered read error - auto reallocate failed
Jul 23 14:00:41 server kernel: [1199443.376121] sd 1:0:0:0: [sda] tag#25 CDB: Read(16) 88 00 00 00 00 00 f9 43 fc 26 00 00 00 02 00 00
Jul 23 14:00:41 server kernel: [1199443.376123] blk_update_request: I/O error, dev sda, sector 4181982246
Jul 23 14:00:41 server kernel: [1199443.376194] ata2: EH complete
A while back I had a faulty SATA cable that caused some read/write errors (that were later corrected by zpool scrubs and restoring from snapshots) and originally thought this error was a result of this. However it keeps randomly recurring, this time while I was in the middle of a scrub.
So far ZFS says that there are no errors, but it also says it's "repairing" that disk:
pool: sdb
state: ONLINE
scan: scrub in progress since Sun Jul 23 00:00:01 2017
5.41T scanned out of 7.02T at 98.9M/s, 4h44m to go
16.5K repaired, 77.06% done
config:
NAME STATE READ WRITE CKSUM
sdb ONLINE 0 0 0
ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N1366685 ONLINE 0 0 0 (repairing)
ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0K3PFPS ONLINE 0 0 0
ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0M94AKN ONLINE 0 0 0
cache
sde ONLINE 0 0 0
errors: No known data errors
SMART data seems to tell me that everything is OK after running a short test, I'm in the middle of running the long self-test now to see if that comes up with anything. The only thing that jumps out is the UDMA_CRC_Error_Count, but after I fixed that SATA cable it hasn't increased at all.
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x002f 200 200 051 Pre-fail Always - 0
3 Spin_Up_Time 0x0027 195 175 021 Pre-fail Always - 5233
4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 625
5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0
7 Seek_Error_Rate 0x002e 100 253 000 Old_age Always - 0
9 Power_On_Hours 0x0032 069 069 000 Old_age Always - 22931
10 Spin_Retry_Count 0x0032 100 100 000 Old_age Always - 0
11 Calibration_Retry_Count 0x0032 100 100 000 Old_age Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 625
192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 581
193 Load_Cycle_Count 0x0032 106 106 000 Old_age Always - 283773
194 Temperature_Celsius 0x0022 118 109 000 Old_age Always - 32
196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0030 100 253 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0032 200 133 000 Old_age Always - 1801
200 Multi_Zone_Error_Rate 0x0008 100 253 000 Old_age Offline - 0
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 22931 -
In addition to that, I'm also getting notifications about ZFS I/O errors, even though according to this it's just a bug related to drive idling/spin up time.
eid: 71
class: io
host: server
time: 2017-07-23 15:57:49-0500
vtype: disk
vpath: /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N1366685-part1
vguid: 0x979A2C1464C41735
cksum: 0
read: 0
write: 0
pool: sdb
My main question is how concerned should I be about that drive? I'm inclined to go replace it to be safe, but waned to know how soon I need to.
Here are the possibilities that I'm thinking might explain discrepancy between SMART data and ZFS/kernel:
ZFS io error bug makes the kernel think that there's bad sectors, but according to SMART there aren't any.
ZFS keeps repairing that drive (related to previous errors with faulty cable), which also might point to drive failure, despite SMART data.
The error is a false alarm and related this unfixed bug in Ubuntu
EDIT: Now I just realized that the good drives are on firmware version 82.00A82, while the one that's getting the errors is 80.00A80. According to the Western Digital forum, there's no way to update this particular model's firmware. I'm sure that's not helping either.
EDIT 2: Forgot to update this a long time ago but this did end up being a hardware issue. After swapping multiple SATA cables, I finally realized that the issue the whole time was a failing power cable. The power flakiness was killing the drive, I but managed to get better drives and save the pool.
|
In the end, it's your data, so you would be the one to say whether the drive should be replaced or not. In the end, it's just spinning rust.
Though, I should point out that it appears you've created a cat/RAID0 pool, so if a drive fails, you'll lose everything. And without a mirror, ZFS is unable to repair any failed files -- only report them.
If you're seeing the error messages sent to syslog while the scrub is running, perhaps its from the drives being taxed while the check the ZFS checksums. And since not all data is accessed, the scrub could be hitting a block the drive deems needs to be reallocated. Or noise on the line. And I'm not referring to Brendan Gregg yelling at disks. ;o) You did note a cable issue, perhaps a controller or port issue is also in the mix?
You also noted a Western Digital forum. I've seen many "complaints" on consumer drives not playing well with software or hardware RAID. If your data is important, you may want to consider using a mirror, and possibly even a 3-way mirror since disks aren't that much and something else could fail during a rebuild/resilver.
As far as "smart data," the verdict is out on how "smart" or useful it is. I've seen drives pass the vendors tests, yet be useless.
| ZFS - "Add. Sense: Unrecovered read error - auto reallocate failed" in syslog, but SMART data looks OK |
1,436,080,480,000 |
I wanted to update my system (Slackware current) which was in multilib. Before updating, I tried to remove all packages (compat32 and multilib). Big mistake !!! This have broken some crucial symlinks and give me now a kernel panic when i trie to boot it.
I have tried several methods, including this one But it does not work since I no longer have the original disc
Can someone tell me what is the proper way to recover the installation in this situation?
|
since you can't boot your system, you need some other medium - cd or usb. there is no other magic way to boot unbootable system.
basically what you have to do is:
boot your machine (slackware installer).
mount your partitions and chroot to system / dir.
install packages you removed (download them from some slackware mirror and copy, ie on usb drive).
in details:
boot from slackware install disc or usb drive.
make some directory for your broken system (mount point), ie:
mkdir /mnt
mount root partition (let's say it's sda2) to created directory, ie:
mount /dev/sda2 /mnt
if your system is spread on many partitions (/boot, /var etc directory on separate partition) - mount them too! let's say your /boot is on sda1 and /var on sda3:
mount /dev/sda1 /mnt/boot
mount /dev/sda3 /mnt/var
copy (ie on usb drive) packages you removed in some accessible place on your system partition, ie /mnt/root.
"switch" to your system partition:
chroot /mnt
install packages, now they are in /root
it is done :)
next, to clean up:
exit chroot environment (Ctrl+D or logout).
umount partitions you mounted in 4. and then(!) 3, ie:
umount /mnt/var
umount /mnt/boot
umount /mnt
reboot to your hopefully rescued slackware os :)
| Linux Slackware ( Broken - kernel panic ) |
1,451,799,439,000 |
This is my first attempt at compiling a Kernel. I have a fresh minamalist Debian Jessie installation, I then...
sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils
sudo apt-get install kernel-package
Obtained Kernel
cd /mnt/local/btrfs_a/Kernel\ Downloads/
wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.2.tar.xz
Extract
tar xvf linux-4.2.tar.xz
cd linux-4.2
Copy existing Kernel Config File
cp /boot/config-$(uname -r) .config
No changes were made in the following lines...
make menuconfig
make-kpkg clean
Compile
fakeroot make-kpkg --initrd --revision=1.0.NAS kernel_image kernel_headers
But this results in:
IHEX firmware/yam/1200.bin
IHEX firmware/yam/9600.bin
make[1]: Leaving directory '/mnt/local/btrfs_a/Kernel Downloads/linux-4.2'
COLUMNS=150 dpkg -l 'gcc*' perl dpkg 'libc6*' binutils make dpkg-dev |\
awk '$1 ~ /[hi]i/ { printf("%s-%s\n", $2, $3) }'> debian/stamp/build/info
uname -a >> debian/stamp/build/info
echo using the compiler: >> debian/stamp/build/info
if [ -f include/generated/compile.h ]; then \
grep LINUX_COMPILER include/generated/compile.h | \
sed -e 's/.*LINUX_COMPILER "//' -e 's/"$//' >> \
debian/stamp/build/info; \
elif [ -f include/linux/compile.h ]; then \
grep LINUX_COMPILER include/linux/compile.h | \
sed -e 's/.*LINUX_COMPILER "//' -e 's/"$//' >> \
debian/stamp/build/info; \
fi
echo done > debian/stamp/build/kernel
/usr/bin/make -f ./debian/rules debian/stamp/binary/pre-linux-image-4.2.0
make[1]: Entering directory '/mnt/local/btrfs_a/Kernel Downloads/linux-4.2'
====== making target debian/stamp/install/linux-image-4.2.0 [new prereqs: ]======
This is kernel package version 13.014+nmu1.
rm -f -r .//mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0 .//mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0.deb
install -p -d -o root -g root -m 755 /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/etc/kernel/postinst.d /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/etc/kernel/preinst.d \
/mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/etc/kernel/postrm.d /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/etc/kernel/prerm.d
install -p -d -o root -g root -m 755 /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0//boot
install -p -d -o root -g root -m 755 /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/usr/share/doc/linux-image-4.2.0/examples
install -p -o root -g root -m 644 debian/changelog /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/usr/share/doc/linux-image-4.2.0/changelog.Debian
install: target ‘Downloads/linux-4.2/debian/linux-image-4.2.0/usr/share/doc/linux-image-4.2.0/changelog.Debian’ is not a directory
debian/ruleset/targets/image.mk:34: recipe for target 'debian/stamp/install/linux-image-4.2.0' failed
make[1]: *** [debian/stamp/install/linux-image-4.2.0] Error 1
make[1]: Leaving directory '/mnt/local/btrfs_a/Kernel Downloads/linux-4.2'
debian/ruleset/local.mk:105: recipe for target 'kernel_image' failed
make: *** [kernel_image] Error 2
OK, my initial folder was ../Kernel Downloads/.. On a whim, I've changed it to 'KernelDownloads' (no space) and attempted to re-compile (from the top). It is now asking me a whole load of questions, is this normal? I'm just hitting return to grab the defaults. Is this the right thing to do?
|
Looks like the issue may have been a space in the folder structure the kernel files were located in. After I removed the space, it was fine!
| Problems compiling Kernel 4.2 Under Debian Linux (Jessie) |
1,451,799,439,000 |
I install the Linux kernel source code RPM:
[root@localhost ~]# rpm -ivh kernel-3.10.0-229.el7.src.rpm
warning: kernel-3.10.0-229.el7.src.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Updating / installing...
1:kernel-3.10.0-229.el7 ################################# [100%]
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
warning: user builder does not exist - using root
warning: group builder does not exist - using root
The installation process seems success, but using rpm -ql kernel-3.10.0-229.el7.src command can't find where the source code is installed:
[root@localhost ~]# rpm -ql kernel-3.10.0-229.el7.src
package kernel-3.10.0-229.el7.src is not installed
Where is the RHEL7 kernel source code installed?
Update: rpm -qa | grep kernel command ouput:
[root@localhost ~]# rpm -qa | grep kernel
kernel-headers-3.10.0-229.el7.x86_64
kernel-devel-3.10.0-229.el7.x86_64
kernel-3.10.0-229.el7.x86_64
kernel-tools-libs-3.10.0-229.el7.x86_64
abrt-addon-kerneloops-2.1.11-19.el7.x86_64
kernel-tools-3.10.0-229.el7.x86_64
|
Source packages are not added to the rpm database, so they will not show on query.
Probable location is ~/rpmbuild/{SOURCES,SPECS} with SOURCES containing the package sources and distribution patches while the SPECS subdirectory containing the .spec file being used to build the package (see rpmbuild (8) man page for details).
If you can't find the sources there, than reinstall with the -vv option to check the location if it's overwritten:
$ rpm -ivvh kernel-3.10.0-229.7.2.el7.src.rpm
--- snip ---
Updating / installing...
1:kernel-3.10.0-229.7.2.el7 ################################# [100%]
D: ========== Directories not explicitly included in package:
D: 0 /home/user/rpmbuild/SOURCES/
D: 1 /home/user/rpmbuild/SPECS/
D: ==========
| Where is the RHEL7 kernel source code installed? |
1,451,799,439,000 |
The "How to Build External Modules" section of the kernel.org kbuild documentation ( https://www.kernel.org/doc/Documentation/kbuild/modules.txt ) says:
To build external modules, you must have a prebuilt kernel available
that contains the configuration and header files used in the build.
Also, the kernel must have been built with modules enabled. If you are
using a distribution kernel, there will be a package for the kernel
you are running provided by your distribution.
An alternative is to use the "make" target "modules_prepare."
My question is, alternative to what? Alternative to
"have a prebuilt kernel available that contains the configuration and
header files"
or
"the kernel must have been built with modules enabled"
or something else?
|
It's an alternative to "using a distribution [...] package", which is synonymous with having "the configuration and header files" available.
You should include a .config before you do this. Most distro kernels have this available in /proc/config.gz; copy that into the top of the source tree and
gunzip -c config.gz > .config
This will only work if the source version is >= the running kernel. Note that if you intend to use the module with the running kernel, the source version number should be exactly the same.
| linux kernel module building prerequisites |
1,451,799,439,000 |
I'm trying to use a new usb wireless interface (atheros ar9271) and my onboard wireless (intel 6200) is interfering with it. The goal is for me to be able to turn the rf kill switch on (enabling wireless, that is) so that I can use the external wireless adapter, and not have the onboard wireless show up at all. I also want to be able to re-add it later on if I need to. Someone suggested using rmmod, but I'm unfamiliar with this, and I don't know how to identify which module the onboard wireless is using.
So to summarize: how do I identify the module (assuming this is the right way to go about this) and then remove it? And question 2: how do I re-add that module later on so that the onboard wireless is detected again?
Running Fedora 21. The onboard wireless is wlan0.
|
On Linux, you can find out which driver a network interface is using with this command:
ls -l /sys/class/net/<interface name>/device/driver
You can rmmod that unless it is statically linked into the running kernel (not likely for a distribution kernel and a wireless driver). Watch out for any other interfaces using the same driver which will be taken down at the same time (but it's not likely in this case that you have any other interface on the system that is using the same driver). You may want/need to make sure the interface is down with ip link set <interface name> down before you remove its driver.
To add it again, use modprobe with the same driver name.
If the wireless device is a PCI device, you can control with actions like "enable" and "remove" instead of removing the driver:
# Get rid of the device (but does not power it off)
# Might not be reversible, I'm not sure
echo 1 >/sys/class/net/<interface name>/device/remove
| How do I completely remove a wireless interface (and re-add it)? |
1,451,799,439,000 |
I have an embedded Linux system with unencrypted kernel image and initramfs in NAND flash.
My RootFS is in SD card.
I want to encrypted some files on SD Card as my SD card is easily accessible physically.
For this I am planing to use eCryptfs.
But I want to keep the keys inside NAND flash in kernel image or initramfs.
What are my options, what is best way to secure some files on my SD card.
|
If you didn't have an initramfs, you could do it with kernel parameters. Just add a random string as kernel parameter and then use /proc/cmdline as the key for your encryption. If it's not easy to add such parameters to your boot loader, the Linux kernel has a CMDLINE config option that lets you compile it in. (Note: it is possible for kernel parameters to end up in log files and such. Whether it's suitable for your scenario depends on what is running on / writing to your SD card.)
With initramfs, of course you're free to do whatever you want. It can ask for your passphrase at bootup, or include a key, or do both using encrypted keys. It's up to you but the exact implementation depends on what your initramfs looks like without such modifications. You can look at various initramfs guides online to get an idea of how it works in principle, for example: https://wiki.gentoo.org/wiki/Custom_Initramfs
You just have to be careful to not leave an unencrypted copy of the key on the SD card itself. At the same time you should have a copy somewhere since it may be hard to get it back out of the NAND if the device ever breaks.
| eCryptfs key in kernel image or initramfs |
1,451,799,439,000 |
...
...
...
--> Running transaction check
---> Package db4-devel.x86_64 0:4.7.25-18.el6_4 will be installed
--> Processing Dependency: db4-cxx = 4.7.25-18.el6_4 for package: db4-devel-4.7.25-18.el6_4.x86_64
--> Processing Dependency: libdb_cxx-4.7.so()(64bit) for package: db4-devel-4.7.25-18.el6_4.x86_64
---> Package gdbm-devel.x86_64 0:1.8.0-36.el6 will be installed
---> Package kernel.x86_64 0:2.6.32-431.20.3.el6 will be installed
--> Processing Dependency: kernel-firmware >= 2.6.32-431.20.3.el6 for package: kernel-2.6.32-431.20.3.el6.x86_64
Package kernel-firmware-2.6.32-431.20.3.el6.noarch is obsoleted by vzkernel-firmware-2.6.32-042stab083.2.noarch which is already installed
---> Package lzo.x86_64 0:2.03-3.1.el6 will be installed
---> Package mesa-private-llvm.x86_64 0:3.3-0.3.rc3.el6 will be installed
---> Package p11-kit.x86_64 0:0.18.5-2.el6_5.2 will be installed
---> Package p11-kit-trust.x86_64 0:0.18.5-2.el6_5.2 will be installed
---> Package shared-mime-info.x86_64 0:0.70-4.el6 will be installed
---> Package snappy.x86_64 0:1.1.0-1.el6 will be installed
--> Running transaction check
---> Package db4-cxx.x86_64 0:4.7.25-18.el6_4 will be installed
---> Package kernel.x86_64 0:2.6.32-431.20.3.el6 will be installed
--> Processing Dependency: kernel-firmware >= 2.6.32-431.20.3.el6 for package: kernel-2.6.32-431.20.3.el6.x86_64
Package kernel-firmware-2.6.32-431.20.3.el6.noarch is obsoleted by vzkernel-firmware-2.6.32-042stab083.2.noarch which is already installed
--> Finished Dependency Resolution
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
Error: Package: kernel-2.6.32-431.20.3.el6.x86_64 (updates)
Requires: kernel-firmware >= 2.6.32-431.20.3.el6
Removing: vzkernel-firmware-2.6.32-042stab083.2.noarch (@openvz-kernel-rhel6)
kernel-firmware = 2.6.32-358.23.2.el6
Updated By: vzkernel-firmware-2.6.32-042stab090.5.noarch (openvz-kernel-rhel6)
kernel-firmware = 2.6.32-431.17.1.el6
Available: kernel-firmware-2.6.32-431.el6.noarch (base)
kernel-firmware = 2.6.32-431.el6
Available: kernel-firmware-2.6.32-431.1.2.0.1.el6.noarch (updates)
kernel-firmware = 2.6.32-431.1.2.0.1.el6
Available: kernel-firmware-2.6.32-431.3.1.el6.noarch (updates)
kernel-firmware = 2.6.32-431.3.1.el6
Available: kernel-firmware-2.6.32-431.5.1.el6.noarch (updates)
kernel-firmware = 2.6.32-431.5.1.el6
Available: kernel-firmware-2.6.32-431.11.2.el6.noarch (updates)
kernel-firmware = 2.6.32-431.11.2.el6
Available: kernel-firmware-2.6.32-431.17.1.el6.noarch (updates)
kernel-firmware = 2.6.32-431.17.1.el6
Available: kernel-firmware-2.6.32-431.20.3.el6.noarch (updates)
kernel-firmware = 2.6.32-431.20.3.el6
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
uname -a
Linux LOD1.downtownhost.com 2.6.32-042stab083.2 #1 SMP Fri Nov 8 18:08:40 MSK 2013 x86_64 x86_64 x86_64 GNU/Linux
I need to get the kernel to stab090.5 to avoid some exploits but I don't get why YUM is broken.
Do I have too many kernels in under /boot/grub?
EDIT:
I see the following
yum list kernel.*
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirror.dattobackup.com
* extras: mirror.atlanticmetro.net
* openvz-kernel-rhel6: mirror.trouble-free.net
* openvz-utils: mirror.trouble-free.net
* soluslabs: mirror.us1.soluslabs.net
* updates: mirror.cs.uwp.edu
Installed Packages
kernel.x86_64 2.6.32-279.el6 @anaconda-CentOS-201207061011.x86_64/6.3
kernel.x86_64 2.6.32-358.0.1.el6 @updates
kernel.x86_64 2.6.32-358.14.1.el6 @updates
kernel.x86_64 2.6.32-358.23.2.el6 @updates
However I don't see the OpenVZ kernel.
Now if I do this:
yum remove kernel kernel-firmware
Loaded plugins: fastestmirror, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package kernel.x86_64 0:2.6.32-279.el6 will be erased
---> Package kernel.x86_64 0:2.6.32-358.0.1.el6 will be erased
---> Package kernel.x86_64 0:2.6.32-358.14.1.el6 will be erased
---> Package kernel.x86_64 0:2.6.32-358.23.2.el6 will be erased
---> Package vzkernel-firmware.noarch 0:2.6.32-042stab083.2 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================
Removing:
kernel x86_64 2.6.32-279.el6 @anaconda-CentOS-201207061011.x86_64/6.3 114 M
kernel x86_64 2.6.32-358.0.1.el6 @updates 116 M
kernel x86_64 2.6.32-358.14.1.el6 @updates 116 M
kernel x86_64 2.6.32-358.23.2.el6 @updates 116 M
vzkernel-firmware noarch 2.6.32-042stab083.2 @openvz-kernel-rhel6 19 M
Transaction Summary
=========================================================================================================================================================
Remove 5 Package(s)
Installed size: 480 M
Is this ok [y/N]: n
How do I exclude the openvz kernel?
|
The solution is to remove vzkernel-firmware package:
rpm -e vzkernel-firmware
and exclude it by adding the line marked in bold to openvz yum repo file /etc/yum.repos.d/openvz.repo:
[openvz-kernel-rhel6]
name=OpenVZ RHEL6-based kernel
#baseurl=http://download.openvz.org/kernel/branches/rhel6-2.6.32/current/
mirrorlist=http://download.openvz.org/kernel/mirrors-rhel6-2.6.32
enabled=1
gpgcheck=1
gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ
exclude=vzkernel-firmware
| YUM won't update KERNEL |
1,451,799,439,000 |
I'm currently working on a project. There's an Ubuntu Linux system installed on a disk, DA, mounting the other disk, DB.
What it requires is that DB can be only mounted by DA in order to prevent data stealing. I planned to use encryption tools provided by Ubuntu to encrypt the whole disk DB. Other Linux won't be able to mount DB since they don't have the right key.
However, my colleague told me it is possible to modify the kernel to make a "fake" new filesystem, say, ext9, and this new filesystem is actually ext3 or ext4. Since only the new kernel knows this "new" filesystem, other Linux would never get it mounted. And since it in fact is ext3, software like Apache or MySQL could run normally.
Is this possible or not.
|
To answer the question in your title: how to fake a filesystem that cannot be mounted by others? Write random data. It's a fake filesystem and nobody will be able to mount it.
To answer the question you're asking: sure, you can fake a filesystem this way, but it's equally trivial to un-fake. Others can definitely mount it, it's just that they'll have to go and change a setting somewhere, it won't be automatic. This is as secure as putting a “turtleneck sweaters” label on your jewelry drawer: it only works as long as nobody bothers to look.
As for the answer to your problem, you already know it. If you don't want others to be able to mount the disk, you need to make what's stored on the disk unusable without some secret that only you know. This is called encryption. Use dm-crypt.
| How to fake a filesystem that cannot be mounted by others |
1,451,799,439,000 |
I'm a gentoo user. When compiling the kernel there are a lot of options which one may enable depending on one's hardware.
My question is how to know what to enable/disable, I'm aware of the hardware I'm using (processor instruction set, number of cores, etc./ motherboard NB and SB/sata drives, etc.) but still don't have a clear idea what to do when choosing options in the kernel setup script.
I've had weird issues because of this (solved after some help from #gentoo). Can someone give me some references on this topic? How do people learn to do this?
P.S. Please don't tell me I should not be compiling the kernel, it's something I want to learn and also why not get some speed and better use of my hardware.
|
I found this document which explains exactly what I was looking for, I hope it's useful for some of you http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/ch08s02.html
Read the entire document, it's full of nice things, specially this:
When the topic of this book was first presented to me, I dismissed it
as something that was already covered by the plentiful documentation
about the Linux kernel. Surely someone had already written down all of
the basics needed in order to build, install, and customize the Linux
kernel, as it seemed to be a very simple task to me.
After digging through the different HOWTOs and the Linux kernel
Documentation directory, I came to the conclusion that there was not
any one place where all of this information could be found. It could
be gleaned by referencing a few files here, and a few outdated
websites there, but this was not acceptable for anyone who did not
know exactly what they were looking in the first place.
So this book was created with the goal of consolidating all of the
existing information already scattered around the Internet about
building the Linux kernel, as well as adding a lot of new and useful
information that was not written down anywhere but had been learned by
trial and error over my years of doing kernel development.
My secret goal of this book is to bring more people into the Linux
kernel development fold. The act of building a customized kernel for
your machine is one of the basic tasks needed to become a Linux kernel
developer. The more people that try this out, and realize that there
is not any real magic behind the whole Linux kernel process, the more
people will be willing to jump in and help out in making the kernel
the best that it can be.
| How to know what to enable in the kernel? |
1,451,799,439,000 |
I run docky which is programmed with mono so I think the binfmt is running correctly, but proc-sys-fs-binfmt_misc.automount complains about it, since I don't have /proc/sys/fs/binfmt_misc/CLR
I already have CONFIG_BINFMT_MISC=y in my kernel config.
|
/proc/sys/fs/binfmt_misc/CLR gets created by the kernel when you register a binary format that you've named "CLR". Are you able to register one manually?
echo ':CLR:M::MZ::/usr/bin/mono:' | sudo tee /proc/sys/fs/binfmt_misc/register
If this works, then the solution is probably that you should add a file in /etc/binfmt.d; see man binfmt.d for more information.
Are you sure systemd is complaining about it not already being there? systemd's systemd-binfmt.service is supposed to do that for you (but I think it does need that config file in order to do it).
| No /proc/sys/fs/binfmt_misc/CLR on my system? |
1,451,799,439,000 |
I upgraded the kernel on my OpenSUSE 12.1 64bit from 3.1.9 to 3.2.9, and when I rebooted, X-windows refused to start, and I got into shell. I tried to run it manually with startx, but still no good.
I managed to make X-windows work by removing the NVidia driver(I had the latest version). When I tried to reinstall it, the installer complained that the drivers are compiled with GCC 4.5 and therefore are not compatible with the kernel, which is compiled with GCC 4.6. I think it's safe to assume that's the reason it didn't work in the first place...
Installing the NVidia driver from the bumblebee repository(originally I installed it from the NVIDIA-Linux-x86_64-295.20.run installer from NVidia's site) didn't work either(this time I just got a black screen, and had to use failsafe mode to remove that driver).
Now, I know the NVidia driver for Linux is not open source, so I'm not going to be able to compile it myself, but is there another way to make it work with the latest kernel, or do I have to wait for NVidia to release a new version for GCC 4.6 compiled kernels?
UPDATE
I've mailed to NVidia, and their tech support noticed that I understood the error message wrong. The NVidia driver was compiled with GCC 4.6 - it was the Linux kernel that was compiled with GCC 4.5.
So, the solution is clear - I need to compile my own kernel...
|
There is a solution which will surely do the job, but it might be painful. Compile and install the kernel you need with GCC 4.5, and then install the NVidia driver.
It would be hard because compiling an own kernel is almost never easy, even if configfile is reachable. Possibly your system contains components which need that the kernel is compiled with GCC 4.6 - those components will not been able to work properly, or work at all.
The safe choice here is reporting the issue to NVidia, and wait with the old kernel.
I asked a question emerged from this problem here.
UPDATE: The answer is arrived for the abovementioned question, its important part is this:
You can patch the version string in the binary. This will trick the kernel into loading the module but at the risk of causing data corruption to internal data structures.
| NVidia driver for the 3.2.9 kernel |
1,451,799,439,000 |
I've got an old Logitech USB gamepad that worked well under both Windows and Mac OS X. That is, the gamepad was totally "plug and play" for games run by a Super Nintendo emulator (SNES9X).
Does Linux support such gamepads out of the box? Or any other controller for that matter? Thanks.
|
Yes - they're recognised as an input device and you should be able to see information about it with "lsusb".
| Linux kernel support for USB gamepads? |
1,451,799,439,000 |
I am working on a C program which gets the timestamping information for a given network interface, like my own version of ethtool. My goal is to get the information printed by $ ethtool -T myNetIf. Something like:
Time stamping parameters for myNetIf:
Capabilities:
hardware-transmit (SOF_TIMESTAMPING_TX_HARDWARE)
software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE)
hardware-receive (SOF_TIMESTAMPING_RX_HARDWARE)
software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
hardware-raw-clock (SOF_TIMESTAMPING_RAW_HARDWARE)
PTP Hardware Clock: 0
Hardware Transmit Timestamp Modes:
off (HWTSTAMP_TX_OFF)
on (HWTSTAMP_TX_ON)
Hardware Receive Filter Modes:
none (HWTSTAMP_FILTER_NONE)
all (HWTSTAMP_FILTER_ALL)
Since I don't want to just scrape the command line output, I have figured out that I can use an ioctl call to query this information from ethtool and get my flags back as an unsigned integer.
struct ifreq ifr;
memset(&ifr, 0, sizeof(struct ifreq));
struct ethtool_ts_info etsi;
memset(&etsi, 0, sizeof(struct ethtool_ts_info));
etsi.cmd = ETHTOOL_GET_TS_INFO;
strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); // dev is read from stdin
ifr.ifr_data = (void *)&etsi;
ioctl(sock, SIOCETHTOOL, &ifr); // sock is an AF_INET socket
The ethtool_ts_info struct which (I believe) contains the data I want is defined here. Specifically, I grab the so_timestamping, tx_types, and rx_filters fields.
Using the same example interface, the value of so_timestamping is 0x5f, or 0101 1111. A look at net_tstamp.h confirms that these are the expected flags.
My issue, however, is in interpreting the values of tx_types and rx_filters. I assumed that the value of tx_types would be something like 0x3 (0011, where the 3rd bit is HWTSTAMP_TX_ON and the 4th is HWTSTAMP_TX_OFF). Alternatively, since the possible transmit modes are defined in an enum with 4 values, perhaps the result would be 0100, where each int enum value is 2 bits.
This is not the case. The actual value of tx_types is 0x7fdd. How on Earth am I supposed to get "HW_TX_OFF and ON" from 0x7fdd? I find the value of rx_filters even more confusing. What is 0x664758eb supposed to mean?
Besides the kernel source code itself, I haven't been able to find much helpful information on this. I think I've done everything right, I just need some help understanding my results.
|
This is embarrassing: I have reviewed my code and found that I did fail to properly initialize a struct, just not in quite the way I expected. I also didn't provide the full context needed to solve the problem, since I thought I had ruled out the possibility of junk values left over from before allocation.
The sample code I posted is part of a function which fills out a struct I've defined containing the relevant fields of ethtool_ts_info.
typedef struct {
unsigned int soTimestamping;
unsigned int txTypes;
unsigned int rxFilters;
} tsCapsFilters_t;
The user of the function initializes this struct themselves and the function merely populates it. So expected usage looks like this:
tsCapsFilters_t tsInfo; // struct full of junk
if(getTsInfo(nameOfNetIf, &tsInfo, errMsgBuf, ERR_BUF_SZ) < 0) {
// handle errors in here
}
printf("%x\n", tsInfo.soTimestamping); // struct filled out by getTsInfo
However, the mistake I made was that I forgot to copy tx_types and rx_filters from the ethtool_ts_info struct (internal to my function) to the tsCapsFilters_t struct (given to the user). So my program got all the fields just fine, but it only returned the so_timestamping capabilities when it was supposed to return all 3 values.
printf("%x\n", tsInfo.soTimestamping); // printed the expected values
printf("%x\n", tsInfo.txTypes); // printed junk
printf("%x\n", tsInfo.rxFilters); // printed junk
Like I said, embarrassing. I'll award the bounty and be more careful with my structs in the future.
| How does the Linux Kernel store hardware TX and RX filter modes? |
1,451,799,439,000 |
I am trying to figure out how to disable bounce buffers used in IOMMU when the hardware IOMMU is used.
To give more context, when IOMMU_DEFAULT_DMA_STRICT is set in the kernel it enables strict IOTLB invalidations on page unmap. Also, it uses an "additional layer of bounce-buffering".
Reference:
config IOMMU_DEFAULT_DMA_STRICT
bool "Translated - Strict"
help
Trusted devices use translation to restrict their access to only
DMA-mapped pages, with strict TLB invalidation on unmap. Equivalent
to passing "iommu.passthrough=0 iommu.strict=1" on the command line.
Untrusted devices always use this mode, with an additional layer of
bounce-buffering such that they cannot gain access to any unrelated
data within a mapped page.
According to the description, this feature enables both strict IOTLB invalidations and bounce-buffer for untrusted PCI devices.
My current understanding is this config option still uses hardware IOMMU and bounce-buffers together (please correct me if I am wrong).
I want a way to enable/disable only the bounce buffers in IOMMU to find the performance overhead involved.
In other words, I want to find the overhead of this "additional layer".
Please let me know if there is a way to enable/disable only the SW bounce buffers when hardware IOMMU is used.
What I tried so far:
I noticed there are kernel command line options such as iommu=soft and swiotlb={force | noforce}.
iommu=soft seems to be a replacement for the hardware IOMMU using software bounce-buffering (reference https://www.kernel.org/doc/Documentation/x86/x86_64/boot-options.txt) which is not what I want.
I want to enable/disable bounce-buffering when it's used as an "additional layer" for the hardware IOMMU.
swiotlb=force seems to be what I want as it forces all the IO operations through SW bounce buffers. However, it does not specify whether hardware IOMMU is still used or not.
It would be great if someone can confirm this.
If this is the case, to enable hardware IOMMU without SW bounce buffers I will use below kernel cmdline parameters:
intel_iommu=on iommu=force
To enable SW bounce buffers with HW IOMMU:
intel_iommu=on iommu=force swiotlb=force
|
I asked the kernel developers the same question and am posting the answer here if anyone else has the same question (relevant kernel mail thread).
There is no kernel boot option or config option to enable or disable IOMMU SW bounce buffers.
SW bounce buffers are internally enabled for any untrusted PCI device.
Linux kernel considers devices/interfaces with external-facing ports as untrusted (more accurate details can be found in kernel patches and kernel src itself, e.g. - https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/).
| How to disable/enable bounce-buffers in IOMMU? |
1,451,799,439,000 |
I'm using Ubuntu 20.04 LTS Server and re-complied whole kernel with my patches. Now at the stage of installing it, but when I runs sudo make install I'm seeing following error,
root@localhost:/home/linux-5.4# sudo make install
sh ./arch/x86/boot/install.sh 5.4.0 arch/x86/boot/bzImage \
System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.4.0 /boot/vmlinuz-5.4.0
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.4.0 /boot/vmlinuz-5.4.0
update-initramfs: Generating /boot/initrd.img-5.4.0
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
make[1]: *** [arch/x86/boot/Makefile:155: install] Error 1
make: *** [arch/x86/Makefile:293: install] Error 2
Here is how much space left on my server with df -i command,
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 114642 367 114275 1% /dev
tmpfs 125596 500 125096 1% /run
/dev/sda 1568000 271637 1296363 18% /
tmpfs 125596 4 125592 1% /dev/shm
tmpfs 125596 3 125593 1% /run/lock
tmpfs 125596 18 125578 1% /sys/fs/cgroup
df-h output,
Filesystem Size Used Avail Use% Mounted on
udev 448M 0 448M 0% /dev
tmpfs 99M 12M 87M 12% /run
/dev/sda 25G 22G 2.2G 92% /
tmpfs 491M 0 491M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 491M 0 491M 0% /sys/fs/cgroup
It's worth noting that df-h was long list of file names before and now it print correctly.
|
I went with installing Kernel first then ran make clean, then proceed with installing Modules. This approach saves the needed space.
| Error 24 : Write error : cannot write compressed block |
1,451,799,439,000 |
My situation is virtually the same as this post on serverfault. To summarize:
I have a really simple C++ app that uses a hash-map to count and merge a number of large files. I reserve memory with with std::unordered_map::reserve() before filling it and start iterating. At about 60Gb of memory used (the system has 378Gb) the process starts swapping and the rate of hash insertions degrades into nothingness.
A barebones Gist of the program is here.
Some notes:
swapoff -a completely fixes the issue
swappiness is set to 1
Better hashmap implementations (like martinus/robin-hood-hashing) do not solve the issue.
Everything is compiled as 64bit, the only options to gcc are -std=c++11 -fopenmp -O3
The program is using 1 thread at this step
High I/O load on the server seems to worsen the issue
More info
file output for the executable:
../script/jelly_union: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=65917c99ec9480c1dfb859f10920fce15a8fefc1, not stripped
uname -a:
Linux picea 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
CPU info (last core):
processor : 63
vendor_id : AuthenticAMD
cpu family : 21
model : 1
model name : AMD Opteron(tm) Processor 6282 SE
stepping : 2
microcode : 0x600063e
cpu MHz : 1156.138
cache size : 2048 KB
physical id : 3
siblings : 16
core id : 7
cpu cores : 8
apicid : 143
initial apicid : 111
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb cpb hw_pstate ssbd ibpb vmmcall arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold
bugs : fxsave_leak sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass
bogomips : 5187.19
TLB size : 1536 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb
|
I'm not certain what is the modern C++ way of doing it, but you might want to look into mlock(2) to disable swapping for memory pages.
I'm also somewhat curious as to what happens if you rerun it immediately. I would expect the reserve call you use do not actually touch all memory pages (and thus do not force them to be actually allocated) - if that was the case, what you start seeing after a while would be the system struggling to actually provide the memory you've asked for in the first place, not swapping it (you should be able to disprove this by looking at the resident size).
| Large memory allocations cause kernel to swap even though more than enough memory is free |
1,451,799,439,000 |
I am following this document
I struggle to wrap my head around file descriptors and how I could read data from one, process it and then send to another.
As a server I need to be able to accept connections, receive data, process it and then pass it to another client.
I have been introduced to epolling yesterday and I want to know if my strategy is correct for creating a client-server network.
One epollfd is created. I specify it to be edge-triggered (EPOLLET) and non-blocking (set with: flags |= 0_NONBLOCK and fctnl(epollfd, F_SETFL, flags).
My intention is to now create an array of networkfds (client sockets) and listen for connection/messages.
Get notified about new data
Read data
Process data
Write some data to another socket.
All the examples I found in linux man and online only offer information about how to read data from sockets and I am afraid my design is dumb and due to failure if I try to have many clients practically communicating to many clients at the same time.
I decided to ask here because I read that NGINX (the web server is using epolling)
Can anyone help?
EDIT 1: I am intending to have (many) sockets in a list (struct epoll_event *events) and access them via epoll_wait().
// If I understand correctly:
int ndfs = epoll_wait(epollfd, events, MAX_EVENTS, -1);
// Puts some events in the <events> array and an int in ndfs
nfds should now contain the number of available fds in events which one can iterate through with a for loop. That's what I understand from the manual.
Once I receive a message from one of them, I would like to be able to process it (i.e read it's contents and take a decision) and eventually trigger a write to another socket.
I do all of this to AVOID multithreading. Is this achievable?
|
Ok, guys. I have come to a conclusion for my question: it depends.
It depends on the application. I studied some benchmarks for epoll only/multithread only/ epoll with worker threads.
I concluded that I will use epoll with worker threads for my project because that makes the most sense: epoll_wait is the fastest fd checker/selector when an fd is available for read/write, but the actual job (decoding / analyzing and handling the data have to be done concurrently (i.e, with threads)
| Communication between two file descriptors (clients) |
1,451,799,439,000 |
I have olddevice mounted to /mnt with:
$ mount olddevice /mnt
I would like to change the device at /mnt mount point. For this purpose, I simply mount newdevice on top of it:
$ mount newdevice /mnt
With that, processes that still have file descriptors on olddevice can keeps working on old device, but new processes using /mnt will use newdevice.
I can detect when olddevice is not used anymore and decide to unmount it.
My problem is how to unmount it:
$ umount olddevice
umount: olddevice: umount failed: Invalid argument.
Is it possible to directly unmount it? Or is it mandatory to unmount newdevice first (I do not want that) ?
|
If you are not already running with mount propagation enabled e.g. as per systemd defaults, run this first:
mount --make-rshared /
Then:
mkdir /root.orig
mount --rbind / /root.orig
mount --make-rprivate /root.orig/mnt
mount newdevice /mnt
...
umount -R /root.orig/mnt # instead of umount olddevice
Then safely disassemble the magic - taking care not to unmount your entire system:
mount --make-rprivate /root.orig
umount -l /root.orig
rmdir /root.orig
Usually, I like to use the recursive variants of mount / umount commands. You say you started with only one filesystem mounted underneath /mnt. In the above sequence, I used umount -R /root.orig/mnt. If there was also a filesystem mounted on a subdirectory of /mnt, this umount -R command might fail half-way through. I.e. because there are no open files on the submount, but there are still some open files on the main mount. IMO this feels similar to how umount -l works. umount -l /path disassembles and detaches a mount tree, and each independent filesystem is shut down as soon as it has no open files.
| How to unmount device from a path hidden by another mounted device? |
1,451,799,439,000 |
I am using kernel 4.14.24 from kernel.org on a KARO-TX6Q and an ADV7182 on a custom board.
With the kernel 4.1.15 from KARO git, I used the adv7180_tvin driver modified to work with adv7182. This driver does not use the media_controller system and directly creates a /dev/videoX entry.
Since a new software update, the 4.1.15 kernel is too old. I need to use the 4.14.24 kernel from kernel.org.
In kernel.org adv7180_tvin does not exist and I have to use the media_controller binding system.
Kernel opts :
CONFIG_MEDIA_CONTROLLER=y
CONFIG_VIDEO_V4L2_SUBDEV_API=y
CONFIG_VIDEO_MUX=y
CONFIG_VIDEO_CODA=y
CONFIG_VIDEO_MEM2MEM_DEINTERLACE=y
CONFIG_VIDEO_SH_VEU=y
CONFIG_VIDEO_ADV7180=m
CONFIG_IMX_IPUV3_CORE=y
CONFIG_IMX_HAVE_PLATFORM_IPU_CORE=y
Boot log :
[ 3.468290] imx-media capture-subsystem: Media device initialized
[ 3.474664] imx-media capture-subsystem: imx_media_add_async_subdev: added port, match type FWNODE
[ 3.483815] imx-media capture-subsystem: imx_media_add_async_subdev: added ipu1_csi0_mux, match type FWNODE
[ 3.493779] imx-media capture-subsystem: imx_media_add_async_subdev: added camera, match type FWNODE
[ 3.503180] imx-media capture-subsystem: imx_media_add_async_subdev: added port, match type FWNODE
[ 3.512311] imx-media capture-subsystem: imx_media_add_async_subdev: added port, match type FWNODE
[ 3.521454] imx-media capture-subsystem: imx_media_add_async_subdev: added port, match type FWNODE
[ 3.530520] imx-media capture-subsystem: imx_media_add_async_subdev: added ipu2_csi1_mux, match type FWNODE
[ 3.541128] imx-media capture-subsystem: imx_media_add_async_subdev: added imx-ipuv3-vdic.2, match type DEVNAME
[ 3.551657] imx-media capture-subsystem: imx_media_add_async_subdev: added imx-ipuv3-ic.3, match type DEVNAME
[ 3.561998] imx-media capture-subsystem: imx_media_add_async_subdev: added imx-ipuv3-ic.4, match type DEVNAME
[ 3.572307] imx-media capture-subsystem: imx_media_add_async_subdev: added imx-ipuv3-ic.5, match type DEVNAME
[ 3.582649] imx-media capture-subsystem: imx_media_add_async_subdev: added imx-ipuv3-vdic.8, match type DEVNAME
[ 3.593245] imx-media capture-subsystem: imx_media_add_async_subdev: added imx-ipuv3-ic.9, match type DEVNAME
[ 3.603684] imx-media capture-subsystem: imx_media_add_async_subdev: added imx-ipuv3-ic.10, match type DEVNAME
[ 3.603994] imx-media capture-subsystem: imx_media_add_async_subdev: added imx-ipuv3-ic.11, match type DEVNAME
[ 3.604921] imx-media: Registered subdev ipu1_vdic
[ 3.605717] imx-media: Registered subdev ipu2_vdic
[ 3.606199] imx-media: Registered subdev ipu1_ic_prp
[ 3.606447] imx-media: Registered subdev ipu1_ic_prpenc
[ 3.608277] imx-media: Registered subdev ipu1_ic_prpvf
[ 3.609036] imx-media: Registered subdev ipu2_ic_prp
[ 3.609254] imx-media: Registered subdev ipu2_ic_prpenc
[ 3.610069] imx-media: Registered subdev ipu2_ic_prpvf
[ 3.611536] imx-media: Registered subdev ipu1_csi0
[ 3.612867] imx-media: Registered subdev ipu1_csi1
[ 3.821930] imx-media: Registered subdev ipu1_csi0_mux
[ 3.822390] imx-media: Registered subdev ipu2_csi1_mux
[ 14.911115] imx-media: Registered subdev adv7180 1-0020
[ 14.931374] imx-media capture-subsystem: Entity type for entity adv7180 1-0020 was not initialized!
DTB file :
&i2c2 {
pinctrl-names = "default", "gpio";
pinctrl-0 = <&pinctrl_i2c2>;
pinctrl-1 = <&pinctrl_i2c2_gpio>;
scl-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>;
sda-gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;
clock-frequency = <100000>;
status = "okay";
adv7182: camera@20 {
compatible = "adi,adv7182";
pinctrl-names = "default";
/* pinctrl-0 = <&pinctrl_adv7182>; */
reg = <0x20>;
powerdown-gpios = <&gpio3 17 GPIO_ACTIVE_LOW>;
interrupt-parent = <&gpio1>;
interrupts = <27 IRQ_TYPE_LEVEL_LOW>;
port {
adv7182_to_ipu1_csi0_mux: endpoint {
remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>;
bus-width = <8>;
};
};
};
};
&ipu1_csi0_from_ipu1_csi0_mux {
bus-width = <8>;
};
&ipu1_csi0_mux_from_parallel_sensor {
remote-endpoint = <&adv7182_to_ipu1_csi0_mux>;
bus-width = <8>;
};
&ipu1_csi0 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ipu1_csi0>;
};
pinctrl_ipu1_csi0: ipu1_csi0grp {
fsl,pins = <
MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x10
MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC 0x10
MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC 0x10
MX6QDL_PAD_DISP0_DAT12__IPU1_DISP0_DATA12 0x10
MX6QDL_PAD_DISP0_DAT13__IPU1_DISP0_DATA13 0x10
MX6QDL_PAD_DISP0_DAT14__IPU1_DISP0_DATA14 0x10
MX6QDL_PAD_DISP0_DAT15__IPU1_DISP0_DATA15 0x10
MX6QDL_PAD_DISP0_DAT16__IPU1_DISP0_DATA16 0x10
MX6QDL_PAD_DISP0_DAT17__IPU1_DISP0_DATA17 0x10
MX6QDL_PAD_DISP0_DAT18__IPU1_DISP0_DATA18 0x10
MX6QDL_PAD_DISP0_DAT19__IPU1_DISP0_DATA19 0x10
>;
};
There is no /dev/media0 file.
How can I debug?
Thanks
Edit :
This line is never called because list_empty(¬ifier->waiting) is always false. drivers/media/v4l2-core/v4l2-async.c @126
if (list_empty(¬ifier->waiting) && notifier->complete)
return notifier->complete(notifier); // <-- this line
|
The media controller needs to have both two IPU activated.
Solved by adding in dts :
&ipu2 {
status = "okay";
};
| IMX6 ADV7180 : no /dev/media0 |
1,451,799,439,000 |
In linux kernel source, some header files and directories are located directly at /include, but some others are located at /include/linux. Why they just don't put everything into /include? What is the difference between /include and /include/linux?
|
But not only linux/, also uapi/ and asm-generic/ are special dirs inside of include. This generic "include" dir is heterogenous -- include/linux is the kernel itself: half of the 40MB of include/.
K&R "C" notes at the end of the chapter: "...for a much larger program more organization and more headers would be needed".
So from the beginning, also with medium size projects, it is all about organization. This is also reflected by the <.h> and ".h"syntax, and the compiler rules for including. Also by the #ifndef... #define "protection", which is applied systematically. Linux kernel has much more organization.
I think I finally found a working example:
kernel/sched/ by itself has small to medium dimensions. It has 8 header files, one of them sched.h which begins:
/*
* Scheduler internal types and methods:
*/
#include <linux/sched.h>
...
This "local" sched.h only contains low level stuff.
This included include/linux/sched.h begins:
#ifndef _LINUX_SCHED_H
#define _LINUX_SCHED_H
/*
* Define 'struct task_struct' and provide the main scheduler
* APIs (schedule(), wakeup variants, etc.)
*/
#include <uapi/linux/sched.h>
#include <asm/current.h>
#include <linux/pid.h>
...
All this is actually very well documented and laid out.
The "uapi" include defines CLONE_ flags and SCHED_ policies (e.g. RR=2): for "export"/use by programs.
asm/current.h is low level to access the current task.
linux/pid.h as sibling is just as elementary as linux/sched.h.
--> include/linux/ is the main central container for global "kernel" header files.
The other dirs -- the big rest -- in include/ are partly for "importing" definitions i.e. integrating hardware. They belong more to drivers/ than to kernel/ or mm/ or fs/.
include/sound/ is also interesting. sound/sound_core.c has:
/*
* First, the common part.
*/
#include <linux/module.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/kdev_t.h>
#include <linux/major.h>
#include <sound/core.h>
So it needs (linux-, kernel-) modules, errors and devices, plus it's own "Main header file for the ALSA driver devices...(1994-2001)" sound/core.h.
| /include vs /include/linux in kernel source tree |
1,451,799,439,000 |
I am running tar in the background, eg:
tar xfvz large_file.tar.gz &
It does extract my file, but when I then launch du -h, du, df or df -h, the output remains the same, and I have to wait few minutes for it to refresh.
Is there any workaround? That's not really a problem, I am asking this for my own Unix culture about du & df & so on.
|
Probably the data has not actually been written to disk yet but is still in the page cache ("dirty pages"). Check with
grep Dirty /proc/meminfo
You can try to run sync before df/du. That should force any data in the page cache to be written to disk.
| Why are du -h / du / df / df -h not refreshing when extracting a large file |
1,451,799,439,000 |
command
rpm -qa | grep kernel
output
kernel-3.10.0-514.16.1.el7.x86_64
kernel-tools-libs-3.10.0-514.16.1.el7.x86_64
kernel-headers-3.10.0-862.9.1.el7.x86_64
kernel-devel-3.10.0-862.9.1.el7.x86_64
kernel-tools-3.10.0-514.16.1.el7.x86_64
command
uname -r
output
3.10.0-514.16.1.el7.x86_64
trying to install matching devel:
sudo yum install http://vault.centos.org/7.3.1611/updates/x86_64/Packages/kernel-devel-3.10.0-514.16.1.el7.x86_64.rpm
I get:
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/scripts/rt-tester/rt-tester.pyo from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/scripts/selinux/genheaders/genheaders from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/scripts/selinux/mdp/mdp from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/scripts/sortextable from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/scripts/sortextable.c from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/scripts/sortextable.h from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/scripts/tags.sh from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/scripts/tracing/draw_functrace.pyc from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/scripts/tracing/draw_functrace.pyo from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/scripts/unifdef from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/tools/build/Makefile.feature from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/tools/build/Makefile.include from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/tools/scripts/Makefile.include from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/tools/objtool/objtool from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/tools/perf/Makefile.perf from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/tools/scripts/Makefile.arch from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/vmlinux.id from install of kernel-devel-3.10.0-514.16.1.el7.x86_64 conflicts with file from package kernel-devel-3.10.0-862.9.1.el7.x86_64
Error Summary
This is our production server. How do I safely resolve this?
If I run
sudo yum install kernel-headers
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
Package kernel-headers-3.10.0-862.9.1.el7.x86_64 already installed and latest version
Nothing to do
sudo yum install kernel-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
Package kernel-devel-3.10.0-862.9.1.el7.x86_64 already installed and latest version
Nothing to do
|
To install Kernel devels run:
yum install kernel-devel-3.10.0-514.16.1.el7.x86_64 OR yum install kernel-devel-$(uname -r)
To install Kernel headers run:
yum install kernel-headers-3.10.0-514.16.1.el7.x86_64 OR yum install kernel-headers-$(uname -r)
| kernel headers and kernel devel |
1,451,799,439,000 |
Folks, there's something I fail to understand:
I've got a laptop with 4 GB of RAM, running a 32 bit, PAE-enabled Linux kernel. The system is powered by an AMD APU with integrated graphics which, as far as I can tell, takes its graphics memory from system memory.
Now, in my dmesg, I see this:
Memory: 3574156K/3638392K available
And it looks sensible: If we take into account that 4 GB are there and that about 512 MB out of these are probably taken for the GPU, then 3638392K look sane. The math probably doesn't work out completely, but close enough to suggest that this assumption is right.
Can I prove that the GPU is taking 512 MB? Probably: I've got this line in dmesg:
radeon 0000:00:01.0: VRAM: 512M 0x0000000000000000 - 0x000000001FFFFFFF (512M used)
and assuming that VRAM doesn't have to be dedicated extra memory (which I'm very confident is not present in the machine), the GPU did probably indeed take itself these 512 MB out of system memory.
So far, so good, I guess I can follow along. But now have a look at these lines, also from dmesg:
3700MB HIGHMEM available.
891MB LOWMEM available.
Wow, that sums up to 4591 MB. Now, taking into account that 4 GB are all that should be there with no extra VRAM or such, how can HIGHMEM + LOWMEM have such a huge value? I would have assumed that these two values added together would equal the total amount of memory in the system, but it's entirely possible that I'm assuming something here which just is not true. Probably something that is not "really"memory in the sense that I have in mind, like some device mapped memory, is also counted in LOWMEM and / or HIGHMEM?
I don't really have a clue, but would be more than happy if someone could probably shed some light into this for me.
Oh, and for reference, I've got a complete dmesg output from the machine I'm talking about up at
http://ftp.tisys.org/pub/misc/teela_dmesg.txt
Thank you all in advance! :-)
|
I knew I had read about this years abog, but I had to take a trip on the wayback machine to find this: https://web.archive.org/web/20130513093456/http://kerneltrap.org/node/2450
Not sure if it directly answers your question, but it might help. I barely grok some of it myself.
| Linux kernel: LOWMEM + HIGHMEM > Total memory? |
1,451,799,439,000 |
Main question: How to get the absolute finger position on the touchpad?
I would like to get the absolute position (x, y coordinates) of a finger on a touchpad? I believe it is possible to extract it from the synaptics-family source code.
Subquestion: How to get the synaptics.h header?
I am trying to get synaptics.h so that I have access to the SynapticsHwState struct which allows to get the coordinates of a finger touching a touchpad.
This is what I've done so far:
I found out that I need to download linux headers, so I ran:
sudo apt-get install linux-headers-`uname -r`
The I found the header in /usr/src/linux-headers-3.16.0-4-686-pae/include/config/mouse/ps2/synaptics.h it was EMPTY however.
It turns out that headers in the include/config path are usually empty files due to some kernel building optimisations.
I'm stuck. I don't know how to get this header.
Here is a link which might be helpful to answer my question. I don't understand much from what is written there however. I've tried to run make headers_install from /usr/src/linux-headers-3.16.0-4-686-pae but I got an error.
My distribution is BunsenLabs i386 Linux (a successor of CrunchBang, Debian based) with a 3.16.0-4-686-pae kernel.
|
I didn't manage to get the synaptics.h header however I found the way to get the position (x y coordinates) of a finger on a touchpad.
The software is called evtest and the source code can be found here for example. There is a single evtest.c file and it is quite easy to modify it and extract the absolute finger position.
After all, I needed the synaptics.h only to get the coordinates. Hence I'll mark this question as solved.
| How to get the absolute position (x, y coordinates) of a finger on a touchpad? |
1,451,799,439,000 |
When a physical interface status is changed from up to down, there are 3 things related to the computer's current routing table and OSPF.
The (connected) network for that interface and remote networks that are routed via that (connected) network are removed from the computer's routing table.
OSPF neighbors on that (connected) network are removed from the OSPF's neighbors table.
Remote networks that are routed via that (connected) network are removed from the OSPF's routing table.
My question is how do the kernel inform OSPF daemon when a physical interface status is down? It seems like it is a mandatory for the kernel to keep informing the OSPF daemon some information like physical interface status.
|
Depending on operating system -- via routing socket (BSD family) or netlink socket (Linux). Very brief overview of available kernel interfaces is in GNU Quagga's documentation.
| How do kernel inform OSPF daemon when a physical interface status is down? |
1,352,768,351,000 |
I got a Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz CPU here , not sure which module should be enabled for EDAC:
Chipset: Inter Coporation 6 Series/C2000 , driver in use: i801_smbus
|
The right answer is Sandy Bridge, after digging a bit in Intel's site.
| Which edac module should I enable here? |
1,352,768,351,000 |
I am trying to use PCI-X1 capture card (intensiy pro) using Ubuntu 10.04 (now) / 11.04 (failed) or Fedora (failed). None of them is yet capturing. I did my best but now i need some backup on this.
Question: Do you know what is causing my capture/input as "Frame received (#0) - No input signal detected"? Where i have another Playstation 3 connected in the input interface.
Please find details, that i followed:
Step 1: Drivers [OK]
$ uname -a
Linux sun-desktop 2.6.32-33-generic #70-Ubuntu SMP Thu Jul 7 21:13:52 UTC 2011 x86_64 GNU/Linux
$ lspci | grep magic
03:00.0 Multimedia video controller: magic Design Device a117
$ lsmod | grep magic
magic 441567 1
$ magicFirmwareUpdater status
magic0 [Intensity Pro] 0x1e OK
$ ll /dev/magic/card0
crw-rw-rw- 1 root video 10, 55 2011-09-24 10:48 /dev/magic/card0
Step 2: Output test [OK]
Step 3: Input test [FAILED]
A) Failed (while trying to capture)
$ ./Capture -m2 -n 1
Frame received (#0) - No input signal detected
Stopping Capture
|
Your PS3 is probably putting out an HDCP-protected video signal. The HDMI licensing authority requires that lossless conversion and transmission products like the BlackMagic Intensity refuse to work unless the downstream element also obeys HDCP. Since this test program doesn't have an HDCP key and your hard disk isn't offering to provide secure HDCP-protected storage, the BlackMagic card has to refuse to provide the raw frames if they want to keep their HDMI license.
The easiest way I can think of to test this is to burn a DVD of a movie you made yourself, using software that lets you turn off the copyright flag. When playing that back, the PS3 should send it out the HDMI port without HDCP protection. If the Blackmagic card starts letting you capture frames, you know it's an HDCP issue.
If you look around online, you may be able to find information about splitting the HDMI into separate DVI and digital audio signals, then recombining them, but I couldn't help you there. I live in the US, where it is currently illegal to even point to such information.
| How to capture from instensive pro in Ubuntu, Fedora, CentOS using HDMI interface? |
1,352,768,351,000 |
I was trying to bring up my custom kernel. I did the following :
$ make menuconfig && make modules && make modules_install && make install
I would like to change the install PATH. How can i do that?
I tried doing
$ export INSTALL_PATH=<my custom path>
But then it is only creating vmlinux.bin (it is not creating the ramdisk image!)
But if I don't do that, make install will automatically create the ramdisk image in the default /boot folder.
How can i change that?
|
Yup, I found where is that install path.
It is inside /sbin. The script file name is installkernel.
Just need to make a couple of changes in there and i could change the default install path of my Linux source(which was /boot).
| How to change the install path of my Linux Source tree? |
1,352,768,351,000 |
I have some doubts about setting the policy of a thread and how that policy is going to be followed while it is executing. Pthread allows setting the scheduling policy of a thread to SCHED_FIFO/SCHED_RR/SCHED_OTHER. I am trying to understand how this user-set-policy works as the Linux kernel uses CFS as the default scheduler policy. Will the user-set-policy is going to be overriden to CFS when it is executing? If so , what is the use of pthread schedling policy?
|
A/ BASIC THEORY 3: CFS is not the default "scheduler policy" under Linux. CFS is the default scheduler under linux.
A scheduler chooses among all existing threads those to which cpu time should be granted.
This choice is governed by miscellaneous parameters that are taken into account differently depending on the scheduling policy of the threads.
All threads get a scheduling policy.
Default scheduling policy under CFS is known as : SCHED_OTHER also sometimes labeled SCHED_NORMAL.
This policy actually instructs the scheduler to take the nice value into account and ensure fairness among all threads running under this policy.
B/ RUN TIME : 1 Every tick (or whatever dedicated interrupt) the scheduler maintains (reorders) a list (a queue) of runable threads according to their associated scheduling policy and other parameters depending on that policy.
When the reordering is over, the thread on the top of the queue will be the one elected.
Threads belonging to "real-time" policies (SCHED_RR / SCHED_FIFO) (if any in a runable situation) will always be at the top of the list. Order, among them, being governed by the real-time priority setting.
C: YOUR QUESTION : If, in these conditions, you change the scheduling policy of some given thread (more precisely : if some running thread issue a system call requesting the change of it's scheduling policy 2) then, provided it gets the rights to do so, the scheduler will reorder its queue accordingly.
If, for example, some SCHED_OTHER thread changes to SCHED_RR, it will enter the top of the list, the scheduler will ignore it's nice value and order it, among other SCHED_RR threads according to its given realtime priority.
BTW, if that was part of your questioning :
The scheduler never decides / forces the scheduling policy of threads.
The scheduler never changes depending on scheduling policies. If CFS has been chosen at boot time, CFS will always be THE scheduler.
One can always opt for other schedulers, some consisting in CFS patches, others written from scratch, each of them claiming lesser overhead / better handling of nice values / more efficient handling of the SCHED_RR scheduling policy / more efficient when MAX_CORES <= 4, etc. But whatever scheduler you boot with, will be kept as the only program scheduling threads until shudown.
In any case, the scheduler adapts its behaviour according to scheduling policies afforded to threads by (most of the time) their parent and, more rarely by themself.
1 : This shall be considered in a single core environment.
It could be extended to whatever SMP / SMP + HT environment at the cost of extra complexity for the understanding because of the possibility to share (or not) queues between cores and to allow threads to run on all / some specific set of available cores.
2 : The family of system calls to use will depend on the API used.
sched_setscheduler() as the standard way, pthread_setschedparam() when using the POSIX API. (function names differ but results (the impact on CFS) are identical)
3 : For a detailed description of each available scheduling policy, please refer to the sched(7) Linux manual page (man sched.7), which, I make no doubt about it, is the most trustable/reputable source you are looking for.
| Scheduling policy of a POSIX thread Vs kernel's Completely Fair Scheduler when the thread is actually executing |
1,492,192,042,000 |
Kernel EFI stub loader support was added in kernel 3.3, but I'm stuck on 3.2 running an Ubuntu 12.04 64bit distribution. Is there a way for me to somehow bring that stub loader support into my kernel?
|
I ended up simply installing a later kernel. You'd be surprised how easy this is. Simply searching packages.ubuntu.com for kernel packages allowed me to find the packages I needed. I needed to install essentially linux-image-3.X.*, linux-image-extra-3.X.*, and linux-headers-3.X.*. Posting from a nice, shiny EFI-booting Linux.
| Installing the kernel EFI stub loader in kernel 3.2? |
1,492,192,042,000 |
I have successfully built both libfreenect (driver for Xbox Kinect) and libusb (which is a dependency).
However, if I try to open the Kinect using the freenect_init(...) function, it returns -99.
I tracked down the error to the funtion libusb_init(...) which is returning this error, LIBUSB_ERROR_OTHER.
As I use a minified custom kernel configuration (version: 2.6.37) I think I missed to enable an important config option.
Kernel config is available on pastebin.com.
The Kinect gets successfully recognized (reported in dmesg including correct product/vendor information).
Does anyone has an idea how to get rid of this error?
UPDATE:
After setting the LIBUSB_DEBUG environment variable to 3 I got the following message:
[op_init] could not find usbfs
|
libusb requires that the VFS usbfs is mounted. After adding the following line to /etc/fstab the problem was solved:
usbfs /proc/bus/usb usbfs defaults 0 0
| libusb_init() returns -99 |
1,492,192,042,000 |
I can't seem to shutdown my machine from mandriva,I have to restart to shut it down from GRUB
it says "System Halted" and just freezes there
I'm using the x86_64 GNOME version
I've already asked on mandriva forums and they couldn't determine the cause of this problem
P.S. I'm using the 2.6.36.2-desktop-2mnb kernel
|
It turns out that the cause of the problem was ACPI,it was switched off
turning it back on solved the problem :)
just in case somebody has a similar issue
| Can't shutdown mandriva 2010.2 |
1,492,192,042,000 |
Reading one of Stephen's excellent replies, I was wondering what differences are between
When the operating system shuts down. ...
and
When the kernel shuts down, ... (... I’m considering that the variant which uses an external command to shut down isn’t the kernel)
?
Is "the variant which uses an external command to shut down" "when the OS shuts down" or "when the kernel shuts down"?
What does "I’m considering that the variant which uses an external command to shut down isn’t the kernel" mean in other words?
Does system call reboot() reboot the OS or kernel?
Does command reboot reboot the OS but not the kernel?
Thanks.
|
He seems to be noting a difference between the kernel itself, and the rest of the operating system, the user-space constructs built on top of the kernel.
When you shut down the system with /sbin/reboot or equivalent (which in turn calls systemd or some init scripts or something), it does more than just ask the kernel to shut down. The user-space tools are the ones that do almost all the cleanup, like unmounting filesystems, sending SIGTERM to other processes ask them to shut down, etc.
If, instead, you go and call the reboot() system call as root directly, then none of that cleanup happens, the kernel just does what it's told to do and shuts down right away (possibly restarting or powering down the machine). The man page notes that reboot() doesn't even do the equivalent of sync(), so it doesn't even do the kinds of cleanup that could be done within the kernel (where the filesystem drivers and I/O buffers reside.)
As an example from the man page:
LINUX_REBOOT_CMD_RESTART
(RB_AUTOBOOT, 0x1234567). The message "Restarting system." is
printed, and a default restart is performed immediately. If
not preceded by a sync(2), data will be lost.
So,
Does system call reboot() reboot the OS or kernel?
It asks the kernel to shut down or reboot, the OS goes down with it.
Does command reboot reboot the OS but not the kernel?
It asks user-space processes to shut down, does other cleanup, and only then asks the kernel to shut down or reboot.
The reboot() system call has a mode (LINUX_REBOOT_CMD_RESTART2) that is described as "using a command string". However, it doesn't mean a user-mode command, but one internal to the kernel, and one that isn't even used on x86.
Note that while we're considering the distinction between the kernel and the OS-on-top-of-the-kernel, you could in principle reboot just the OS but keep the kernel running. You'd need to clean up everything set up by the userspace and kill other userspace processes, then restart init to bring everything back up again instead of asking the kernel to reboot. That might not be very useful though, and it would be hard to reliably reset all state left in the kernel (you'd need to manually reset all network interfaces, clean up iptables rules, reset RAID and loop devices, etc. etc. There's a good chance of missing something that might then bite back afterwards.)
| What is the difference between "when the operating system shuts down" and "when the kernel shuts down"? |
1,492,192,042,000 |
Currently I am playing with the idea of a jvm running in the kernel space, as a (maybe linux) kernel module. I see a lot of advantage of the idea.
Of course the biggest advantage of a such system were the major simplification of the kernel space development. But it happened because different aspects:
1) every java developer with a relative minor lowlevel knowledge were able to develop a kernel module. Yes, it is't surelly a good possibility :-), especially if we see the current code quality of most opensource java userspace projects, but... there isn't a need to happen the same in the kernelspace as well.
2) (And it is the really intended goal): a JVM could solve the greatest problem of the kernel development, and it is the lack of the memory protection. A binary code segment compiled from java never caused any harm to data structures out of its scope, if there isn't another problem (f.e. jit compiler error or lowlevel hw problem), although the runtime safety checks of a such binary code caused a well measurable drawback in speed.
First, it doesn't need to be a java bytecode interpreter as well. A JIT (just in time compiler) could exist on the system user space, mapping only the compiled binary files (practically: kernel modules) in the kernel space. Only the namespace manager and the garbage collector need to run in kernel space.
Second, it doesn't need to be big, slow and monstrous. It is because the big, ineffectively used libraries in the case of the userspace jvms, and there is no ground for the same in case of, for example, a driver written in java.
The only fallback which I can see were with the realtime functionality. Of course it were much harder to do with java, because we have much fewer control on the minor details of the memory management.
What about I am curious, if a such project already exists (?#1), and are there any visible major fallbacks about this if not (?#2).
|
I think this would be a very big project, since you would need a JVM implementation written in C with custom parts using the kernel API. The openjdk hotspot is apparently 250K+ LOC in C and C++. Note you cannot use C++ with the linux kernel.
Methinks that could work out to a number of person-years to implement. It's very unlikely you could then get it included in the official source tree, but that is not such a big deal.
Considering that scale in relation to what you refer to as "the biggest advantage":
Of course the biggest advantage of a such system were the major simplification of the kernel space development.
I'm not sure what you mean by this. For people who can code in Java but not C, I suppose this is obviously true. But if you mean in a general sense, I don't see how that would be so. I'm comfortable with both C and Java and don't have a strong preference for one over the other (context, or someone else, tends to make this decision for me). Perhaps Java is slightly easier to use since, e.g., you don't need to do MM (but is MM really that difficult?), etc. -- but IMO it can also seem more awkward and restricted.
Personally, I would not consider this a worthwhile pursuit, but that does not mean I think it is impossible, or a bad idea. Your major hurdle will be finding other people to contribute.
| Porting jvm into the kernel space? |
1,492,192,042,000 |
If not, what do they use. Please provide a source.
|
Some of the OpenSolaris 10 source code is publicly available, and yes, kmem uses a slab allocator in that release. See kmem.c, the comments describe the allocator in some detail.
(Illumos uses the same allocator.)
Looking at the Debugging With the Kernel Memory Allocator pages from the Oracle Solaris Modular Debugger Guide for Solaris 11 (Express), there is no reason to believe that the allocator changed substantially in that release.
| Do Solaris 10 and 11 still use slab allocation for their kernel memory allocator |
1,561,650,454,000 |
I'm reading through the documentation for Linux Wireless Extensions, linked in a related question.
It says:
/proc/net/wireless is designed to give some wireless specific
statistics on each wireless interface in the system. This entry is in
fact a clone of /proc/net/dev which gives the standard driver
statistics.
The formats of these two files is completely different:
/proc/net/dev:
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 13094103 37388 0 0 0 0 0 0 13094103 37388 0 0 0 0 0 0
eth0: 539566809 524165 0 0 0 0 0 0 47595494 365161 0 0 0 0 0 0
tunl0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
gre0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ip6tnl0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
wlan1: 41003557 351105 0 49935 0 0 0 0 525781104 475280 0 35 0 0 0 0
tun0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
/proc/net/wireless:
Inter-| sta-| Quality | Discarded packets | Missed | WE
face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
wlan1: 0000 21. -66. -256. 0 0 0 0 0 0
Does this mean that the values in /proc/net/wireless are generated by doing arithmetic on the values for wlan1 in /proc/net/dev?
|
This entry is in fact a clone of /proc/net/dev which gives the standard driver statistics.
is an over-simplification. The comment in the code implementing /proc/net/wireless is more accurate:
This interface is a pure clone of /proc/net/dev (in net/core/dev.c).
The content of the file is basically the content of "struct iw_statistics".
The interface is a clone, i.e. the look: columns, with a header using pipe separators. But the content is completely different (and you can’t calculate it from /proc/net/dev).
| How is /proc/net/wireless a "clone" of /proc/net/dev? |
1,561,650,454,000 |
I am about to install a patch for wireless drivers named Compat Wireless in order to solve a problem with my WiFi channel (it locks on the not existing -1 channel) on my Ubuntu Linux v12.04 and Kali Linux v1.0.9.
But first I would like to know if this patch is already installed (why installing something I do have?).
I have done some research about, and I can not find a way to know if my patch is already there, nor a generic method to list installed patches. I don't even know if it is possible or not to obtain such info from a running Linux.
Any ideas, please?
|
Has a patch already been applied to my Linux kernel?
If one is comfortable enough with Linux to be applying a patch, as this questioner appears to be, then checking if the patch is already in the default kernel is relatively simple: Just check the source code.
Use the Source, Luke!¹
The following should work for any distribution derived from Debian GNU/Linux, which includes what the questioner asked for, Ubuntu:
apt source linux
That will download the Linux source and patch it to be exactly the same state as the distribution used when they compiled it. In the linux-x.y.z directory are the file(s) mentioned in the patch. Just look at the line numbers and make sure that the lines with minus signs aren't there and the ones with plus signs are. That's it.
More detailed answer
Patches are text files that look like this:
Signed-off-by: Alexey Brodkin <[email protected]>
---
drivers/usb/core/urb.c | 5 -----
1 file changed, 5 deletions(-)
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -321,9 +321,6 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb);
*/
int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
{
- static int pipetypes[4] = {
- PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT
- };
int xfertype, max;
struct usb_device *dev;
struct usb_host_endpoint *ep;
@@ -441,11 +438,6 @@ int usb_submit_urb(struct urb *urb, gfp_
* cause problems in HCDs if they get it wrong.
*/
- /* Check that the pipe's type matches the endpoint's type */
- if (usb_pipetype(urb->pipe) != pipetypes[xfertype])
- dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n",
- usb_pipetype(urb->pipe), pipetypes[xfertype]);
-
/* Check against a simple/standard policy */
allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK |
URB_FREE_BUFFER);
Usually, one uses the patch program to apply patchfiles to the source code before compiling, but for this question, it might not be worth the bother. One can quickly just eyeball a patchfile and see the filename and the line numbers at the top and then open a text editor there (in this example, emacs +321 drivers/usb/core/urb.c). A quick glance is all it takes to know. (Minus signs mark lines that should be deleted and plus signs, added).
But, maybe it's a good idea to run patch
On the other hand, if one plans on recompiling Linux, it's not a bad idea to start from the distribution's default kernel. In that case, there's no reason not to try running patch. The program is smart enough to recognize if the patch was already applied and ask the operator if maybe they want to reverse it.
Example of running patch (previously unpatched)
Here is an example of what it looks like on a patch that was not in the default kernel:
$ patch -p1 < foo.patch
patching file drivers/usb/core/urb.c
Hunk #1 succeeded at 323 (offset 2 lines).
Hunk #2 succeeded at 440 (offset 2 lines).
If it succeeds, the distribution's default wasn't patched and needs to be recompiled. Fortunately, the Linux source code is now conveniently right there, with the patch applied.
Example of running patch (previously patched)
And here is what it would look like if the distribution's default kernel had already been patched:
$ patch -p1 < foo.patch
patching file drivers/usb/core/urb.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file drivers/usb/core/urb.c.rej
"Reversed or previously applied" means nothing more needs to be done as the default kernel was already patched.
Footnote ¹ Sorry for the bad pun, but don't blame me for it; that was the encouragement I was taught long, long ago by UNIX gurus wise in the ways of the Source. They said that when the Source is with you, you become more powerful than any proprietary vendor could ever imagine.
| How can I check if a certain patch is already installed in my system? |
1,561,650,454,000 |
So if n processes are sharing a library L with size M then the contribution to their PSS is M/n.
Now imagine one of the process terminates. So the contribution would be M/(n-1).
Q1: My question is how soon is this change reflected in the PSS values of processes still running and using the shared library?
Q2: As a trivial case suppose only two processes are using a shared lib L of size 100K. PSS contribution to each process is 50K. Now when P2 dies it is the only process using L. So its PSS should increase and become 100K. How soon will this happen, as soon as P2 dies, or after some time? After how much time?
|
The change is reflected immediately. There is no caching along the way. When you read /proc/<pid>/smaps, you actually trigger a traversal of that process's page table. Information about the mappings is accumulated along the way, then displayed, without any caching.
The code behind the /proc/<pid>/smaps file is in fs/proc/task_mmu.c, specifically the show_smap function.
That function does a walk_page_range with smaps_pte_range as the PTE callback. smaps_pte_range itself accumulates the information in a struct mem_size_stats.
The part of that code responsible for PSS does:
mapcount = page_mapcount(page);
if (mapcount >= 2) {
if (pte_dirty(ptent) || PageDirty(page))
mss->shared_dirty += ptent_size;
else
mss->shared_clean += ptent_size;
mss->pss += (ptent_size << PSS_SHIFT) / mapcount;
} else {
if (pte_dirty(ptent) || PageDirty(page))
mss->private_dirty += ptent_size;
else
mss->private_clean += ptent_size;
mss->pss += (ptent_size << PSS_SHIFT);
}
(You can see here that pages can only be accounted in the Shared part if it is actually mapped more than once - it's accounted as private otherwise.)
page_mapcount is defined inline in linux/mm.h and simply accesses a struct page:
static inline int page_mapcount(struct page *page)
{
return atomic_read(&(page)->_mapcount) + 1;
}
So PSS is "always up to date".
| How often is PSS value updated for a given process in /proc/pid/smaps |
1,561,650,454,000 |
Let's say I have a file which I want to query on demand to check which process is currently accessing is (opened). Going through all PIDs in /proc/{PID}/fd seems resource intensive, Is there any alternative way to accomplish the same?
|
There are tools to do it for you: fuser (just outputs the PIDs) and lsof (lots of options and fancy output).
Going through all PIDs in /proc/{PID}/fd seems resource intensive
It's the only way anyway on Linux. There's no system call to query which processes have a file open. But don't do it yourself — if only because /proc/{PID}/fd is only about open files in the strict sense, and doesn't list other cases such as memory-mapped files, open directories, etc.
Note that this means you cannot know about processes running as other users¹ that might have the file open, even if you own the file, unless you do the lookup as root. (But if no other user can even see the file, and this has been true since the file was created or the system rebooted, you know there are no such processes.)
¹ More generally, processes that you don't have control over, which can include other cases such as processes running in a different namespace or with extra privileges.
| What is most efficient way to get the PID of the process that is using a file on Linux |
1,561,650,454,000 |
How can I manually create a Linux kernel module dependency?
For example, at some point in time module vboxdrv gets loaded automatically. BUT, when this happends I also want to automatically load module vfat (just as example).
Thus, how can I create a dependecy, when module 1 gets loaded, it triggers automatic load of module 2 ?
I do not need module loading at boot time with initramfs, I just want - so to say - this dependency, when 1 gets loaded, 2 will get loaded as well. You know what I mean ;-)
Thank you
|
You can add a configuration file /etc/modprobe.d/vboxdrv-includes-vfat.conf with a "soft dependency" command:
softdep vboxdrv post: vfat
The man page modprobe.d(5) documents the syntax:
softdep modulename pre: modules... post: modules...
The softdep command allows you to specify soft, or optional, module dependencies. modulename can be used without these optional modules installed, but usually with some features missing. For example, a driver for a storage HBA might require another module be loaded in order to use management features.
pre-deps and post-deps modules are lists of names and/or aliases of other modules that modprobe will attempt to install (or remove) in order before and after the main module given in the modulename argument
Alternatively, if softdep doesn't work as expected (e.g. if modprobe is too old to understand soft dependencies), you could use an install command in a file in the same directory to script the module insertion:
install modulename command...
This command instructs modprobe to run your command instead of inserting the module in the kernel as normal. The command can be any shell command: this allows you to do any kind of complex processing you might wish.
For example, if the module "fred" works better with the module "barney" already installed (but it doesn't depend on it, so modprobe won't automatically load it), you could say "install fred /sbin/modprobe barney; /sbin/modprobe --ignore-install fred", which would do what you wanted. Note the --ignore-install, which stops the second modprobe from running the same install command again. See also remove below.
The long term future of this command as a solution to the problem of providing additional module dependencies is not assured and it is intended to replace this command with a warning about its eventual removal or deprecation at some point in a future release
| Create Linux module dependency for autoloading module |
1,561,650,454,000 |
Say, I have custom kernel from my distribution, how could I get list of all options the kernel was build with?
It's possible to get them by reading config file from kernel package from vendor's repo, but is there any other way? I mean ways to get that information form the kernel itself, maybe from procfs?
|
In addition to what @Stephen Kitt said, at least on my Debian system you can find the information in:
/boot/config-<version>
Where version, in my case, is:
3.16.0-4-686-pae
So, issuing:
less /boot/config-3.16.0-4-686-pae
Spits out the kernel configs in a long list!
| How to determine the options Linux kernel was build with? [duplicate] |
1,561,650,454,000 |
Is there any way to cause a kernel panic under Linux? I've heard of
echo c > /proc/sysrq-trigger
but it seems to just freeze, and I'm not sure it's a kernel panic. Is there any C program I can run as root to cause a kernel panic?
|
using kill
I think you could try the following:
$ kill -6 1
This sends signal # 6 to process #1 (the init process). If you read up in the signals man page: "man 7 signals":
Signal Value Action Comment
-------------------------------------------------------------------------
SIGHUP 1 Term Hangup detected on controlling terminal
or death of controlling process
SIGINT 2 Term Interrupt from keyboard
SIGQUIT 3 Core Quit from keyboard
SIGILL 4 Core Illegal Instruction
SIGABRT 6 Core Abort signal from abort(3)
You can find out how a process wants to handle the various signals (cat /proc/$PID/status). See this U&L Q&A for more info: How can I check what signals a process is listening to?.
overflowing memory
Another method is to overflow memory to induce a kernel panic. First you'll need to disable swap.
$ swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 14352376 3177812 -1
$ swapoff /dev/mapper/VolGroup00-LogVol01
Now to consume all the memory:
$ for r in /dev/ram*; do cat /dev/zero > $r; done
References
How to force a Linux kernel panic
How can I check what signals a process is listening to?
| Intentional kernel panic under Linux? |
1,561,650,454,000 |
From my understanding, BIOS 1) initializes HW and 2) jumps to a location and loads a boot loader into RAM.
When the BIOS does the initialization of HW, it must be running some routines (i.e. setting proper register bits, delays, etc...).
The questions I'm asking is if those BIOS routines are:
Are BIOS routines called by Linux Kernel or do Linux Kernel drivers reimplement the necessary routines?
Also is BIOS written in Assembly or is it some Hardware-Defined Language?
|
It depends. In most cases, the kernel drives hardware directly, without going through the system firmware; but it does rely on firmware-provided functions in some cases (e.g. through ACPI).
The original PC BIOS was written in assembly language (the source code was included in IBM’s technical reference manuals). Current PC system firmware is mostly written in C, see TianoCore.
| Does the Linux Kernel access HW through BIOS, or does it directly interface with the HW? |
1,561,650,454,000 |
I am not an electrician, so I am not sure how to ask this, whether I need to refer to voltage, or watts, or something out.
In lamens terms, I am wondering how much electricity is currently being fed to my laptop through my charging adapter.
The reason why I want to know this is because sometimes my laptop internal battery is charging, and other times it is discharging while plugged in. I'd like to know what the values are at either point, and discover if this is something I can adjust with the kernel, to fix any issues that may be related to this.
Thanks.
|
There are several tools for checking the power status of your computer.
You can try installing upower if you haven't got it already. Then run:
upower -e
This will display the detected devices. Then run the information mode on the battery according to the device you have available:
upower -i /org/freedesktop/UPower/devices/battery_BAT0
This will give you the following information. You can look at the energy-rate
native-path: BAT0
vendor: SMP
model: DELL 1P6KD5A
serial: 2206
power supply: yes
updated: Mon 04 Jan 2021 11:56:02 PM CET (102 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: fully-charged
warning-level: none
energy: 38.5434 Wh
energy-empty: 0 Wh
energy-full: 38.5434 Wh
energy-full-design: 83.9952 Wh
energy-rate: 0.0114 W
voltage: 12.382 V
percentage: 100%
capacity: 45.8876%
technology: lithium-polymer
icon-name: 'battery-full-charged-symbolic'
| Find out how much electricity is being fed through my charging adapter? |
1,561,650,454,000 |
I am currently reading Linux Kernel Development by Robert Love.
In the chapter "15 The Process Address Space" he prints the memory map of a process.
user@machine:~$ pmap 1424
#all the processes mapped memory (skipped for readability)
bfffe000 (8KB) rwxp (0:00 0) [ stack ]
The last line shows the stack (as it grows down).
He now states:
The stack is, naturally, readable, writeable and executable - not of much use otherwise.
As far as I know we use the stack for data and code addresses (functions and their parameters/variable).
I do not understand why the stack must be executable?
|
That information is outdated, and the stack is typically not executable any more:
00007ffd884fa000 356K rw--- [ stack ]
GCC needs an executable stack if it generates trampolines for nested function calls. These trampolines are small pieces of code generated at runtime, and stored on the stack — so if they are used, the stack needs to be executable. The compiler keeps track of this requirement, and it outputs a flag in binaries (libraries and executables) to indicate whether they need an executable stack. You can see and manipulate the value of this flag using execstack(8).
| Why must the stack VMA be executable? |
1,561,650,454,000 |
I need to update the kernel from version 2.6.30 to 2.6.37. I'm going to just compile the kernel and kernel modules for this architecture and boot it. But also there are a lot of packages installed, and I would like to know if I have to update all of them also for the newer kernel, or can I update only some of them which I need, and keep old versions of other packages?(I'm asking since that computer doesn't have internet connection and I would have to do that manually). I know that kernel headers are backward compatible and so on but I'm still not sure.
|
2.6.37 is quite old, so you should really be asking yourself if that's what you want. The age also means that many people have probably forgotten how much change happened at that time (I know I have), but those versions are close enough, and both 2.6, so I guess there were no API/ABI-changes, and that means it should be safe to upgrade the kernel and nothing else. But I'm not promising anything.
| Updating kernel but not packages |
1,561,650,454,000 |
I know there are solution for not rebooting after kernel update:
https://en.wikipedia.org/wiki/Ksplice
But If Ksplice isn't installed, and the user doesn't reboots it's notebook after even several kernel updates (so notebook running for even months). Could there be a problem about it? (not counting that an update probably came because there was a bugfix or security fix)
|
It won't affect the kernel itself (besides not taking advantage of the update).
However, some newly installed programs might rely on newer kernel features.
Also, if you run a program that relies on loading a kernel module then you may find that that module is no longer installed, and newly installed modules won't load in the old kernel.
Basically, if there is a problem, you'll see it. Otherwise you're fine.
| Could it cause any problem if I not reboot after a kernel upgrade? |
1,561,650,454,000 |
We know a program is a process (ex: gedit, ssh....etc ).
How about kernel and driver?
are they individual processes?
ex:
A process running kernel code.
B process running driver foo.
|
In Unix-style contexts, some people think of the kernel as “process 0” (coming before process 1, init). However that’s not really accurate, notably because kernels aren’t scheduled in the same way as processes.
Unix-style kernels, in general, only run in response to some event. These events come under two or three major categories:
System calls: when a process calls a system call, the kernel is invoked; this happens in the context of the calling process, and doesn’t involve any other process.
Hardware interrupts: when hardware needs the attention of the main CPU, it issues a hardware interrupt, and the kernel is invoked to handle it. How this is accounted for varies from one operating system to another, but in most cases it the initial interrupt handling doesn’t involve any new process either.
Faults (which could be considered as a form of hardware interrupt): when something goes wrong, and the CPU needs the attention of a “responsible adult”, it issues a fault, and the kernel is invoked to handle it. This happens in the context of the faulting process. This can happen for example when a process accesses unmapped memory; if the process was allowed to do so, the kernel will map the missing memory, and return to the process; if it wasn’t, the kernel will kill the process.
Some kernels do use processes for part of their tasks; for example, Linux uses processes for long-running tasks. This includes device drivers, for long-running tasks, not all uses of device drivers. In most systems, device drivers aren’t separate from the kernel when they’re running; once loaded, they become part of the kernel.
See also How does the Linux kernel knows which process made a system call?
Note that all the above assumes a typical Unix-style large kernel; microkernels take a different approach, and many parts of what is commonly considered the kernel’s responsibility are handled by processes. See the Hurd for example.
| kernel code is a dedicated process running? |
1,561,650,454,000 |
Containers share the machine’s OS system kernel
https://www.docker.com/resources/what-container/
If container's share the machine's OS system kernel, is it true that there isn't a kernel included in Docker base images of Linux like Debian or Alpine? Can the rootfs builds used in these base images be used in environments other than Docker?
The Dockerfile of Alpine Linux shows an example,
FROM scratch
ADD alpine-minirootfs-3.14.6-x86_64.tar.gz /
CMD ["/bin/sh"]
Are these builds of Linux assuming anything specific to Docker about the kernel?
|
is it true that there isn't a kernel included in Docker base images of Linux like Debian or Alpine?
That's typically true. As your reference to alpine shows, they are based on the mini root filesystem which do not contain a kernel.
Can the rootfs builds used in these base images be used in environments other than Docker?
Obviously they can be directly used in other container environments like podman. And the filesystem they contain can also be used elsewhere.
Taking Alpine as an example, as you show in your question, the docker image is nothing more than the contents of the alpine-minirootfs-<version>.tar.gz file. If you downloaded that file from here and untared it you could immediately chroot into the directory to use it as a temporary environment.
wget https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/x86_64/alpine-minirootfs-3.15.4-x86_64.tar.gz
mkdir foo
cd foo
tar -xf alpine-minirootfs-3.15.4-x86_64.tar.gz
chroot . /bin/sh
Note chroot does not setup all of the isolations such as networking isolation that docker does
Docker itself packages things in layers so to use a docker image outside of a container environment, like docker or podman, you would need to manually collect the layers back together into one directory tree.
| Can the Linux base images for Docker containers be used in environments other than Docker? |
1,561,650,454,000 |
on our rhel machine ( production server ) we noticed that lastlog is huge
we not want to interrupt the OS logs that always wrote to log
but we want to clear the lastlog
is it ok to clear the lastlog as
echo > /var/log/lastlog
second
how is it possible to disable writing to lastlog as permanent?
|
Lastlog does not report its size correctly in ls and is often not very large at all. If you are checking its size make sure to either run ls -s or use du.
I believe lastlog is what is called a sparse file. ls without the -s flag is reporting the apparent size of the file instead of the actual size.
Most likely you do not need to clear lastlog or be concerned with how much it is being written to at all.
| how to clear the lastlog file without interruption |
1,561,650,454,000 |
I've gone to upgrade my machine as I do every day and I've received the following errors:
$ sudo apt-get update && sudo apt-get upgrade
Hit:1 http://ftp.uk.debian.org/debian buster InRelease
Hit:2 http://security.debian.org/debian-security buster/updates InRelease
Hit:3 http://ftp.uk.debian.org/debian buster-updates InRelease
Hit:4 https://updates.signal.org/desktop/apt xenial InRelease
Hit:5 https://packagecloud.io/AtomEditor/atom/any any InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up linux-image-4.19.0-8-amd64 (4.19.98-1+deb10u1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.19.0-8-amd64
pigz: abort: write error on <stdout> (No space left on device)
E: mkinitramfs failure cpio 141 pigz 28
update-initramfs: failed for /boot/initrd.img-4.19.0-8-amd64 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-4.19.0-8-amd64 (--configure):
installed linux-image-4.19.0-8-amd64 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.19.0-8-amd64
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
I believe the following line might be the cause of the issue, but I'm unsure how to fix:
pigz: abort: write error on <stdout> (No space left on device)
System info
$ uname -a
Linux debian 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64 GNU/Linux
$ ls -la /boot/
drwxr-xr-x 5 root root 1024 Apr 29 08:54 .
drwxr-xr-x 22 root root 4096 Feb 11 05:39 ..
-rw-r--r-- 1 root root 206361 Nov 11 00:30 config-4.19.0-6-amd64
-rw-r--r-- 1 root root 206194 Apr 27 06:05 config-4.19.0-8-amd64
-rw-r--r-- 1 root root 186598 Sep 20 2019 config-4.9.0-11-amd64
drwx------ 3 root root 4096 Jan 1 1970 efi
drwxr-xr-x 5 root root 1024 Feb 11 05:39 grub
-rw-r--r-- 1 root root 62662464 Feb 9 19:01 initrd.img-4.19.0-6-amd64
-rw-r--r-- 1 root root 62708576 Feb 11 05:39 initrd.img-4.19.0-8-amd64
-rw-r--r-- 1 root root 47360778 Oct 25 2019 initrd.img-4.9.0-11-amd64
drwx------ 2 root root 12288 Jan 27 2019 lost+found
-rw-r--r-- 1 root root 3410671 Nov 11 00:30 System.map-4.19.0-6-amd64
-rw-r--r-- 1 root root 3408461 Apr 27 06:05 System.map-4.19.0-8-amd64
-rw-r--r-- 1 root root 3203475 Sep 20 2019 System.map-4.9.0-11-amd64
-rw-r--r-- 1 root root 5270768 Nov 11 00:30 vmlinuz-4.19.0-6-amd64
-rw-r--r-- 1 root root 5274864 Apr 27 06:05 vmlinuz-4.19.0-8-amd64
-rw-r--r-- 1 root root 4249376 Sep 20 2019 vmlinuz-4.9.0-11-amd64
$ sudo dpkg -l | grep linux-image
ii linux-image-4.19.0-6-amd64 4.19.67-2+deb10u2 amd64 Linux 4.19 for 64-bit PCs (signed)
iF linux-image-4.19.0-8-amd64 4.19.98-1+deb10u1 amd64 Linux 4.19 for 64-bit PCs (signed)
ii linux-image-4.9.0-11-amd64 4.9.189-3+deb9u1 amd64 Linux 4.9 for 64-bit PCs
ii linux-image-amd64 4.19+105+deb10u3 amd64 Linux for 64-bit PCs (meta-package)
$ sudo cat /var/log/dpkg.log
2020-04-29 08:54:32 startup packages configure
2020-04-29 08:54:32 configure linux-image-4.19.0-8-amd64:amd64 4.19.98-1+deb10u1 <none>
2020-04-29 08:54:32 status half-configured linux-image-4.19.0-8-amd64:amd64 4.19.98-1+deb10u1
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 3987600 0 3987600 0% /dev
tmpfs 804084 9672 794412 2% /run
/dev/mapper/debian--vg-root 220799920 117407476 92106736 57% /
tmpfs 4020420 165216 3855204 5% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 4020420 0 4020420 0% /sys/fs/cgroup
/dev/sdb1 114854440 84891720 24085372 78% /mnt/Extended
/dev/sda2 241965 208213 21260 91% /boot
/dev/sda1 523248 5220 518028 1% /boot/efi
tmpfs 804084 20 804064 1% /run/user/1000
/dev/sdd2 15006688 41004 14183656 1% /media/squire/GENERAL
|
You can free up some space by deleting the 4.9 kernel:
sudo apt purge linux-image-4.9.0-11-amd64
| Errors when trying to upgrade Linux kernel |
1,561,650,454,000 |
Suppose I have 10 process such as :
process p0 with PID 1.
process p1 with PID 2.
process p2 with PID 3.
process p3 with PID 4.
process p4 with PID 5.
process p5 with PID 6.
process p6 with PID 7.
process p7 with PID 8.
process p8 with PID 9.
process p9 with PID 10.
When I kill a process, such as :
kill 7
and process p6 is killed successfully, between process p5 and p7 is empty, when I run p10 as a process, kernel assigns PID 11 to p10.
Question is why kernel (linux and freebsd) assigns a incremental PID instead of assigning PID 7 to process p11?
|
PIDs aren’t reused as soon as they’re freed because doing so results in races, and ultimately, bugs which can sometimes be used to evade security restrictions (see these examples of Android security bugs caused by PID races).
If PIDs are reused, then processes which hold a PID for whatever reason (e.g., to send a signal to some other process) might not realise immediately that the process they intend to communicate with has exited. Once the PID is recycled, it’s difficult to reliably detect that the process using it has changed. Delaying this reuse makes races less likely (albeit not impossible). Other approaches include raising the maximum PID (as done e.g. on Fedora — see /proc/sys/kernel/pid_max), but again that only reduces the likelihood.
The Linux kernel recently added pidfds to provide a reliable way of reasoning about processes and their PIDs.
| PID and incremental aproach |
1,561,650,454,000 |
I wanted to migrate to CentOS 7.5 from CentOS 6.9. during installation I saw an option kdump that i could enable or disable. I wonder what is kdump and disabling it has any bad effect on server? I want to install database on my server later I just want to make sure that kdump cause no problem.
|
kdump is a kernel crash dumping mechanism. In the event of a system crash, kdump produces a crash dump of the kernel that can be used for further analysis. Depending upon the severity of the failure, this crash dump may be the only information available for further analysis.
In the event of a system crash, kdump works by loading a second kernel into memory using the kexec system call. This second kernel captures the contents of the first kernel's memory. This information is saved as the crash dump.
To allow the second kernel to be loaded into memory, a part of the system memory has to be permanently reserved for it. This area of memory is inaccessible to the first kernel. The amount of memory reserved depends on the system architecture and the total amount of memory installed on the system. As an example, a system with the x86_64 architecture and 2 GiB of installed memory will require a minimum amount of 163968 KiB (160.25 MiB) to be reserved for kdump.
RHEL 7 (and CentOS 7, by extension) have the kdump mechanism installed and activated by default for (most) new installations. The Anaconda installer provides limited options for configuring kdump. Other installation options such as Kickstart may not have kdump enabled by default.
Further details on kdump (installation, configuration, usage) can be found at the RHEL 7 Documentation on Kernel Administration: Kernel Crash Dump Guide
| kdump in CentOS 7 |
1,561,650,454,000 |
In my journal I see the following a few times a day:
kernel: wlp2s0: failed to remove key (1, ff:ff:ff:ff:ff:ff) from hardware (-22)
lspci reports:
02:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)
My kernel version is 4.14.15-1-MANJARO.
|
Kernel Bug 198357 - iwlwifi: failed to remove key (1, ff:ff:ff:ff:ff:ff) from hardware (-22) lists the issue as:
CLOSED CODE_FIX
Kernel Version: 4.15.0-rc6-00048-ge1915c8195b3
Regression: Yes
My hope is that this will be made available to earlier maintained kernel versions in the near future.
| kernel: wlp2s0: failed to remove key (1, ff:ff:ff:ff:ff:ff) from hardware (-22) |
1,561,650,454,000 |
I read through the docs of man proc. When it comes to the overcommit_memory, the heuristics in overcommit_memory=0 isn't understood well. What the heuristics actually mean?
does "calls of mmap(2) with MAP_NORESERVE are not checked" mean that the Kernel only allocate virtual memory without being aware of even the existence of swap space?
This file contains the kernel virtual memory accounting mode. Values are:
0: heuristic overcommit (this is the default)
1: always overcommit, never check
2: always check, never overcommit
In mode 0, calls of mmap(2) with MAP_NORESERVE are not checked, and the default check is very weak, leading to the risk
of getting a process "OOM-killed".
Apart from preceding questions, will exhaustion of the virtual address space cause the OOM regardless of the enough remaining physical memory.
Thanks.
|
The overcommit_memory setting is taken into account in three places in the memory-management subsystem.
The main one is __vm_enough_memory in mm/util.c, which decides whether enough memory is available to allow a memory allocation to proceed (note that this is a utility function which isn’t necessarily invoked). If overcommit_memory is 1, this function always succeeds. If it’s 2, it checks the actual available memory. If it’s 0, it uses the famous heuristic which you mention; that proceeds as follows:
count the number of free pages
add the number of file-backed pages (these can be recovered)
remove pages used for shared memory
add swap pages
add reclaimable pages
account for reserved pages
leave some memory for root (if the allocation isn’t being done by a cap_sys_admin process)
The resulting total is used as the threshold for memory allocations.
mmap also checks the setting: MAP_NORESERVE is honoured if overcommit is allowed (modes 0 and 1), and results in allocations with no backing swap (VM_NORESERVE). In this particular case, mode 0 is effectively equivalent to mode 1; this is what “calls of mmap(2) with MAP_NORESERVE are not checked” is referring to: it means that MAP_NORESERVE mmap calls will always succeed, and over-allocation will result in the OOM-killer stepping in after the fact, or a segment violation when a write is attempted.
shmem has similar behaviour to mmap.
Running out of address space should cause allocation failures, not OOM-kills, since the allocation can’t actually proceed.
| What does heuristics in Overcommit_memory =0 mean? |
1,561,650,454,000 |
What if boot like this:
Pass INIT=/bin/sh(or /bin/bash) parameter to kernel, through GRUB command line or similar ways, then boot;
Once shell is loaded, exit immediately. Then the computer has no response to any key pressed.
I am quite curious about the STATUS of the system at this moment. As I have learned that init is the first process which would be executed once kernel is loaded and other processes are all forked from it, it seems that when execute /bin/sh as described above instead of init with normal boot procedure, then system has no processes any more and nothing to do.
Is it idle like running
while (1) {
sleep(1);
}
or what else?
Thanks all of you for your advices. Maybe more information is helpful, which I used to think as unnecessary.
I worked on a CentOS 7.2 server recently, and one XFS disk partition is not normal that it cost endless time doing check and recover when system booted. I planed to edit /etc/fstab to turn off auto mounting of this partition. As normal boot procedure was stuck, I used init=/bin/bash to make system boot into bash. After edit fstab, I executed shell exit carelessly, then no response on screen to any key pressed including Ctrl-Alt-Del, and no information prompted kernel panic(I could not tell whether CPU was hard working because that room was very noisy). I regarded it as idle as just nothing to do. This phenomenon made me think about the question I wrote down at beginning.
And I made some tests tonight, on my own notebook computer with Debian 8. Kernal panic obviously.
|
I'm surprised. My understanding was that terminating PID 1 causes a kernel panic. I can tell you what happened in that case.
Panic behaviour is configurable. With the default options, you will reach a loop that looks exactly as you say.
The delay function used is documented as being a "busy-wait". It is not expected to enter the power-saving CPU sleep states used when the OS idles normally.
If you look at the backtrace printed by the panic, I think you see this all happens within sys_exit(). I think technically PID 1 doesn't get destroyed, it just never returns from making that system call. Any other CPUs are stopped first.
(There is something called a "boot idle thread". I don't see it involved in this process. AFAICT you can never see this thread. And if you wanted to understand it as an idle thread, you'd also have to ask what provides the idle thread for the other cpus once they are brought online).
| Is system totally idle if boot with INIT=/bin/sh kernel parameter then quit immediately from shell? |
1,561,650,454,000 |
Is it possible to umount the partition, whose files/directories are in use?
The underlying files and directories are in memory so un-mounting the partition is technically safe (I guess).
But umount is not allowing me to un-mount it.
(Who is denying this operation: umount or kernel?)
|
You can do a "lazy unmount".
A lazy unmount makes the filesystem unavailable to any new processes that are launched, but any processes which are currently using it will be able to continue using it. Then once those processes which are currently using it are finished, the filesystem will unmount.
To do this, it's simply:
umount -l /mount/point
| Un-mount active partition |
1,561,650,454,000 |
I see that
$ du -h /boot/initrd-2.6.37.6-0.5-pae
3.9M /boot/initrd-2.6.37.6-0.5-pae
$ du -h /boot/vmlinuz-2.6.37.6-0.5-pae
4.1M /boot/vmlinuz-2.6.37.6-0.5-pae
$ du -sh /boot
17M /boot
So why does the "kernel-default" package on SUSE Studio come with 114MB?
|
The main reason for the 114MB (openSUSE 12.1's kernel-default-3.1.0-1.2.1.x86_64.rpm (34MB)) is that the kernel modules that are included with the RPM are collectively quite large.
From the extracted RPM, as an example:
$ du -sh lib/modules/3.1.0-1.2-default/kernel/*
1.3M lib/modules/3.1.0-1.2-default/kernel/arch
1004K lib/modules/3.1.0-1.2-default/kernel/crypto
60K lib/modules/3.1.0-1.2-default/kernel/Documentation
101M lib/modules/3.1.0-1.2-default/kernel/drivers
13M lib/modules/3.1.0-1.2-default/kernel/fs
32K lib/modules/3.1.0-1.2-default/kernel/kernel
252K lib/modules/3.1.0-1.2-default/kernel/lib
16K lib/modules/3.1.0-1.2-default/kernel/mm
12M lib/modules/3.1.0-1.2-default/kernel/net
72K lib/modules/3.1.0-1.2-default/kernel/security
9.2M lib/modules/3.1.0-1.2-default/kernel/sound
This shows there is approximately 101MB of drivers (which is essentially hardware enablement modules (USB, network cards, storage devices etc).
All kernels for modern distributions are going to have similar sized packages unless they split less common modules into sub-packages.
| Why is kernel-default 114MB on SUSE Studio? |
1,561,650,454,000 |
Using lshw to query my WiFi USB adapter shows the following:
$ lshw -C network
*-network
description: Wireless interface
physical id: 12
bus info: usb@3:7
logical name: ...
serial: ...
capabilities: ethernet physical wireless
configuration: broadcast=yes driver=rtw_8822bu driverversion=6.5.0-28-generic firmware=N/A ip=... link=yes multicast=yes wireless=IEEE 802.11
The adapter works fine. However, I am confused by driver=rtw_8822bu. As far as I can tell there is no kernel model called rtw_8822bu.ko on my system, instead, I have rtw88_8822bu.ko,
/usr/lib/modules/6.5.0-28-generic/kernel/drivers/net/wireless/realtek/rtw88/rtw88_8822bu.ko
which also shows up using lsmod:
$ lsmod | grep rtw
rtw88_8822bu 12288 0
rtw88_usb 24576 1 rtw88_8822bu
rtw88_8822b 229376 1 rtw88_8822bu
rtw88_core 356352 2 rtw88_usb,rtw88_8822b
mac80211 1720320 3 rtw88_core,rtw88_usb,rtl8xxxu
cfg80211 1323008 3 rtw88_core,mac80211,rtl8xxxu
Question: Why does lshw show driver=rtw_8822bu when the kernel module in the system is named rtw88_8822bu. Where is the former name coming from?
|
A module is a library containing functions that can be loaded into the kernel.
When writing a module, you can define a C data structure that defines the name of a driver, and the functions to be called to check whether there's a device that can be handled by the driver, which function to call when the device gets unplugged, among other things.
You then put a macro in there that registers that data structure as a representation of a "driver". So, "driver" is really just an idea that encompasses a name, and a couple of functions to call in specific situations (such as when you want to set up or tear down the device's functionality).
So, here's your driver's data structure:
static struct usb_driver rtw_8822bu_driver = {
.name = "rtw_8822bu",
.id_table = rtw_8822bu_id_table,
.probe = rtw8822bu_probe,
.disconnect = rtw_usb_disconnect,
};
See the `.name = ' in there? That is where the name of the driver is defined.
Here's how it gets registered as driver within a module:
module_usb_driver(rtw_8822bu_driver);
You can have as many of these driver in a single module as you want, provided each of them has a different name. And there's no reason that the name of the module needs to be the same as the name of the driver. You could have a module called drivers_for_webcams.ko and it could contain realtek_ssd_controller_driver1 through realtek_ssd_controller_driver98, and nothing would be wrong; the assumption that driver name == module name is simply wrong.
| What is the difference between driver name and kernel module name for lshw? |
1,561,650,454,000 |
How is nanosleep implemented on x86 Linux?
The description states:
nanosleep() suspends the execution of the calling thread until either at least the time specified in *req has elapsed, or the delivery of a signal that triggers the invocation of a handler in the calling thread or that terminates the process.
Let's say I want to sleep for n nanoseconds.
My initial assumption would be that execution is suspended with HLT. This suspends until the next 'external interrupt'. So, I will need to schedule an interrupt.
How can I schedule an interrupt for n nanoseconds from now?
How will my processor know to interrupt at that point -- e.g. will it check each cycle? If it checks each cycle, how is this any less resource-intensive than simply busy waiting with a loop?
|
In Linux, nanosleep relies on high-resolution timers. The main sleep loop loops over
put the current task to sleep
start a timer
reschedule
as long as there’s no pending signal and the timer hasn’t expired (t->task becomes NULL when the timer expires), restarting if necessary (when a signal is handled before the timer expires).
The high-resolution timer provides the interrupt. Execution isn’t suspended using a CPU instruction such as HLT, because there are probably other tasks waiting to run while the task calling nanosleep sleeps.
| How is POSIX nanosleep implemented on x86 Linux? |
1,636,111,100,000 |
I post here what I wrote, with no yet luck, to the VirtualBox forum at https://forums.virtualbox.org/viewtopic.php?f=7&t=104377&p=508627#p508627 .
I installed the newest kernel 5.15.0 on my Linux Mint 19.3 (Ubuntu 18,04) equipped with the latest VirtualBox release.
Starting any VM I get this error:
Kernel driver not installed (rc=-1908)
The VirtualBox Linux kernel driver is either not loaded or not set up correctly. Please try setting it up again by executing
'/sbin/vboxconfig'
as root.
If your system has EFI Secure Boot enabled you may also need to sign the kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load them. Please see your Linux system's documentation for more information.
where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT.
So I ran /sbin/vboxconfig:
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: failed: Look at /var/log/vbox-setup.log to find out what went wrong.
There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root. If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
The log file contains:
Error building the module:
make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/5.15.0-051500-generic/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j8 modules
make[1]: warning: -jN forced in submake: disabling jobserver mode.
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
You are using: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
make -f ./scripts/Makefile.build obj=/tmp/vbox.0 \
single-build= \
need-builtin=1 need-modorder=1
gcc -Wp,-MMD,/tmp/vbox.0/linux/.SUPDrv-linux.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -fsanitize=bounds -fsanitize-undefined-trap-on-error -DMODULE -DKBUILD_BASENAME='"SUPDrv_linux"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/linux/SUPDrv-linux.o /tmp/vbox.0/linux/SUPDrv-linux.c
gcc -Wp,-MMD,/tmp/vbox.0/.SUPDrv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -fsanitize=bounds -fsanitize-undefined-trap-on-error -DMODULE -DKBUILD_BASENAME='"SUPDrv"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/SUPDrv.o /tmp/vbox.0/SUPDrv.c
gcc -Wp,-MMD,/tmp/vbox.0/.SUPDrvGip.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -fsanitize=bounds -fsanitize-undefined-trap-on-error -DMODULE -DKBUILD_BASENAME='"SUPDrvGip"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/SUPDrvGip.o /tmp/vbox.0/SUPDrvGip.c
gcc -Wp,-MMD,/tmp/vbox.0/.SUPDrvSem.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -fsanitize=bounds -fsanitize-undefined-trap-on-error -DMODULE -DKBUILD_BASENAME='"SUPDrvSem"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/SUPDrvSem.o /tmp/vbox.0/SUPDrvSem.c
gcc -Wp,-MMD,/tmp/vbox.0/.SUPDrvTracer.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -fsanitize=bounds -fsanitize-undefined-trap-on-error -DMODULE -DKBUILD_BASENAME='"SUPDrvTracer"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/SUPDrvTracer.o /tmp/vbox.0/SUPDrvTracer.c
gcc -Wp,-MMD,/tmp/vbox.0/.SUPLibAll.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -fsanitize=bounds -fsanitize-undefined-trap-on-error -DMODULE -DKBUILD_BASENAME='"SUPLibAll"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/SUPLibAll.o /tmp/vbox.0/SUPLibAll.c
gcc -Wp,-MMD,/tmp/vbox.0/r0drv/.initterm-r0drv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -fsanitize=bounds -fsanitize-undefined-trap-on-error -DMODULE -DKBUILD_BASENAME='"initterm_r0drv"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/r0drv/initterm-r0drv.o /tmp/vbox.0/r0drv/initterm-r0drv.c
gcc -Wp,-MMD,/tmp/vbox.0/r0drv/.alloc-r0drv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -fsanitize=bounds -fsanitize-undefined-trap-on-error -DMODULE -DKBUILD_BASENAME='"alloc_r0drv"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/r0drv/alloc-r0drv.o /tmp/vbox.0/r0drv/alloc-r0drv.c
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
scripts/Makefile.build:277: recipe for target '/tmp/vbox.0/SUPLibAll.o' failed
make[2]: *** [/tmp/vbox.0/SUPLibAll.o] Error 1
make[2]: *** Deleting file '/tmp/vbox.0/SUPLibAll.o'
make[2]: *** Waiting for unfinished jobs....
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
scripts/Makefile.build:277: recipe for target '/tmp/vbox.0/SUPDrvSem.o' failed
make[2]: *** [/tmp/vbox.0/SUPDrvSem.o] Error 1
make[2]: *** Deleting file '/tmp/vbox.0/SUPDrvSem.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
scripts/Makefile.build:277: recipe for target '/tmp/vbox.0/r0drv/initterm-r0drv.o' failed
make[2]: *** [/tmp/vbox.0/r0drv/initterm-r0drv.o] Error 1
make[2]: *** Deleting file '/tmp/vbox.0/r0drv/initterm-r0drv.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
scripts/Makefile.build:277: recipe for target '/tmp/vbox.0/r0drv/alloc-r0drv.o' failed
make[2]: *** [/tmp/vbox.0/r0drv/alloc-r0drv.o] Error 1
make[2]: *** Deleting file '/tmp/vbox.0/r0drv/alloc-r0drv.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
scripts/Makefile.build:277: recipe for target '/tmp/vbox.0/linux/SUPDrv-linux.o' failed
make[2]: *** [/tmp/vbox.0/linux/SUPDrv-linux.o] Error 1
make[2]: *** Deleting file '/tmp/vbox.0/linux/SUPDrv-linux.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
scripts/Makefile.build:277: recipe for target '/tmp/vbox.0/SUPDrvTracer.o' failed
make[2]: *** [/tmp/vbox.0/SUPDrvTracer.o] Error 1
make[2]: *** Deleting file '/tmp/vbox.0/SUPDrvTracer.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
scripts/Makefile.build:277: recipe for target '/tmp/vbox.0/SUPDrvGip.o' failed
make[2]: *** [/tmp/vbox.0/SUPDrvGip.o] Error 1
make[2]: *** Deleting file '/tmp/vbox.0/SUPDrvGip.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
scripts/Makefile.build:277: recipe for target '/tmp/vbox.0/SUPDrv.o' failed
make[2]: *** [/tmp/vbox.0/SUPDrv.o] Error 1
make[2]: *** Deleting file '/tmp/vbox.0/SUPDrv.o'
Makefile:1874: recipe for target '/tmp/vbox.0' failed
make[1]: *** [/tmp/vbox.0] Error 2
/tmp/vbox.0/Makefile-footer.gmk:117: recipe for target 'vboxdrv' failed
make: *** [vboxdrv] Error 2
Then I ran it again, and I got a different error message:
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
linux-headers-generic linux-headers-5.15.0-051500-generic
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
linux-headers-generic linux-headers-5.15.0-051500-generic
There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root. If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
How can I solve this?
Regards!
Edit
I download the missing headers and when I try to install it by dpg I get this error:
Selecting previously unselected package linux-headers-5.15.0-051500-generic.
(Reading database ... 831861 files and directories currently installed.)
Preparing to unpack .../linux-headers-5.15.0-051500-generic_5.15.0-051500.202110312130_amd64.deb ...
Unpacking linux-headers-5.15.0-051500-generic (5.15.0-051500.202110312130) ...
dpkg: dependency problems prevent configuration of linux-headers-5.15.0-051500-generic:
linux-headers-5.15.0-051500-generic depends on libc6 (>= 2.34); however:
Version of libc6:amd64 on system is 2.27-3ubuntu1.4.
dpkg: error processing package linux-headers-5.15.0-051500-generic (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
linux-headers-5.15.0-051500-generic
Why?
|
Oracle VirtualBox aims to support whatever was the newest released Linux kernel at the time a particular version of VirtualBox was released.
Linux kernel 5.15.0 was released on 2021-10-31.
VirtualBox 6.1.28 (the current version) was released on 2021-10-19.
Since kernel 5.15.0 did not exist yet when VirtualBox 6.1.28 was released, there are no guarantees that the VirtualBox drivers can be built successfully or work with kernel 5.15.0.
You're also using a kernel package built with a compiler version that is different from what your Mint 19.3 has. This may also cause problems when trying to build the VirtualBox drivers for your kernel.
For a third reason, the corresponding linux-headers package for your 5.15.0 kernel was obviously built for some other distribution, because it depends on a different version of libc6. Trying to update the distribution's default version of libc6 with a third-party one is very much not recommended unless you really know what you are doing.
An error in libc6 upgrade has the potential to "break everything": it can make effectively all dynamically linked executables (i.e. more than 99% of all executables) unusable.
If you need a newer libc6 for whatever you're doing, you probably should update to a newer version of your Linux distribution instead. In other words, you should seriously think about updating to Mint 20.2 first instead of trying to bolt a bleeding-edge kernel and a newer libc6 onto Mint 19.3.
And if you need VirtualBox, even with Mint 20.2, stick with kernel versions 5.14.x or less until the next maintenance release of VirtualBox (probably 6.1.30) comes out, unless you really want to participate in VirtualBox development.
You would first need to upgrade from Mint 19.3 to 20, then upgrade from Mint 20 to 20.2.
| VirtualBox: "Kernel driver not installed" on Kernel 5.15.0 |
1,636,111,100,000 |
I found this in my kernel logs:
kernel: r8169 0000:02:00.0: can't disable ASPM; OS doesn't have ASPM
control
What does it mean and how should I fix it?
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.04
Release: 21.04
Codename: hirsute
|
ASPM is the Active State Power Management of PCI Express. It governs things like switching the PCIE link to a low-power mode whenever there is no data to transfer. It can be controlled by the ACPI firmware, or by the operating system.
When the system is booting up, the firmware initially controls "everything". As the kernel of an ACPI-aware operating system starts up, the firmware offers it a list of features the firmware can hand over to be controlled by the OS.
In your case, the firmware did not offer ASPM control to the OS, for reasons only the system/motherboard vendor's engineers might know for sure.
It might be because the hardware is not ASPM-capable, so there is actually nothing to control and the PCIe links are always fully powered when the system is running (this is probably the most common reason, at least on desktop systems). Or it might be because the firmware did not implement the necessary programming interface, although the hardware might be ASPM- capable. Or it might be because the hardware implementation has some quirk that makes it misbehave if an OS with no specific hardware knowledge attempts to control ASPM.
So, the message is basically an informative one: the driver attempted to take control of the NIC's PCIe power management, and the OS told it "sorry, I don't have control of that feature myself so I cannot give it to you either". If the reason is that the hardware doesn't actually have ASPM capabilities, then you cannot really fix it, other than by replacing hardware if absolute maximum power saving is a critical requirement for you.
However, if the hardware is actually supposed to be ASPM-capable, then a firmware update ("BIOS update") might help.
| What "r8169 can't disable ASPM" means and how should I fix it? |
1,636,111,100,000 |
My OS:
uname -a
Linux debian 5.10.0-0.bpo.5-amd64 #1 SMP Debian 5.10.24-1~bpo10+1 (2021-03-29) x86_64 GNU/Linux
Something is wrong with my r8168-dkms; every time I install some other package, this appears at the end of the output:
Setting up r8168-dkms (8.046.00-1) ...
Removing old r8168-8.046.00 DKMS files...
------------------------------
Deleting module version: 8.046.00
completely from the DKMS tree.
------------------------------
Done.
Loading new r8168-8.046.00 DKMS files...
Building for 5.10.0-0.bpo.5-amd64
Building initial module for 5.10.0-0.bpo.5-amd64
Error! Bad return status for module build on kernel: 5.10.0-0.bpo.5-amd64 (x86_64)
Consult /var/lib/dkms/r8168/8.046.00/build/make.log for more information.
dpkg: error processing package r8168-dkms (--configure):
installed r8168-dkms package post-installation script subprocess returned error exit status 10
Processing triggers for man-db (2.8.5-2) ...
Errors were encountered while processing:
r8168-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)
How to fix the issue?
|
You can install the newer r8168-dkms (8.048.03-1~bpo10+1) package
from backports which compiles fine on my system (same kernel version).
If not already done, add the following line to your /etc/apt/sources.list
deb http://deb.debian.org/debian buster-backports main contrib non-free
to enable the backports repository.
Then run
sudo apt update
sudo apt -t buster-backports install r8168-dkms
to install the package.
Related: bugs.debian.org/cgi-bin/bugreport.cgi?bug=960091
| How to set up r8168-kms? |
1,636,111,100,000 |
I've been using Docker for a while and I'm interested in learning its internals. I've read about kernel namespaces it uses. But I don't understand how they are used.
So my problem is: I haven't found any official Linux kernel documentation about it. I haven't found any official source covering subcategories either (PID, IPC, Network).
What I found is the following page: https://www.kernel.org/doc/Documentation/namespaces/
|
The closest thing to official documentation for namespaces is the namespaces(7) manpage and related pages. These are maintained by kernel developers.
The best introduction to containers’ use of namespaces I know of is Matt Turner’s “Istio — the packet’s eye view” presentation (which also exists as a lengthier workshop).
LWN’s series on namespaces is also a good introduction (and more).
| How to find official documentation about Linux kernel namespaces? |
1,636,111,100,000 |
I would guess that it does so into the memory of the process from which the system call is made. However, if so, how do the rest of the processes use that space? How does the kernel know that the buffer points to a virtual address space, and not a real one? But then that would be like eating up space meant for the process for some general purpose kernel stuff, wouldn't it?
|
vmalloc is a kernel allocator, it doesn’t (necessarily) relate to processes. The kernel also sees virtual memory, not linear memory, most of the time. The particularity of vmalloc is that it only allocates contiguous virtual memory, not physical memory; kmalloc allocates contiguous virtual and physical memory. Both return virtual addresses.
vmalloc, unlike kmalloc, has to allocate new page table entries (kmalloc allocates from a pre-mapped area); they are mapped in the shared part of the page table tree, or when KPTI is enabled, in the kernel-private part of the tree.
See Linux Device Drivers chapter 8 for details.
| Which processes' page table does vmalloc() allocate new memory in? |
1,636,111,100,000 |
I want to compile a new kernel 4.14.8-gentoo-r1 on Gentoo Linux. I had created symbolic link using eselect kernel set 2 before I entered to directory /usr/src/linux and I executed genkernel all in this directory. Unfortunately, while compiling Linux kernel 4.14.8-gentoo-r1 I've received following error:
pecan@tux /usr/src/linux $ sudo genkernel all
* Gentoo Linux Genkernel; Version 3.4.52.4
* Running with options: all
* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..
* Linux Kernel 4.14.8-gentoo-r1 for x86_64...
* .. with config file /usr/share/genkernel/arch/x86_64/generated-config
* kernel: --mrproper is disabled; not running 'make mrproper'.
* >> Running oldconfig...
* kernel: --clean is disabled; not running 'make clean'.
* kernel: >> Invoking menuconfig...
* >> Compiling 4.14.8-gentoo-r1 bzImage...
* >> Installing firmware ('make firmware_install') due to CONFIG_FIRMWARE_IN_KERNEL != y...
* ERROR: Failed to compile the "firmware_install" target...
*
* -- Grepping log... --
*
*Allow for memory compaction (COMPACTION) [Y/n/?] y
* Page migration (MIGRATION) [Y/?] y
*Enable bounce buffers (BOUNCE) [Y/n/?] y
*Enable KSM for page merging (KSM) [Y/n/?] y
*Low address space to protect from user allocation (DEFAULT_MMAP_MIN_ADDR) [4096] 4096
*Enable recovery from hardware memory errors (MEMORY_FAILURE) [Y/n/?] y
*--
* *
* round-robin scheduling (IP_VS_RR) [M/n/?] m
* weighted round-robin scheduling (IP_VS_WRR) [M/n/?] m
* least-connection scheduling (IP_VS_LC) [M/n/?] m
* weighted least-connection scheduling (IP_VS_WLC) [M/n/?] m
* weighted failover scheduling (IP_VS_FO) [N/m/?] n
*--
* rj54n1cb0c support (SOC_CAMERA_RJ54N1) [N/m/?] n
* tw9910 support (SOC_CAMERA_TW9910) [M/n/?] m
*
* drm/i915 Debugging
*
*Force GCC to throw an error instead of a warning when compiling (DRM_I915_WERROR) [N/y/?] n
*Enable additional driver debugging (DRM_I915_DEBUG) [N/y/?] n
*Enable additional driver debugging for fence objects (DRM_I915_SW_FENCE_DEBUG_OBJECTS) [N/y/?] n
*Enable additional driver debugging for detecting dependency cycles (DRM_I915_SW_FENCE_CHECK_DAG) [N/y/?] (NEW)
*Enable selftests upon driver load (DRM_I915_SELFTEST) [N/y/?] n
*Enable low level request tracing events (DRM_I915_LOW_LEVEL_TRACEPOINTS) [N/y/?] n
*Enable extra debug warnings for vblank evasion (DRM_I915_DEBUG_VBLANK_EVADE) [N/y/?] n
*--
*Enable tracing for RCU (RCU_TRACE) [N/y/?] n
*Provide debugging asserts for adding NO_HZ support to an arch (RCU_EQS_DEBUG) [N/y/?] n
*Force round-robin CPU selection for unbound work items (DEBUG_WQ_FORCE_RR_CPU) [N/y/?] n
*Force extended block device numbers and spread them (DEBUG_BLOCK_EXT_DEVT) [N/y/?] n
*Enable CPU hotplug state control (CPU_HOTPLUG_STATE_CONTROL) [N/y/?] n
*Notifier error injection (NOTIFIER_ERROR_INJECTION) [N/m/y/?] n
*--
* CC ipc/syscall.o
* CC kernel/irq/proc.o
* CC mm/swap_cgroup.o
* CC ipc/ipc_sysctl.o
* CC kernel/irq/migration.o
* CC mm/memory-failure.o
*--
* GZIP arch/x86/boot/compressed/vmlinux.bin.gz
* MKPIGGY arch/x86/boot/compressed/piggy.S
* AS arch/x86/boot/compressed/piggy.o
* DATAREL arch/x86/boot/compressed/vmlinux
* LD arch/x86/boot/compressed/vmlinux
*ld: arch/x86/boot/compressed/head_64.o: warning: relocation in readonly section `.head.text'
*ld: warning: creating a DT_TEXTREL in a shared object.
*--
* Running with options: all
* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..
*
* ERROR: Failed to compile the "firmware_install" target...
*
* -- End log... --
*
* Please consult /var/log/genkernel.log for more information and any
* errors that were reported above.
*
* Report any genkernel bugs to bugs.gentoo.org and
* assign your bug to [email protected]. Please include
* as much information as you can in your bug report; attaching
* /var/log/genkernel.log so that your issue can be dealt with effectively.
*
* Please do *not* report compilation failures as genkernel bugs!
*
Can anyone help me?
|
This issue was reported on the Gentoo Forums and the Gentoo bugtracker a little while ago. As mentioned in the bug report, you can either set FIRMWARE_INSTALL=no in your genkernel.conf, or upgrade genkernel to the unstable version (the thread also suggests setting CONFIG_FIRMWARE_IN_KERNEL=y in your .config file, but verify if that's something you want to use.) You probably will want to take note that as of 4.14, Linux no longer has in-kernel firmware, which is why you are getting that error message: genkernel was trying to make something that no longer exists.
| Compile kernel 4.14.8-gentoo-r1 on Gentoo |
1,636,111,100,000 |
I just finished installing Nvidia driver on Ubuntu.
Nvidia installer created a key pair and signed the module with it.
Now it says I should add this key pair to list of kernels' trusted keys to be able to use module.
I googled but couldn't find any solution for this as I am not an expert Linux user.
I appreciate your help.
(using lubuntu 16.10)
|
Here I found the solution.
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-signing-kernel-modules-for-secure-boot.html
If your key pair are created, then:
(The instruction is for RedHat but worked fine on Lubuntu and most probably will work for Ubuntu too)
The Machine Owner Key (MOK) facility is a feature that is supported by Red Hat Enterprise Linux 7 and can be used to augment the UEFI Secure Boot key database. When Red Hat Enterprise Linux 7 boots on a UEFI-enabled system with Secure Boot enabled, the keys on the MOK list are also added to the system keyring in addition to the keys from the key database. The MOK list keys are also stored persistently and securely in the same fashion as the Secure Boot key database keys, but these are two separate facilities. The MOK facility is supported by shim.efi, MokManager.efi, grubx64.efi, and the Red Hat Enterprise Linux 7 mokutil utility.
The major capability provided by the MOK facility is the ability to add public keys to the MOK list without needing to have the key chain back to another key that is already in the KEK database. However, enrolling a MOK key requires manual interaction by a physically present user at the UEFI system console on each target system. Nevertheless, the MOK facility provides an excellent method for testing newly generated key pairs and testing kernel modules signed with them.
Follow these steps to add your public key to the MOK list:
Request addition of your public key to the MOK list using a Red Hat Enterprise Linux 7 userspace utility:
~]# mokutil --import my_signing_key_pub.der
You will be asked to enter and confirm a password for this MOK enrollment request.
Reboot the machine.
The pending MOK key enrollment request will be noticed by shim.efi and it will launch MokManager.efi to allow you to complete the enrollment from the UEFI console. You will need to enter the password you previously associated with this request and confirm the enrollment. Your public key is added to the MOK list, which is persistent.
Once a key is on the MOK list, it will be automatically propagated to the system key ring on this and subsequent boots when UEFI Secure Boot is enabled.
| How to add a key pair (public and private) to list of kernel's database which hold list of trusted keys |
1,636,111,100,000 |
I want to install kernel 4.5 on a Debian Jessie machine (I want to be as close as possible to a specific machine I have in production).
Currently the version on the backports repo is 4.7, and I can't find a way to obtain 4.5
How do I look for versions that are not the latest? Any repository I can add that holds an archive?
|
echo 'Acquire::Check-Valid-Until false;' > /etc/apt/apt.conf.d/archive
echo 'deb http://snapshot.debian.org/archive/debian/20160529T223338Z/ jessie-backports main contrib non-free' > /etc/apt/sources.list.d/debian-snapshot.list
apt-get update
apt-get install linux-image-4.5.0-0.bpo.2-amd64
But you don't need this, because 4.7 is fully compatible with 4.5 and there are no significant performance issues at all. I do not recommend to use kernel 4.5, but if you want...
| Installing a specific kernel version on debian linux |
1,636,111,100,000 |
So, there were already questions about ignoring ata devices (like How to tell Linux Kernel > 3.0 to completely ignore a failing disk?) from where I got the info that one has to add something like
libata.force=2:disable
to your kernel argument line.
However, for some, reason, on one of my system's controller cards, there are 2 broken ports which are always probed, but I can't switch the card yet. In the first place, there was only one broken port and I could just use the above solution and it worked just fine. Then, when the other port died, I thought I could just add another one of these, like
"... libata.force=2:disable libata.force=4:disable"
which lead to the result that only port 4, and not port 2 was getting ignored, like if the second argument was kinda overriding the first one.
Then I tried
"... libata.force=2:disable,4:disable"
which also didn't work for me.
Q: How can I make the kernel ignore multiple ata devices?
|
It's always good to refer to the kernel parameters documentation.
There we can read, for libata.force:
[LIBATA] Force configurations. The format is comma
separated list of "[ID:]VAL" where ID is
PORT[.DEVICE]. PORT and DEVICE are decimal numbers
matching port, link or device.
Your ports are 2 and 4, and your VAL is disable. Thus you're looking for libata.force=2:disable,4:disable.
| Q: How to tell the Linux Kernel to ignore MULTIPLE ata devices? |
1,636,111,100,000 |
I normally would test whether sysrq + sub works when the kernel panic occurs, but "unfortunately" my system works pretty stable, and I have no idea how to make kernel panic. So the question is very simple. Does sysrq work when the kernel panics, or do I have to reboot the machine by using the reset button?
A bonus question: When the kernel reboots the system via the kernel.panic sysctl parameter, is it the exact same situation compared to pressing the reset button? Does the kernel make any actions before restarting the system, for instance sync or remount read-only?
|
You should be able to generate a panic using:
sysctl kernel.panic=1
sysctl kernel.sysrq=1
echo c > /proc/sysrq-trigger
See the kernel documentation for details on the kernel.sysrq parameter and the 'c' command
The kernel.panic=1 parameter is to set to have the host to reboot after 1 second when a panic occured. If you want to investigate console output you might want to set the parameter to 0 to prevent the automatic reboot.
| Does sysrq work when the kernel panic occurs? |
1,636,111,100,000 |
Is it possible to generate major page faults in the linux kernel at will? Can a program be written such that it is guaranteed to cause a major page fault on it's execution.
|
To produce major page faults you need to force reads from disk. The following code maps the file given on the command-line, telling the kernel it doesn't need it; if the file is large enough (pick a large file in /usr/bin), you'll always get major page faults:
#include <fcntl.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/stat.h>
int main(int argc, char ** argv) {
int fd = open(argv[1], O_RDONLY);
struct stat stats;
fstat(fd, &stats);
posix_fadvise(fd, 0, stats.st_size, POSIX_FADV_DONTNEED);
char * map = (char *) mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0);
if (map == MAP_FAILED) {
perror("Failed to mmap");
return 1;
}
int result = 0;
int i;
for (i = 0; i < stats.st_size; i++) {
result += map[i];
}
munmap(map, stats.st_size);
return result;
}
There isn't much in the way of error handling, this is just to demonstrate the idea. On my system,
gcc majorfault.c -o majorfault && /usr/bin/time -v ./majorfault /usr/bin/git-annex
always produces 154 major page faults.
| Generate major page faults |
1,636,111,100,000 |
I've just noticed the very weird situation I don't have a good explanation for.
The machine (debian) has one interface with one IP address assigned:
# ifconfig vmbr0 |grep inet
inet addr:192.168.1.26 Bcast:192.168.1.255 Mask:255.255.255.0
In the some software settings (powerdns recursor if it's necessary) it is specified that its daemon binds to the following interfaces:
local-address=127.0.0.1 192.168.1.24
As you may have noticed, it was a mistake made in the IP address value, but the thing is - daemon successfully bound to it:
# netstat -nlp | grep 1.24 | grep 53
tcp 0 0 192.168.1.24:53 0.0.0.0:* LISTEN 328862/pdns_recurso
udp 0 0 192.168.1.24:53 0.0.0.0:* 328862/pdns_recurso
And what is more surprising - the switch successfully route traffic to this machine (there is no other 192.168.1.24 in the LAN, so no IP address conflicts).
So could anyone explain why it is possible and works?
I thought that kernel will only accept IP packets that have the correct destination and discard all others.
|
As indicated in the comments, the address (192.168.1.24) is actually present on the host, but due to limitations in the ifconfig utility, it is not shown. Instead you should be using the Iproute2 utility ip, and not ifconfig. ifconfig has been deprecated in Linux for several years now, and is missing a lot of functionality. The specific bit of functionality affecting your case is the ability to add/show multiple IP addresses on a single interface (without creating interface aliases).
The method of adding multiple IP addresses to an interface with ifconfig is to create interface aliases (eth0 -> eth0:0 eth0:1 etc). However you can only have 255 aliases on a single interface, so for some enterprise setups, this is a significant limitation.
With the Iproute2 ip utility, you can add an unlimited number of addresses to a single interface.
For example:
$ ip addr add 169.254.0.1 dev eth0
$ ip addr add 169.254.0.2 dev eth0
$ ifconfig eth0 | grep '\<inet\>'
inet 192.168.0.20 netmask 255.255.255.0 broadcast 192.168.0.255
$ ip addr show dev eth0 | grep '\<inet\>'
inet 192.168.0.20/24 brd 192.168.0.255 scope global eth0
inet 169.254.0.1/32 scope global eth0
inet 169.254.0.2/32 scope global eth0
So notice how ifconfig is only showing one address, while ip addr is showing all of them.
| Binding to not existing interface |
1,636,111,100,000 |
I have a Linux 3.14.0 kernel(CentOS 6.2) running on my machine, but the source isn't in /usr/src/.
Is there any way to find out the source from which it was compiled?
The source is most definitely somewhere on the machine, it was compiled by one of my colleagues. Also, these are lab machines not connected to the internet, hence the source code has to be manually copied and installed.
I just need to locate it based on the current kernel image.
|
/lib/modules/$(uname -r)/source should be a symbolic link to the kernel source tree (if it was installed in a reasonable way).
Other than that
find / -type d -name "linux-3.14.0"
will look for the distribution directory of the 3.14.0 Linux kernel - that is the one you get when you unpack the tarball. If that fails,
find / -type d -name "linux-*"
find / -type f -name "Kbuild"
shouldn't give you too many false positives.
If you need to compile it then you can transfer the sources to the machine and do it from scratch, provided he compiled it with embedded .config (the CONFIG_IKCONFIG option). You can extract that either from /proc/config.gz (if supported by the kernel - see the CONFIG_IKCONFIG_PROC option), or with the scripts/extract-ikconfig script from the kernel source directory.
Apart from that, is asking your colleague entirely out of question?
| How to find the source of a currently running kernel on my machine? |
1,636,111,100,000 |
I'm trying to setup an environment for kernel module development in Linux. I've built the kernel in the home folder and would like to place the sources and binaries to the correct place so include correctly.
The example for building the kernel module has the following includes:
#include <linux/init.h>
#include <linux/module.h>
What are the absolute paths that the linker looks for these headers?
|
I generally approach this question like this. I'm on a Fedora 19 system but this will work on any distro that provides locate services.
$ locate "linux/init.h" | grep include
/usr/src/kernels/3.13.6-100.fc19.x86_64.debug/include/linux/init.h
/usr/src/kernels/3.13.7-100.fc19.x86_64.debug/include/linux/init.h
/usr/src/kernels/3.13.9-100.fc19.x86_64/include/linux/init.h
/usr/src/kernels/3.13.9-100.fc19.x86_64.debug/include/linux/init.h
Your paths will be different but the key take away is that you want to ask locate to find what's being included ("linux/init.h") and filter these results looking for the keyword include.
There are also distro specific ways to search for these locations using RPM (Redhat) or APT (Debian/Ubuntu).
gcc
Notice however that the paths within the C/C++ file are relative:
#include <linux/init.h>
This is so that when you call the compiler, gcc, you can override the location of the include files that you'd like to use. This is controlled through the switch -I <dir>.
excerpt from man gcc
-I dir
Add the directory dir to the list of directories to be searched for
header files. Directories named by -I are searched before the
standard system include directories. If the directory dir is a
standard system include directory, the option is ignored to ensure
that the default search order for system directories and the special
treatment of system headers are not defeated . If dir
begins with "=", then the "=" will be replaced by the sysroot
prefix; see --sysroot and -isysroot.
External modules
There's this article which discusses how one would incorporate the development of their own kernel modules into the "build environment" that's included with the Linux kernel. The article is titled: Driver porting: compiling external modules. The organization of the Kernel's makefile is also covered in this article: makefiles.txt.
For Kernel newbies there's also this article: KernelHeaders from the kernelnewbies.org website.
NOTE: The Kernel uses the KBuild system which is covered here as part of the documentation included with the Kernel.
https://www.kernel.org/doc/Documentation/kbuild/
References
How to include local header files in linux kernel module
| Placement of kernel binary and sources for kernel module building? |
1,636,111,100,000 |
Looking at the proc man page (http://man7.org/linux/man-pages/man5/proc.5.html) it is possible to detect which processes are kernel threads in /proc/<pid>/stat by looking at the flags value (PF_KTHREAD)
flags %u (%lu before Linux 2.6.22)
(9) The kernel flags word of the process. For bit
meanings, see the PF_* defines in the Linux kernel
source file include/linux/sched.h. Details depend
on the kernel version.
This process flag (PF_KTHREAD) doesn't seem to exist in kernel version 2.6.18 (used in RHEL5), the value is used by a different flag.
Is there another method to determine if a pid is a kernel thread?
|
Heuristically, see https://stackoverflow.com/questions/12213445/identifying-kernel-threads
ps and top (from procps-3.28) use "no command line" as the check, and have no knowledge of PF_KTHREAD. That is what triggers them to add [``] to the process name, it's not part of the actual process name. Since the command line is under control of the process itself, it's possible that it's been modified.
It depends on how far back (2.4? 2.2?) you need to go. A quick rummage on a few systems indicates no evident common flag (field 9 of /proc/PID/stat)
On late 2.6.x you can mostly guess by the the parent PID being 0 for [kthreadd], that often will have PID 2, and all threads will be its children (init may have PPID=0 too). Or possibly (early 2.6.x?) a [kthread] instead, but not PID 2, but it may only be the parent of most, not all threads.
Another way is to inspect /proc/PID/maps (user space memory map), for a kernel thread this will be empty -- so as long the process flag (in /proc/PID/stat) is not &(PF_EXITING), /proc/PID/maps being empty is a good indicator. Note you must actually read maps, not just stat() it, since the size is misreported as 0; and you must also have permission, if you do not it may appear empty without causing an error.
for pp in /proc/[0-9]*; do
if [ -z "$(< $pp/maps)" ]; then echo ${pp##/proc/}; fi;
done
You could add a similar expression to check that cmdline is also empty.
| Detecting kernel thread on pre-3.0 kernels |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.