date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,593,753,506,000 |
I configured a debian kernel 5.10.57 to add the HSR/PRP module. I enabled it as built-in <*>. Then i compiled and installed the kernel using make deb-pkg and dpkg -i *.deb respectively.
The new kernel is running.
debian@debian:~$ uname -r
5.10.57
The HSR/PRP module path is in the builtin.modules file :
debian@debian:~$ cat /lib/modules/5.10.57/modules.builtin |grep hsr
kernel/net/hsr/hsr.ko
But the hsr directory (and the .ko file) does not exist.
debian@debian:~$ ls /lib/modules/5.10.57/kernel/net/ |grep hsr
debian@debian:~$
So the module is not loaded.
debian@debian:~$ lsmod |grep hsr
debian@debian:~$
In the /usr/src/linux-5.10.57/ folder, containing the kernel I compiled, the hsr configuration files are all here.
debian@debian:~$ ls /usr/src/linux-5.10.57/net/hsr/
hsr_debugfs.c hsr_forward.c hsr_framereg.h hsr_netlink.c hsr_slave.h
hsr_device.c hsr_forward.h hsr_main.c hsr_netlink.h Kconfig
hsr_device.h hsr_framereg.c hsr_main.h hsr_slave.c Makefile
debian@debian:~$
I tried a few commands to build the .ko file but nothing worked.
debian@debian:/usr/src/linux-5.10.57/net/hsr$ make
make: *** No targets. Stop.
debian@debian:/usr/src/linux-5.10.57/net/hsr$
debian@debian:/usr/src/linux-5.10.57/net/hsr$ make install
make: *** No rule to make target 'install'. Stop.
debian@debian:/usr/src/linux-5.10.57/net/hsr$
debian@debian:/usr/src/linux-5.10.57/net/hsr$ make modules
make: *** No rule to make target 'modules'. Stop.
debian@debian:/usr/src/linux-5.10.57/net/hsr$
debian@debian:/usr/src/linux-5.10.57/net/hsr$ make modules_install
make: *** No rule to make target 'modules_install'. Stop.
If you want to know what is in the Makefile :
debian@debian:/usr/src/linux-5.10.57/net/hsr$ cat Makefile
# SPDX-License-Identifier: GPL-2.0-only
#
# Makefile for HSR
#
obj-$(CONFIG_HSR) += hsr.o
hsr-y := hsr_main.o hsr_framereg.o hsr_device.o \
hsr_netlink.o hsr_slave.o hsr_forward.o
hsr-$(CONFIG_DEBUG_FS) += hsr_debugfs.o
debian@debian:/usr/src/linux-5.10.57/net/hsr$
Here are my questions :
Does a builtin module need a .ko file to be in the path required by the /lib/modules/5.10.57/modules.builtin file to be loaded ?
If yes, how can I generate or find the hsr.ko file I need ?
|
Since you configured the driver as built-in, rather than a module (<M> in the kernel configuration), it is part of the kernel binary (bzImage etc.). It will always be “loaded” whenever that particular kernel binary is booted.
You won’t see it as a separate .ko file, nor will you be able to force the .ko file to be built.
| Built-in module enabled at kernel configuration is missing |
1,593,753,506,000 |
I was trying my hand at upgrading/changing the kernel manually. I have tried many kernels and wanna know if the WSL2 kernel can be installed in a normal distro before I mess up my installation.
|
While you can do this, you probably don't want to. The WSL kernel is designed to meet the special needs of WSL. As a consequence, it's designed to run only on Hyper-V and won't contain drivers that are needed to boot on physical hardware. You might be able to get it to boot in a Hyper-V virtual machine, but that's about it.
You may also find that it lacks drivers for things you want; for example, it may not contain support for a file system you'd like to use. It may also be older than your distro ships with, and as a consequence lack important features that a newer distro might depend on.
For similar reasons, Debian's cloud kernels are designed to run only on VMs and are much smaller because they don't need to drive most real hardware. This is great if you have space-limited virtual machines, but significantly less great if your hard disk can't be read or your keyboard and mouse don't work.
| Can a normal Linux kernel be replaced by the WSL2 kernel? |
1,593,753,506,000 |
I stumbled upon this Intel webpage that supposedly provides the proprietary WiFi drivers. I am currently using Ubuntu 20.04.
Not keeping the question specific to these device drivers (hoping that it still keeps the question answerable) my question is -
Can device drivers be installed on any Linux Distro (like Ubuntu and CentOS) if they are based on the same Kernel (say 5.2)?
Of course, I assume that the Kernel version satisfies the version requirement given on the page.
The reason why I am uncertain of the answer is that I know that many Softwares are developed for the specific Linux distro and even released separately which can be installed through their package managers. Isn't the system similar in the case of device drivers?
P.S. : The link to the page.
|
Those are not drivers.
They are firmware packages for the WiFi chips themselves. The WiFi chips don't generally have persistent flash memory for the firmware, so the driver (in this case, the open-source iwlwifi driver for essentially all modern Intel WiFi chips) needs the correct chip-model-specific firmware file for loading into the chip as part of initializing the chip for use.
Typically the kernel does not need to understand the contents of a firmware file at all; it just needs to stuff the contents of the file into the hardware in question in an appropriate way.
These firmware files can be installed on any Linux distribution: they typically go into /lib/firmware/. But the actual driver needs to be of a new enough version to know how to actually communicate with the chip to make use of them: the webpage documents the kernel version at which point the support for a particular WiFi chip was added into the driver in the "mainline" Linux kernel.
So any Linux distribution whose kernel version is at or above the level specified for a particular WiFi chip is essentially guaranteed to support that chip.
However, sometimes some distributions (especially the "enterprise" or Long Term Support distributions) use an older kernel, but backport newer versions of drivers into it. In such cases, you might find that the distribution supports some piece of hardware, even though its kernel version doesn't seem quite new enough for it according to this list.
Sometimes, other people produce PPAs of newer drivers for older kernels, or otherwise produce more or less easily installable additional or upgraded drivers, if the hardware in question is popular/important enough.
Compatibility of third-party drivers to kernel versions can be more complicated: a driver can be too old for a particular kernel version (e.g. it attempts to do something that needs to be done a bit differently with newer kernels), or too new (e.g. it relies on a kernel feature that was implemented in a particular kernel version, and just can't work with kernels older than that).
For example, trying to use a driver module that was compiled before the implementation of the major Spectre/Meltdown workarounds with a kernel compiled after it, or vice versa, may easily cause the system to hang or crash.
Drivers that are available in source code format and must be compiled for your specific kernel version can be somewhat more flexible than drivers provided in pre-compiled form, but both can have version compatibility limits in both directions.
| Will two different Linux Distros support the same device drivers given that they use the same kernel? |
1,593,753,506,000 |
I know that it's strongly recommended to restart after updating kernel (well, anything important) so that the changes can apply and can propagate. I also know about the option to livepatch kernel.
However, I'm confused about why do things tend to break when I update kernel and then don't restart. It's pretty much random, sometimes it happens and sometimes not, and reboot always fixes it. Sometimes it's bluetooth refusing to connect to new devices, netflix cannot play videos and tells me to restart computer - things generally get weird.
But why so? I don't want an answer why my bluetooth stopped working, however I'd like to hear a high level explanation why do things in general break?
Is it because part of the update is applied and part is not, maybe there are even multiple versions of something running at the same time and things break when it tries to communicate?
Why do things get weird after kernal update?
|
Some, drivers and services are dependent on your kernel's version (virtualbox's driver is one of them). When you update your kernel, some services are stopped to be updated but cannot be restarted because they rely on the new kernel. Most distros don't patch the running kernel (Live patching) to upgrade it and instead prefer to keep the old kernel running and boot the new kernel on restart. If your bluetooth driver required the new kernel after it was updated, it will remain stopped (or in a crash loop) until the new kernel is loaded.
| Why do things tend to break when one doesn't restart after kernel update? |
1,593,753,506,000 |
since our production server not startup ( very important server - Rhel 7.2 )
we try to access as single user mode according to the link - https://www.tecmint.com/boot-into-single-user-mode-in-centos-7/
after entering the single user mode details using VMconsole , Linux stop on the following
what we can do from this stage in order to recover the production server?
|
If the GRUB boot menu includes multiple kernel versions, try booting with an older version. (There should always be at least the current kernel and the kernel used by the OS installer: the latter has a version number like 0-rescue-<numbers>.
If the boot is successful with an older kernel, then the problem might be a damaged/missing initramfs file. This is pretty common if your /boot filesystem ran out of disk space while installing a kernel update package, for example.
(Each kernel version has its own initramfs file, so if the problem was caused during the most recent update, the older kernel and its initramfs will most likely work.)
If the system is otherwise running normally with the old kernel, you can use a command like
mkinitrd /boot/initramfs-3.10.0-327.el7.img 3.10.0-327.el7
to recreate the initramfs file for the new kernel.
But if booting with an older kernel fails too, the problem might be something else. In that case, you should perform a rescue mode boot from the installation media. In the case of VMware, that means making sure the virtual hardware includes a virtual CD-ROM drive, and "inserting" an ISO image of a RHEL 7.x installation media (preferably 7.2 or newer) to the virtual CD drive, and telling the VM to boot from CD.
Once the GRUB boot menu of the installation media appears, select "Troubleshooting" and then "Rescue a RedHat Linux system". The installation program will load and ask for language & keyboard settings as with a normal installation, but then it will switch to rescue mode. It will even offer to automatically mount the disks of the installation-to-be-rescued for you, if that OS installation is not too badly damaged. Then it will give you a root command prompt you can use to further troubleshoot and apply fixes as necessary.
When in a rescue boot environment, your real root filesystem will be mounted at /mnt/sysimage. To be able to access it using normal pathnames (= without prefixing /mnt/sysimage to everything), you can use the chroot /mnt/sysimage command, which will also be suggested to you just before entering the rescue command prompt.
After using the chroot /mnt/sysimage command, you should be able to use any shell commands your installed OS has available. For example, if you find that the initramfs files for your kernels are missing from /boot, you can use the mkinitrd command (as described above) to recreate them.
| Cant access as single user mode - what can we do to recover Linux machine |
1,593,753,506,000 |
After my PC runs I can see three options which are
Fedora (5.3.16-300. fc31.x86_64) 31
Fedora (5.3.7-301. fc31.x86_64) 31
Fedora (0-rescu-bd .....) 31
Windows 7
Searching on the Net, I found that "kernel-5.3.16-300.fc31.x86_64.rpm" is a kernel and also "kernel-5.3.7-301.fc31" is a kernel too.
My questions are:
Do I have two kernel on my system at the same time?
What is the advantage of two extra options? (By extra I mean the other options, for example the second and third options.) Many thanks
|
Do I have two kernel on my system at the same time?
Yes.
What is the advantage of two extra options? (By extra I mean the other
options, for example the second and third options.)
If the kernel-5.3.16-300 proved to be bad, and broke your system, you could still boot from the earlier kernel-5.3.7-301.
Rescue kernel is for exactly what it suggests, rescuing your system.
"Rescue mode provides the ability to boot a small Fedora environment
entirely from CD-ROM, or some other boot method, instead of the
system's hard drive. As the name implies, rescue mode is provided to
rescue you from something. During normal operation, your Fedora system
uses files located on your system's hard drive to do everything — run
programs, store your files, and more. However, there may be times when
you are unable to get Fedora running completely enough to access files
on your system's hard drive. Using rescue mode, you can access the
files stored on your system's hard drive, even if you cannot actually
run Fedora from that hard drive."
| Why do I have two kernel on my boot manager? |
1,593,753,506,000 |
I hope to check the value of log_buf_len via sysctl, but sysctl -a doesn't show it, why and is there any other way to check its value
|
The value of log_buf_len is set once and for all when the kernel is configured and built OR when it is booted with a parameter log_buf_len=NNN: you cannot change it after that. sysctl generally concerns itself with things that you can change in the running kernel: that's probably the reason why log_buf_len is not included.
You can find the configured value of LOG_BUF_SHIFT by just grepping through the kernel config file (assuming that it's available). For example, on my Fedora 29 system, I do
$ grep CONFIG_LOG_BUF_SHIFT /boot/config-5.2.11-100.fc29.x86_64
CONFIG_LOG_BUF_SHIFT=18
log_buf_len is equal to 2^18 then UNLESS it has been set through the boot command line.
If that is the case (or if you don't have access to the config file), then the only way I know is to use gdb to examine the running kernel, but I haven't done that in many years and I really can't remember all the steps - the main difficulty is to get debugging symbols for the kernel you are running. Somebody else will have to provide those instructions though (or perhaps provide a simpler method; e.g. it is possible to write a kernel module that prints out the value when it is loaded - there are many tutorials on writing simple kernel modules, e.g. here: that tutorial dates from the days of the 2.6 kernel and things may be different today but I (naively?) don't expect things to be very different).
| sysctl -a doesn't include log_buf_len |
1,593,753,506,000 |
In Linux 0.11, we can see there is a main.c with a main()
In my understanding, the object code needs an OS to run it.
I mean, since Linux 0.11 is an OS, who is in front of it to run it? DOS?
|
The name of main() was simply chosen for familiarity and esthetical reasons; there was no C runtime calling it, as with the main() from a user land program. There's even a comment that tells as much in init/main.c:
void main(void) /* This really IS void, no error here. */
The main() function is called from boot/head.s:
after_page_tables:
pushl $0 # These are the parameters to main :-)
pushl $0
pushl $0
pushl $L6 # return address for main, if it decides to.
pushl $_main
jmp setup_paging
L6:
jmp L6 # main should never return here, but
# just in case, we know what happens
Notice how the address of main is pushed on the stack, and setup_paging is called with jmp, not with call, which means that the ret at its end will continue from the start of main().
| who run main() of linux? |
1,552,589,345,000 |
My question is similar to this question:
Where to find the Linux changelog of minor versions
But I would like to search all changelogs from 4.18.0 to 4.20.16 for any reference to a specific word, such as sama5d3, mmc0, or other term.
I can search the individual changelogs but didn't see a way to search a set at the same time?
|
If you want to search across multiple changelogs, I would recommend using the git repository. For stable releases, clone the stable tree:
git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-stable
This will take a little while, it involves downloading 2 GiB of data. If you don’t need all the history you could use a shallow clone instead:
git clone --shallow-since=v4.18 --no-single-branch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-stable
(You need --no-single-branch if you want to compare different major releases since each stream of stable releases is its own branch starting from a major release.)
Then in linux-stable, you can use git log to view logs, filtering with the various options, e.g.
git log --grep=sama5d3 v4.18..v4.20.16
| Best method for searching linux kernel changelog from 4.18.0 to 4.20.16 |
1,552,589,345,000 |
There are very many APs.
In my opinion, there are at least 200 APs in this field.
Scanning with iwlist will only scan up to 128 scans.
The debug information of wpa_supplicant is limited to a maximum of 128 scans.
I think the kernel limits the number of scans to 128.
Is there a way to increase this list being scanned?
I would like to see all of the APs in the field without limit.
|
I am using wifi as a realtek chip.
The maximum number of ssids at scan time is affected by MAX_BSS_CNT.
The bss_max_count option of wpa_supplicant is only a memory option for wpa_supplicant.
In my realtek kernel device driver, MAX_BSS_CNT was set to 128.
I set MAX_BSS_CNT to 4 and confirmed that only up to 4 scans can be done.
| Can I increase the maximum number of scans in iwlist? |
1,552,589,345,000 |
After I upgrade my kernel, the next time I start my machine several versions of the kernel will be listed on the boot screen, and I can use up and down arrow keys to choose what kernel I want to launch.
Does that mean:
the old kernel versions haven't been overwritten by the new one?
each version of the kernel will take some hard drive space, and each time the kernel is upgraded, more and more space will be taken?
|
You are correct, but the size of the kernels are extremely small. Here are the total sizes for all the kernels on one of my machines:
# ls -l /boot/
total 66307
drwxr-xr-x 5 root root 1024 Feb 18 18:18 grub
lrwxrwxrwx 1 root root 40 Feb 18 18:18 initramfs -> initramfs-genkernel-x86_64-4.15.3-gentoo
-rw-r--r-- 1 root root 4722276 Jan 7 02:16 initramfs-genkernel-x86_64-4.14.12-gentoo
-rw-r--r-- 1 root root 4725024 Jan 6 14:59 initramfs-genkernel-x86_64-4.14.12-gentoo.old
-rw-r--r-- 1 root root 4553984 Jan 11 03:09 initramfs-genkernel-x86_64-4.14.13-gentoo
-rw-r--r-- 1 root root 4555532 Jan 22 03:09 initramfs-genkernel-x86_64-4.14.14-gentoo
-rw-r--r-- 1 root root 4544696 Jan 18 01:49 initramfs-genkernel-x86_64-4.14.14-gentoo.old
-rw-r--r-- 1 root root 4577944 Feb 4 03:56 initramfs-genkernel-x86_64-4.15.1-gentoo
-rw-r--r-- 1 root root 4750536 Feb 8 15:42 initramfs-genkernel-x86_64-4.15.2-gentoo
-rw-r--r-- 1 root root 4745248 Feb 18 18:18 initramfs-genkernel-x86_64-4.15.3-gentoo
-rw-r--r-- 1 root root 4745760 Feb 13 23:06 initramfs-genkernel-x86_64-4.15.3-gentoo.old
lrwxrwxrwx 1 root root 44 Feb 18 18:18 initramfs.old -> initramfs-genkernel-x86_64-4.15.3-gentoo.old
-rw-r--r-- 1 root root 3645904 Jan 7 02:15 kernel-4.14.12-gentoo
-rw-r--r-- 1 root root 3645904 Jan 11 03:08 kernel-4.14.13-gentoo
-rw-r--r-- 1 root root 3641808 Jan 22 03:09 kernel-4.14.14-gentoo
-rw-r--r-- 1 root root 3682768 Feb 4 03:55 kernel-4.15.1-gentoo
-rw-r--r-- 1 root root 3682768 Feb 8 15:42 kernel-4.15.2-gentoo
-rw-r--r-- 1 root root 3682768 Feb 13 23:05 kernel-4.15.3-gentoo
-rw-r--r-- 1 root root 3682768 Feb 18 18:18 kernel-4.15.4-gentoo
drwx------ 2 root root 12288 Apr 4 2017 lost+found
# du -hd1 /boot
12K /boot/lost+found
2.0M /boot/grub
67M /boot
# du -hd1 /lib/modules
4.1M /lib/modules/4.14.14-gentoo
4.2M /lib/modules/4.14.13-gentoo
4.2M /lib/modules/4.14.12-gentoo
4.1M /lib/modules/4.15.3-gentoo
4.1M /lib/modules/4.15.1-gentoo
4.1M /lib/modules/4.15.2-gentoo
4.1M /lib/modules/4.15.4-gentoo
29M /lib/modules/
So for seven kernels, it takes 100MB. That's hardly anything, and it gives me the ability to revert to a previous version of the kernel if I have a problem booting into the most recent one. I occasionally clear out old kernels (about every 3-4 months) but it doesn't affect the running of the system.
TL;DR: Don't worry about previous kernels too much. They take almost no space, and provide insurance against an unbootable system.
| Why does my boot screen list several kernel versions? |
1,552,589,345,000 |
I have Linux with a kernel that was compiled with the real-time patch, but the config option CONFIG_PREEMPT_RT_FULL was not enabled (it says in /proc/config that it is not set).
Do you now if there is any way to turn this on, without having to recompile the kernel?
I guess it's not possible but maybe there's some way?
|
No, it’s a solely compile-time configuration option, there’s no runtime equivalent. You’ll need to rebuild your kernel.
| Enable CONFIG_PREEMPT_RT_FULL after the kernel compilation |
1,552,589,345,000 |
What does the following negative kernel value mean ?
net.ipv4.conf.all.rp_filter = -1
|
From kernel documentation negative value make no sense:
rp_filter - INTEGER
0 - No source validation.
1 - Strict mode as defined in RFC3704 Strict Reverse Path
Each incoming packet is tested against the FIB and if the interface
is not the best reverse path the packet check will fail.
By default failed packets are discarded.
2 - Loose mode as defined in RFC3704 Loose Reverse Path
Each incoming packet's source address is also tested against the FIB
and if the source address is not reachable via any interface
the packet check will fail.
So it is possible the minus is a mistake
| What does the following negative kernel value mean? |
1,552,589,345,000 |
The motivation behind this question arises from exploring the Intel Galileo gen2 board which has a single threaded processor.
I'm looking for a conceptual explanation on what does that mean for all the userspace applications that rely on the existence of threading?
Does this mean that the kernel needs to be patched so that the system calls for the threading invocation are emulated in software instead of relying on the CPU threading support?
|
Multi-tasking systems handle multiple processes and threads regardless of the number of processors or cores installed in the system, and the number of "threads" they handle. Multi-tasking works using time-slicing: the kernel and every running process or thread each get to spend some time running, and then the system switches to the next runnable thread. The switches happen very frequently, which gives the impression everything is running in parallel even when it's not.
All this happens without any change to the APIs etc. Multi-core systems need to be able to run more threads than they physically support anyway, the single-core case is just an instance of that.
Describing a CPU as single-threaded refers to simultaneous multithreading (SMT, or hyper-threading in the Intel world), not the CPU's ability to run multiple threads (or processes, or tasks). Adding SMT features to a CPU doesn't add any instructions to help running threads, it just allows better use of the hardware in some circumstances.
| Multithreaded applications on a single threaded CPU? |
1,552,589,345,000 |
Related to:
Cannot compile kernel: error, kernel does not support PIC mode
I also just had this issue, instead of patching;
I configured alternates with a different gcc version, jumped from v4 to v5, it's compiling now.
$ update-alternatives --config gcc
There are 3 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/gcc-6 30 auto mode
1 /usr/bin/gcc-4.8 10 manual mode
* 2 /usr/bin/gcc-5 20 manual mode
3 /usr/bin/gcc-6 30 manual mode
What issues could arise, are there any best practice for choosing a GCC version for compiling the kernel?
The system is Debian Stretch.
|
According to the kernel documentation, you should be able to use any version of GCC starting with 3.2. In practice though, I don't think older versions of GCC tend to be tested much with kernel builds, so you're better off using newer versions of GCC (but not too new, there are issues with GCC 6).
In Debian, you can find out the appropriate version of GCC by looking at the kernel source package's build dependencies, or the kernel header package's dependencies. Thus, linux-headers-4.7.0-1-amd64 depends on linux-compiler-gcc-5-x86 which depends on gcc-5.
You can retrieve the correct value of CC automatically by pulling in the values from /usr/src/linux-headers-$(uname -r)/.kernelvariables (after installing linux-headers-$(uname -r) if necessary). For example, my system currently has
override ARCH = x86
override KERNELRELEASE = 4.7.0-1-amd64
CCACHE = ccache
CC = $(if $(DEBIAN_KERNEL_USE_CCACHE),$(CCACHE)) $(CROSS_COMPILE)gcc-5
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
override CROSS_COMPILE = $(DEB_HOST_GNU_TYPE)-
endif
Using this CC will produce a working kernel (or module for the running kernel) regardless of the default GCC (I use GCC 6 as the default).
| What consequences may arise from using an alternate GCC version to compile the kernel? [closed] |
1,552,589,345,000 |
I've watched DebConf 14: QA with Linus Torvalds, and at about 19:50 Linux mentions how "UUIDs are crazy sh!t."
What are UUIDs used for (at the kernel level)? What does Linus mean by this?
|
FIlesystems, when they are formatted, are given a random number to uniquely identify them. In the old days, you had to configure your boot loader and /etc/fstab to identify which filesystems should be mounted where using a dev node, which consists of an arbitrarily assigned ID, like /dev/sda, and a partition number. The problem with that was that if your partition numbers changed, all of those existing references broke. The really big problem came though when the arbitrary IDs for the disks themselves started to change quite frequently. With IDE disks there could only be 4, and so depending on which physical port you had the drive connected to, that would determine whether it was /dev/hda or /dev/hdb. With SCSI disks, or SATA disks, or systems with multiple disk controllers though, the ID is simply assigned in the order they are detected in, and this order is somewhat random and subject to change from one boot to the next, even if you don't do something like (un)plug a USB disk. As such systems became popular, it became important to not have to rely on the dev node names and so systems switched to using UUIDs to identify what filesystem should be mounted where, and whatever dev node it happens to show up as on a given boot doesn't matter.
| What are kernel UUIDs? Why would they be crazy sh!t? |
1,552,589,345,000 |
I am working with linux 3.19.0+ and I want to know if my linux kernel supports f2fs (Flash-Friendly File System). How do I know that?
|
cat /proc/filesystems should do the trick...
| How do I know which File Systems my linux supports? [duplicate] |
1,552,589,345,000 |
I try to count IOPS and I/O size with SystemTap script and use MySQL to be workload.
I found mysqld doesn't call systemcall but mysqld has read/write on VFS.
So, do MySQL processes run in user or kernel modes?
|
Mysql doesn't have a kernel module, therefore it runs in user mode.
Perhaps what you are seeing is that mysql is using memory-mapped files instead of calling read/write. So, accessing a page of memory causes a read/write without using a syscall.
Or, perhaps you called strace without "-f" to follow the child processes?
| Does MySQL processes run in user or kernel modes? |
1,552,589,345,000 |
Is there any option in the kernel compilation or userspace setting to do the above? I'm looking to add a crash reported to my new embedded Linux system.
|
Yes. If you echo a string that starts with a | character to /proc/sys/kernel/core_pattern, it will get executed and receive the core dump as input. More information is available in man 5 core.
| Option to configure Linux kernel to run userspace script when core dump occurs? |
1,552,589,345,000 |
I am using the release version of OpenBSD 5.6 and have to apply a patch called 004_kernexec.patch.sig (URL: http://ftp.openbsd.org/pub/OpenBSD/patches/5.6/common/004_kernexec.patch.sig )
An excerpt of the said patch is as follows:
OpenBSD 5.6 errata 4, Oct 20, 2014:
Executable headers with an unaligned address will trigger a kernel panic.
Apply patch using:
signify -Vep /etc/signify/openbsd-56-base.pub -x 004_kernexec.patch.sig \
-m - | (cd /usr/src && patch -p0)
Then build and install a new kernel.
I'm now at the section titled 5.3.4 - Building the kernel (URL: http://www.openbsd.org/faq/faq5.html#Why).
According to it, I need to issue the following command first:
cd /usr/src/sys/arch/`machine`/conf
followed by
config GENERIC
Is it compulsory to use the name GENERIC? Can I call it something else such as bsd?
I remember that towards the end of the installation process of the OS, there was this line that stated bsd.mp would replace bsd.rd as my machine was a multi-processor system.
|
The OpenBSD FAQ is your friend in this case. They have extensive documentation on how to build your own kernel. In particular you want section 5.3.4 but before you do that make sure and read all of section 5.3 to get a feel for the bigger picture. I'd also recommend taking a look at Absolute OpenBSD by Michael Lucas. He's got a pretty good walk through on how to build your own kernel.
Good luck.
| When building a new kernel in OpenBSD 5.6, can the name of `config` be something else? |
1,552,589,345,000 |
I am taking an OS course this semester, and we mentioned that device drivers can cause about 85% of crashes(for Windows).
My understanding is that: since many personal computers are configured with a variety of hardware, and most device drivers are not very robust when fault happens. Thus Windows crashes a lot, and Linux's driver code also have a lot of bugs.
However, Mac might be a different story. Since all OS X are only available on Mac, and the hardware components of a Mac is relatively constant compared with other PC. Thus Apple may have much higher quality of driver code than other OS does. That's why Mac OS X seems to be more stable than other OS. I wonder if I am correct on this argument.
I don't really know much about Mac, and I haven't found a journal/conference paper talking about crashes of Mac OS X. Please correct my statement if the singularity of hardware is not the reason why OS X seems to be more stable than other OS.
|
The premise is unprovable. Science requires a falsifiable hypothesis; there is no way to test any of the likely counterhypotheses, such as that Windows would crash less if Apple wrote all of the drivers instead, or that Windows would be more stable if Microsoft somehow cut off support for a vast chunk of the existing supported hardware space. You'd basically have to restart the history of personal computing and have an omnipotent hand to rearrange the facts to drive toward the conclusion you wish to test.
Nevertheless, I believe there is some truth to this argument.
My personal experience is that Linux, FreeBSD and OS X all kernel panic about the same amount, which is to say "rarely." The vast majority of cases where I have been able to diagnose the reason for crash, it has been due to a device driver, but that in turn was due to faulty hardware. When the hardware breaks, it causes the device driver to break, and when something breaks in kernel space, the kernel usually crashes, locks up, or self-diagnoses via some panic/oops/BSOD condition.
As to how that applies to Windows, I think the situation is simply that Windows boxes tend to be built down to an arbitrary price that the marketing department picked. The market is so competitive that corners get cut, so low-end Windows hardware fails more often than happens in our expensive Macs and *ix servers.
You see this often in the *ix worlds. Someone will be complaining about networking problems, then mention that they're using some dodgy on-board MAC chip (RealTek, Broadcom, etc.) and right away, someone will tell them to go get an Intel card.
It is also the case that this extreme price sensitivity in the Windows market means there is less money available for software development talent, so drivers may not be written by the most competent people around. Even when good talent is put on the project, they're going to ship as soon as they've got something that marketing considers sufficiently functional. That team will all be let go, or will go on to another project, so when the 1.0 driver hits the real world and unanticipated problems come up, there isn't a fully-staffed competent development team sitting around to fix those problems.
I mentioned that OS X, FreeBSD and Linux are all roughly comparable in terms of kernel panics per year because it shows that quantity of drivers doesn't explain everything here. Linux has many more drivers than either FreeBSD or OS X, yet it's roughly as stable, as long as you stay away from the really low-end hardware. Linux typically won't run as well on a $500 repurposed Windows PC as on a $1,500 purpose-built Linux server. You're paying for better quality components which cause fewer problems for the driver, which makes it less likely to crash.
If you run Windows on that same $1,500 server, I predict that it will run quite reliably. The days of Windows being unreliable on pretty much all hardware started disappearing with Windows 2000. The problem isn't Windows, per se any more, the problem is with the skinflints driving the Windows market. This is also the source of many other ills, such as "freeware" that sneakily installs predatory software in order to funnel money back to the creators.
Another point about your 85% number: that's not surprising, since a huge amount of what a kernel does is run drivers, and the rest of what it does is mostly generic, and therefore extremely well-debugged. When you have 1,000 different NIC chips to support, you can't expect them to be as well-debugged as when you only support 20 NIC chips. And, your restricted set of 20 NIC chip drivers still won't be as well-debugged as, say, the kernel's message passing code.
| Is hardware helping reducing crashes of OS X? [closed] |
1,552,589,345,000 |
I am trying to compile the TI-Graph Link USB Drivers? So I downloaded it, and ran make in the directory libusb. It produced the following:
~/Téléchargements/tiusb/tiusb-1.10$ make
make -C /lib/modules/`uname -r`/build SUBDIRS=`pwd` modules
make[1]: entrant dans le répertoire « /usr/src/linux-headers-3.13.0-031300-generic »
CC [M] /home/dovakhin/Téléchargements/tiusb/tiusb-1.10/tiusb.o
/home/dovakhin/Téléchargements/tiusb/tiusb-1.10/tiusb.c:36:28: erreur fatale: linux/smp_lock.h : Aucun fichier ou dossier de ce type
compilation terminée.
make[2]: *** [/home/dovakhin/Téléchargements/tiusb/tiusb-1.10/tiusb.o] Erreur 1
make[1]: *** [_module_/home/dovakhin/Téléchargements/tiusb/tiusb-1.10] Erreur 2
make[1]: quittant le répertoire « /usr/src/linux-headers-3.13.0-031300-generic »
make: *** [tiusb.o] Erreur 2
So the fatal error is cannot find linux/smp_lock.h
I'd like to connect my TI 83 to my computer.
|
this is upstream. I've somehow found this topic through an unrelated search :)
The page where Braiam found the "It's intended to be used with kernel 2.4 & 2.6" information, http://lpg.ticalc.org/prj_usb/linux_download.html , correctly states "Note: driver is now longer maintained. Use built-in libusb support in ticables library."
All Linux drivers related to TI calculators produced by the LPG (tipar, tiser, tiusb) were superseded by user-space solutions, in the aforementioned libticables, years before I became the maintainer of the libti* family, in June 2009.
tipar was removed from mainline kernel by commits cb8c9b6de076d981ca22801dbd6bce12b0758468 (November 2007), 755271358cc401eb3db0db52b2c8fb8d71ae4d8f, f557d0996a6f9c06912528ea85e1dba0fb7d485f.
TILP II will enable you to your Linux computer through a SilverLink and a DirectLink. The standard install script for libti* + gfm + tilp is http://lpg.ticalc.org/prj_tilp/download/install_tilp.sh , it has worked for dozens of persons on multiple Linux distros over 5 years.
If your distro isn't Debian or one of its derivatives (Ubuntu, Mint, etc.), you need to edit the script to add --enable-libusb10 at the indicated place. Most other distros do no longer provide proper libusb 0.1 packages, only the 0.1 compat layer for libusb 1.0, which fails to work for the purposes of libticables.
| Fatal error: linux/smp_lock.h: no such file or directory when trying to compile tiusb |
1,552,589,345,000 |
I upgraded kernel on my CentOS 5.8 from 2.6.18 to 3.5.3 and now it is unable to mount the root filesystem:
I could not find any explanation through Google. Can you point me in the right direction? I use Grub 0.97.
I tried to point to the root device in the grup.conf by label, by /dev/hda and by UUID and nothing changed.
I compared the init scripts located in old and new initrd images and they are mostly the same - dm-mem-cache.ko, dm-message.ko and dm-raid45.ko modules are not loaded into the new kernel.
The drivers installed with the new kernel are the same as those with the old one.
|
According to this website (which cites this forum thread), you need to enable a kernel option. First, get into the kernel's menuconfig:
# cd /usr/src/linux
# make clean && make mrproper
# cp /boot/config-`uname -r` /usr/src/linux/.config
# make menuconfig
Then go into the "General settings" section, and include "enable deprecated sysfs features to support old userspace tools" in the kernel. Hit escape a few times until it asks you to save, and say yes. Then build the kernel and install it (the actual path might be different on your system):
# make rpm
# rpm -ivh /usr/src/redhat/RPMS/i386/kernel-2.6.35.10local0-1.i386.rpm
| Kernel upgrade 2.6 to 3.5.3 on CentOS 5.8 -> switchroot: mount failed: No such file or directory |
1,552,589,345,000 |
Kernel module files are located in directories such as
/lib/modules/drivers/
/lib/modules/storage/
/lib/modules/fs/
they all have the extension .ko
but how does the kernel understand that a specific module file belongs to a certain type and should be in a certain directory?
|
The top-level directory for kernel modules is determined by the kernel’s reported version (as shown by uname -r): modules go in /lib/modules/$(uname -r). Modules built alongside the kernel go in a subdirectory of the kernel directory in the top-level directory; modules built later go in a subdirectory of the updates directory.
Inside those directories, kernel modules are installed according to where their source code lives in the tree. Thus all block modules are in the block directory, all fs modules are in the fs directory, etc.
To pick a specific example, /lib/modules/$(uname -r)/kernel/drivers/crypto/padlock-aes.ko is built from drivers/crypto/padlock-aes.c; it’s declared in the relevant Makefile.
Modules are found at installation time by looking for modules.order files which are generated during the build. The implementation lives in scripts/Makefile.modinst.
| How does the kernel understand that a specific module file belongs to a certain type and should be in a certain directory? |
1,552,589,345,000 |
Before start: I replied to a thread on Arch Linux forum about similar issue (https://bbs.archlinux.org/viewtopic.php?id=284076), since I'm on Arch. I'm asking here to get more help and check if anyone using other distributions is having the same issue.
After upgrading the kernel to the current newest on Arch repository, that is 6.5.2-arch1, or the version I used to use, 6.5.2-zen1, I'm experiencing random GPU crash that renders the system virtually unusable because it happens around 5~20 minutes of uptime.
The system journal log showed something like this:
Sep 11 20:00:46 yoohyeon.dc.sidlibrary.org kernel: amdgpu 0000:07:00.0: amdgpu: [gfxhub0] no-retry page fault (src_id:0 ring:24 vmid:1 pasid:32814, for process chrome pid 4073 thread chrome:cs0 pid 4101)
Sep 11 20:00:46 yoohyeon.dc.sidlibrary.org kernel: amdgpu 0000:07:00.0: amdgpu: in page starting at address 0x0000e38dbdd3b000 from IH client 0x1b (UTCL2)
Sep 11 20:00:46 yoohyeon.dc.sidlibrary.org kernel: amdgpu 0000:07:00.0: amdgpu: VM_L2_PROTECTION_FAULT_STATUS:0x00100430
Sep 11 20:00:46 yoohyeon.dc.sidlibrary.org kernel: amdgpu 0000:07:00.0: amdgpu: Faulty UTCL2 client ID: IA (0x2)
Sep 11 20:00:46 yoohyeon.dc.sidlibrary.org kernel: amdgpu 0000:07:00.0: amdgpu: MORE_FAULTS: 0x0
Sep 11 20:00:46 yoohyeon.dc.sidlibrary.org kernel: amdgpu 0000:07:00.0: amdgpu: WALKER_ERROR: 0x0
Sep 11 20:00:46 yoohyeon.dc.sidlibrary.org kernel: amdgpu 0000:07:00.0: amdgpu: PERMISSION_FAULTS: 0x3
Sep 11 20:00:46 yoohyeon.dc.sidlibrary.org kernel: amdgpu 0000:07:00.0: amdgpu: MAPPING_ERROR: 0x0
Sep 11 20:00:46 yoohyeon.dc.sidlibrary.org kernel: amdgpu 0000:07:00.0: amdgpu: RW: 0x0
I tried switching between mesa/proprietary drivers, also between mesa radeon-vulkan and amdvlk, changing the session type (X11/Wayland) chrome uses, or changing the session type for the whole DE (I use KDE Plasma, but based on quick search GNOME users seemed to have the same problem), or adding kernel cmdline parameters suggested on here and there on the web (relax, I referred to documentations for the implications before applying it), such as amdgpu.runpm=0, amdgpu.dpm=0, amdgpu.vm_update_mode=3 and so on, but no luck on any of them or their combinations. Especially, amdgpu.dpm=0 rendered the system unbootable, so I guess that's definitely not the one I was looking for.
The issue happened more frequently when I was using chrome/chromium (with or without vaapi hardware acceleration, and both X11/Wayland session), and when the external monitor (4K2K@60Hz1 + FHD@60Hz1) was attached via USB-C DP Alt and then converted to HDMI by the dock.
Fortunately, downgrading the kernel to 6.4.12-arch1 or 6.4.12-zen1 seemed to make the system stable, and that is why I'm suspecting the new kernel is the problem, and decided to ask here to see if any other distro kernel or vanilla kernel from kernel.org has the same issue. I'm now on linux-lts Arch kernel package (specifically, 6.1.52-1-lts kernel) temporarily to make the system usable, and it is stable so far, but I want to be that early adaptor who keeps living on the almost-newest kernel versions XD
While I will try to bisect what commit may have contributed to this issue with Arch forum's help, any ideas, issue me-tos, or suggestions are welcomed.
Thanks for taking time to read this question and, if you do so, replying/answering it!
|
It seems like there are reports that setting the amdgpu module parameter amdgpu.mcbp=0 fixes the issue for those who were having it since kernel 6.5.
I also found out that the default value for amdgpu.mcbp parameter was changed from 0 (disabled) to -1 (auto) from kernel version 6.5, according to the kernel documentations for versions 6.4 and 6.5 (see 'mcbp' entry of the pages).
Since it's described as a parameter toggling "mid command buffer preemption", I think this is the cause of the issue I was having, considering the log mentioned about graphics VM page fault related to permissions.
| Kernel 6.5.2 seems to have amdgpu crash on no-retry page fault |
1,552,589,345,000 |
I have a NXP Layerscape LS1012A development board (FRWY) running Layerscape, which is essentially just Ubuntu 20.04. I’ve plugged a PCIe WiFi module, Type 1XL by Murata (uses NXP WiFi chip 88W9098), into the PCIe slot on the dev board, and have obtained all the binary files needed to create a driver.
I’m having issues with the ‘make build’ command, and from what I’ve read it’s because I haven’t setup the Kernel correctly to make the build (I’m on kernel 5.10.35). Does anyone know how to properly set/build/prepare the kernel directory so this driver build can execute?
|
In general, the first requirement for building kernel modules (drivers) is to have the build headers for the exact kernel version you are building the drivers for. Depending on distribution, these might be packaged as kernel-headers-<kernel version number> (Fedora/RHEL style) or linux-headers-<kernel version number (Debian/Ubuntu style). Some distributions might omit having a separate package for the headers, and will just require installing the complete kernel source package for building kernel modules (I think SuSE does this, or at least used to).
So, for a Ubuntu-like distribution, if you haven't done a apt-get install linux-headers-$(uname -r), you should do that. You should also do a apt-get install build-essential to ensure you'll have the compiler and all the basic tools required.
One pitfall here is, if you have recently updated the system but not rebooted yet: the package manager will usually allow multiple kernel versions to co-exist, but usually keeps only the newest version of the build headers unless explicitly told to do otherwise. So the package manager might have installed an updated kernel that's waiting to be activated on next reboot, and also updated the build headers to match that kernel... which will stop you from building modules for your current kernel.
Usually, if you are using packaged kernels, and have installed the appropriate package containing the headers for your kernel version, there should be a symbolic link at /lib/modules/$(uname -r)/build, pointing at the directory the headers are located in. Often the third-party module/driver build process can use this to automatically find the build headers for your current kernel.
If you are building your own custom kernels, you can create such a symbolic link yourself: just point it at the root directory of the Linux source code tree you used to build your kernel in. For example:
ln -s /usr/local/src/linux-5.10.35 /lib/modules/5.10.35/build
| Compiling NXP WiFi Driver on Ubuntu |
1,552,589,345,000 |
For a OS project, I am creating a ext2 file system image and mounting it. This means that I am writing out a 1 MB file with block information and then using it as the mount target.
For example, assume there is a file called base.img:
fsck.ext2 base.img # checking my file system
mkdir mnt
sudo mount -o loop base.img mnt
After the mount is successful, what is happening internally? From my understanding, my base.img simply initializes the image correctly. Internally, these are my questions:
Is there now a drive partition with this file system?
How are changes to the file system managed?
For the second, from my understanding, there exists a "mount table" and perhaps an ext2 module that Linux will use for further changes. Will these changes be reflected in base.img or is there a new disk partition for it now?
My underlying question here is: how does this all work, especially with varying implementations and ambiguity?
|
mount -o loop base.img mnt
uses a loop device to make base.img available as a block device, and mounts that block device under mnt. There is no new partition on disk; all changes to mnt are stored in base.img.
If base.img contains an ext2 file system, its contents will indeed be managed by the kernel’s ext2 driver.
| Internal mechanisms of mounting an ext2 file system image and managing changes |
1,552,589,345,000 |
On Debian, I need to build a driver with kernel headers.
$ uname -r
5.10.110
So I tried the easiest method:
$ sudo apt install linux-headers-$(uname -r)
E: Unable to locate package linux-headers-5.10.110
My /etc/apt/sources.list:
deb http://mirrors.163.com/debian bullseye main contrib non-free
deb-src http://mirrors.163.com/debian bullseye main contrib non-free
deb http://mirrors.163.com/debian-security bullseye-security main contrib non-free
deb-src http://mirrors.163.com/debian-security bullseye-security main contrib non-free
deb http://mirrors.163.com/debian bullseye-updates main contrib non-free
deb-src http://mirrors.163.com/debian bullseye-updates main contrib non-free
# This is added by me
deb-src http://deb.debian.org/debian bullseye main
How can I install kernel headers for 5.10.110 version?
Which other version might be a safe bet that complies with 5.10.110 and can be used for custom driver compilation?
|
Your kernel isn’t a Debian kernel, so you should install the kernel headers from wherever you got your kernel.
You might be able to get away with a newer 5.10 release, but you won’t be able to use the Debian-packaged kernel headers — they use a different ABI naming scheme (currently, 5.10.0-21), so you won’t be able to use them to build a kernel module which will load on your 5.10.110 kernel.
Unless you have a specific reason to use your 5.10.110 kernel, your best bet is to install the Debian kernel package and corresponding headers, and use that kernel instead:
sudo apt install linux-image-amd-64 linux-headers-amd64
(replacing amd64 as appropriate).
| Installing kernel headers: not found? |
1,552,589,345,000 |
So I am working on building minimal os using busybox. What I want is I want to run my .net program from BIOS. But I am not sure linux will run .net program or not, so to clear my path I am using C program instead of .net program. I am generating initrd.img file successfully. Now before generating initrd.img file. I want to integrate my hello.c program with init file.
This command I used to read file and which is reading C program code successfully. echo 'cat /etc/hello.c' >> init
Now I want to execute this hello.c. So I tried following command but it not working as cat command.
echo 'gcc -o echo /etc/hello.c' >> init
echo 'chmod +x echo' >> init
echo './echo' >> init
This is the error I am getting:
/init: line 6: gcc: not found
chmod: echo: No such file or directory
/init: line 8: ./echo: not found
|
Your script is failing because you don’t have gcc in your initrd.
You should not ship hello.c in your initrd; you should build the program and ship that instead in your initrd. You should also specify the full path to your program when attempting to run it.
| How to integrate C program with init file? |
1,552,589,345,000 |
My Ubuntu has performed an unattended upgrade from 5.4.0-1091-azure to 5.4.0-1094-azure kernels. I suspect this might had an effect on the performance of my Java application and I'd like to find a detailed list of changes in between the two versions. I have found a changelog for 5.4.0 but this is in the past. Can someone help me what's the best way to get a brief overview of the changes?
|
You can find the changelog on the linux-azure-5.4 source package page; specifically, this is the changelog for 1094:
* CVE-2022-2602
- SAUCE: io_uring/af_unix: defer registered files gc to io_uring release
- SAUCE: io_uring/af_unix: fix memleak during unix GC
* CVE-2022-41674
- SAUCE: wifi: cfg80211: fix u8 overflow in
cfg80211_update_notlisted_nontrans()
- SAUCE: wifi: cfg80211/mac80211: reject bad MBSSID elements
- SAUCE: wifi: cfg80211: ensure length byte is present before access
- SAUCE: wifi: mac80211_hwsim: avoid mac80211 warning on bad rate
- SAUCE: wifi: cfg80211: update hidden BSSes to avoid WARN_ON
* CVE-2022-42721
- SAUCE: wifi: cfg80211: avoid nontransmitted BSS list corruption
* CVE-2022-42720
- SAUCE: wifi: cfg80211: fix BSS refcounting bugs
| How to find out changelog in between 5.4.0-1091-azure and 5.4.0-1094-azure kernels? |
1,552,589,345,000 |
I want to know what security features is added or improved in each Linux kernel release, is there anything like "security change log"?
I couldn't find it on the internet, the only thing I found is this: https://github.com/iovisor/bcc/blob/master/docs/kernel-versions.md but it's for eBPF so it's not everything I'm looking for.
|
I’m not aware of an “official” change log of security improvements in the Linux kernel, but Kees Cook sometimes publishes blog posts summarising improvements in a specific release. His latest post on the topic covers security improvements in 5.10 and has links to posts on earlier versions.
| Linux kernel changelog for security features |
1,552,589,345,000 |
For compiling the linux kernel, If I do
make_runner.sh && echo "hello"
it prints hello even if some of the kernel compilation fails.
Is there a way for it to only print if all of the compilation targets built correctly?
Where make_runner.sh is the following:
#!/usr/bin/env bash
set -xe
make O=out ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- vendor/citrus-perf_defconfig
make O=out ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- -j$(nproc --all) 2>&1 | tee kernel.log
|
Because of the pipe to tee, the second make’s exit status is ignored.
To get the behaviour you want, you need to enable pipefail: change the set -xe line to
set -xe -o pipefail
See Debugging scripts, what is the difference between -x to set -euxo pipefail? for details.
| make && echo "hello" only print hello when make succeeds (kernel) |
1,552,589,345,000 |
As far as I understand it does not even touches the filesystem.
So what can be a cause for this, using strace -T:
0.481441 getcwd("/home/user/web/url.com/public_html", 4096) = some number
I am using Linux 4.9.30.
The system has some strange lags, i want to identify it.
Cpu, iowait, load, memory, all seems to be normal
It is a kvm virtual machine, maybe that changes something.
|
We found out, that it was a faulty SSD.
These were the commands that helped to identify it:
$ ioping -c 20 /home/jsaak/temp/
min/avg/max/mdev = 1.00 ms / 5.71 ms / 29.3 ms / 7.62 ms
$ fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=fiotest --filename=testfio --bs=4k --iodepth=64 --size=32M --readwrite=randrw --rwmixread=75
read : io=24608KB, bw=3136.8KB/s, iops=784, runt= 7845msec
write: io=8160.0KB, bw=1040.2KB/s, iops=260, runt= 7845msec
| How is it possible that getcwd() takes sometimes half a second, according to strace? |
1,552,589,345,000 |
I'm looking to test a DirtyPipe PoC and I need a vulnerable kernel version (5.8-5.15) to test on. I'm running an Alpine container in Docker for this purpose however am open to other Linux distros (such as Debian) if it'll be easier to setup there. The only way I can come up with that would work for this purpose is personally compiling the kernel but I'd rather not.
|
You're misunderstanding what a container is:
It's your Linux kernel giving a process (and all of its children) a different view on filesystem, users, network, IPC,…. But it's not a separate kernel!
So, your only choice to run a different kernel is to boot into that kernel. Either physically booting a different Linux, or by booting in a VM. Of course, setting up a VM is much faster (especially in times of vagrant), but I'm not sure whether the nested page approach inherent to VMs would not make your DirtyPipe less likely to succeed.
| How to downgrade the kernel in Alpine Linux (in Docker)? |
1,552,589,345,000 |
I am trying to compile linux kernel (version 4.4) with KASAN support on a 32 bits machine, but i can't enable it. It seems that it depends on 64 bits architecture only.
So my question is about the possibility of using KASAN in 32 bits architecture CONFIG_x86 ?? Is there a relation between KASAN and 64 bits arch ??
|
As the documentation says:
Currently KASAN is supported only for the x86_64 and arm64 architectures.
| KASAN config in 32 bits architecture? |
1,552,589,345,000 |
I had a system running Ubuntu-16.04 with a customized RT kernel version 4.4.
After upgrading the operating system to Ubuntu-20.04, I'm still running the same kernel due to its customizations.
Is it ok to run the new OS with the old kernel?
|
There will be lots of security updates since that 6 year old kernel was released. It's also crawling all over EOL. For that reason alone, no.
There is also the possibility that new syscalls will have been created and if any of the newly installed software tries to call them, then that will fail.
You really want to update the kernel.
| Is it fine to use old kernel with a newer operating system? [closed] |
1,552,589,345,000 |
I am tring to install nvidia driver by the following command.
sudo ./NVIDIA-Linux-x86_64-418.43.run --dkms -s
Here I got an error as follows.
ERROR: Failed to run `/sbin/dkms build -m nvidia -v 418.43 -k 3.10.0-1062.el7.x86_64`: Error! echo
Your kernel headers for kernel 3.10.0-1062.el7.x86_64 cannot be found at
/lib/modules/3.10.0-1062.el7.x86_64/build or /lib/modules/3.10.0-1062.el7.x86_64/source.
You can use the --kernelsourcedir option to tell DKMS where it's located.
ERROR: Failed to install the kernel module through DKMS. No kernel module was installed; please try installing again without DKMS, or check the DKMS logs for more
information.
However, /lib/modules/3.10.0-1062.el7.x86_64/build and /lib/modules/3.10.0-1062.el7.x86_64/source are both in my /lib/modules path.
# cd /lib/modules/3.10.0-1062.el7.x86_64
# ls -la
lrwxrwxrwx. 1 root root 39 7月 2 11:11 build -> /usr/src/kernels/3.10.0-1062.el7.x86_64
lrwxrwxrwx. 1 root root 5 7月 2 11:11 source -> build
I have tried sudo yum install "kernel-devel-uname-r == $(uname -r)" in a similar question which doesn't work, it said
No package kernel-devel-uname-r == 3.10.0-1062.el7.x86_64 available
This is my output of uname -r
3.10.0-1062.el7.x86_64
And this is the kernel related packages
kernel.x86_64 3.10.0-1062.el7
kernel.x86_64 3.10.0-1160.31.1.el7
kernel-devel.x86_64 3.10.0-1160.31.1.el7
kernel-headers.x86_64 3.10.0-1160.31.1.el7
How can I solve this?
|
The simplest option would appear to be a reboot, so that the running kernel matches the installed headers (1160.31.1).
Otherwise you’d have to find the header package for your older kernel (1062).
| Your kernel headers for kernel 3.10.0-1062.el7.x86_64 cannot be found |
1,552,589,345,000 |
In the linux kernel I found the following lines in the main.c file:
if (!try_to_run_init_process("/sbin/init") ||
!try_to_run_init_process("/etc/init") ||
!try_to_run_init_process("/bin/init") ||
!try_to_run_init_process("/bin/sh"))
return 0;
panic("No working init found. Try passing init= option to kernel. "
"See Linux Documentation/admin-guide/init.rst for guidance.");
I wonder how can I change the init program's path to something else, system/init for example.
Any help will be appreciated!!
|
From https://www.kernel.org/doc/html/v5.11/admin-guide/kernel-parameters.html
init= [KNL]
Format: <full_path>
Run specified binary instead of /sbin/init as init
process.
system/init is not a valid path (misses the root slash), it must be something like init=/system/init
| Change init program location in linux |
1,552,589,345,000 |
Our server started to crash almost each day when the traffic is higher during the peak hours, the syslog is always spammed by a few eth0 resets and then the network crashes completely and the machine has to be rebooted in order to gain remote access to the machine again.
Does this error mean that the NIC card is dead or is it just a software issue ?
Running kernel: 4.19.0-10-amd64
OS: Debian 10
Jan 25 18:00:41 Debian-83-jessie-64-minimal kernel: [161879.702795] e1000e 0000:00:1f.6 eth0: Reset adapter unexpectedly
Jan 25 18:00:45 Debian-83-jessie-64-minimal kernel: [161883.545928] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
Jan 25 18:04:41 Debian-83-jessie-64-minimal kernel: [162119.835193] e1000e 0000:00:1f.6 eth0: Reset adapter unexpectedly
Jan 25 18:04:45 Debian-83-jessie-64-minimal kernel: [162123.214074] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
Jan 25 18:05:50 Debian-83-jessie-64-minimal kernel: [162188.695254] e1000e 0000:00:1f.6 eth0: Reset adapter unexpectedly
Jan 25 18:05:54 Debian-83-jessie-64-minimal kernel: [162192.610229] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
Jan 25 18:06:14 Debian-83-jessie-64-minimal kernel: [162212.759251] e1000e 0000:00:1f.6 eth0: Reset adapter unexpectedly
Jan 25 18:06:18 Debian-83-jessie-64-minimal kernel: [162216.990139] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
Jan 25 18:07:27 Debian-83-jessie-64-minimal kernel: [162285.975361] e1000e 0000:00:1f.6 eth0: Reset adapter unexpectedly
Jan 25 18:07:31 Debian-83-jessie-64-minimal kernel: [162289.814340] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
Jan 25 18:07:47 Debian-83-jessie-64-minimal kernel: [162305.687558] e1000e 0000:00:1f.6 eth0: Reset adapter unexpectedly
Jan 25 18:07:51 Debian-83-jessie-64-minimal kernel: [162309.506389] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
Jan 25 18:07:59 Debian-83-jessie-64-minimal systemd[1]: session-247.scope: Succeeded.
Jan 25 18:08:48 Debian-83-jessie-64-minimal kernel: [162366.871583] e1000e 0000:00:1f.6 eth0: Reset adapter unexpectedly
Jan 25 18:08:52 Debian-83-jessie-64-minimal kernel: [162370.734613] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
Jan 25 18:09:01 Debian-83-jessie-64-minimal CRON[27975]: (root) CMD ( [ -x /usr/lib/php5/sessionclean ] && /usr/lib/php5/sessionclean)
Jan 25 18:09:01 Debian-83-jessie-64-minimal CRON[27974]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jan 25 18:09:01 Debian-83-jessie-64-minimal systemd[1]: Starting Clean php session files...
Jan 25 18:09:01 Debian-83-jessie-64-minimal systemd[1]: phpsessionclean.service: Succeeded.
Jan 25 18:09:01 Debian-83-jessie-64-minimal systemd[1]: Started Clean php session files.
Jan 25 18:09:42 Debian-83-jessie-64-minimal kernel: [162420.891568] e1000e 0000:00:1f.6 eth0: Reset adapter unexpectedly
Jan 25 18:09:46 Debian-83-jessie-64-minimal kernel: [162424.734698] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
Jan 25 18:10:57 Debian-83-jessie-64-minimal kernel: [162495.895693] e1000e 0000:00:1f.6 eth0: Reset adapter unexpectedly
Jan 25 18:11:01 Debian-83-jessie-64-minimal kernel: [162499.750608] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.895786] e1000e 0000:00:1f.6 eth0: Reset adapter unexpectedly
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.915877] ------------[ cut here ]------------
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.915964] kernel BUG at drivers/net/ethernet/intel/e1000e/netdev.c:3804!
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.916048] invalid opcode: 0000 [#1] SMP PTI
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.916126] CPU: 0 PID: 5 Comm: kworker/0:0 Tainted: G W 4.19.0-10-amd64 #1 Debian 4.19.132-1
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.916222] Hardware name: FUJITSU D3401-H1/D3401-H1, BIOS V5.0.0.11 R1.7.0.SR.2 for D3401-H1x 11/25/2015
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.916328] Workqueue: events e1000_reset_task [e1000e]
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.916410] RIP: 0010:e1000_flush_desc_rings+0x2a9/0x2f0 [e1000e]
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.916486] Code: ff ff 31 c0 31 ed 66 41 89 45 20 e9 a8 fe ff ff 4c 89 e7 e8 89 f3 ff ff e9 af fe ff ff 4c 89 e7 e8 7c f3 ff ff e9 30 fe ff ff <0f> 0b 4c 89 e7 e8 6d f3 ff ff eb ac 4c 89 e7 e8 63 f3 ff ff e9 68
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.916615] RSP: 0018:ffffaf708629fde0 EFLAGS: 00010202
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.916689] RAX: 0000000000000067 RBX: ffff9043211f48c0 RCX: 000000000000007d
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.916780] RDX: 0000000000000067 RSI: 0000000000000246 RDI: 0000000000000246
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.916872] RBP: 000000003103f0fa R08: 0000000000000002 R09: ffffaf708629fdc4
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.916963] R10: 00000000000000fe R11: 0000000000000000 R12: ffff9043211f4e38
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917055] R13: ffff90432a33f800 R14: 0000000004008000 R15: ffff9043211f4940
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917147] FS: 0000000000000000(0000) GS:ffff904331200000(0000) knlGS:0000000000000000
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917240] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917315] CR2: 00007f31849487f8 CR3: 00000005a660a003 CR4: 00000000003606f0
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917406] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917497] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917588] Call Trace:
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917663] e1000e_reset+0x574/0x790 [e1000e]
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917743] e1000e_down+0x1cf/0x200 [e1000e]
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917819] e1000e_reinit_locked+0x46/0x60 [e1000e]
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917898] process_one_work+0x1a7/0x3a0
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.917974] worker_thread+0x30/0x390
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.918046] ? create_worker+0x1a0/0x1a0
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.918118] kthread+0x112/0x130
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.918188] ? kthread_bind+0x30/0x30
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.918260] ret_from_fork+0x35/0x40
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.918331] Modules linked in: unix_diag ip6t_rpfilter ipt_rpfilter binfmt_misc veth ip6t_MASQUERADE ipt_MASQUERADE xt_CHECKSUM xt_comment xt_tcpudp bridge stp llc dm_mod ebtable_filter ebtables ip6table_raw ip6table_mangle ip6table_nat nf_nat_ipv6 ip6table_filter ip6_tables iptable_raw iptable_mangle iptable_nat nf_nat_ipv4 nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter nf_tables nfnetlink cpufreq_conservative cpufreq_userspace cpufreq_powersave fuse intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul evdev crc32_pclmul ghash_clmulni_intel intel_cstate intel_uncore squashfs iTCO_wdt pcc_cpufreq sg iTCO_vendor_support intel_pch_thermal intel_rapl_perf fujitsu_laptop wmi loop sparse_keymap video acpi_pad button ip_tables x_tables autofs4
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.918698] ext4 crc16 mbcache jbd2 crc32c_generic fscrypto ecb btrfs zstd_decompress zstd_compress xxhash raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid0 multipath linear raid1 md_mod sd_mod crc32c_intel ahci xhci_pci libahci xhci_hcd libata aesni_intel e1000e usbcore scsi_mod aes_x86_64 crypto_simd cryptd glue_helper i2c_i801 usb_common thermal fan
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.918920] ---[ end trace fc8f12793b39335d ]---
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.918998] RIP: 0010:e1000_flush_desc_rings+0x2a9/0x2f0 [e1000e]
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.919078] Code: ff ff 31 c0 31 ed 66 41 89 45 20 e9 a8 fe ff ff 4c 89 e7 e8 89 f3 ff ff e9 af fe ff ff 4c 89 e7 e8 7c f3 ff ff e9 30 fe ff ff <0f> 0b 4c 89 e7 e8 6d f3 ff ff eb ac 4c 89 e7 e8 63 f3 ff ff e9 68
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.919206] RSP: 0018:ffffaf708629fde0 EFLAGS: 00010202
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.919281] RAX: 0000000000000067 RBX: ffff9043211f48c0 RCX: 000000000000007d
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.919372] RDX: 0000000000000067 RSI: 0000000000000246 RDI: 0000000000000246
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.919464] RBP: 000000003103f0fa R08: 0000000000000002 R09: ffffaf708629fdc4
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.919555] R10: 00000000000000fe R11: 0000000000000000 R12: ffff9043211f4e38
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.919647] R13: ffff90432a33f800 R14: 0000000004008000 R15: ffff9043211f4940
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.919739] FS: 0000000000000000(0000) GS:ffff904331200000(0000) knlGS:0000000000000000
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.919851] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.919937] CR2: 00007f31849487f8 CR3: 00000005a660a003 CR4: 00000000003606f0
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.920030] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Jan 25 18:12:01 Debian-83-jessie-64-minimal kernel: [162559.920123] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
|
kernel BUG at drivers/net/ethernet/intel/e1000e/netdev.c:3804!
kernel: [162559.916048] invalid opcode: 0000 [#1] SMP PTI
kernel: [162559.916126] CPU: 0 PID: 5 Comm: kworker/0:0 Tainted: G W 4.19.0-10-amd64 #1 Debian 4.19.132-1
kernel: [162559.916222] Hardware name: FUJITSU D3401-H1/D3401-H1, BIOS V5.0.0.11 R1.7.0.SR.2 for D3401-H1x 11/25/2015
kernel: [162559.916328] Workqueue: events e1000_reset_task [e1000e]
kernel: [162559.916410] RIP: 0010:e1000_flush_desc_rings+0x2a9/0x2f0 [e1000e]
You're running Debian's distribution kernel, which has some patches applied on top of the upstream source, so my quick analysis might not be entirely accurate. But looking at line 3804 of drivers/net/ethernet/intel/e1000e/netdev.c in 4.19.170 upstream source brings us to this line:
BUG_ON(tdt != tx_ring->next_to_use);
This would trigger the kernel BUG at... message with the stack trace and all that stuff if the specified condition is true.
That line is in function e1000_flush_tx_ring(), which is called by function e1000_flush_desc_rings() which in turn is mentioned as the instruction pointer location in the bug message:
RIP: 0010:e1000_flush_desc_rings+0x2a9/0x2f0 [e1000e]
Perhaps the compiler has inlined or otherwise optimized the e1000_flush_tx_ring() function so that it is not apparent as an identifiable symbol for the RIP: line. But it seems to match: the call trace strongly suggests that the driver was in the process of resetting the NIC, and flushing the TX ring is clearly part of that process.
But what makes the reset necessary? It turns out that Intel has published a specification update for the I218/I219 NICs.
5.Buffer Overrun While the I219 is Processing DMA Transactions
Problem:Intel® 100/200 Series Chipset platforms reduced the round-trip latency for the LAN Controller DMA accesses, causing in some high-performance cases a buffer overrun while the I219 LAN Connected Device is processing the DMA transactions.
Implication:I219LM and I219V devices can fall into unrecovered Tx hang under very stressfully UDP traffic and multiple reconnection of Ethernet cable. This Tx hang of the LAN Controller is only recovered if the system is rebooted.
Workaround:Slightly slow down DMA access by reducing the number of outstanding requests.This workaround could have an impact on TCP traffic performance and could reduce performance up to 5 to 15% (depending) on the platform. Disabling TSO eliminates performance loss for TCP traffic without a noticeable impact on CPU performance.
Status: Intel® 100/200 Series Chipsets – NoFix
Intel® 300 Series Chipsets - Fixed
So the root cause seems to be a hardware (or possibly NIC firmware) bug. The driver finds that the structure of the TX ring buffer has been corrupted, and assumes the cause is a fault in the driver. But in this case, it seems the fault is in the NIC itself.
The recommended workaround is to disable the TCP Segmentation Offload feature (tso) of the NIC:
ethtool -K eth0 tso off
The Fujitsu D3401-H1 seems to have a Intel Core i7-6700 processor, which is of the Skylake generation... so I would expect the Intel 100 series chipset along with it. It looks like there is no fix available for that chipset, and so you'll probably need to apply the workaround.
| kernel BUG at drivers/net/ethernet/intel/e1000e/netdev.c:3804! [duplicate] |
1,552,589,345,000 |
we have rhel servers with version 7.2 and kernel versions - 3.10.0-327.el7
since we have network connectivity issues per as described on Red Hat case , we decided to upgrade the kernel from 3.10.0-327.el7 to kernel-3.10.0-1127
but on the next month we also preparing to upgrade the rhel version from 7.2 to 7.6
and rhel 7.6 include the kernel version = 3.10.0-957
so I not sure if we have conflicts here ?
|
RHEL/Fedora/CentOS allow to coinstall as many Linux kernel versions as you need.
| kernel upgrade on very old rhel machines versions |
1,552,589,345,000 |
Dear friends and college
we have VM machines with rhel 7.2 version - 3.10.0-327.el7.x86_64
we noticed about the following messages ( from /var/log/messages )
e1000 0000:02:01.0 eth0: Detected Tx Unit Hang#012 Tx Queue <0>#012 TDH <45>#012 TDT
and from dmesg we get that
[21519947.519425] e1000 0000:02:01.0 eth0: Detected Tx Unit Hang
Tx Queue <0>
TDH <45>
TDT <45>
next_to_use <26>
next_to_clean <45>
buffer_info[next_to_clean]
time_stamp <6032d5901>
next_to_watch <47>
jiffies <6032d75ab>
next_to_watch.status <0>
[21519949.521583] e1000 0000:02:01.0 eth0: Detected Tx Unit Hang
Tx Queue <0>
TDH <45>
TDT <45>
next_to_use <26>
next_to_clean <45>
buffer_info[next_to_clean]
time_stamp <6032d5901>
next_to_watch <47>
jiffies <6032d7d7e>
next_to_watch.status <0>
[21519949.811366] e1000 0000:02:01.0 eth0: Reset adapter
[21519949.855081] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
we try to search the solution for the problem above and we see post about the following fixing
set following in /etc/sysctl.conf, and reboot machine
pcie_aspm=offet ( https://serverfault.com/questions/193114/linux-e1000e-intel-networking-driver-problems-galore-where-do-i-start )
or
ethtool -K eth0 tso off gso off
or
changed the network adapters tor VMNETX3.
and so on ....
so we are confuse about the right solution
please advice what is the right approach for our problem ?
|
This is a known issue with older kernels (Bugzilla 1288237). The fix has been backported into newer kernsla and is tracked under the following security advisories:
RHSA-2020:1016
RHSA-2019:3979
This problem is believed to have been introduced by the following upstream commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b4ded8327fea82b53fcec39e0845011246d020f4
With kernels older than 3.10.0-514.el7, some users report that the behavior stops occurring when the Scatter-Gather offload engine on the affected interface was disabled via ethtool:
# ethtool -K <interface> sg off
For more information check out the Knowledgebase article from Red Hat: https://access.redhat.com/solutions/2070703
In general, due to the stable ABI and API interfaces provided by RHEL there is seldom any benefit in running out of date software and one should update to the latest patch release for the major version being run (e.g. RHEL 7, RHEL &).
| rhel + eth0: Detected Tx Unit Hang |
1,604,774,249,000 |
I've read the man pages on fork(), and they say something along the lines of "all file descriptors open in the calling process are copied".
It is not 100% clear to me if the file descriptor for the executable binary that the calling process is executing at that point in time is included in that statement.
I know the man pages say "all file descriptors", but I'm asking this because it would seem easier to me to open() the same executable binary for the forked process, rather than synchronizing two processes working with them.
So if they are indeed also copied, why?
|
There's no file descriptor to the binary file being executed, only memory mappings.
(See, e.g. ls -l /proc/self/fd and cat /proc/self/maps on Linux.)
The memory mappings will point to the same file, of course, but that's what happens with shared libraries, too. In the case of the main program file, on Linux, writes to it while it's being used by a running process are not allowed. (Though the last time I checked, that didn't apply to shared libraries.)
| Does fork() also copy the file descriptor for the executable binary that the calling process is currently executing? |
1,604,774,249,000 |
I am trying to use the the Linux Kernel crc32 generation facility. I need to do a crc32 of some data to be sent over the wire (independent of any transport methodologies) to an embedded system. The embedded system has a CRC32 engine that calculates the CRC32 of data in a manner that is the same or very similar to that of the kernel. However, all crc related headers related to the kernel are not present in /usr/include/linux and any attempts to manually place them there results in compile time errors. Either missing dependent headers or missing macros.
Doing some searching around isn't yielding any useful results.
|
The kernel’s CRC functions are available to the kernel (including modules), but nowhere else. Since you’re referring to /usr/include/linux I’m assuming you want to use them from a program outside the kernel.
There are two solutions available to you:
if your program’s license is compatible with the kernel’s license, you could copy lib/crc32.c to your project and adjust it to suit;
you can use another implementation of CRC32 (assuming it’s compatible with the target) — zlib has one, with a different license.
| Linux kernel crc32.h missing from /usr/include/linux |
1,604,774,249,000 |
I have two processes P1 (sender) and P2 (receiver). P1 uses unix-domain-socket (UDS) to send data to P2. what will happen if P1 sends data at the rate of 100 messages/second and P2 is capable to receive 50 messages/second. Both are non-blocking sockets.
What is happening in the above scenario? will p1 or p2 face memory exhaust after some time?
team, kindly explain what will happen under the hood in the above scenario.
thanks.
|
If the receiver is not reading as fast as the sender sends, then the sockets buffers fill up after a while.
When assuming a datagram socket type a blocking socket would block if the buffers are full and thus implicitly slow down the sender. With a non-blocking socket the sending of a message simply would fail and EAGAIN would be returned as error by send. Note that this is true only for unix domain sockets of type datagram. With UDP sockets the send will succeed and messages would simply be lost.
With a stream socket a partial message might be written, no matter if the socket is blocking or non-blocking. The sender needs to check how many bytes are actually written (return of send) and make sure to send the remaining data later. With a non-blocking socket the send also could fail completely with EAGAIN, with a blocking socket it would instead block and wait for the receiver reading some data in order to have space again in the socket buffer.
| what will happen if receiver unable to handle data velocity through socket? |
1,604,774,249,000 |
I have a multi threaded environment so parallel write to eventfd is possible. Is parallel write to eventfd is safe? Is there any official doc that explains this behavior of eventfd.
|
If you take a look at the kernel sources (here 5.4.48), you can find the implementation of the functions that handle reads from/writes to eventfd file descriptors:
// fs/eventfd.c
static ssize_t eventfd_read(struct file *file, char __user *buf, size_t count,
loff_t *ppos)
{
struct eventfd_ctx *ctx = file->private_data;
...
spin_lock_irq(&ctx->wqh.lock);
static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t count,
loff_t *ppos)
{
struct eventfd_ctx *ctx = file->private_data;
...
spin_lock_irq(&ctx->wqh.lock);
The implementation has internal locking, which will make it thread safe.
| is parallel write to eventfd is safe? |
1,604,774,249,000 |
Initially, My approach was to re-compile whole kernel from scratch but all hopes went down the moment I found out that it requires large amount of disk space.
Now, I'm trying to figure out how to compile only part of it.
The file I modified is net/ipv4/tcp_ipv4.c
I then followed following steps but lost at middle,
Downloaded kernel source files to /home/linux
ran cp /boot/config-$(uname -r) .config
make oldconfig
make scripts prepare modules_prepare
apt-get install linux-headers-$(uname -r)
make -C . M=net/ipv4
make net/ipv4/tcp_ipv4.c
I don't know what to do next as the answers found on Stackoverflow are describing about building custom made modules.
An answer found on Stackoverflow (LINK) describes that it can't be done, and that it's only possible to compile whole Kernel.
"It can't be done. Just compile the whole kernel. After the first
compilation, make will ensure only changed files are recompiled so
future builds will be fast."
I had thought about using Google Drive as the HDD for full compile but it looks like there are lack of options doing that as-well.
My last option would be resizing the whole server.
Edit:
I entered into /net/ipv4 dir via CD and tried
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules_install
and it outputs
Building modules, stage 2.
MODPOST 61 modules
FATAL: parse error in symbol dump file
make[1]: *** [scripts/Makefile.modpost:94: __modpost] Error 1
make: *** [Makefile:1632: modules] Error 2
make: Leaving directory '/usr/src/linux-headers-5.4.0-26-generic'
|
If you look at net/ipv4/Makefile, you’ll see that tcp_ipv4.o is part of obj-y, which means it can only be built as part of the kernel, it can’t be built as a module.
If you want your changes to be taken into account, you’ll have to rebuild the complete kernel. Since you’re short of disk space, you can build only the kernel, install that, then clean the build tree and build the modules, and install them; that will require a little less disk space.
| How to compile only net/ipv4 of Linux Kernel? |
1,604,774,249,000 |
Thank you for reading this question.
I was trying to compile a kernel module that works with sysfs, and while executing make I ended up with this error. Can somebody please help me understand what this error means?
/usr/src/linux-headers-4.19.0-9-common/include/linux/build_bug.h:29:45: error: negative width in bit-field ‘<anonymous>’
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
followed by
/usr/src/linux-headers-4.19.0-9-common/include/linux/kernel.h:1051:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
BUILD_BUG_ON_ZERO((perms) & 2) + \
^~~~~~~~~~~~~~~~~
/usr/src/linux-headers-4.19.0-9-common/include/linux/sysfs.h:103:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’
.mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
^~~~~~~~~~~~~~~~~~~~~~~~
/home/bkkarthik/Workspace/tasks/task09/helloworld.c:76:45: note: in expansion of macro ‘__ATTR’
static struct kobj_attribute id_attribute = __ATTR(id, 0666, id_show, id_store);
I am relatively new to Linux kernel programming, I am not aware of what information you need to assess this situation. Please feel free to ask for further information if needed. Thanks in advance :)
|
This specific error isn’t particularly important, it’s a “trick” used to break the build if a given value is determined to be zero. To understand why the build is failing, you need to look at the next error message, which should include
note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
followed by the expression which caused the error.
In your case, the build is failing because you’re specifying a world-writable mode, 0666; you should set at most 0664.
| negetive width in bit field '<anonymous>' while running 'make' |
1,604,774,249,000 |
I'm currently reading the book called Linux Device Drivers, Third Edition, here is a link to it, but I'm sure that most of you that experienced are already familiar with it:
https://lwn.net/Kernel/LDD3/
I just got to Chapter 2. And generally speaking, it's about setting up the basic kernel programming environment. For educational purposes, this book almost all the time (except one example at the end) relies only on built-in hardware, like discs, etc. Therefore my question is:
Can I use a virtual machine (I'm currently using Ubuntu 18.04 on VirtualBox with 5.3 Kernel) for this book? I know that VMs have their own Kernels. So can I go through this book, write char drivers, etc using the VirtualBox instead of a real machine? And is it safe? Because the main reason I want to do this is to avoid damaging my girl system. For now I, unfortunately, don't have any additional hardware on which I could run another system to test things on. Would a Ubuntu VM be enough for that book?
NOTE: I have seen similar posts but I would like to make another one because here I specify what I'm going to do with it, that is, follow the examples of this book. Therefore ask is a VM is enough at least for THOSE examples.
|
Yes, you can do all that on a VM, and yes, it is safe inasmuch as it will prevent you from damaging your system. You can do all the examples on virtualized hardware. Be aware, though, that the kernel has evolved quite a bit since the publication of that book, so you may have to adapt a few bits when working on a current kernel.
| Can I use a Virtual Machine for Linux Kernel Drivers Development? |
1,604,774,249,000 |
we have rhel 7.5 machines , that perform unexpected reboot
before the reboot we can see the following lines from /var/log/messages file
any idea how this lines indicate about the machine reboot?
May 8 21:46:01 server_mng kernel: system 00:00: [io 0x1000-0x103f] could not be reserved
May 8 21:46:01 server_mng kernel: system 00:00: [io 0x1040-0x104f] has been reserved
May 8 21:46:01 server_mng kernel: system 00:00: [io 0x0cf0-0x0cf1] has been reserved
May 8 21:46:01 server_mng kernel: system 00:04: [mem 0xfed00000-0xfed003ff] has been reserved
May 8 21:46:01 server_mng kernel: system 00:05: [io 0xfce0-0xfcff] has been reserved
May 8 21:46:01 server_mng kernel: system 00:05: [mem 0xf0000000-0xf7ffffff] has been reserved
May 8 21:46:01 server_mng kernel: system 00:05: [mem 0xfe800000-0xfe9fffff] has been reserved
May 8 21:46:01 server_mng kernel: pnp: PnP ACPI: found 6 devices
May 8 21:46:01 server_mng kernel: ACPI: bus type PNP unregistered
May 8 21:46:01 server_mng kernel: pci 0000:00:15.0: BAR 15: assigned [mem 0xc0000000-0xc01fffff 64bit pref]
May 8 21:46:01 server_mng kernel: pci 0000:00:16.0: BAR 15: assigned [mem 0xc0200000-0xc03fffff 64bit pref]
May 8 21:46:01 server_mng kernel: pci 0000:00:0f.0: BAR 6: assigned [mem 0xc0400000-0xc0407fff pref]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.3: BAR 13: no space for [io size 0x1000]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.3: BAR 13: failed to assign [io size 0x1000]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.4: BAR 13: no space for [io size 0x1000]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.4: BAR 13: failed to assign [io size 0x1000]
May 8 21:46:01 server_mng kernel: pci 0000:00:01.0: PCI bridge to [bus 01]
May 8 21:46:01 server_mng kernel: pci 0000:02:01.0: BAR 6: assigned [mem 0xfd500000-0xfd50ffff pref]
May 8 21:46:01 server_mng kernel: pci 0000:00:11.0: PCI bridge to [bus 02]
May 8 21:46:01 server_mng kernel: pci 0000:00:11.0: bridge window [io 0x2000-0x3fff]
May 8 21:46:01 server_mng kernel: pci 0000:00:11.0: bridge window [mem 0xfd500000-0xfdffffff]
May 8 21:46:01 server_mng kernel: pci 0000:00:11.0: bridge window [mem 0xe7b00000-0xe7ffffff 64bit pref]
May 8 21:46:01 server_mng kernel: pci 0000:03:00.0: BAR 6: assigned [mem 0xfd400000-0xfd40ffff pref]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.0: PCI bridge to [bus 03]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.0: bridge window [io 0x4000-0x4fff]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.0: bridge window [mem 0xfd400000-0xfd4fffff]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.0: bridge window [mem 0xc0000000-0xc01fffff 64bit pref]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.1: PCI bridge to [bus 04]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.1: bridge window [io 0x8000-0x8fff]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.1: bridge window [mem 0xfd000000-0xfd0fffff]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.1: bridge window [mem 0xe7800000-0xe78fffff 64bit pref]
May 8 21:46:01 server_mng kernel: pci 0000:00:15.2: PCI bridge to [bus 05]
|
Those messages are the result of the system scanning the hardware configuration and assigning system resources to various devices. Normally you'll see these messages logged in an early part of the boot-up sequence, basically just after the bootloader has loaded the kernel and started it.
If the system would assign the resources incorrectly, it might cause the system to crash immediately. In that case, the last messages logged/displayed before the crash might be helpful to kernel developers to identify which resource allocation was done incorrectly, and the nature of the incorrect allocation (Overlapping assignments? Trying to assign a configuration that makes no sense? Something else?). If you selected a more verbose boot process (in RHEL, typically removing the boot options rhgb and quiet), all these messages would appear as boot messages.
If the system has hot-pluggable PCI/PCI-X/PCIe/Thunderbolt devices, you might see a smaller group of similar messages at hot-plug time. But the facts that there are both PnP ACPI resource allocations and PCI ones, and that there are messages for so many different PCI devices, support the conclusion that these messages are probably from the boot process. A PCI hot-plug event would generally produce a group of messages with a more limited set of PCI device ID numbers.
This output looks like it's scanning for basically all the (virtual) devices the (virtual) machine has, and that usually only happens at boot time.
When troubleshooting an unexpected system crash, usually the messages logged just before the reboot, if any are available, are the most useful in finding out the cause of the crash.
If there aren't any abnormal messages logged from before the reboot, it might mean that the problem has been detected at the level of the virtualization host, and it has killed and restarted the VM - the VM-level equivalent of kill -9, of sorts. Or it might mean that the problem affected the storage driver, and so the kernel had no way to get the error message written into the logs.
| rhel unexpected reboot + messages file |
1,604,774,249,000 |
from the dmesg we get very strange lines as
[6484420.812643] raid6: using avx2x2 recovery algorithm
[6484420.859086] Btrfs loaded
[6484426.278636] nr_pdflush_threads exported in /proc is scheduled for removal
[6484708.776239] ixgbe 0000:04:00.0: invalid short VPD tag 06 at offset 4
[6900952.098901] perf: interrupt took too long (6247 > 6167), lowering kernel.perf_event_max_sample_rate to 32000
[7372848.819396] Peer 0000:0000:0000:0000:0000:ffff:0a15:f030:1054/8042 unexpectedly shrunk window 3002395993:3002395997 (repaired)
[8139485.039423] Turbo disabled by BIOS or unavailable on processor
[8380300.891343] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380320.890541] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380440.896206] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380460.895001] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380463.207397] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380467.316531] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380468.363352] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380469.332044] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380489.330943] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380509.329849] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380529.328678] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380549.468256] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380569.326474] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380589.340946] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380609.339969] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380619.870472] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380620.964216] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380621.979847] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380641.869255] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380661.883737] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380681.867153] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380701.881531] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380721.864752] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380741.879282] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380761.878160] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380781.876977] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380801.875853] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380821.874754] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380841.873636] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380861.872533] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380881.871408] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380901.870340] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380921.884773] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380956.392645] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380957.392566] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380958.517530] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380978.384846] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8380998.383622] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8381018.387820] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8381038.390564] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8381058.395931] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8381060.052209] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8381061.114504] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8381062.115355] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
[8381082.053988] UDP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
is that lines:
DP: bad checksum. From 73.2.33.11:5353 to 82.2.33.1:5353 ulen 69
indicate a serious problem ?
|
Those "UDP errors" is UDP Checksum offloading. The NIC is responsible for the checksum, and so it is not done at CPU level, to save CPU resources. VMWare does it, and I think KVM does it too (and not only). Hence when using tcpdump or looking at system logs, not seeing the right checksums at OS/VM level.
see Segmentation and Checksum Offloading: Turning Off with ethtool
Unfortunately sometimes what we see in Wireshark is not what we
expect. One case in which this occurs is when TCP/IP operations are
offloaded by the operating system to the Network Interface Card (NIC).
Common operations for offloading are segmentation and checksum
calculations. That is, instead of the OS using the CPU to segment TCP
packets, it allows the NIC to use its own processor to perform the
segmentation. This saves on the CPU and importantly cuts down on the
bus communications to/from the NIC.
see also Linux Networking: How to disable/enable offload features, RX/TX checksum, scatter, gather and beyond
UDP / TCP Checksum errors in tcpdump output
if you have offload features enabled and you see cksum
incorrect in tcpdump output, without any packet errors and your
network is working properly: it is nothing to worry about because the
checksum is actually calculated on the network adapter and the tcpdump
is showing the checksum calculated on kernel level.
From UDP / TCP Checksum errors from tcpdump & NIC Hardware Offloading
After checking active NIC hardware offloading options you can see the
obvious
$ sudo ethtool -k eth0 | grep on
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
generic-segmentation-offload: on
generic-receive-offload: on
rx-vlan-offload: on
tx-vlan-offload: on
After disabling TCO (tcp offloading) for TX/RX on the NIC the problem
is gone
$ sudo ethtool -K eth0 tx off rx off
Be sure to turn back on the optimizations after finishing debugging network problems, as you have a small performance hit while they are off.
TLDR Those "errors" are a regular sight on Linux VMs, and nothing to obsess about once you know they are part of your baseline. Also, keep in mind, when looking at logs, or debugging network issues, that what you see at kernel level is not necessarily what will be seen at wire level.
| dmesg + UDP: bad checksum. + rhel 7.x |
1,604,774,249,000 |
I am writing a LKM to create a character device driver.
Linux Kernel: 4.4.0-93-generic in VirtualBox, 2GB ram and SWAP is 300Kb
Problem 1
If I write a C program that handles the fd in dev_write, it's all good, it reads as it should, but if I try to use head -n 1 < /dev/opsysmem it does not output anything.
Code for reading from device:
int main()
{
int ret, fd;
char stringToSend[BUFFER_LENGTH];
printf("Starting device test code example...\n");
fd = open("/dev/opsysmem", O_RDWR); // Open the device with read/write access
if (fd < 0)
{
perror("Failed to open the device...");
return errno;
}
printf("Press ENTER to read back from the device...\n");
getchar();
printf("Reading from the device...\n");
ret = read(fd, receive, BUFFER_LENGTH); // Read the response from the LKM
if (ret < 0)
{
perror("Failed to read the message from the device.");
return errno;
}
printf("The received message is: [%s]\n", receive);
return 0;
}
Problem 2
If I repeatedly send a message big enough, everything is fine, my 2MiB buffer fills up and then the following messages are discarded. However, if the message is smaller (i.e 1 char each), it stops after about 10000 nodes. Is this a problem with my implementation of the linked list, a known linux problem or it's just me not observing something in my code?
When I encounter Problem 2, the vCPU throttles in sinusoidal manner
Here are my functions for read, write:
static ssize_t dev_read(struct file *filep, char *buffer, size_t len, loff_t *offset) {
Node *msg;
int ret_val;
char* message;
unsigned int message_length;
// Entering critical section
down(&sem); //wait state
msg = pop(&l, 0);
// No message? No wait!
if(!msg) {
up(&sem);
return -EAGAIN;
}
if(len < msg->length) {
up(&sem);
return -EINVAL;
}
// Since we have a message, let's send it!
current_size -= message_length;
// copy_to_user has the format ( * to, *from, size) and returns 0 on success
ret_val = copy_to_user(buffer, msg->string, message_length);
if (!ret_val) {
remove_element(&l, 0);
up(&sem);
return ret_val;
} else {
up(&sem);
return -EFAULT; // Failed
}
}
static ssize_t dev_write(struct file *filep, const char *buffer, size_t len, loff_t *offset) {
Node *n;
// buffer larger than 2 * 1024 bytes
if(len > MAX_MESSAGE_SIZE || len == 0) {
return -EINVAL;
}
n = kmalloc(sizeof(Node), GFP_KERNEL);
if(!n) {
return -EAGAIN;
}
n->string = (char*) kmalloc(len, GFP_KERNEL);
n->length = len;
copy_from_user(n->string, buffer, len);
// Enter critical section
down(&sem); //wait state
if(SLEEP) msleep(100);
// buffer is larger than the total list memory (2MiB)
if(current_size + len > MAX_LIST_SIZE) {
up(&sem);
return -EAGAIN;
}
current_size += len;
push(&l, n);
up(&sem);
// Exit critical section
return len;
}
And here is my linked list and its functions
typedef struct Node {
unsigned int length;
char* string;
struct Node *next;
} Node;
typedef struct list{
struct Node *node;
} list;
static void init(list * l){
l->node = NULL;
}
static void destroyNode(Node *n) {
if(n) {
destroyNode(n->next);
kfree(n->string);
n->string = NULL;
kfree(n);
n = NULL;
}
}
static void destroy(list *l){
if(l) {
destroyNode(l->node);
}
}
static Node* pop(list *l, unsigned int index) {
struct Node *_current = l->node;
// Cut down index until reaching the desired position
while(_current) {
if(index) {
_current = _current->next;
index--;
} else { return _current; }
}
// If you are here, the node does not exist
return NULL;
}
static int push(list * l, Node *n) {
if(!n) { return -1; }
// Initialize the string
// Do we have a node in the list?
if (l->node) {
// Virtually add it as a head
n->next = l->node;
} else {
n->next = NULL;
} // Otherwise prepare the list to have no tail
// Now make the list point to the head
l->node = n;
return 0;
}
static int remove_element(list * l, unsigned int index){
// Get the reference for head
struct Node *previous;
struct Node *_current;
previous = NULL;
_current = (Node*) l->node;
// Swap _current until index
while(_current) {
// Is the index !0 and we have more nodes?
if(index) {
previous = _current;
_current = _current->next;
index--;
} else {
if(previous) {
previous->next = _current->next;
} else {
l->node = _current->next;
}
// Free memory, assign NULL pointer
kfree(_current->string);
_current-> string = NULL;
kfree(_current);
_current = NULL;
// Return success
return 0;
}
}
// No _current? No problem!
return -1;
}
Update on __ Problem 2 __
I tried different sizes for the input string and I found this:
After about 650 calls to the device driver, with a size of 3.3k, the message list size becomes 4MiB (which is the maximum). A few more calls are made to the device and then the kernel freezes.
EDIT 1: I updated te dev_write as per comment and deleted debug code
EDIT 2: Added some more functions: push/pop/destroy
EDIT 3: I put in the check for buffer length vs message length
|
I think Problem 1 may be either because head is not seeing an end-of-line character (e.g. newline,'\n'), or it uses seek system calls and you ignore the offset argument in your dev_read() and dev_write() functions (which means seeks won't work, if I understand it correctly) ... check this out - head does try to optimise things using seeks, but not sure if it applies in your case.
Also not sure your answer about Problem 2 being caused by time being out of sync is correct (unless it has something to do with msleep()) ... my guess would be memory allocation problems or a race condition but you don't show us the source code for push() and pop() so we can't tell.
It looks like you just store the buffer and len arguments from dev_write() and then use them in dev_read() to pass to copy_to_user() ... the data in that buffer will still be in user space, so you could be attempting to copy from user space to user space. Reading this might help.
You should update your question with the code of push() and pop() ... but at a minimum push() will need to allocate memory for both a linked list element to be inserted in the list and for a buffer to hold the write data, then use copy_from_user() to get the data out of user space and into the kernel buffer ... and then, after you have finished with msg in dev_read(), you will need to free the kernel buffer contained in msg and then free msg itself.
A lot of copying going on here I know, but to avoid this you have to work very hard with the virtual memory system and the design of your code (i.e. a Zero Copy implementation).
One more small but very important thing, in dev_read() you don't check that message_length is <= len i.e. that there is enough space for the message in the buffer. For example, as your code stands, your driver potentially could try to copy a message bigger than the space available. copy_to_user() should catch this, but then again maybe this is the source of your Problem 2.
| Linux character device driver issues |
1,604,774,249,000 |
I'm trying to find the Linux kernel path to find out what kind of compression it uses in a industrial Raspberry Pi.
I'm running the command cat /proc/cmdline and get the output:
dwc_otg.lpm_enable=0 smsc95xx.macaddr=18:83:C4:04:49:C5 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd elevator=deadline bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080
The content of /boot is (the Linux kernel image should be here):
total 24948
-rwxr-xr-x 1 root root 15747 Jul 31 2018 bcm2710-rpi-cm3.dtb
-rwxr-xr-x 1 root root 3667 Jul 31 2018 bcm2710-rpi-cm3.dts
-rwxr-xr-x 1 root root 50192 Feb 10 2017 bootcode.bin
-rwxr-xr-x 1 root root 391 Oct 7 2019 boot.scr
-rwxr-xr-x 1 root root 136 Jan 1 1980 cmdline.txt
-rwxr-xr-x 1 root root 103 Jul 31 2018 config.txt
-rwxr-xr-x 1 root root 4 Oct 7 2019 console_status
-rwxr-xr-x 1 root root 18693 Aug 21 2015 COPYING.linux
-rwxr-xr-x 1 root root 39946 Jul 31 2018 dt-blob.bin
-rwxr-xr-x 1 root root 62963 Jul 31 2018 dt-blob.dts
-rwxr-xr-x 1 root root 2527 Nov 25 2016 fixup_cd.dat
-rwxr-xr-x 1 root root 6617 Feb 10 2017 fixup.dat
-rwxr-xr-x 1 root root 9751 Nov 25 2016 fixup_db.dat
-rwxr-xr-x 1 root root 9749 Nov 25 2016 fixup_x.dat
-rwxr-xr-x 1 root root 512 Jan 1 1980 FSCK0000.REC
-rwxr-xr-x 1 root root 512 Jan 1 1980 FSCK0001.REC
-rwxr-xr-x 1 root root 512 Jan 1 1980 FSCK0002.REC
-rwxr-xr-x 1 root root 512 Jan 1 1980 FSCK0003.REC
-rwxr-xr-x 1 root root 145 Nov 25 2016 issue.txt
-rwxr-xr-x 1 root root 4228952 Feb 10 2017 kernel7.img
-rwxr-xr-x 1 root root 4128712 Nov 25 2016 kernel.img
-rwxr-xr-x 1 root root 1494 Nov 18 2015 LICENCE.broadcom
-rwxr-xr-x 1 root root 18974 Nov 25 2016 LICENSE.oracle
drwxr-xr-x 2 root root 8192 Jul 31 2018 overlays
-rwxr-xr-x 1 root root 633636 Nov 25 2016 start_cd.elf
-rwxr-xr-x 1 root root 4954692 Nov 25 2016 start_db.elf
-rwxr-xr-x 1 root root 2830532 Feb 10 2017 start.elf
-rwxr-xr-x 1 root root 3904260 Nov 25 2016 start_x.elf
drwxr-xr-x 2 root root 512 Feb 10 2017 System Volume Information
-rwxr-xr-x 1 root root 383 Jan 1 01:00 tb_config
-rwxr-xr-x 1 root root 35700 Jan 1 01:00 tb_config_tmp
-rwxr-xr-x 1 root root 391 Jul 31 2018 tmp_boot.cmd_servic_off
-rwxr-xr-x 1 root root 438 Jul 31 2018 tmp_boot.cmd_servic_on
-rwxr-xr-x 1 root root 340632 Feb 10 2017 u-boot.bin
-rwxr-xr-x 1 root root 4228672 Feb 10 2017 zImage
But I don't see relationship between them... Can someone help me identify the image and explain the output of the command cat /proc/cmdline?
UPDATE
In my laptop with Arch Linux the relationship is clear:
Input: cat/proc/cmdline
Output: BOOT_IMAGE=/vmlinuz-linux root=UUID=[...] rw quiet
And in /boot I can find:
-rw-r--r-- 1 root root 6289792 oct 18 02:15 vmlinuz-linux
|
You are looking for the file called zImage in the bottom of your listing.
If I am not mistaken that is a gzip compressed kernel image which the boot loader loads.
The best reference I found on a quick search is https://en.wikipedia.org/wiki/Vmlinux.
If anyone has better reference feel free to edit or comment.
| Linux Kernel Path and compression |
1,604,774,249,000 |
I've been trying to figure out this stuff for years, but every time I don't understand. I understand quite well how paging, page tables and page table directories work in Linux, I just don't get why they're actually needed.
The problem why we need paging and page table levels (Linux uses 4 levels) seems to be the fact that you can't load all memory in the same moment. But can't we just load a selected amount of pages and addresses without all of the directories thing?
I know we need to learn where a certain frame is located in physical memory, but why can't we directly retrieve a certain subset of a big page table? What issues would that cause? I understand that if we didn't use pages + offsets the whole thing'd be too big, but do the directories really solve anything?
There is a lot of discussion on how different systems divide the bits of an address in order to structure the page table levels, but at the end of the day we're always gonna have 32/64 bits for an entry. We won't be able to address more than that (except with tricks on the cr3 register like PAE does), what's the point of splitting them? In the end, how is having (I'll simplify) "directory 3, subdirectory 5, page 7, offset 2" better than just saying "address 3572"?
Even worse, if the CPU didn't help us (I guess it has built-in circuits to do all of the process in 1 clock cycle? Not really sure!) wouldn't it be a lot less efficient to have to retrieve all of the directories and subdirectories at every memory access rather than directly retrieving the logical/physical memory mapping and then accessing the needed address?
|
The reason for having the multiple levels is to save space.
Consider what would be needed if there were not multiple levels. If there are 48 bits of address space (no current x86_64 cpu gives you the full 64 bits), and you are using a 4k byte page size (12 bits), then you have 2 to the power of 36 pages.
If you could fit the mapping information into 64 bits (8 bytes), then you would need 8 * 2**36 bytes or 512Gb of memory just to hold the translation table.
Almost all of this table would be set to a value representing "Invalid address".
With the multiple levels you can reduce the space requirements for the translation table. If the 64bit address space is split into 16/9/9/9/9/12 bits for currently_unused/PML4/PDPT/PD/PT/address_in_page then you only need 512 entries for the PML4 table, of which 510 are probably the value representing "Invalid Address" and the remaining 2 point to two arrays of 512 entries of PDPT. If we stopped there then we have reduced the space needed from 2**36 entries to about 2 + 2**27 entries, less than 0.2% of the original linear requirement. Of course it doesn't stop there, there are 3 additional levels although they tend not to give quite as large savings.
| I can't really get why directories in paging are needed |
1,604,774,249,000 |
I try to understand the internals around the Linux kernel, the process management and the context switch around the processes. As far as I understand the tutorials (from this community, IBM, and so on) the kernel is loaded by the bootloader after the power button is pressed. It then starts the scheduler and creates the final init process which is responsible for starting all other processes.
So after some time, a context switch occurs. During this context switch, the kernel looks at the page table for the new process and load it (if necessary) into the TLB of the MMU. Does the kernel load the whole page table (so for 4 GB of virtual memory on a 32-bit system) into the MMU? And how does this table swap works, because as I understand it, the top 1 GB of memory will be present and not swapped out during all processes, because this is the kernel memory? Does the page tables for all processes contain a direct mapping for the top 1 GB of memory, so that the top 1 GB of virtual memory is directly mapped into the top 1 GB of physical memory?
Is there some kind of documentation of how this context switch works because I don´t find any documents who explain this for noobs like me.
|
Each process has its own set of page pages, spanning the low 3 GB on 32-bit x86 machines. The top 1 GB on 32-bit machines is common to all processes, and is not accessible from user space. The top 1 GB is reserved for the kernel, and originally contained a mapping of the whole physical RAM offset by 3 GB. This means physical memory address 0 is visible at virtual address 0xc0000000, physical memory address 1 is visible at address 0xc0000001, and so on. When memory sizes outgrew the 1 GB limit, the excess physical memory started to be accessed via a "highmem" window.
On x86-64, the upper half of the address space is reserved for the kernel, the lower half for user space. Note that current hardware does not allow use of the whole 64-bit address space: typically only 48 address bits are usable, the upper 16 bits must be either all zeroes or all ones. (The exact number of usable bits varies depending on the CPU model.)
At a context switch, the user space part of the mapping is replaced with the new process's mapping, but the kernel part stays the same. The whole 4 GB memory space is not mapped, only the parts that are actually used. This allows for a much smaller page table tree. The initial mapping is determined by the ELF file containing the program to be run. The page tables are modified as needed when new memory is allocated dynamically, mapped using mmap, or by automatically extending the stack.
The scheduler is not "started", since it is not a separate process. The kernel reschedules processes when the running process needs to wait for input or some other event, or when the current process has used up its time slice. Each process is in one of several states, like waiting for some event, ready to run, or running. When the kernel does a reschedule, it examines the list of ready to run processes, and chooses one (per CPU) to run next.
Also, the Translation Lookaside Buffer (TLB) is not loaded directly by the kernel (on x86 processors). Software only modifies page tables, and the hardware automatically fills the entries in the TLB as needed at runtime. The TLB can be flushed by software; this needs to be done at a context switch.
A few books have been written on the Linux kernel internals ("Understanding the Linux Kernel", for example), but most of them are quite old by now. But, even if they are not good references anymore, many of them do provide sill relevant information, but you have to keep in mind that a lot has changed.
| Understanding Linux process management [closed] |
1,604,774,249,000 |
I have a packard bell ze7 it's a x64 machine and it only has BIOS.
Before I got it, I thought that's a non-existent combination...
I'm building Gentoo by hand, my own initramfs, all that good stuff. I've done it before a couple of times(successfully), and as it's not a sufficient number, I'm not sure if I'm doing everything correctly. The reason I'm asking -- I haven't done it with BIOS and I haven't used GRUB, and I'm getting an error. I'm booting from grub prompt(because it doesn't boot by itself for some reason): set root..,linux ..., boot. And I'm getting "Kernel panic - not syncing: attempted to kill init!" (Code: Bad RIP value)
So I'm wondering if it has anything to do with the machine being x64 and having only BIOS at the same time?
|
x86-64 CPUs, from both AMD and Intel, pre-date UEFI, so it was common for a while to see 64-bit systems with only old-style BIOSs. It is still possible to boot them, with new kernels, so it should be possible to boot your Packard Bell.
I can’t guarantee that your failure is unrelated, but it could easily be related to something else. Attempting to kill init means it’s booted far enough to start init...
| Booting on a x64 machine with BIOS? |
1,604,774,249,000 |
When I do
lspci -v
in order to find may audio device memory I get
00:1f.3 Multimedia audio controller: Intel Corporation Device ds35
Subsystem: Intel Corporation Device 754 Flags: bus master, fast
devsel, latency 64, IRQ 126
Memory at d1114000 (64-bit,
non-prefetchable) [size=16K]
Memory at d1000000 (64-bit,
non-prefetchable) [size=1M] Capabilities: Kernel
...
As you can see "memory at" shows up twice?
Why is that?
What are the differences in both these addresses.
Why it is only the case for this particular audio device.
Thanks for help.
|
1.) The chipset has been designed to split the memory-mapped I/O allocation of the audio controller into several blocks, and the base address for each block can be assigned separately. This results in a more flexible chipset design that can be configured to accomodate various different hardware configurations.
2.) The two blocks are not copies of each other, but are used for different purposes. To understand more, you'll have to download the datasheet PDF(s) for your chipset from Intel, and possibly also some documentation on the HD Audio standard, and then read some very solid technical documentation.
3.) If the audio controller needs a total of 1040K of address space for its MMIO functionality, assigning it in two separate blocks that are both power-of-2 sized, the firmware will have a higher chance of being able to assign all the MMIO areas of the various hardware components into one or just a few contiguous blocks of addresses, without leaving too many inconvenient "holes" of memory or unusable address space in between them. This allows the hardware memory management unit of the processor to work more efficiently, as the Memory Type Range Registers (MTRRs) can assign optimal access strategies for both MMIO and regular memory blocks. There is only a limited number of MTRRs available, so achieving a tight packing of MMIO blocks helps.
| PCI device has two memory addresses? |
1,604,774,249,000 |
Recently I see these messeges in my /var/log/messeges and dmesg | less:
kernel: INFO: task flush-8:32:1065 blocked for more than 120 seconds.
kernel: Not tainted 2.6.32-696.el6.x86_64 #1
kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this
message.
kernel: flush-8:32 D 0000000000000004 0 1065 2 0x00000000
kernel: ffff88063389b840 0000000000000046 0000000000000000 0005120000000001
kernel: ffff880636304ce0 ffff8806363098c0 00022e760ddb7d3a ffff88062db31360
kernel: 0000000000011200 000000012494c97a ffff88062e0fbad8 ffff88063389bfd8
kernel: Call Trace:
kernel: [<ffffffff811d11e0>] ? sync_buffer+0x0/0x50
kernel: [<ffffffff8154ae83>] io_schedule+0x73/0xc0
kernel: [<ffffffff811d1220>] sync_buffer+0x40/0x50
kernel: [<ffffffff8154b73a>] __wait_on_bit_lock+0x5a/0xc0
kernel: [<ffffffff811d11e0>] ? sync_buffer+0x0/0x50
kernel: [<ffffffff8154b818>] out_of_line_wait_on_bit_lock+0x78/0x90
kernel: [<ffffffff810a68c0>] ? wake_bit_function+0x0/0x50
kernel: [<ffffffff811d1540>] ? end_buffer_async_write+0x0/0x190
kernel: [<ffffffff811d13c6>] __lock_buffer+0x36/0x40
kernel: [<ffffffff811d26c5>] __block_write_full_page+0x305/0x330
kernel: [<ffffffff811d1540>] ? end_buffer_async_write+0x0/0x190
kernel: [<ffffffff811d27d0>] block_write_full_page_endio+0xe0/0x120
kernel: [<ffffffffa0211d00>] ? buffer_unmapped+0x0/0x20 [ext3]
kernel: [<ffffffff811d2825>] block_write_full_page+0x15/0x20
kernel: [<ffffffffa021288d>] ext3_ordered_writepage+0x1ed/0x240 [ext3]
kernel: [<ffffffff81142367>] __writepage+0x17/0x40
kernel: [<ffffffff8114362d>] write_cache_pages+0x1fd/0x4c0
kernel: [<ffffffff81009913>] ? __switch_to+0x2f3/0x340
kernel: [<ffffffff81142350>] ? __writepage+0x0/0x40
kernel: [<ffffffff81299899>] ? cpumask_next_and+0x29/0x50
kernel: [<ffffffff81064054>] ? find_busiest_group+0x254/0xa50
kernel: [<ffffffff81143914>] generic_writepages+0x24/0x30
kernel: [<ffffffff81143955>] do_writepages+0x35/0x40
kernel: [<ffffffff811c6f1d>] writeback_single_inode+0xdd/0x290
kernel: [<ffffffff811c731d>] writeback_sb_inodes+0xbd/0x170
kernel: [<ffffffff811c747b>] writeback_inodes_wb+0xab/0x1b0
kernel: [<ffffffff811c7873>] wb_writeback+0x2f3/0x410
kernel: [<ffffffff8154a68e>] ? schedule+0x3ee/0xb70
kernel: [<ffffffff811c7b3d>] wb_do_writeback+0x1ad/0x250
kernel: [<ffffffff8108f000>] ? process_timeout+0x0/0x10
kernel: [<ffffffff811c7c86>] bdi_writeback_thread+0xa6/0x220
kernel: [<ffffffff811c7be0>] ? bdi_writeback_thread+0x0/0x220
kernel: [<ffffffff810a63ae>] kthread+0x9e/0xc0
kernel: [<ffffffff8100c28a>] child_rip+0xa/0x20
kernel: [<ffffffff810a6310>] ? kthread+0x0/0xc0
kernel: [<ffffffff8100c280>] ? child_rip+0x0/0x20
Today one of VM machines rebooted. When I checked messeges, I saw above messeges and then some database errors. That network had a problem and this machine lost connection with its primary and just rebooted. My question is: what are these kernel messeges and where should I search for problem? Do they have something to do with network? Does it only happens on VM machines?
|
That warning is due to resource starvation.
If in a VM, it might be a clue the host is oversubscribed.
Mind you it is a warning (hence the INFO keyword), it can be ignored. However I advise dealing with the underlying issues that are causing it, also because they are bound to worsen over time.
I would go for lack or resources/overuse of I/O storage.
You can also try to run:
sudo sysctl -w vm.dirty_ratio=10
sudo sysctl -w vm.dirty_background_ratio=5
If that works out for you, put it permanently, for applying it at boot time, in /etc/sysctl.conf:
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10
See Linux Kernel panic issue: How to fix hung_task_timeout_secs and blocked for more than 120 seconds problem
By default Linux uses up to 40% of the available memory for file
system caching. After this mark has been reached the file system
flushes all outstanding data to disk causing all following IOs going
synchronous. For flushing out this data to disk this there is a time
limit of 120 seconds by default. In the case here the IO subsystem is
not fast enough to flush the data withing 120 seconds. As IO subsystem
responds slowly and more requests are served, System Memory gets
filled up resulting in the above error, thus serving HTTP requests.
| kernel error in CentOS 6.9 |
1,604,774,249,000 |
I need to disable retpoline for a use case. I tried adding noretpoline to the boot parameter but it doesn't seem to work.
The output after adding noretpoline param:
$ cat /sys/devices/system/cpu/vulnerabilities/spectre_v2
Mitigation: Full generic retpoline, STIBP: disabled, RSB filling
Kernel: 4.18.0-58.el8.x86_64
|
To disable retpoline, you need to disable the Spectre variant 2 mitigations using spectre_v2=off on the kernel command line. See the kernel’s list of parameters for details (that link is specifically for 4.18; for other versions, replace “v4.18” in the URL as appropriate).
| How to disable retpoline? |
1,604,774,249,000 |
I wonder how kernel puts data on LLC or L3 caches in detail. I have been searching the information about using cache in kernel but many results talk about page cache or buffered cache but in this question it is only related to cache above the main memory.
Assume that I make a working set or data structure (30MB) in the kernel context by using kmalloc, vmalloc or whatever. What I am thinking is that there might be a different procedure such as protection or extra optimization to prevent any memory violation in kernel unlike using malloc or mmap in user context.
Therefore, if I make a same-size working set(30MB) using user library(malloc) in user mode, I would expect that I might get different performance when I access this data in the working set.
Question
1. How kernel uses LLC cache?
2. Can I get different performance when I allocate memory using malloc?
|
LLC means only "last level cache". It is strongly architecture-dependent, exactly which level of cache is it. In recent x86/amd64 architectures, it is typically L3 cache.
Caching happens mostly independently from the kernel. There is none to little function to manipulate CPU-memory caching, including L3 cache, even on the asm level. It might be dubious, if it is even the task of the kernel to deal with it.
On Intel (AMD) CPUs, there are the mtrr registers which can affect, how the kernel can see the cache-ability of memory ranges. On newer intel CPUs, there is also a functionality to partition the L3 cache, which can be tuned by tools (since kernel 4.10).1
The kernel API doesn't have a malloc() function. It has kmalloc(), which is essentially a malloc(). It has also vmalloc(), which allocates always pages and not bytes. Note, the kernel VM deals mostly with pages, kmalloc() is essentially only a wrapper around vmalloc() to get a more effective, malloc-like functionality.
There are various optimizations in the kernel algorithms to make it better tuned in a caching environment, although they deal mainly with lower cache levels (for example, it is better if concurrent processes/kernel threads work least possible on the same page or cache line). Using vmalloc() can help a lot to deal with cache in a multi-cpu environment.
The kernel is written mainly in C, it handles memory addresses and caching is handled by the cpu memory handler mechanism transparently.
1 Thanks for Stephen Kitt for the valuable comment.
| A procedure of caching data in linux kernel, especially on LLC |
1,604,774,249,000 |
I am a little bit confused about /proc directory. Each process frequently updating its state, memory info, progress etc in their process.
My question is that the /proc directory keeps the memory or writes on harddrive each information.
What I believe that It frequently updating the information it takes IO operations and it no further uses when computer restart so it might be in the memory.
|
The /proc directory itself exists as an empty directory on the hard drive. It's contents, however, are added by the kernel without touching the disk. If you try to access /proc before it is mounted (say, booting your system with nothing but a shell with init=/bin/sh), it will be empty.
You can replicate /proc on any directory with mount -t proc proc /path/to/directory.
Just like ext4, fat32, etc., proc is a filesystems. (It is referred to as a pseudo filesystem because it cannot actually be used for storing files. If you try to do so, even as root, it will not work.) There are 'real' filesystems like proc that don't write to the disk, say ramfs/tmpfs. These filesystems don't actually write their files the disk, rather keeping them in the system ram. (If it isn't already there, I recommend adding the line tmpfs /tmp tmpfs rw 0 0 to your /etc/fstab so that temporary files written to /tmp don't actually get written to your disk.)
There are a few other pseudo filesystems, like sysfs on /sys and devtmpfs on /dev. (/dev is slightly different. It isn't maintained by the kernel, and devtmpfs isn't always mounted over /dev, sometimes block files are written directory to the disk.)
| Is /proc folder and process details really exists on hard drive [duplicate] |
1,604,774,249,000 |
Here is what happened. cpanel updated and also updated my kernel during the update. It required a reboot.
On reboot, I got kernel panic. Luckily, I have IPMI and was able to easily switch back to the oldest kernel. It was the last to try because the other kernels, none of them worked but the oldest one.
So, now I am using the oldest kernel (it's not that old, just older than the other ones). To avoid the problem and because kernel update is still pending, I decided to run a kernel update over ssh using yum update -y kernel.
My only worry is that it might delete my current kernel.
Here is what I got. Maybe you can confirm something for me.
During install, I got this info:
Removed:
kernel.x86_64 0:3.10.0-693.11.1.el7
Installed:
kernel.x86_64 0:3.10.0-862.3.3.el7
So, this is the old kernel removed during this update now, and the new kernel that will become active on reboot.
I checked what kernel I am currently on:
# uname -r
3.10.0-693.17.1.el7.x86_64
And I checked the list of installed kernels:
# rpm -qa kernel
kernel-3.10.0-862.3.3.el7.x86_64
kernel-3.10.0-862.3.2.el7.x86_64
kernel-3.10.0-693.17.1.el7.x86_64
If I am correct, from this info it looks like it did not delete my current kernel (but I'm not sure), but rather the oldest with the exception of the one I am on.
If that is the case, I'm safe because if it goes back to kernel panic, then I can switch back to this kernel again.
Otherwise, I would waste like 3 days of work trying to get everything reinstalled. To be sure, I did do a full backup, but still reinstalling from scratch would be days of work, needless if I just didn't reboot before I resolved the issue.
It would be a bit of a challenge to get my provider to allow me to have them connect another SSD to DD the whole drive in the event it didn't work - especially if I don't need that. Because, if I know ahead of time, I could do a DD to another SSD to swap it back in for working in the event update failed (or would that even work? If kernel is missing, it still has to boot up!)
Overall, the concern here is whether the existing kernel is deleted when there are a limited number of kernels (I have it set to 3 max - too late to change it now).
It would make sense for CentOS devs to never delete the existing kernel as a failsafe. I just want to be 100% sure about it before risking a reboot and potentially giving myself a ton of work.
Of course, eventually this issue will need to be solved. But, I can wait until a week when I do not have a million things to do, and I simply don't have time for 3 days of unwanted work at the moment, especially when currently things will be working fine for sure until the next reboot. At this point, I can delay the reboot until a later date, and keep my server and all sites up and running.
So, in summary, when doing a CentOS 7 kernel update, is the existing kernel is deleted when there are a limited number of kernels?
Thanks so much, appreciate your help. I think this question would be useful for others in a variety of situations.
|
yum will never delete the currently running kernel unless explicitly directed to. It will update the related -devel package regardless though.
| When you update a kernel and it deleted the oldest kernel, could it delete the kernel you are on? |
1,604,774,249,000 |
Browsing through fs/nfs/... but this wasn't obvious to me, so: if I try to write while being "above quota", to a file that doesn't belong to me, will I get EPERM or ENOSPC?
Another way to phrase this is: for an inode write, which comes first, the check for permissions, or the check for quota?
|
You can only write to a file after you have opened it. When you open it the permission checks are done. In theory one might argue that for a request for a read-write file descriptor the quota state might be checked but as you need write access to truncate a file and quota should never prevent space from being freed I assume this is not the case.
Thus due to the order of open() and write() the permission check should always come first.
| Which comes first, for a write/create: permissions check or quota check? |
1,604,774,249,000 |
How does Linux kernel developers handle their work with millions of rows of code? Is their a method?
I've read that the kernel has about 15 million rows of code. To me, a man working with simple scripts of usually up to 100 rows of code, 15 million rows of code sounds like something very hard to handle with. I mean, I imagine a file tree huge in a galactic scale and a confusing environment.
But of course, it's not this way, because if it was this way, no human would develop the kernel, so there must be a way to navigate in the huge file tree and working with it when it's generally not confusing, and when it is just systematic and comfortable.
Is there a formal method of work / inode organization / finding one's way in this giant inode tree?
Just like astronomers basically map their environment this way: Universe > Laniakea > Virgo Supercluster > Local group > LIC > Solar system > Earth, I believe there is a similar mapping system in the Linux kernel, that could give someone like me, a junior programmer, at least just a glimpse as of now, to the core of the nix systems I work with.
|
It takes git, Perl scripts, e-mail and patience. I highly recommend this video from one of the main contributors to the kernel. It has the answer to all the questions that you've posted.
Greg Kroah Hartman on the Linux Kernel —
https://www.youtube.com/watch?v=L2SED6sewRw
| How does Linux kernel developers handle their work with millions of rows of code? Is their a method? [closed] |
1,604,774,249,000 |
Is it technically possible to write a kernel module to physically connect a PS/2 keyboard to a USB port using a passive converter? If not, why?
(If I simply wanted my keyboard to work I would buy an active adapter, but the purpose of this question is to learn something)
|
No.
No USB standard implements backwards compatibility with PS/2. PS/2 mice which predate USB do not contain time-travelled USB descriptors. Nor can an arbitrary USB port be accessed as a GPIO.
USB descriptors: https://blog.digital-scurf.org/posts/stm32-and-rtfm/
https://en.wikipedia.org/wiki/Gpio & https://en.wikipedia.org/wiki/Bit_banging
(Wiki links aren't going to be great, but the introductions here should give the idea).
Converting the opposite way round, passive USB to PS/2 converters require USB support in the USB input device, and recent USB devices don't bother with it: https://en.wikipedia.org/wiki/PS/2_port#Conversion_between_PS.2F2_and_USB
| Kernel module to connect ps/2 keyboard to usb? |
1,604,774,249,000 |
I have a FreeBSD 7.3 server and I configured IPsec on it but now I need to put my server behind a NAT. I know in order to using NAT I should add IPsec_NAT_T to my kernel but the problem is IPsec_NAT_T is not built in and I must add patch to my kernel.
How can I do that?
|
You have already figured out that you need to patch your kernel sources as you have a very old version. Never versions already have the option. And I think that -current (what will become 12) have deprecated the option and supports NAT-T by default.
So you need to figure out what kernel source version you have locally and are building from. When you know that then you can look for a patch-set which matches your sources.
Earlier versions seems to be here:
https://people.freebsd.org/~vanhu/NAT-T/
https://people.freebsd.org/~vanhu/NAT-T/patch-natt-7.2-2009-05-12.diff
I found two later versions here (but no directory listing):
http://people.freebsd.org/~bz/20110123-01-stable7-natt.diff
http://people.freebsd.org/~bz/20110603-02-stable7-natt.diff
I would try the latest version first. Make a copy of your sources and use the patch command. If it applies cleanly to your 7.3 sources you should be good to go. When the patches have been applied follow the steps for recompiling your kernel.
For your purpose you need to enable these:
options IPSEC
device crypto
options IPSEC_NAT_T
You can find the steps in the FreeBSD Handbook
If the patch does not apply cleanly then look for other patchsets. The patches are fairly simple so it might be easier to add them manually. If you do not know how to do this - then you are much much better off upgrading your system. The pain of upgrading will be far lesser than learning how to program C to adapt the code :-)
| using IPsec behind NAT in freebsd 7.3 |
1,604,774,249,000 |
I just stumbled across a problem where the installed kernel sources don't match the kernel that I'm actually running.
I'm running 4.11.7-300.fc26.x86_64:
[root@localhost VirtualBoxGuestAdditions]# uname -r
4.11.7-300.fc26.x86_64
But the latest kernel sources don't seem to have the same version:
[root@localhost VirtualBoxGuestAdditions]# yum install kernel-devel
Last metadata expiration check: 1:30:50 ago on Wed 28 Jun 2017 04:11:01 PM CEST.
Package kernel-devel-4.11.6-301.fc26.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!
And looking at /usr/src/kernels/ surely enough, I only have the old sources:
[root@localhost VirtualBoxGuestAdditions]# ls -la /usr/src/kernels/
total 12
drwxr-xr-x. 3 root root 4096 Jun 28 16:22 .
drwxr-xr-x. 4 root root 4096 Jun 28 16:50 ..
drwxr-xr-x. 23 root root 4096 Jun 28 16:22 4.11.6-301.fc26.x86_64
So I tried to specify the version manually, but without success:
[root@localhost VirtualBoxGuestAdditions]# yum install kernel-devel-4.11.7-300.fc26
Last metadata expiration check: 1:27:40 ago on Wed 28 Jun 2017 04:11:01 PM CEST.
No package kernel-devel-4.11.7-300.fc26 available.
Error: Unable to find a match
Is this normal? What am I supposed to do now?
|
I expect that this is merely a transient mirroring problem. Try
sudo dnf --refresh upgrade kernel-devel
(Or possibly just a general sudo dnf --refresh upgrade.)
| Latest kernel sources not available for installation? (Fedora 26 Beta) |
1,604,774,249,000 |
I installed Debian Jessie with debootstrap, updated the kernel to 4.9.0-0.bpo.3-amd64 and created an image of it. Now, I wanted to start Jessie with qemu and the following command: qemu-system-x86_64 -kernel bzImage -append "root=/dev/sda" -hda jessie.img -net nic -enable-kvm -nographic -m 2G. To obtain the bzImage, I downloaded and compiled Kernel version 4.9 from Linus' github.
The problem I am facing now, is a version mismatch, although I have (at least I thought so) the proper versions:
[ 49.506967] pcwd_usb: version magic '4.9.0-0.bpo.3-amd64 SMP mod_unload modversions ' should be '4.9.0 SMP mod_unload '
Does anybody know, which kernel version I have to get (and where)?
|
You need your kernel modules (installed inside the VM) to match your kernel image. Inside the VM, you installed the Debian kernel, which you can grab either from /boot/vmlinuz-4.9.0-3-amd64 inside the VM or from https://packages.debian.org/stretch/linux-image-4.9.0-3-amd64 (at least, if that's where you downloaded the newer kernel from to update the VM). Surprised it worked at all without the initrd, too.
PS: It's probably easier to just boot using the bootloader (grub) installed in the image.
| Kernel 4.9 module mismatch |
1,604,774,249,000 |
There is a flag called CPU_FREQ_STAT, which
exports CPU frequency statistics information through sysfs
file system.
More info available here: cpufreq driver kconfig
Then, one can guess constant I/O operation due to the statistic information exporting can cause memory overhead or any decrease of the performance and battery life.
Would this affirmation be correct? If not, why?
|
sysfs is a virtual filesystem. It doesn't really exist on disk, so there is no (disk) I/O. Nor is there any I/O at all, even virtual, except when something reads the file. It's just a kernel API that's being exposed to userspace through open/read/write/close instead of, e.g., adding another syscall.
There is probably a tiny overhead. It surely takes a trivial bit of memory to hold the counters, a trivial amount of CPU time to update them, and increases the kernel image size by a trivial amount.
OTOH, if frequency scaling is used on your machine, turning that off will greatly reduce your ability to investigate its behavior—and lowering CPU frequency at the right time typically has a major effect on both performance and battery life.
| Could disabling kernel cpu frequency monitoring improve performance and/or battery life? |
1,604,774,249,000 |
I've just setup a proof-of-concept UEFI, PXE, NFS diskless booting system. For the NFS booting to work, I needed to create a custom initramfs using dracut-network including modules for nfs, network, and base.
Eventually, there will be many different filesystems (operating systems) on the NFS, each one with multiple kernels (from updates/debug). I want it to be relatively simple to create/update any of these OSs.
How can I build one initramfs that will work with any generic distro kernel? (Is this even possible? Other architectural suggestions regarding the project are welcome too).
|
Either the modules you need in order to mount the root filesystem (like nfs, the necessary network interface drivers, and so on) are built in to the kernel, or else they will need to be present in the initramfs. The former is unlikely, because distro kernels don't tend to have those modules linked in statically (they go for a minimum set, counting on the initramfs for the rest). The latter won't solve your problem, because you'll have to supply modules that go with any of the kernels that the user might be using.
In other words, you probably can't.
| Creating generic initramfs that is kernel-independent |
1,604,774,249,000 |
I am trying to compile my own Linux for embededd devices, using the OpenWRT distribution. I am trying to get some Multicast information using the /proc/net/netstat interface but it is not found (normally this is available on my desktop).
If I am right this should be enabled in the kernel_menuconfig but I am not able to find any option related to this.
UPDATE: i was trying with kernel 3.10.49and 4.4.14. In both cases proc.c is compiled (proc.o is available in my build_dir, /proc is mounted, but /proc/net/netstat does not exists.
|
After a while I have just returned to this issue, and finally solved it.
The problem is, that OpenWRT is pathcing the kernel source, and an extra option should be disabled, namely the CONFIG_PROC_STRIPPED. This is located in
(make) kernel_menuconfig -> File systems -> Pseudo filesystems -> [ ] Strip non-essential /proc functionality to reduce code size
The way it was figured out is looking at the patched version of kernel source, not the official one.
Thank you for all the effort you made!
| /proc/net/netstat not found |
1,604,774,249,000 |
I'm trying to compile and install the kernel-4.9.8 sources from https://kernel.org on Debian 8 (jessie).
I'm following this procedure:
make defconfig
make menuconfig
make
I managed to compile the sources succesfully, but I can't install the kernel,
I've tried with both sudo make install and sudo dkms autoinstall -k 4.9.8, but they seems to require linux-headers-4.9.8 and I can't find it the Debian repositories.
|
Try using make-kpkg instead. When run from a kernel source tree it'll compile a kernel and build a full set of debian packages using that source and config -- linux-image, linux-headers, linux-doc, all as per your version specified.
It's part of the kernel-package package, so what you want to do is:
sudo apt-get install kernel-package
Edit /etc/kernel-img.conf and /etc/kernel-kpg.conf to match your preferences
fakeroot make-kpkg --initrd linux-image
Sit back, get some tea. The above process will take a while.
It will generate a linux-image-(version) deb package one level up, which you can then install with dpkg and will handle things like calling your bootloader's update to add the new kernel automatically. This will significantly ease your difficulties.
At the end of this process, you will have a Linux kernel that has the exact capabilities you told it to have, and none of the capabilities that you didn't tell it to have.
Consider that last sentence a polite warning.
| Compile and install pure Kernel on Debian |
1,604,774,249,000 |
I want to build latest (4.7.4) kernel with make-kpkg. Also I want to make it as modular as possible. Will it compile modules too or should I run 'make modules' before?
Thanks.
|
Yes it will compile modules. Please refer to http://man.he.net/man1/make-kpkg .
| Will make-kpkg compile modules too? |
1,604,774,249,000 |
Running the ureadahead in the command line results in this error:
#/usr/sbin/ureadahead
ureadahead: Error while tracing: No such file or directory
I got the following messages from strace
open("/var/lib/ureadahead/pack", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/sys/kernel/debug/tracing", O_RDONLY|O_LARGEFILE|O_NOATIME) = 3
openat(3, "events/fs/do_sys_open/enable", O_RDWR|O_LARGEFILE) = -1 ENOENT (No such file or directory)
close(3) = 0
write(2, "ureadahead: Error while tracing:"..., 59ureadahead: Errorwhile tracing: No such file or directory
) = 59
exit_group(5) = ?
+++ exited with 5 +++
Does this line
openat(3, "events/fs/do_sys_open/enable", O_RDWR|O_LARGEFILE) = -1 ENOENT (No such file or directory)
mean that the kernel is not correctly patched? Should patched the kernel first?
|
Yes, that error means you need to apply the appropriate patch to your kernel; that patch adds the ability to trace certain filesystem events, and exposes files in the kernel's /sys/kernel/debug/tracing/events directory.
| ureadahead: Error while tracing. Possible kernel patch problem? |
1,604,774,249,000 |
I have a laptop Thinkpad T520 with the dockstation Lenovo 4338-35 which has one USB 3.0 port (it's blue, marked with SS). However, my Linux Mint 17.2 does not recognize it.
$ lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
|__ Port 4: Dev 3, If 0, Class=Communications, Driver=, 480M
|__ Port 4: Dev 3, If 1, Class=Communications, Driver=cdc_acm, 480M
|__ Port 4: Dev 3, If 2, Class=CDC Data, Driver=cdc_acm, 480M
|__ Port 4: Dev 3, If 3, Class=Communications, Driver=cdc_acm, 480M
|__ Port 4: Dev 3, If 4, Class=CDC Data, Driver=cdc_acm, 480M
|__ Port 4: Dev 3, If 5, Class=Communications, Driver=cdc_wdm, 480M
|__ Port 4: Dev 3, If 6, Class=Communications, Driver=cdc_ncm, 480M
|__ Port 4: Dev 3, If 7, Class=CDC Data, Driver=cdc_ncm, 480M
|__ Port 4: Dev 3, If 8, Class=Communications, Driver=cdc_wdm, 480M
|__ Port 4: Dev 3, If 9, Class=Communications, Driver=cdc_acm, 480M
|__ Port 4: Dev 3, If 10, Class=CDC Data, Driver=cdc_acm, 480M
|__ Port 5: Dev 4, If 0, Class=Chip/SmartCard, Driver=, 12M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 3: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 12M
|__ Port 4: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
|__ Port 4: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M
|__ Port 4: Dev 4, If 2, Class=Vendor Specific Class, Driver=, 12M
|__ Port 4: Dev 4, If 3, Class=Application Specific Interface, Driver=, 12M
|__ Port 5: Dev 5, If 0, Class=Hub, Driver=hub/7p, 480M
|__ Port 5: Dev 7, If 0, Class=Vendor Specific Class, Driver=ch341, 12M
|__ Port 6: Dev 8, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 6: Dev 6, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 6: Dev 6, If 1, Class=Video, Driver=uvcvideo, 480M
If I plug some device into USB 3.0 port, it appears under Port 5: Dev 5, If0, Class=Hub, Drive=hub/7p, 480M:
$ lsusb -t
....
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 3: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 12M
....
|__ Port 5: Dev 5, If 0, Class=Hub, Driver=hub/7p, 480M
|__ Port 5: Dev 7, If 0, Class=Vendor Specific Class, Driver=ch341, 12M
|__ Port 6: Dev 8, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
here--> |__ Port 7: Dev 9, If 0, Class=Mass Storage, Driver=usb-storage, 480M
|__ Port 6: Dev 6, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 6: Dev 6, If 1, Class=Video, Driver=uvcvideo, 480M
Device plugged into this port works normally, just like in any other (USB 2.0) port.
I've seen it other outputs people posted that USB 3.0 devices should appear with speed 5000M, but I have 480M only.
Some other outputs:
$ lsusb
Bus 002 Device 004: ID 17ef:1003 Lenovo Integrated Smart Card Reader
Bus 002 Device 003: ID 0bdb:1911 Ericsson Business Mobile Networks BV
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 006: ID 04f2:b217 Chicony Electronics Co., Ltd Lenovo Integrated Camera (0.3MP)
Bus 001 Device 008: ID 0458:003a KYE Systems Corp. (Mouse Systems) NetScroll+ Mini Traveler / Genius NetScroll 120
Bus 001 Device 007: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 005: ID 17ef:100a Lenovo ThinkPad Mini Dock Plus Series 3
Bus 001 Device 004: ID 0a5c:217f Broadcom Corp. BCM2045B (BDC-2.1)
Bus 001 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)
00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)
00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b4)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation QM67 Express Chipset Family LPC Controller (rev 04)
00:1f.2 IDE interface: Intel Corporation 6 Series/C200 Series Chipset Family 4 port SATA IDE Controller (rev 04)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)
00:1f.5 IDE interface: Intel Corporation 6 Series/C200 Series Chipset Family 2 port SATA IDE Controller (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation GF119M [Quadro NVS 4200M] (rev ff)
03:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)
0d:00.0 System peripheral: Ricoh Co Ltd MMC/SD Host Controller (rev 08)
Kernel version is 3.16:
$ uname -r
3.16.0-38-generic
Could anyone give some clue how to make it recognize as USB 3.0, please? Thanks.
|
Don't know if this is so much a kernel issue as it is a hardware one...
From what I saw when I checked the specs of the ThinkPad T520 online, it doesn't come with any USB 3.0 functionality on the mobo, meaning that even if your dockstation has a 3.0 port, it will be bottlenecked by the port on the laptop.
Here's a PDF of the tech-specs for the 420/520 series laptops, and I found a message board on Lenovo's forums with some more useful links/information as well.
| System recognizes my USB 3.0 port as USB 2.0 port |
1,468,534,540,000 |
On my system ulimit -u reports 63172 and /proc/sys/kernel/pid_max reports 32768.
Why is it that the value for ulimit -u is higher than the kernel's value? From my understanding, ulimit -u shows the max processes a user can have, not system-wide. pid_max is supposed to be system-wide via the kernel. It seems wrong to me that ulimit -u is higher than pid_max, wouldn't this mean that a user could cause PIDs to wrap around if they spawned enough processes? Also, if the pid_max value is hit by something a user is doing, won't that cause the No more processes error to occur?
|
PIDs do wrap around in normal usage. That's not a problem at all; the kernel ensures that new PIDs don't collide with existing PIDs. Nothing says that PIDs have to be monotomically increasing; process 12345 could easily fork() and have a child process of 5001.
In this scenario, yes, a user could potentially use up all process slots and prevent further fork() type activity from occurring. If this is a problem in your environment then you need to tune the ulimit values in /etc/security/limits.conf or /etc/security/limits.d/*
| Why is ulimit -u higher than /proc/sys/kernel/pid_max? |
1,468,534,540,000 |
When IPv6 is enabled for an interface, it will get a link-local address assigned automatically based on the MAC of the network interface.
But who assigns this address? Is it done in the kernel, or by some userspace program that also sets up the interface?
Ideally, I would also be interested in a link to the actual source code where it is done.
|
The kernel on OpenBSD via in6_ifattach_linklocal, as found by a fgrep -rl fe80 /usr/src 2>/dev/null search.
| Are IPv6 link-local addresses assigned by the kernel or by a userspace program |
1,468,534,540,000 |
Nowdays, I have to compile linux kernel more and more...
So :
make /home/mohsen/K=kernel menuconfig
make /home/mohsen/K=kernel
make /home/mohsen/K=kernel modules_install install
Question is , When I run install target make command, I don't want to install new kernel and old kernel stay. Do you know a target for make command to replace my new kernel?
UPDATE:
Suppose , Once I did the following way:
make /home/mohsen/K=kernel menuconfig
make /home/mohsen/K=kernel
make /home/mohsen/K=kernel modules_install install
Then I find out to add/remove to kernel , So do the following job:
make /home/mohsen/K=kernel menuconfig
make /home/mohsen/K=kernel
For 3th command , When you usekernel install, This copy current kernel to *.old and install new kernel.
I don't want to copy current kernel to *.old
|
The installkernel command installs the kernel and there is no option to disable creating the .old. If you don't want it then you can use your own installation script and set the environment variable INSTALLKERNEL
INSTALLKERNEL
--------------------------------------------------
Install script called when using "make install".
The default name is "installkernel".
The script will be called with the following arguments:
$1 - kernel version
$2 - kernel image file
$3 - kernel map file
$4 - default install path (use root directory if blank)
Without knowing what you are trying to do I'd humbly suggest you add rm of the old kernel to your installation steps rather than writing your own INSTALLKERNEL.
| replace new linux kernel with make |
1,468,534,540,000 |
I tried playing around with compiling my own kernel. Everything is fine so far, except for that one thing.
Whenever I leave a wifi network or unplug my ethernet cable the system does not recognize, that the connection was lost and I have to manually tell the network manager.
I think it has to do with the new kernel, since that is the only thing that changed.
Since I feel like the documentation on the kernel components is pretty hard to parse, I'll ask it:
What kernel module/symbol did I set wrongly to provoke this behaviour?
|
My particular problem turned out to be ifplugd. It failed with a NLAPI: Packet too small or truncated error everytime I plugged my ethernet cable in or out.
Seems like some change in Kernel 3.9 introduced something. So I recompiled ifplugd with a change to the buffer size in src/nlapi.c line 74.
-- char replybuf[1024];
++ char replybuf[8*1024];
Now it works.
Related links:
Bug Report
Fix in busybox version of ifplugd
| New Kernel does not automatically reconnect to network |
1,468,534,540,000 |
I am compiling linux red hat stable kernel on red hat linux and the error which I am facing is as below
|
First install XZ
yum -y install xz
then
tar -xvf yourfile.tar.xz
| how to untar file in linux red hat? |
1,468,534,540,000 |
I am trying to compile FreeBsd 8.2 RELEASE kernel
# uname -a
FreeBSD 8.2-RELEASE FreeBSD 8.2-RELEASE #2: Sun May 18 00:07:10 PDT 2014
Build the kernel
# pwd
/usr/src
# make buildkernel
... it compiles until I get this error ...
MAKE=make sh /usr/src/sys/conf/newvers.sh GENERIC
cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -nostdinc -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -fstack-protector -Werror vers.c
linking kernel.debug
text data bss dec hex filename
9336435 915392 672984 10924811 a6b30b kernel.debug
objcopy --only-keep-debug kernel.debug kernel.symbols
objcopy --strip-debug --add-gnu-debuglink=kernel.symbols kernel.debug kernel
cd /usr/src/sys/modules; MAKEOBJDIRPREFIX=/usr/obj/usr/src/sys/GENERIC/modules KMODDIR=/boot/kernel MODULES_OVERRIDE="usb/run" DEBUG_FLAGS="-g" MACHINE=i386 KERNBUILDDIR="/usr/obj/usr/src/sys/GENERIC" SYSDIR="/usr/src/sys" make all
===> usb/run (all)
cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/usr/src/sys/GENERIC/opt_global.h -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common -g -I/usr/obj/usr/src/sys/GENERIC -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -fstack-protector -std=iso9899:1999 -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -c /usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:150: error: 'USB_PRODUCT_CISCOLINKSYS_AE1000' undeclared here (not in a function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_vap_delete':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:861: error: 'struct run_vap' has no member named 'beacon_mbuf'
cc1: warnings being treated as errors
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:861: warning: passing argument 1 of 'm_freem' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:862: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:862: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_newstate':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:1809: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:1809: warning: passing argument 1 of 'm_freem' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:1810: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:1810: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_key_set':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2106: error: 'struct run_softc' has no member named 'cmdq_key_del'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2106: warning: passing argument 1 of 'atomic_load_acq_int' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_key_delete_cb':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2166: error: 'struct run_softc' has no member named 'cmdq_key_del'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2166: warning: passing argument 1 of 'atomic_clear_barr_int' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_key_delete':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2181: error: 'struct run_softc' has no member named 'cmdq_key_del'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2181: warning: passing argument 1 of 'atomic_set_barr_int' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_drain_fifo':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2284: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2284: warning: assignment from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: error: 'RUN_TXCNT' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: error: (Each undeclared identifier is reported only once
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: error: for each function it appears in.)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: error: lvalue required as increment operand
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2287: error: 'RUN_SUCCESS' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2287: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2287: error: lvalue required as increment operand
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2287: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2298: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2298: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2299: error: 'RUN_RETRY' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2299: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2299: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_iter_func':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2315: error: array type has incomplete element type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2324: warning: cast discards qualifiers from pointer target type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2325: warning: passing argument 4 of 'run_read_region_1' makes integer from pointer without a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2330: error: 'struct usb_device_id' has no member named 'error'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2330: error: request for member 'fail' in something not a structure or union
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2330: warning: cast from pointer to integer of different size
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2332: error: 'struct usb_device_id' has no member named 'tx'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2332: error: request for member 'retry' in something not a structure or union
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2332: warning: cast from pointer to integer of different size
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2333: error: 'struct usb_device_id' has no member named 'tx'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2333: error: request for member 'success' in something not a structure or union
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2333: warning: cast from pointer to integer of different size
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2334: error: 'struct usb_device_id' has no member named 'error'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2334: error: request for member 'fail' in something not a structure or union
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2334: warning: cast from pointer to integer of different size
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2336: error: 'struct usb_device_id' has no member named 'error'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2336: error: request for member 'fail' in something not a structure or union
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2336: warning: cast from pointer to integer of different size
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2339: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2339: warning: assignment from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2341: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2341: warning: comparison of distinct pointer types lacks a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2342: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2342: warning: comparison of distinct pointer types lacks a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2345: error: 'RUN_TXCNT' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2345: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2345: warning: assignment makes integer from pointer without a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2346: error: 'RUN_SUCCESS' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2346: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2346: warning: assignment makes integer from pointer without a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2347: error: 'RUN_RETRY' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2347: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2347: warning: assignment makes integer from pointer without a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2315: warning: unused variable 'sta'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_newassoc_cb':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2378: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2378: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2378: warning: passing argument 1 of 'memset' discards qualifiers from pointer target type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_update_beacon':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:3990: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:3990: warning: passing argument 3 of 'ieee80211_beacon_update' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_update_beacon_cb':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4019: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4020: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4021: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4022: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4025: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4025: warning: assignment from incompatible pointer type
*** Error code 1
Stop in /usr/src/sys/modules/usb/run.
*** Error code 1
Stop in /usr/src/sys/modules.
*** Error code 1
Stop in /usr/obj/usr/src/sys/GENERIC.
*** Error code 1
Stop in /usr/src.
*** Error code 1
Stop in /usr/src.
I am not sure how to assess this error message and fix it.
Any recommended directions?
UPDATE TRIED ON ANOTHER VM
Got a similar error message
cc -static -o rescue rescue.o cat.lo chflags.lo chio.lo chmod.lo cp.lo date.lo dd.lo df.lo echo.lo ed.lo expr.lo getfacl.lo hostname.lo kenv.lo kill.lo ln.lo ls.lo mkdir.lo mv.lo pkill.lo ps.lo pwd.lo realpath.lo rm.lo rmdir.lo setfacl.lo sh.lo stty.lo sync.lo test.lo rcp.lo csh.lo atacontrol.lo badsect.lo camcontrol.lo ccdconfig.lo clri.lo devfs.lo dmesg.lo dump.lo dumpfs.lo dumpon.lo fsck.lo fsck_ffs.lo fsck_msdosfs.lo fsdb.lo fsirand.lo gbde.lo geom.lo ifconfig.lo init.lo kldconfig.lo kldload.lo kldstat.lo kldunload.lo ldconfig.lo md5.lo mdconfig.lo mdmfs.lo mknod.lo mount.lo mount_cd9660.lo mount_msdosfs.lo mount_nfs.lo mount_ntfs.lo mount_nullfs.lo mount_udf.lo mount_unionfs.lo newfs.lo newfs_msdos.lo nos-tun.lo ping.lo reboot.lo restore.lo rcorder.lo route.lo routed.lo rtquery.lo rtsol.lo savecore.lo spppcontrol.lo swapon.lo sysctl.lo tunefs.lo umount.lo atmconfig.lo ping6.lo ipf.lo zfs.lo zpool.lo bsdlabel.lo sconfig.lo fdisk.lo dhclient.lo head.lo mt.lo sed.lo tail.lo tee.lo gzip.lo bzip2.lo xz.lo tar.lo vi.lo id.lo chroot.lo chown.lo /usr/src/rescue/rescue/../librescue/exec.o /usr/src/rescue/rescue/../librescue/getusershell.o /usr/src/rescue/rescue/../librescue/login_class.o /usr/src/rescue/rescue/../librescue/popen.o /usr/src/rescue/rescue/../librescue/rcmdsh.o /usr/src/rescue/rescue/../librescue/sysctl.o /usr/src/rescue/rescue/../librescue/system.o -lcrypt -ledit -lkvm -ll -ltermcap -lutil -lalias -lcam -lcurses -ldevstat -lipsec -lipx -lzfs -lnvpair -luutil -lavl -lgeom -lbsdxml -ljail -lkiconv -lmd -lreadline -lsbuf -lufs -lz -lbz2 -llzma -larchive -lcrypto -lm
csh.lo(.text+0xdba6): In function `nlsclose':
: undefined reference to `dl_iconv_close'
csh.lo(.text+0xdd21): In function `nlsinit':
: undefined reference to `dl_iconv_open'
csh.lo(.text+0xde1c): In function `iconv_catgets':
: undefined reference to `dl_iconv'
*** Error code 1
Stop in /usr/src/rescue/rescue.
*** Error code 1
Stop in /usr/src/rescue/rescue.
*** Error code 1
Stop in /usr/src/rescue.
*** Error code 1
Stop in /usr/src.
*** Error code 1
Stop in /usr/src.
|
In both cases those are not primarily warnings that break the build.
For the kernel compilation:
error: 'struct run_vap' has no member named 'beacon_mbuf'
the compiler tells you, that the code is trying to access something that isn't there. This may have many reasons, but generally it suggests that the code is broken. Maybe you are trying to compile a module that relies on newer/older internal kernel API (i.e. is using another definition of structures than the rest of the kernel).
warning: passing argument 1 of 'm_freem' from incompatible pointer type
is often either a programming mistake (i.e. indeed passing something else as argument than what is expected) or a missing cast operator.
cc1: warnings being treated as errors
is caused by -Werror in the compiler flags, which tells the compiler to treat warnings as errors. Which is usually a Good IdeaTM, actually (mostly because of the often encountered - "But it compiles, there are just some warnings" attitude).
For the other problem:
csh.lo(.text+0xdba6): In function `nlsclose':
: undefined reference to `dl_iconv_close'
is actually an error from the linker - compilation went (more or less) well but you are not supplying external libraries that provide some symbols referenced by the code. This often happens when you correctly #include header files and then forget to tell linker to actually link against that library (usually the -l option).
| cc1: warnings being treated as errors when compile FreeBSD 8.2 Release |
1,468,534,540,000 |
I searched high and low for what “Intel P state” is and what it does. I found out that it has to do with performance and power consumption. I learned that if you build it in the kernel, it'll becomes the default scaling driver for Intel CPUs.
But What I want to know is, what does it do?
Does it reduce CPU functionality and power in favour of reducing power consumption, or does it manage and balance the CPU state, i.e if CPU is under heavy load and compiling something it boosts the CPU frequency to compensate and it reduces it when it is idle?
|
P states on x86 processors are levels of voltage scaling. When a processor runs at higher voltage, it can run faster, but it also uses more energy and heats more. The P state numbering is standardized: 0 to 15, from fastest to slowest.
It is up to the kernel to decide when to switch between P states. The kernel will switch to a lower-numbered (faster, hotter) state when it detects a heavy workload (the CPU is never idle), and switch back to a higher-numbered (slower, cooler) state when it detects that the CPU has spare time.
The P state driver is the part of the kernel that takes the decision to switch between P states.
| Role of the Intel P state driver |
1,468,534,540,000 |
I am installing CentOS 6.4 via a kick start file that looks like this in my build:
# install the bootloader (GRUB)
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto"
After the installation I see this in /root/anaconda-ks.cfg
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
The problem is I do not want 'quiet' appended the the kernel parms. quiet gives the moving progress bar during the installation instead of the detail. I want to see the details.
Why does the installation add quiet to the bootloader when I never specified it??
How do I prevent CentOS 6.4 from adding this automatically during installation???
UPDATE:
My initial post was wrong.. rhgb kernel parm enables graphical progress bar during boot. So, in my case I needed to get rid of both rhgb and quiet.
Updated my ks.cfg file and added suggested editing in the %post section. Works great now!!!
|
According to the docs, it seems you can't get rid of it from Kickstart: http://fedoraproject.org/wiki/Anaconda/Kickstart#bootloader
But what you can do is get the command line and the grub config replaced in the post-install (%post) section and delete it from there.
I think this should do:
%post
sed -i -e 's/quiet//' /mnt/sysimage/boot/grub/menu.lst
| CentOS 6.4 Kickstart bootloader problem |
1,468,534,540,000 |
I need Debian with kernel 2.6.34.8
Is there any way to force Debian with it?
I don't want to install and then compile version I need.
|
First off, with such a specific requirement, you should be aware that any kernels you grab from Debian have been patched. They're not pristine upstream sources.
That said, Debian stable uses 2.6.32.x and wheezy, I believe, will use 3.2.x. So 2.6.34.x was probably never packaged by the Debian kernel team. Checking snapshot.debian.org's linux-2.6 page shows that 2.6.34 was put in experimental, but that appears to be 2.6.34, without the .8. And of course, it contains Debian patches.
I think 2.6.34 has make deb-pkg, so it should be fairly easy to build the upstream source into a .deb, and then install that. Your other option would be to grab the Debian sources from the older 2.6.34.0, and merge in .8 yourself. That will lead to a .8 with Debian patches, and is probably a fair bit more work.
BTW: If you're going to run 2.6.34.x, you should run 2.6.34.14 (the current release on that branch).
| Force Debian kernel version |
1,468,534,540,000 |
I am running a Ubuntu of version 12.04.
Can I use a kernel of version of version 2.4 on it?
|
There might be a lot of things broken if you would use a kernel 2.4 on it.
First, such an old kernel might not (honestly it will not) recognize some or all your hardware because it did not exist at that time. Depending on the not recognized hardware you might or might not be able to start your machine.
Then, all the user space applications that directly communicate with the kernel might (or will) not work. Because the kernel architecture and feature changed that much that they are no longer compatible with it. Thus again you probably won't be able to boot.
So I would advise not to do it on a used system. If you really want to try it, create a VM, install Ubuntu in it, compile your kernel (if that works still!) and reboot the VM using this kernel. I doubt it will work, but who knows :-)
| Relation between the kernel version and OS version |
1,468,534,540,000 |
I am studying OCFS2 kernel source code and I found this comment of function dlm_lanuch_thread in file fs/ocfs2/dlm/dlmthread.c:
/* Launch the NM thread for the mounted volume */
So what does the "NM thread" mean?
|
From the user's guide, section 4, "O2CB Cluster Service":
NM: Node Manager that keep[sic] track of all the nodes in the cluster.conf
| What's a NM thread? |
1,468,534,540,000 |
I want to reinstall my VPS with the debian's official repository, instead of with the image provided by the VPS operator(I don't trust the VPS operator).
On original system I installed debian-installer by apt install debian-installer debian-installer-12-netboot-amd64, and taked the kernel that comes with debian-installer as a new grub booting entry.
When I reboot the VPS, it can automatically begin a fresh installing session, just like boot from a USB stick, so I can erase everything that offered by the operator.
Now I want to do more perfectly, i.e. to boot with expert install mode of the debian installer.
I guess the only way I can control the booting process of the installer's kernel, is to offer some kernel parameters in grub entry.
But I don't know what parameter I should specify, because these are NOT common kernel parameters those we can refer to the standard Linux docs.
What name and value of kernel parameters, can make the debian installer to boot into exert mode?
Or Where to find docs of this?
Thanks!
|
instead of with the image provided by the VPS operator(I don't trust the VPS operator).
Then you need to change the VPS operator. These guys run the virtualizer that your operating system runs in – they can literally do whatever they like with your RAM, including substituting URLs, making signature checks pass when they fail and so on.
So, yeah, you have a trust problem without a technical solution there.
Now I want to do more perfectly, i.e. to boot with expert install mode of the debian installer.
I didn't even know that was still a thing! I remember the advanced text-mode installer as being necessary mostly because the default installer didn't give one the choice over network setup and disk layout, but I don't think that is still an issue, and the current installer just can do as much as the "expert installer", maybe aside from Braille reader support (you'll want the default network setup for your VPS anyways, and even if you wanted to do manual setup, you can do that as soon as DHCP / IPv6 autoconf fails). I just played it through – I haven't found a single thing that I could do in the expert install that I can't in the default graphical installer, and which I'd want to do in a VM: Things like adding repositories, installing additional software or removing things are honestly best done with provisioning tools that you run on the clean installation (e.g., ansible), not through manual fiddling with dselect in the installer.
So make sure you're actually solving an issue there and not just making your life harder. Virtualized environments typically are perfectly auto-detectable without additional drivers (and if they aren't, you'll probably need the kernel from your VPS provider; see the unsolvable trust issue above).
However, should you prefer to do the installation via the serial console that your VPS provider might give you access to, sure, the DEBIAN_FRONTED=text parameter might be your method of choice. Note that the more common way is to upload a provisioning scheme (for example, a cloud-init configuration file). But this depends on the virtualization solution of your VPS provider.
In your use case, it's really more common to make a bootable image that supplies an SSH server, or that is fully preseeded to do the installation without manual interaction.
What name and value of kernel parameters, can make the debian installer to boot into exert mode? Or Where to find docs of this?
You'd find that by going to https://www.debian.org, clicking on "User Support / Getting help and documentation", clicking on the link in the dark grey box "documentation", clicking on "Installation Guide", then clicking on the architecture you have (64-bit ARM? 64-bit PC?), and then navigating to section 5, "Booting the Installation System"; and there, clicking on "5.3.2 Debian Installer Parameters".
| Boot a kernel of debian installer with expert mode |
1,468,534,540,000 |
Linux automatically populates a devtmpfs with the right devices and directory structure. This provides an almost complete tree for /dev, but the pts devices are notably missing.
For the pts devices, Linux provides another virtual filesystem named devpts. This however is also a collection of device nodes, sometimes causing surprises when a human installer simply mounts a devtmpfs to the chroot dev directory.
I find the design likely rooted from historical reasons, but even then, the kernel can simply populate /dev/pts automatically with devtmpfs, and any distros formerly using a udev-managed tmpfs with a devpts could migrate over to just devtmpfs. I can't think of a good reason for the decision otherwise.
|
The design is indeed historical: the devpts file system, tied to Unix98 PTY support, has been available for a very long time, whereas the devtmpfs file system isn’t quite as old.
devtmpfs could have included support for /dev/pts, but there are a few reasons to keep them separate. The two features are independent, so it is possible to configure a kernel with devpts and without devtmpfs, and vice versa. It is also possible to configure a system to use /dev/pts on top of any kind of /dev — static (part of the root file system), a separate udev-managed tmpfs (as you mention), or devtmpfs. Preserving all these possibilities requires a separate /dev/pts implementation anyway, so there probably isn’t much point in adding specific /dev/pts support to devtmpfs.
| Why don't devtmpfs populate /dev/pts? |
1,468,534,540,000 |
The aim is to install Debian using debootstrap. First I want to install all system on a small 32GB flash disk.
And concepts of GPT partition tables and GRUB is quite clear: There is a table of partitions. Each partition has uniq ID. Further on each partition a filesystems created. FileSystem itself is the way to store files, journal, dirs and so on, it is a DataSturture.
Ok. Clear.
Now there is a ESP. A partition where the BOOTLoader is stored. And it must be FAT32 is not it?
Now I need to get kernel, ramdisk. Create a ESP on a FlashStick. And install GRUB so it going to be on the ESP and select appropriate Kernel and Ramdisk. And here I am stuck.
How to create ESP? Is it a simple partition that further formated to FAT32?
How to tell GRUB where to be installed? How to configure it? I know about grub-mkconfig - and I know that need to set linux and initrd but still a little bit confusing.
So here a problems begins.
How to connect ESP with a rest of FileSystem?
How kernel knows where to search for all files and configurations?
That jump from starting GRUB and starting kernel passing parameters and mounting ESP into FileSystm looks weird and awkward.
Need help.
Thank you.
|
How to create ESP? Is it a simple partition that further formated to FAT32?
Yes, it is a simple partition, formatted to FAT32 (newer UEFI versions may accept other forms of FAT too), and the partition type UUID of a GPT-style partition table set to indicate it's an EFI System Partition (or ESP for short). If you are booting UEFI-style from a MBR-partitioned disk, the partition type code of the ESP should be set to 0xef instead of a regular FAT32 partition type code.
How to tell GRUB where to be installed? How to configure it?
To install GRUB, the grub-install command is used. It takes as a parameter the device name of the disk or partition to where GRUB should be installed.
If there is only one ESP on the disk (as is generally recommended), you can just specify the whole-disk device, e.g. /dev/sda or /dev/nvme0n1, just like you would do when installing a legacy BIOS-style GRUB. It will automatically find the ESP and write grubx64.efi in there, and also register it into UEFI NVRAM firmware variables (which you can view with efibootmgr -v).
If you are installing to a removable flash disk, you should also specify the option --removable to grub-install. If the disk is not removable as such, but you plan to move or clone it to another system, you should probably use the --force-extra-removable option instead.
Once GRUB is installed, grub-mkconfig - or a Debian-specific update-grub wrapper for it - can be used to create a GRUB configuration file.
In Debian, the standard mount point for the ESP is /boot/efi. Other distributions may do things differently.
When the system is booting UEFI-style, the firmware will first check its NVRAM boot variables for a boot order. A UEFI-style boot variable will specify a device, the ESP partition on it (identified primarily by the unique PARTUUID of the ESP), and a boot file to use within that ESP. In the case of a permanently-installed Debian distribution, the boot file pathname will be (Windows style, like the firmware will usually represent it) \EFI\debian\grubx64.efi, or \EFI\debian\shimx64.efi if a Secure Boot compatibility is also desired and the shim-signed and grub-efi-amd64-signed packages have been installed.
If there is no boot variable (e.g. because a removable media was selected for booting), a 64-bit x86 UEFI system will look for a pathname (in Windows style) \EFI\BOOT\BOOTx64.efi. If GRUB was installed using the --removable or --force-extra-removable options, this will actually be a copy of grubx64.efi.
So, the firmware will start GRUB, and then GRUB will read \EFI\debian\grub.cfg from the ESP. It will normally contain just a search command that will tell GRUB to find whatever partition contains /boot/grub using its UUID, and then the commands required to read /boot/grub/grub.cfg from there. (Depending on how the system is set up, this could refer to the root filesystem, or a separate /boot filesystem - either way is fine.)
After reading the real configuration from /boot/grub/grub.cfg, GRUB will know where to find the kernel and initramfs files, and what menu items to present to the user. GRUB will then load the selected kernel and initramfs files, pass the specified kernel boot options to the kernel command line, and then it will start the kernel. At this point, the boot-time jobs of GRUB, the ESP, and the /boot directory are all done - from this point onward, the boot can proceed without them.
The kernel will find the root filesystem based on the root= kernel boot option and any scripts within the initramfs, and once the root filesystem is located, checked (if necessary) and mounted, the boot process will be able to access the real /etc and proceed according to the information found in there.
At boot time, the kernel will never need to access /boot nor the ESP - when the kernel starts up, the bootloader and the firmware will have already read all they need from there. The ESP is mounted to /boot/efi only to allow for easy updates of the bootloader and its configuration. If you plan to never do that (e.g. in an embedded appliance system that will receive any updates by a total reimaging), you could leave the ESP completely unmounted.
| ESP and GRUB instalation |
1,468,534,540,000 |
Is there a way to make it so that certain kernel modules, mount points, and boot-time services (in either Systemd or OpenRC) can be enabled or disabled based on boot-time parameters (and/or the type of kernel running)?
And taking it a step further, could init systems be swapped in a similar way? (I am aware of the init=... kernel parameter, but can (for example) both systemd and OpenRC co-exist together in the same installation and swapped out at-will during boot-time)?
For some background (in case anyone is old enough to remember this), my line of thinking stems from the DOS technique of having multiple system profiles in config.sys/autoexec.bat which could be chosen based on a boot-time menu.
So if I (purely for the sake of example) wanted to have three menu entries in GRUB:
"Gaming": would load a custom kernel, load proprietary nvidia drivers & enable optimus (or vfio passthrough), and boot into X11;
"Work": would load another kernel, load intel video drivers, mount my encrypted work partition, and boot into Wayland;
"Server": would load a third (high-latency) kernel, start specific additional background services (i.e. web server, ssh host, vm host), and boot into the text console.
The above are just examples, but hopefully the point comes across.
Is something like this possible in Linux?
|
Sure. Depending on your distro, it might be easy or hard, but yes.
For modules, this U&L post mentions the modules_load kernel parameter for loading modules And this other post has a parameter for blocking modules. On Arch Linux, mkinitcpio makes it easy to generate multiple kernel images with different configurations (well, at least for pre-loaded modules and so on, but not build config).
For loading services, mounting volumes, etc., systemd makes it easy by having both be units which can part of dependency chains. So you can create a "target" gaming.target which Wants/Requires or is WantedBy/RequiredBy a service which starts X11, or a work.target which Wants/Requires or is WantedBy/RequiredBy by the mount unit and device units of the encrypted work partition, and a unit which starts Wayland, and so on. Then the target that you want to boot to will be part of the kernel command line using the systemd.unit parameter (say, systemd.unit=gaming.target or systemd.unit=work.target).
Since the target needs to be set in the kernel command line, and possibly the modules to load as well, you will need to update your bootloader configuration to create separate entries for each with corresponding the kernel images and command lines.
Init systems can be swapped - when Ubuntu first introduced systemd, it was possible to swap between Upstart and systemd. I think Gentoo still supports it. For other distros, somebody will have to set up service configuration and so on for the non-default init system (and that somebody will likely be you, entailing a lot of work).
| Separate system profiles -- i.e. different boot / init configurations based on kernel parameters |
1,468,534,540,000 |
Low CPU IDLE can be caused by a variety of factors, including:Insufficient RAM or slow Hard Disk Drive
but in our RHEL server RAM memory have enough RAM but from dmesg we found couple errors about the disks drive
our suspicion is about the disks as for example sdk and sdc and that because we saw from dmesg errors as [sdk] tag#0 Add. Sense: Unrecovered read error
here the details from sar command that show the CPU IDLE values
09:43:56 AM CPU %user %nice %system %iowait %steal %idle
09:44:01 AM all 98.57 0.00 0.62 0.00 0.00 0.80
09:44:06 AM all 98.26 0.00 0.92 0.01 0.00 0.81
09:44:11 AM all 97.29 0.00 1.66 0.01 0.00 1.03
09:44:16 AM all 92.81 0.00 6.06 0.03 0.00 1.10
09:44:21 AM all 92.31 0.00 6.43 0.05 0.00 1.21
Average: all 95.85 0.00 3.14 0.02 0.00 0.99
09:44:21 AM CPU %user %nice %system %iowait %steal %idle
09:44:22 AM all 96.52 0.00 3.10 0.00 0.00 0.38
09:44:22 AM 0 98.00 0.00 2.00 0.00 0.00 0.00
09:44:22 AM 1 98.00 0.00 2.00 0.00 0.00 0.00
09:44:22 AM 2 100.00 0.00 0.00 0.00 0.00 0.00
09:44:22 AM 3 98.00 0.00 2.00 0.00 0.00 0.00
09:44:22 AM 4 98.00 0.00 2.00 0.00 0.00 0.00
09:44:22 AM 5 98.00 0.00 2.00 0.00 0.00 0.00
09:44:22 AM 6 97.98 0.00 2.02 0.00 0.00 0.00
09:44:22 AM 7 97.98 0.00 2.02 0.00 0.00 0.00
09:44:22 AM 8 98.99 0.00 1.01 0.00 0.00 0.00
09:44:22 AM 9 98.00 0.00 2.00 0.00 0.00 0.00
09:44:22 AM 10 98.00 0.00 2.00 0.00 0.00 0.00
09:44:22 AM 11 98.02 0.00 0.99 0.00 0.00 0.99
09:44:22 AM 12 97.00 0.00 1.00 0.00 0.00 2.00
09:44:22 AM 13 96.97 0.00 3.03 0.00 0.00 0.00
09:44:22 AM 14 98.02 0.00 0.99 0.00 0.00 0.99
09:44:22 AM 15 94.00 0.00 6.00 0.00 0.00 0.00
09:44:22 AM 16 83.00 0.00 16.00 0.00 0.00 1.00
09:44:22 AM 17 98.00 0.00 1.00 0.00 0.00 1.00
09:44:22 AM 18 96.97 0.00 2.02 0.00 0.00 1.01
09:44:22 AM 19 96.00 0.00 4.00 0.00 0.00 0.00
09:44:22 AM 20 97.98 0.00 1.01 0.00 0.00 1.01
09:44:22 AM 21 95.05 0.00 4.95 0.00 0.00 0.00
09:44:22 AM 22 94.95 0.00 5.05 0.00 0.00 0.00
09:44:22 AM 23 98.99 0.00 1.01 0.00 0.00 0.00
09:44:22 AM 24 98.99 0.00 1.01 0.00 0.00 0.00
09:44:22 AM 25 99.00 0.00 1.00 0.00 0.00 0.00
09:44:22 AM 26 98.99 0.00 1.01 0.00 0.00 0.00
09:44:22 AM 27 98.99 0.00 1.01 0.00 0.00 0.00
09:44:22 AM 28 98.00 0.00 2.00 0.00 0.00 0.00
09:44:22 AM 29 98.00 0.00 2.00 0.00 0.00 0.00
09:44:22 AM 30 94.95 0.00 5.05 0.00 0.00 0.00
09:44:22 AM 31 97.03 0.00 1.98 0.00 0.00 0.99
09:44:22 AM 32 98.02 0.00 1.98 0.00 0.00 0.00
09:44:22 AM 33 99.00 0.00 1.00 0.00 0.00 0.00
09:44:22 AM 34 98.00 0.00 1.00 0.00 0.00 1.00
09:44:22 AM 35 97.98 0.00 2.02 0.00 0.00 0.00
09:44:22 AM 36 94.00 0.00 5.00 0.00 0.00 1.00
09:44:22 AM 37 98.02 0.00 0.99 0.00 0.00 0.99
09:44:22 AM 38 97.98 0.00 1.01 0.00 0.00 1.01
09:44:22 AM 39 89.00 0.00 11.00 0.00 0.00 0.00
09:44:22 AM 40 83.00 0.00 13.00 0.00 0.00 4.00
09:44:22 AM 41 97.00 0.00 3.00 0.00 0.00 0.00
09:44:22 AM 42 91.92 0.00 8.08 0.00 0.00 0.00
09:44:22 AM 43 94.06 0.00 5.94 0.00 0.00 0.00
09:44:22 AM 44 92.93 0.00 7.07 0.00 0.00 0.00
09:44:22 AM 45 97.00 0.00 3.00 0.00 0.00 0.00
09:44:22 AM 46 99.00 0.00 1.00 0.00 0.00 0.00
09:44:22 AM 47 98.99 0.00 1.01 0.00 0.00 0.00
sar -B 2 5
09:44:24 AM pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeff
09:44:26 AM 14852.00 71776.00 101443.50 0.00 216420.00 0.00 0.00 0.00 0.00
09:44:28 AM 14336.00 184.00 5123.00 0.00 47167.50 0.00 0.00 0.00 0.00
09:44:30 AM 14418.00 203778.00 67194.50 0.00 132952.50 0.00 0.00 0.00 0.00
09:44:32 AM 14352.00 220796.00 2475.00 0.00 59666.00 0.00 0.00 0.00 0.00
09:44:34 AM 13318.00 56996.00 16290.00 0.00 9599.00 0.00 0.00 0.00 0.00
Average: 14255.20 110706.00 38505.20 0.00 93161.00 0.00 0.00 0.00 0.00
from vmstat command
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
65 0 3505188 6265864 4828612 304096576 0 0 137 127 0 0 49 1 50 0 0
63 1 3505188 6068484 4828660 304294848 0 0 12292 41500 95782 88751 98 2 1 0 0
66 0 3505188 5933464 4828672 304429248 0 0 14668 130968 85788 90844 97 2 1 0 0
r: The number of processes waiting for run time.
from kernel messages we get:
[117426425.532990] blk_update_request: critical medium error, dev sdc, sector 116127985
[117426431.038365] sd 0:0:3:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[117426431.038374] sd 0:0:3:0: [sdc] tag#0 Sense Key : Medium Error [current] [descriptor]
[117426431.038378] sd 0:0:3:0: [sdc] tag#0 Add. Sense: Unrecovered read error
[117426431.038383] sd 0:0:3:0: [sdc] tag#0 CDB: Read(16) 88 00 00 00 00 00 06 eb f8 f0 00 00 00 08 00 00
[117426431.038386] blk_update_request: critical medium error, dev sdc, sector 116127985
[139602560.596832] traps: polkitd[27641] general protection ip:7f7996318cf2 sp:7ffe7a28e5b0 error:0 in libmozjs-17.0.so[7f79961da000+3b3000]
[144770588.094226] sd 0:0:11:0: [sdk] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[144770588.094238] sd 0:0:11:0: [sdk] tag#0 Sense Key : Medium Error [current] [descriptor]
[144770588.094242] sd 0:0:11:0: [sdk] tag#0 Add. Sense: Unrecovered read error
[144770588.094248] sd 0:0:11:0: [sdk] tag#0 CDB: Read(16) 88 00 00 00 00 00 01 15 20 00 00 00 02 00 00 00
so based on above output is it make sense that the root cause of very low CPU IDLE is because disks errors as we get from kernel messages ?
|
Based on the timestamps, nearly a year passed between the two disk errors in your logs, so no, they’re not the reason your system isn’t idling.
As an aside, note that
r: The number of processes waiting for run time.
isn’t accurate: in vmstat, the r column shows the number of runnable processes, i.e. the number of processes either running or waiting to run. If you have many logical CPUs then a high number here isn’t a problem.
| CPU IDLE low as results of bad disks is it the case here |
1,468,534,540,000 |
I need help to find a kernel patch to get a VTIME from tty termios API lower than 100ms, in order to decrease gap inter char. It blocks read syscall until VTIME timeout.
Function n_tty_read() is the patch entry point :
https://elixir.bootlin.com/linux/latest/source/drivers/tty/n_tty.c#L2131
Is there someone to advise me? I have to use non-canonical mode (without framing protocol, no ascii, no break). And VMIN param is null because all messages length are variables.
The solution to poll each char is too expensive with a multiple uart system and implied multiple process context switches.
Extract termios manual:
VTIME Timeout in deciseconds for noncanonical read (TIME). https://man7.org/linux/man-pages/man3/termios.3.html
A Linux kernel patch is necessary...
Is it better to divide HZ with a greater value ? Or to set global HZ to a smaller value ?
Microsoft Windows Serial API is able to configure until 1ms but not Linux. So Windows is better for raw Serial port processing.
ReadIntervalTimeout : https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddser/ns-ntddser-_serial_timeouts
Comment extract "in non-canonical mode ... only accept 4095 char", I think problem is here, perhaps it is why read_wait queue is not woke up.
https://elixir.bootlin.com/linux/latest/source/drivers/tty/n_tty.c#L1667
|
To propose a patch that keeps kernel API compatibility, I think a diversion solution is primary possible: It is to use VEOF paramater value (unsigned char value unused) of CANON mode to tune VTIME (add a division factor to timeout value before appling schedule_timeout function), which will be applied to NON-CANON mode read function.
Use VEOF value which is unused in non-canon mode:
https://elixir.bootlin.com/linux/latest/source/include/linux/tty.h#L39
Apply division here: for example, if VEOF value differs from default value then apply to reduce VTIME timeout.
https://elixir.bootlin.com/linux/latest/source/drivers/tty/n_tty.c#L2196
| How to patch kernel to reduce VTIME gap for uart termios API? |
1,468,534,540,000 |
I am writing an LSM, and I am compiling it using my kernel 6.2.0-20-generic. When I browse the files in /lib/modules/6.2.0-20-generic/build, I can see that there is a struct named lsm_id. But When I examine the recent Linux source tree in Github, I can not see this struct. I tried downloading a different version but I could not find this struct anywhere in any of the Linux kernel source codes.
I can see that there is a patch that has been released this year but I am not sure why I can not see it in the source tree and how it got in my kernel source code in /lib/modules?
I want to have the source code of the kernel with patches applied, is there any way to get that?
Link for the patch
https://patchwork.kernel.org/project/linux-security-module/patch/[email protected]/
Thanks!
|
The structure is present because Ubuntu applies the relevant patches to its kernel.
The easiest way to get a complete, patched source tree for your kernel is to install the linux-source-6.2.0 package.
| Why the struct lsm_id is not present in linux kernel source tree |
1,468,534,540,000 |
I want to share the following issue
after upgrading the security rpm's on RHEL 7.9 machines include update of microcode_ctl rpm
rpm -qa | grep microcod
microcode_ctl-2.1-73.15.el7_9.x86_64
we noticed about the following kernel messages.
[Sun Jun 4 13:12:19 2023] Microcode update for Intel Broadwell-EP/EX (BDX-ML B/M/R0; family 6, model 79,
stepping 1; CPUID 0x406f1) CPUs is disabled as it may cause system instability.
Please refer to /usr/share/doc/microcode_ctl/caveats/06-4f-01_readme
and /usr/share/doc/microcode_ctl/README.caveats for details.
[Sun Jun 4 13:13:35 2023] After installation of a new version of microcode_ctl package,
[Sun Jun 4 13:13:35 2023] initramfs hasn't been re-generated for all the installed kernel packages.
[Sun Jun 4 13:13:35 2023] The following kernel packages have been skipped: kernel-3.10.0-514.26.2.el7.x86_64.
[Sun Jun 4 13:13:35 2023] Please re-generate initramfs manually for these kernel packages with the
[Sun Jun 4 13:13:35 2023] "dracut -f --kver KERNEL_VERSION" command in order to get the latest
[Sun Jun 4 13:13:35 2023] Intel CPU microcode included into early initramfs image for it, if needed.
the current RHEL kernel version is
uname -r
3.10.0-1160.80.1.el7.x86_64
so according to dmesg we can see that.
dracut -f --kver KERNEL_VERSION
so is it means that we need to set the current kernel version in command as
dracut -f --kver 3.10.0-1160.80.1.el7.x86_64
or to set the kernel as defined in kernel message as
dracut -f --kver kernel-3.10.0-514.26.2.el7.x86_64
|
The message says
The following kernel packages have been skipped: kernel-3.10.0-514.26.2.el7.x86_64.
Please re-generate initramfs manually for these kernel packages with the
"dracut -f --kver KERNEL_VERSION" command in order to get the latest
Intel CPU microcode included into early initramfs image for it, if needed.
It asks you to re-generate the initramfs for version 3.10.0-514.26.2:
dracut -f --kver 3.10.0-514-26.2
You only need to do this if you plan on switching back to 514 instead of your current 1160.
| RHEL 7.9 + microcode_ctl + warning in kernel messages |
1,468,534,540,000 |
In kernel boot options (https://www.kernel.org/doc/Documentation/x86/x86_64/boot-options.txt) I noticed the following option:
iommu=[<size>][,noagp][,off][,force][,noforce]
[,memaper[=<order>]][,merge][,fullflush][,nomerge]
[,noaperture][,calgary]
General iommu options:
off Don't initialize and use any kind of IOMMU.
noforce Don't force hardware IOMMU usage when it is not needed.
(default).
force Force the use of the hardware IOMMU even when it is
not actually needed (e.g. because < 3 GB memory).
soft Use software bounce buffering (SWIOTLB) (default for
Intel machines). This can be used to prevent the usage
of an available hardware IOMMU.
It mentions that iommu=soft is the default option for Intel machines and also mentions that it can be used to prevent the use of a hardware IOMMU.
So if this option is the default for Intel machines, do Intel machines not use hardware IOMMU or do they use hardware IOMMU + software bounce buffering by default?
Also, is there a way to see which IOMMU configuration is being used in the kernel after bootup?
|
The iommu=soft option refers to a software workaround for systems that don't have IOMMU or where IOMMU is disabled. This workaround is called Software IO TLB (SWIOTLB). The SWIOTLB is a mechanism for systems without an IOMMU to be able to safely perform DMA operations to devices.
When iommu=soft is set (which is the default for Intel machines), the Linux kernel uses SWIOTLB by default. This does not mean that hardware IOMMU is not used if it is available, as the Linux kernel is designed to use the hardware IOMMU if it is available and functional, even if iommu=soft is set. The SWIOTLB mechanism is more of a fallback for when hardware IOMMU is not available.
To check the IOMMU configuration after bootup, you can use the command dmesg | grep -i iommu.
| What is the IOMMU configuration used for the Intel machines? |
1,468,534,540,000 |
I wrote a simple program with a thread which runs on a CPU core. It spins kind of aggressively, and it takes 100% of the CPU core. I can see that with top + 1.
After N minutes, I would like to be able to know:
How many times has the kernel preempted (interrupted) my running thread?
|
That's what Linux has event hooks for, and you can use them with perf
Gathering Statistics
I'd start with something simple:
sudo perf state -e sched:sched_switch yourprogram
Try this:
busyloop.c
#include <stdint.h>
int main()
{
for (volatile uint_fast64_t i = 0; i < (1ULL<<34); ++i) {
}
}
compile:
gcc -O3 -o busyloop busyloop.c
run:
$ sudo perf stat -e sched:sched_switch ./busyloop
Performance counter stats for './busyloop':
134 sched:sched_switch
26.534402995 seconds time elapsed
26.496337000 seconds user
0.000996000 seconds sys
There you have you your answer – kind of. That's the times scheduling switched. That does include your process by itself entering the kernel, instead of getting interrupted.
Subtract the number you get when specifying both sched_switch and syscall enter counting:
$ sudo perf stat -e sched:sched_switch,raw_syscalls:sys_enter ./busyloop
Performance counter stats for './busyloop':
765 sched:sched_switch
30 raw_syscalls:sys_enter
26.528107216 seconds time elapsed
26.473054000 seconds user
0.002994000 seconds sys
In this more loaded example run, there were 765 context switches, but only 30 of these were caused by the process doing a syscall by itself.
Live Statistics
What can be done with perf stat can generally also be observed live with the same command line options using perf top
./busyloop &
sudo perf top -e sched:sched_switch,raw_syscalls:sys_enter -p $!
(perf top, perf record, perf report without any specified events to observe do something very awesome – they observe how often in a more-or-less regular sampling your CPU cores are in which function. This is an excellent first step in optimizing software and systems in real workload situations. But that leads to far here!)
In-Depth Tracing
Should you want something that is veeery detailed, perf sched is a surprisingly mighty tool.
$ # make a recording
$ sudo perf sched record -- ./busyloop
[ perf record: Woken up 75 times to write data ]
[ perf record: Captured and wrote 161,058 MB perf.data (1458691 samples) ]
$ # evaluate the recording
$ sudo perf sched map
*A0 179778.272339 secs A0 => migration/0:17
*. 179778.272347 secs . => swapper:0
. *B0 179778.272413 secs B0 => migration/1:21
. *. 179778.272419 secs
. . *C0 179778.272494 secs C0 => migration/2:26
. . *. 179778.272503 secs
. . . *D0 179778.272576 secs D0 => migration/3:31
. . . *. 179778.272585 secs
. . . . *E0 179778.272659 secs E0 => migration/4:36
. . . . *. 179778.272670 secs
. . . . . *F0 179778.272714 secs F0 => migration/5:41
. . . . . *. 179778.272733 secs
. . . . . . *G0 179778.272815 secs G0 => migration/6:46
. . . . . . *. 179778.272821 secs
. . . . . . *H0 179778.272948 secs H0 => perf-exec:1315372
………
Here, every column is a CPU core, and each row is an event. man perf-sched can explain these in more detail than I could. perf schedule latency takes a recording and tells you how much latency the execution of each task experienced in scheduling.
$ sudo perf sched latency | grep busyloop
busyloop:1315372 | 26548.094 ms | 677 | avg: 0.055 ms | max: 0.660 ms | max start: 179800.883053 s | max end: 179800.883713 s
Pretty neat!
| How many times has my process been preempted? |
1,468,534,540,000 |
I have tested ksplice uptrack on Ubuntu 20.04
I see It applies patches to live kernel.
For example:
Effective kernel version is 5.4.0-139.156
uptrack-upgrade -y
The following steps will be taken:
Install [w4h8q11e] CVE-2023-20938: Use-after-free in the Android Binder deriver.
Installing [w4h8q11e] CVE-2023-20938: Use-after-free in the Android Binder deriver.
Your kernel is fully up to date.
Effective kernel version is 5.4.0-144.161
The kernel is first 5.4.0-139
then became 5.4.0-144 without reboot.
My question is simple: did exist/works on Linux a "patch" or system to make the kernel "live upgrade" for example from 5.4.0-144 to 5.10.0-121?
I heard some years ago about an Intel patch about this..
|
Live kernel patching is meant to fix vulnerabilities, not upgrade kernel release. The fact that you're seeing that 5.4.0-139 became 5.4.0-144 is quite unusual. Perhaps Ubuntu does something to keep all the modules compatible within a single kernel release but that is not what upstream thinks is allowed or possible. Upstream insists you need to reboot even if you replaced e.g. 5.4.1 with 5.4.2.
Still upgrading to new major kernel releases via live patching is outright impossible.
The kernel sees major changes between releases, including headers, thus often ABI/API.
Any changes in the core kernel structures are reflected in kernel modules, thus they cannot be compatible with different kernel releases.
Live patching changes the kernel memory image. It cannot change modules on the disk.
| Is there a system for live kernel upgrade from 5.4 to 5.10? |
1,670,605,065,000 |
In a laptop of 64 bits with Windows 7 as host with VirtualBox 6.1.40 installed, was created a Virtual Machine for the latest Peppermint OS available at Choosing and Downloading a Disk Image. I got the PeppermintOS-i386.iso file and the Virtual Machine is based on Debian 32 bits with 2GB of ram.
When the .iso file is booted, appears the welcome screen with:
PeppermintOS - Live
PeppermintOS (686-pae)
PeppermintOS with Localisation support >
Utilities >
Recovery Options >
Is selected the PeppermintOS (686-pae) option and appears a new screen with the following message:
This kernel requires the following features not present on the CPU:
pae
Unable to boot - please use a kernel appropriate for your CPU.
The goal is get some experience with Peppermint 32 bits to be installed really in other old laptop based on 32 bits.
How fix this situation? I am assuming some setting should be applied for VirtualBox in some place.
|
With the Virtual Machine stopped and selected
Open Settings
System
Processor
Check the 'Enable PAE/NX' checkbox
Done
| Can't boot Peppermint 32 bits in VirtualBox 6.1.40 - kernel does not have PAE |
1,670,605,065,000 |
I am attempting to use make to build something, but it seems that /lib/modules/4.18.0-240.22.1.el8_3.x86_64/build is missing.
Previously when I encountered a similar problem with a different version kernel, the command sudo yum install "kernel-devel-$(uname -r)" worked, but this time it says:
No match for argument: kernel-devel-4.18.0-240.22.1.el8_3.x86_64
running sudo yum install kernel-devel outputs
Package kernel-devel-4.18.0-348.7.1.el8_5.x86_64 is already installed.
Package kernel-devel-4.18.0-394.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
where it seems that it's already installed for later versions.
Another question suggests that a reboot would fix this problem, by upgrading the kernel. The kernel was purposefully downgraded because we suspect that what we are trying to do doesn't work with a higher level kernel. Additionally, rebooting the machine seemed to not fix anything.
How do I fix this, installing the correct version of kernel-devel?
|
Apparently the package can be found here. Downloaded it as an rpm, used yum remove kernel-devel do get rid of the newer installations, and then installed from the rpm package, which worked
| Unable to find a match for kernel devel version |
1,670,605,065,000 |
So what I need to do is read a kernel symbol directly from physical memory. I wrote a kernel module that exports a variable (symbol) using the following lines
int test_var = 5;
EXPORT_SYMBOL(test_var);
Using cat /proc/kallsyms | grep test_var I get
ffffffffc04d6064 r __kstrtab_test_var [smigenerator]
ffffffffc04d606d r __kstrtabns_test_var [smigenerator]
ffffffffc04d6054 r __ksymtab_test_var [smigenerator]
ffffffffc04d7000 D test_var [smigenerator]
So my symbol is stored at 0xc04d7000. If I run sudo devmem2 0xc04d7000 I'll get its value (=5), right?
Wrong! Reading that address returns 0xFF300A24. Why am I not getting the variable's value when I read the memory address where it's supposed to be stored??
I've read something about kernel base address and about this address obtained from kallsyms being an offset that should be added to the kernel base address, Not sure if that's true, but in case it is, how can I get this kernel base address?
This might be a dumb question, but I'm totally new to kernel and its concepts and didn't find any answers that could help me.
For the record I'm on Ubuntu 22, kernel 5.15.0-52-generic
|
The symbol is stored at the virtual address ffffffffc04d7000 (ignoring layout randomisation, but that doesn’t matter here ultimately), in kernel memory, and it’s inaccessible from userspace.
If you want to make a variable accessible (read-only) in userspace, you should make it available through the vDSO; look at how gettimeofday is implemented. See also how to declare a new variable in vvar.h |create a vdso in linux.
| How to read symbol value directly from memory? |
1,670,605,065,000 |
I Just installed fedora and on reboot there was this error on the Problem Reporting app, that (as it turns out it cant't be reported????) saying something about ath10k firmware.
Edit: It happens again when I reboot!
|
It is like this answer: https://askubuntu.com/a/1155863/754057
You could try to update your Firmware like this:
fwupdmgr get-updates
fwupdmgr get-devices
Or you install the *.cab drivers with fwupdmgr as written in the Ubuntu Forum, this tool will work the same way in Fedora.
This GitHub Page is probably very helpful for you: https://github.com/kvalo/ath10k-firmware
If you update your System (sudo dnf upgrade) it could be resolved in the Feature as well.
When this is not the proper solution we need to dig deeper there.
Greets
| Fedora Linux ath10k firmware problem. Fresh install |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.