date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,445,774,632,000
I am a student working on a moon rover for CMU and need to work with a TUN interface communication between two devices on the rover. I can create a TUN interface, but am unable to assign its IP addresses in C. Here is the current state right after making the TUN device: 41: tun11: <POINTOPOINT,MULTICAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 500 link/none Here is the desired state: 14: tun71: <POINTOPOINT,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 500 link/none inet 192.168.0.29 peer 192.168.0.23/32 scope global tun71 valid_lft forever preferred_lft forever I have tried setting the dstaddr for the ifreq to no avail. int fd; int dst_fd; struct ifreq ifr; struct sockaddr_in* addr; struct sockaddr_in* dst_addr; fd = socket(AF_INET, SOCK_DGRAM, 0); dst_fd = socket(AF_INET, SOCK_DGRAM, 0); ifr.ifr_addr.sa_family = AF_INET; memcpy(ifr.ifr_name, "tun11", IFNAMSIZ - 1); addr = (struct sockaddr_in*)&ifr.ifr_addr; dst_addr = (struct sockaddr_in*)&ifr.ifr_dstaddr; inet_pton(AF_INET, ip_address, &addr->sin_addr); inet_pton(AF_INET, ip_address, &dst_addr->sin_addr); int err; if ( (err = ioctl(fd, SIOCSIFADDR, &ifr)) == -1 ) { perror("ioctl SIOCSIFFLAGS");close(fd);exit(1); } I don't know what else to do. I have tried debugging IP after giving it a command to do this, but I cannot figure it out.
If you haven't got one already, create a test tun: # ip tuntap add mode tun dev tun0 # ip address show dev tun0 5: tun0: <POINTOPOINT,MULTICAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 500 link/none This looks pretty similar to what's in the question. Now to see what code we need... // uptun.c - set an IP address and UP a tun #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stddef.h> /* offsetof */ #include <net/if.h> #include <net/if.h> #include <linux/sockios.h> #include <netinet/in.h> #if __GLIBC__ >=2 && __GLIBC_MINOR >= 1 #include <netpacket/packet.h> #include <net/ethernet.h> #else #include <asm/types.h> #include <linux/if_ether.h> #endif // TWEAK #define IFNAME "tun0" #define HOST "192.168.0.29" #define ifreq_offsetof(x) offsetof(struct ifreq, x) int main(int argc, char **argv) { struct ifreq ifr; struct sockaddr_in sai; int sockfd; /* socket fd we use to manipulate stuff with */ int selector; unsigned char mask; char *p; /* Create a channel to the NET kernel. */ sockfd = socket(AF_INET, SOCK_DGRAM, 0); /* get interface name */ strncpy(ifr.ifr_name, IFNAME, IFNAMSIZ); memset(&sai, 0, sizeof(struct sockaddr)); sai.sin_family = AF_INET; sai.sin_port = 0; sai.sin_addr.s_addr = inet_addr(HOST); p = (char *) &sai; memcpy((((char *) &ifr + ifreq_offsetof(ifr_addr))), p, sizeof(struct sockaddr)); ioctl(sockfd, SIOCSIFADDR, &ifr); ioctl(sockfd, SIOCGIFFLAGS, &ifr); ifr.ifr_flags |= IFF_UP | IFF_RUNNING; // ifr.ifr_flags &= ~selector; // unset something ioctl(sockfd, SIOCSIFFLAGS, &ifr); close(sockfd); return 0; } This gives us: # make uptun cc uptun.c -o uptun # ./uptun # ip address show dev tun0 5: tun0: <NO-CARRIER,POINTOPOINT,MULTICAST,NOARP,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 500 link/none inet 192.168.0.29/32 scope global tun0 valid_lft forever preferred_lft forever which only lacks the peer address. Some altagoobingleduckgoing reveals that tun have a SIOCSIFDSTADDR (set destination, duh) in addition to SIOCSIFADDR. Let's jam that into the script right after the SIOCGIFFLAGS line... // KLUGE copypasta in the destination address sai.sin_addr.s_addr = inet_addr("192.168.0.23"); p = (char *) &sai; memcpy((((char *) &ifr + ifreq_offsetof(ifr_addr))), p, sizeof(struct sockaddr)); ioctl(sockfd, SIOCSIFDSTADDR, &ifr); and after a compile and re-run of uptun we have: # ip address show dev tun0 5: tun0: <NO-CARRIER,POINTOPOINT,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 500 link/none inet 192.168.0.29 peer 192.168.0.23/32 scope global tun0 valid_lft forever preferred_lft forever
How to set the IP address and Peer IP Address of a TUN interface in C
1,445,774,632,000
Today I ran into some code that's writing a newline character explicitly into a sysctl file. See moby/docker source code. My first thought is that the author has diligently copied the shell's behaviour into go despite the newline being redundant. But then I started to look for documentation on the subject and found it a really hard one to find information on either way. I haven't managed to come up with anything so far. When writing sysctl files in /proc/sys/ many of the values are integers written in ASCII. For example, to toggle something on or off you have to write 1 or 0 as text into a file. Often the advice here on U&L and on blogs etc. is to do this in the shell using echo. For example turning on IPv4 forwarding: echo 1 > /proc/sys/net/ipv4/ip_forward But this advice does something subtly different to its stated goal. It doesn't write a single byte 0x31 to the file. It writes two: 0x31 0x0A also known as 1\n. I had always assumed the newline (0x0A) was simply ignored by the kernel. Does writing a newline character into a sysctl file (eg /proc/sys/net/ipv4/ip_forward) have any effect? References welcome even if they are links to source code.
In most cases it shouldn’t make any difference either way, at least at the end of an input string. In all cases, only written data is processed — the kernel knows how long the supplied buffer is (1 byte for 1 with no newline, 2 for 1 with a newline) and will only process that many bytes. sysctl entries using the standard sysctl-handling functions handle newlines explicitly: in strings, they terminate input, in vectors, they separate entries (most numeric values end up being handled as vectors, e.g. /proc/sys/net/ipv4/ip_forward). This is in addition to reaching the end of user input, which always ends processing. So the following all produce the same result: $ echo 1 > /proc/sys/net/ipv4/ip_forward $ printf 1 > /proc/sys/net/ipv4/ip_forward $ printf '1\n0\n' > /proc/sys/net/ipv4/ip_forward Thus the answer to Does writing a newline character into a sysctl (/proc/sys) file have any effect? is yes: it indicates the end of a value. That indication may or may not add information compared to the end of the input as a whole; that depends on the context (specifically, whether the value being written is a vector or not). Code handling output for sysctl, i.e. producing the text that’s read when something reads from a sysctl entry, always adds a terminating newline, as might be expected. The sysctl utility always writes a newline, so it’s safe to assume that in most cases this will continue to be valid. (I haven’t checked all the sysctl handlers so there may be some specific handlers which object to newlines.)
Does writing a newline character into a sysctl (/proc/sys) file have any effect?
1,445,774,632,000
I'm writing an article about swapfiles. I decided to check how many swapfiles can I create and use. According to man 2 swapon, I know that it should be 29 - https://man7.org/linux/man-pages/man2/swapon.2.html. I checked my kernel configuration options with grep CONFIG_MIGRATION /boot/config-$(uname -r) and grep CONFIG_MEMORY_FAILURE /boot/config-$(uname -r). But when I wrote a simple script to check: for i in {1..33}; do SWAP_FILE="/swapfile-$i" sudo dd if=/dev/zero of=$SWAP_FILE bs=1M count=10 sudo chmod 600 $SWAP_FILE sudo mkswap $SWAP_FILE sudo swapon $SWAP_FILE done I was able to activate only 27 of them. [root@localhost ~]# swapon NAME TYPE SIZE USED PRIO /swapfile-1 file 10M 0B -2 (...) /swapfile-27 file 10M 0B -28 It means that there is probably something missing in the documentation. I'm using EuroLinux 8 (just another RHEL 8 clone). But I tried it also on Fedora with identical results. I tried to get why this happened by looking into the swap.h kernel file (https://github.com/torvalds/linux/blob/master/include/linux/swap.h) but it made me even more confused as there is: #ifdef CONFIG_DEVICE_PRIVATE #define SWP_DEVICE_NUM 4 #define SWP_DEVICE_WRITE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM) #define SWP_DEVICE_READ (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+1) #define SWP_DEVICE_EXCLUSIVE_WRITE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+2) #define SWP_DEVICE_EXCLUSIVE_READ (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+3) #else #define SWP_DEVICE_NUM 0 #endif #ifdef CONFIG_MIGRATION #define SWP_MIGRATION_NUM 2 #define SWP_MIGRATION_READ (MAX_SWAPFILES + SWP_HWPOISON_NUM) #define SWP_MIGRATION_WRITE (MAX_SWAPFILES + SWP_HWPOISON_NUM + 1) #else #define SWP_MIGRATION_NUM 0 #endif #ifdef CONFIG_MEMORY_FAILURE #define SWP_HWPOISON_NUM 1 #define SWP_HWPOISON MAX_SWAPFILES #else #define SWP_HWPOISON_NUM 0 #endif #define MAX_SWAPFILES \ ((1 << MAX_SWAPFILES_SHIFT) - SWP_DEVICE_NUM - \ SWP_MIGRATION_NUM - SWP_HWPOISON_NUM) (1<< SWAPFILES_SHIFT) = 32 (SWAPFILES_SHIFT=5) SWP_DEVICE_NUM is 4 or 0 SWP_MIGRATION is 2 or 0 SWP_HWPOISON_NUM is 1 or 0 32 - X = 27 adds only when SWP_DEVICE_NUM and SWP_HWPOISON_NUM is used. At the very same time, the man 2 swapon says that: Since kernel 2.6.18, the limit is decreased by 2 (thus: 30) if the kernel is built with the CONFIG_MIGRATION And configs are set to yes. [root@fedora ~]# grep CONFIG_MIGRATION /boot/config-$(uname -r) CONFIG_MIGRATION=y [root@fedora ~]# grep CONFIG_MEMORY_FAILURE /boot/config-$(uname -r) CONFIG_MEMORY_FAILURE=y Any help in understanding why only 27 swaps are available is appreciated.
Absolutely nothing wrong with the docs. Your misunderstanding simply comes from the fact you are basing your calculus on definitions found in swap.h taken from Linus' git, that is the swap.h related to the master branch, in other words, nowadays ahead of 5.17-rc-1 While making your experiments under RHEL 8 which, AFAIK, is based on Linux-4.18 In swap.h of 4.18.20 if we can still read the same formula : #define MAX_SWAPFILES \ ((1 << MAX_SWAPFILES_SHIFT) - SWP_DEVICE_NUM - \ SWP_MIGRATION_NUM - SWP_HWPOISON_NUM) SWP_MIGRATION_NUM is however taking a different value : #define SWP_MIGRATION_NUM 2 2 instead of 4. Applying this value to the formula taking in account your config settings gives: MAX_SWAPFILES = 32 - 2 - 2 - 1 = 27 Justifying both the results of your experiments and the documentation.
Maximum number of swapfiles - kernel documentation bug?
1,445,774,632,000
From my understanding, in systems without bus support for discovery/enumeration (mostly embedded systems), the dtb files are used to describe the hardware and allow the kernel to use it once it has been loaded into to memory. So, assuming we just want to update the kernel for such a system, do we need to also update the dtb? Since it only describes the hardware and the hardware is unchanged, couldn't it be simply reused? I came to this question while installing a newer kernel in my raspberrypi, the official build documentation and also every other tutorial I could find makes an explicit mention about compiling and copying the dtb files, so I was wondering if this step is really necessary since the hardware wont change.
Mainly, kernel and device tree are supposed to be independent from each other, so yes: Usually you can use a freshly compiled kernel along with the old dtb and vice versa. Of course, this stops being true if the device tree relies on certain versions of device drivers or the new kernel expects different device tree attributes. Now considering that building a new dtb with dtc is a question of milliseconds and authors of tutorials do not know whether some patch did change any dts or dtsi file, it's saver to recommend including building and deploying the dtb along with the kernel.
with a static hardware, do I need to recompile the dtb every time I update the kernel?
1,445,774,632,000
I need to install the linux-header-* package for other kernel versions in order to compile a kernel module locally for a different system. Say, I want to compile for Debian 10, with a kernel version of 4.19.0-13-amd64, using Ubuntu 20.10, with a kernel version of 5.8.0-43-generic. In that case, is it possible to install the neccessary linux-headers-4.19.0-13-amd64 package from the Ubuntu 20.10 machine? In particular, apt-cache search linux-headers-.* only show 5.8.0-* versions on Ubuntu 20.10. If not possible to download the necessary kernel headers using apt-get, where can these be obtained? I don't want the complete Linux source, just the headers required for compiling the kernel module.
You can't install the debian linux-headers on Ubuntu but you can download the source: Add only the debian sources , it doesn't harm ubuntu: printf "%s\n" "deb-src http://deb.debian.org/debian buster main" |\ sudo tee /etc/apt/sources.list.d/debian-src.list Add the gpg keys: sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 04EE7237B7D453EC 648ACFD622F3D138 DCC9EFBF77E11517 sudo apt-key update Download the source: apt source linux-headers-4.19.0-14-amd64 The linux-headers-4.19.0-13-amd64 is available from debian snapshot.
How to obtain linux-headers-* for other kernel versions than the most current using `apt-get`?
1,603,138,374,000
I'm not extremely familiar with systems programming or operating systems, so this is probably a stupid question. But I was trying to get a game running in Wine recently that implements an anti-cheat system. After much frustration I learned that it wasn't possible because the anti-cheat system needs to run in kernel mode ("ring 0"?) and Wine runs in user mode ("ring 3"?) There are plenty of posts about the differences between ring 0 and ring 3, or why Wine runs in one instead of the other. For instance: Why does wine not support kernel mode driver? However when I thought about it, the problem felt oddly familiar to the one being solved by container solutions like Docker. Would Wine, running inside of Docker, not be able to provide ring 0 access safely? Or can Docker only run user mode programs? Why does an entire CPU need to be emulated when you can just utilize containers to prevent malicious programs from going ham on your machine?
x86 ring 0 = supervisor mode = kernel mode x86 ring 3 = user mode Docker containers and the docker daemon run in user mode. The containers share the kernel with the host system. Docker uses new features in the kernel, in the same way that other programs use old features in the kernel. If you run code in supervisor mode, then it runs in the kernel, and has god powers over all of your processes and data. However you can run code in virtual supervisor mode (using virtual box or other visualisers). For this you put the whole system, in the virtual machine, not just the user mode parts. Therefore you can add kernel mode code. Note carefully: If you install kernel mode code, then it has TOTAL control of your machine. It can see everything that you do, and control your machine to do what ever it wants.
Why can't Wine run kernel-mode (ring 0) drivers in a container?
1,603,138,374,000
I want to reserve a large amount (~1 gigabyte) of contiguous memory for DMA from a device. The entire purpose of this particular Linux box is to run a single application which uses the device. The device does large transfers of ~10-200MB per operation. To be clear, put up this question for the next guy. Expect to have an answer somewhat shortly.
I don't think you'll be able to. Instead, you'll have to "fake it" as described here. The last time I checked (it's been a while), the CMA hadn't been ported to x86 from ARM yet. Even then, that big a buffer is unlikely to work out for you.
How do I reserve a large block of memory from the Linux kernel for device/DMA use?
1,603,138,374,000
I am digging into calculation of LA. So, what have I found: LA calculates as exponential moving average every five seconds: LA(t) = LA(t-1) + EXP_R * (n(t) - LA(t-1)) where LA(t-1) - is the LA recorded on the previous iteration EXP_R - are three predefined constants for 1, 5, and 15 minutes n(t) - number of R (running) or D (uninterruptible) processes in the system Here is the kernel code doing the stuff (and some magic with floating numbers as well): unsigned long avenrun[3]; static inline void calc_load(unsigned long ticks) { unsigned long active_tasks; /* fixed-point */ static int count = LOAD_FREQ; count -= ticks; if (count < 0) { count += LOAD_FREQ; active_tasks = count_active_tasks(); CALC_LOAD(avenrun[0], EXP_1, active_tasks); CALC_LOAD(avenrun[1], EXP_5, active_tasks); CALC_LOAD(avenrun[2], EXP_15, active_tasks); } } static unsigned long count_active_tasks(void) { struct task_struct *p; unsigned long nr = 0; read_lock(&tasklist_lock); for_each_task(p) { if ((p->state == TASK_RUNNING || (p->state & TASK_UNINTERRUPTIBLE))) nr += FIXED_1; } read_unlock(&tasklist_lock); return nr; } #define FSHIFT 11 /* nr of bits of precision */ #define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */ #define LOAD_FREQ (5*HZ) /* 5 sec intervals */ #define EXP_1 1884 /* 1/exp(5sec/1min) as fixed-point */ #define EXP_5 2014 /* 1/exp(5sec/5min) */ #define EXP_15 2037 /* 1/exp(5sec/15min) */ #define CALC_LOAD(load,exp,n) \ load *= exp; \ load += n*(FIXED_1-exp); \ load >>= FSHIFT; I've written naive bash script that tries to do the same stuff: #!/usr/bin/env bash set -euo pipefail LA_1=0 LA_5=0 LA_15=0 EXP_1=0.0800 EXP_5=0.0165 EXP_15=0.0055 count() { echo $(ps -eostat | grep -E "R|D" | wc -l) } echo "1 min 5 min 15 min" while true; do n=$(($(count) - 1)) # -1 to eliminate `ps` from the result LA_1=$(bc -l <<<"$LA_1 + $EXP_1 * ($n - $LA_1)") LA_5=$(bc -l <<<"$LA_5 + $EXP_5 * ($n - $LA_5)") LA_15=$(bc -l <<<"$LA_15 + $EXP_15 * ($n - $LA_15)") echo -ne "$LA_1 $LA_5 $LA_15\r" sleep 5 done But the results of my script are far from the actual LA. I think that the main difference comes from the counting of active processes, where kernel calls count_active_tasks() and my script uses simple ps. Can I somehow get the more precise number of active tasks from bash? Or maybe I am doing wrong somewhere else? UPD: I was running my script for a while and here is the result: 1 min 5 min 15 min .42342580723140551985 .53553677285166903835 .35305247755440928285 While actual LA is: load average: 0.80, 1.63, 1.54 The kernel source code is taken from this article explaining LA: https://wiki.nix-pro.com/view/Load_average_explained UPD: Definition of EXP_R in my script differs from the definition from the kernel source code: In my script it is actually 1 - exp_kernel (where exp_kernel - is the definition in the kernel source). It does not influence the final result because the final factor holds the same
Thank to @muru, he has found error in the formula I use. Here is the correct one and the results are pretty accurate: #!/usr/bin/env bash set -euo pipefail LA_1=0 LA_5=0 LA_15=0 EXP_1=0.9200 EXP_5=0.9835 EXP_15=0.9945 count() { echo $(ps -eostat | grep -E "R|D" | wc -l) } echo "1 min 5 min 15 min" while true; do n=$(($(count) - 1)) LA_1=$(bc -l <<<"$LA_1 * $EXP_1 + $n * (1 - $EXP_1)") LA_5=$(bc -l <<<"$LA_5 * $EXP_5 + $n * (1 - $EXP_5)") LA_15=$(bc -l <<<"$LA_15 * $EXP_15 + $n * (1 - $EXP_15)") echo -ne "$LA_1 $LA_5 $LA_15\r" sleep 5 done
Reproduce load average calculation
1,603,138,374,000
The KDE Neon FAQ mentions it's build on Ubuntu LTS 18.04. It doesn't mention which point release of Ubuntu LTS it's using. I would like to try out KDE Neon, but I know my laptop doesn't work well (or at all) on kernel versions before 4.19. Default LTS comes with kernel 4.5 and is not an option. According to the Ubuntu kernel overview, Ubuntu 18.04.3 would be the first version that would work for me. Does KDE Neon follow Ubuntu point releases? Alternatively, is it possible to manually enable the HWE as described on the Ubuntu wiki? With: sudo apt-get install --install-recommends linux-generic-hwe-18.04 xserver-xorg-hwe-18.04 Or would that break the KDE Neon update system?
You can get the requisite information by visiting https://files.kde.org/neon/images/user/current/. In particular, https://files.kde.org/neon/images/user/current/neon-user-20200213-1120.manifest has linux-generic-hwe-18.04 5.3.0.28.96 linux-headers-5.3.0-28 5.3.0-28.30~18.04.1 linux-headers-5.3.0-28-generic 5.3.0-28.30~18.04.1 linux-headers-generic-hwe-18.04 5.3.0.28.96 linux-image-5.3.0-28-generic 5.3.0-28.30~18.04.1 linux-image-generic-hwe-18.04 5.3.0.28.96 linux-modules-5.3.0-28-generic 5.3.0-28.30~18.04.1 linux-modules-extra-5.3.0-28-generic 5.3.0-28.30~18.04.1 linux-signed-generic-hwe-18.04 5.3.0.28.96 In other words, you could use https://files.kde.org/neon/images/user/current/neon-user-current.iso.
Does KDE Neon use Ubunu LTS point releases?
1,603,138,374,000
I know KConfig serves to tune the C preprocessor, at the start of the Linux kernel compilation. And that the device tree is used to give a compiled kernel a description about hardware at runtime. How do these two configurability features overlap? Both give information about intrinsic CPU details and drivers for external peripherals, for example. I imagine that any peripheral mentionned in the device tree must have gotten its driver previously declared in the .config file. I can guess too that if a driver has been compiled as built-in, it will not be loaded as a module again... but what finer details are there?
A compile-time kernel configuration can specify whether or not include each of the standard drivers included in the kernel source tree, how those drivers will be included (as built-in or as loadable modules), and a number of other parameters related to e.g. what kind of optimizations and other choices will be used in compiling the kernel (e.g. optimize to specific CPU models, or to be as generic as possible, or whether or not enable some features like Spectre/Meltdown security mitigations by default or not). If a compile-time kernel configuration is set generic enough, the same kernel can be used with a large number of different systems within the same processor architecture. On the other hand, the device tree is about the actual hardware the kernel is currently running on. For embedded systems and other systems with no autoprobeable technologies like ACPI or PCI(e), the device tree will specify the exact I/O or memory addresses specific hardware components will be found at, so that the drivers will be able to find and use those hardware components. Even if the device tree describes a particular hardware component exists and how it can be accessed, if the necessary driver for it is disabled at compile-time, then the kernel will be unable to use it unless the driver module is added separately later. Or if the kernel is compiled with a completely monolithic configuration with no loadable module support, then that kernel won't be able to use a particular device at all unless the driver for it is included in the kernel compilation. If a driver for a hardware component is included in kernel configuration (either built-in or as a loadable module) but there is no information for it in the device tree (and the hardware architecture does not include standard detection mechanisms), then the kernel will be unaware of the existence of the hardware component. For example, if the device tree incorrectly specifies the display controller's framebuffer area as regular usable RAM, then you might get a random display of whatever bytes happen to get stored in the display controller's default framebuffer area, as a jumble of pixel "noise". Or, if the display controller needs a specific initialization to start working, you might get no output at all. In other words, the purpose of the device tree is to tell the kernel where the various hardware features of the system are located in the processor's address space(s), both to enable the kernel to point the correct drivers to correct physical hardware, and to tell the kernel which parts of address space it should not attempt to use as regular RAM.
How does kbuild compare to the device tree?
1,603,138,374,000
I have Samsung SSD 970 EVO Plus NVMe M.2 500GB mounted on the motherboard and it works fine, but when I open for example gnome-disks or parted to get more info about disk, system doesn't recognise model of the disk. SMART data & Self-Tests are also disabled. This only happens on the M.2 disk. Normal SSD works fine. Is there any kernel option or system configuration that can cause this? I have linux-4.19.44-gentoo kernel.
I just noticed that in the newer version of gnome-disks the model is already displayed correctly.
System doesn't recognise model of my SSD disk
1,603,138,374,000
It is possible to install Devuan/Debian stable and then editing /etc/apt/sources.list upgrade to a testing/unstable branch (ref). However on my laptop I have an AMD Ryzen 7 2700U processor, which does not support Linux kernels before 4.10, so I just cannot install the stable versions (kernel 4.9) to start from. Where can I download from and install the latest unstable versions (e.g. Devuan Ceres) directly?
# /etc/apt/sources.list.d/devuan-ceres.list deb http://deb.devuan.org/merged ceres main deb-src http://deb.devuan.org/merged ceres main
How to install Devuan/Debian testing/unstable without starting from a stable release?
1,603,138,374,000
I am not a driver programmer, I don't have a clear picture of how linux assign irq number for pcie devices. From an NIC driver example, it seems Linux already know which irq number should be used before the function of 'probe' or 'open' was executed. ex: https://github.com/torvalds/linux/blob/4608f064532c28c0ea3c03fe26a3a5909852811a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c#L6608 err = ixgbe_request_irq(adapter); ixgbe can get irq number by using the data of the 'adapter' variable, it means the irq value already inside adapter structure, it is not a generated number, it is an already existed value. if it is read from pci/pcie configuration space, wasn't it very easy to conflict with other devices? if it is generated/arrange by kernel, how the irq number already inside the 'adapter' variable? ( or it is assigned by BIOS ? ) For interrupt for MSI, it seems generated by kernel ?? -- In my understanding, the irq number should be read from Interrupt Line Register (offset 3Ch) in PCIe configuration space, I guess that's why kerenl already know which irq number should be used, and Interrupt Line Register should be updated by BIOS ( my guess ) during boot, but there still a virtual IRQ ( when lspci without -b ), and seems MSI has another irq (?), are they common resource like memory to be arranged ?
for legacy interrupt, the irq value was read from the configuration space, however, the irq value was mostly assigned by BIOS. more info for this part: http://tldp.org/HOWTO/Plug-and-Play-HOWTO-7.html For MSI/MSI-X interrupt, it is done by allocation. ex: pci_alloc_irq_vectors() https://www.kernel.org/doc/Documentation/PCI/MSI-HOWTO.txt
How linux know which irq number should be used?
1,603,138,374,000
I've experienced a few kernel page fault (fatal trap 12) on my FreeBSD 10.3-RELEASE server. They occur anywhere from milliseconds of uptime to days of uptime. The current process is always different (pagedaemon, pkg, find). After reading online, the answer seems to point towards failing hardware. My question is how exactly does the failing hardware manifest itself in a kernel level page fault? Why doesn't failing hardware result in a Kernel panic with more descriptive information? UPDATE: As per Bob's post below, I performed hardware testing. I had a bad RAM stick. I used memtest to determine that.
A kernel panic is either a software detected error, or some hardware trap that has been sprung and detected by the kernel as being in kernel code. The only safe thing for the kernel to do is panic (i.e. voluntarily halt). This could be caused by bad memory, which causes the kernel to execute bad memory contents as code, or bad memory which causes the kernel to get bad data which causes some error or detected inconsistency. A kernel level page fault is also caused by bad kernel data; the kernel tries to access a page that doesn't exist, probably because it's using a bad address that it's fetched from memory. In this case all the kernel knows is that it used a bad address; one could trace the code back with a debugger to get clues how that started, but you wouldn't go back far before encountering multiple causes. The upshot is that all you can do if you get kernel level page faults is test the hardware!
How does failing hardware cause a kernel page fault (fatal trap 12)?
1,603,138,374,000
For example: Where does the lshw - list hardware program read the info out? (I mean on a software level, that there are probably some ROM chips here and there is of course the case) Basically everything, (the user could potentially want to know) about the machine and system internals, is provided to the user by the kernel with virtual filesystems. i.e. procfs mounted at /proc right? So is the only way to read (non process/user-land stuff),(means the actual system-software/kernel/os infos and not some isolated process which gets told everything) is through that virtual filesystems. How does the kernel get it? I mean does it see the ROM chips/Sensors as I/O Hardware and do they have an physical address which is memory mapped? For the CPU I know that x86 has a special instruction which puts the cpuinfo in a register out of which it can be read with additionall instructions.(i.e. lscpu)
On x86 hardware, it gets a lot of its information from DMI, an API to get information from the BIOS. More details at github : lshw
Where does system information come from
1,603,138,374,000
I have been experimenting with trying to apply Ingo Molnar's reatime patch and came into a situation where I get a blank screen and no message at all. i.e. Kernel panic, or otherwise. Given, that I want to get involved into understanding the kernel better and the real time patch in particular, is there a set of methods I can follow to take information about what went wrong in this state? Are there perhaps a log written somewhere that I can study by plugging the disk to another Linux system, or a kernel configuration option that will make kernel more verbose and perhaps produce some sort of artifact or or a way to produce a memory dump? In fact, what do kernel developers use as a means to test and troubleshoot kernels? Thank you very much for your help!
One way of being sure of not missing any message from the kernel is to debug it in a virtual machine. For example, the following script uses qemu to start a virtual machine with a custom kernel: qemu-system-x86_64\ -kernel arch/x86/boot/bzImage\ -drive file=/home/lgeorget/VM/image.qcow2,if=virtio\ -append "root=/dev/vda1"\ -netdev user,id=mynet0 -device e1000,netdev=mynet0\ -enable-kvm\ -S The important option here is -S which makes qemu start a GDB server and wait for the debugger to be ready before booting. In another console, go to your Linux development tree, where you compiled your custom kernel, and here start GDB with gdb vmlinux to load the kernel symbols. Next, on the prompt, type: target remote :1234 This will connect to the gdb server that qemu started (on localhost, port 1234 by default). Then, you can use your debugger almost as for any program, set breakpoints, continue the execution with command continue, etc. You should be able to inspect and dump the memory, as well as copying logs if you want to analyze them. Note that this does not increase the verbosity of the kernel, though. There are a lot of tutorials on the web, as well as some official documentation. https://stackoverflow.com/questions/11408041/how-to-debug-the-linux-kernel-with-gdb-and-qemu http://wiki.osdev.org/Kernel_Debugging http://elinux.org/Debugging_The_Linux_Kernel_Using_Gdb
How to troubleshoot a kernel not booting without producing a message on screen
1,603,138,374,000
For example: I have a kernel 3.16 from my embedded support, but I want to have some network wireless drivers from 3.19. What is the best way to merge only this drivers (not full kernel)? I tried merge, but it results in many conflicts. Copying files from 3.19 to 3.16 is a lot of work and results in many missing functions. I have to copy includes also, and these includes needs other includes and new functions, etc. This is a never ending work or never working. I tried to make a diff between some commits and try to cherry-pick them, but I'm not sure that git diff A..B is really working. Sometimes we have merges between A..B with different branches and it's a real mess to consider "what is what". On the other hand, I have to decide which cherry-pick is important for wireless driver and which isn't. Is there any better way?
Finally the best option for me was : Copy drivers files from 3.19 into 3.16 directly. Before commit, thanks to git difftool check every change with previous code. If change uses newer kernel function then get back to older function or add newer function files from 3.19 kernel Compile - if errors then get back to 2. Test. Commit changes.
Merging part of kernel - best way?
1,603,138,374,000
I'm working on one of amazon's linux distros (4.4.11-23.53.amzn1.x86_64). (1gb ram)on that instance I am running node.js with the forever module. (It makes sure to restart the node.js process if it crashes). My experience is: The web server works for about 2-3 hours then the process just disappears. Before running the webserver about 70% of the memory is taken and about 80% after. I looked into every file in /var/log and found nothing relevant to the killed processes. And also logged all outputs from my node server and got nothing from there either. I'm assuming linux killed my process because it ran out of memory but I'm not sure how to double check. And not sure why the memory use would increase when my web application memory usage does not increase over time.
To get an idea of why your process dies, make its parent process print the exit status. The exit status indicates whether the program due to a signal and includes an 8-bit exit code from the process. The 8-bit exit code is conventionally 0 for success and 1..125 to indicate an error. In a C/Perl/… program, you can query the whole exit status. Consult the documentation of your language's library. From a shell script, the exit status including the signal information is packed into a single 8-bit value, with signals being reported as values 128+n where n is the signal number. #!/bin/sh myprogram ret=$? if [ $ret -eq 0 ]; then echo "The program exited normally";; elif [ $ret -gt 128 ]; then echo "The program died of signal $((ret-128)): $(kill -l $ret)" else echo "The program failed with status $ret" fi If Linux kills your program because the system has run out of memory, this is recorded in the system logs, specifically in the kernel logs which can be displayed with the command dmesg and which are normally recorded in a file under /var/log (I don't know which file name Amazon's distribution uses). Don't AssUMe that your process ran out of memory and was killed because of that. Check what happened. The most plausible explanation is that the program has a bug and crashed.
how do I know if and why linux is killing my processes?
1,603,138,374,000
I'm writing a script to scrape some data from this. I'm wondering if this file changes often or is different between distros.
The Linux kernel strives to have stable interfaces for everything that applications use. This includes not only system calls but also files under /proc and under select parts of /sys (some parts of /sys are officially unstable and do change, refer to the documentation for details). /proc/net/dev is documented so it's a stable interface. You can count on it not changing. It hasn't changed since at least the 2.4 series, more than 10 years ago.
Does the format or columns of /proc/dev/net change often?
1,603,138,374,000
I've been debugging an issue in my linux kernel and have found a fix for the issue. Checking cross reference, I can see that the fix was applied to that file between kernel version A and kernel version B. What is the best way to find the patch the exact patch that this fix got checked in with? I would like to see if there are other issues that are fixed with the same patch. Thing I know: Exact file and line of code that changed Kernel version where the bug was present and the version that it was fixed in Thanks!
You might get somewhere browsing the torvalds git tree, eg for the file time/hrtimer.c. Click on blame and for each line number you see the last patch applied. You can also browse the history for older patches.
How to find a specific patch for a kernel file
1,603,138,374,000
I see some empty functions in the Linux kernel file exec.c here: http://lxr.free-electrons.com/source/fs/exec.c#L235 But, some functions like free_arg_pages is again declared below here (with same protoype): http://lxr.free-electrons.com/source/fs/exec.c#L322 I am wondering why we have empty function and filled function with same prototype ?
You cannot have the same function twice in a c file, so you need to look at what cpp might be doing to manipulate the source. In this case, one version of the function is inside #ifdef CONFIG_MMU and the other is in the #else part.
What's the use of this empty function declaration in exec.c kernel source?
1,444,276,466,000
I have a server running on Debian Wheezy 3.2.68-1+deb7u1 x86_64. Lately strange records in /var/log/messages appeared. First messages of this log starts just after server reboot. 6.222.18 LEN=44 TOS=0x00 PREC=0x00 TTL=58 ID=61546 PROTO=TCP SPT=80 DPT=42918 WINDOW=16384 RES=0x00 ACK SYN URGP=0 Jun 6 08:02:49 s02 kernel: [ 29.615405] iptables-input-drop: IN=eth0 OUT= MAC=d4:3d:7e:ed:0a:9a:3c:94:d5:4a:e5:03:08:00 SRC=104.31.176.10 DST=144. 76.222.18 LEN=44 TOS=0x00 PREC=0x00 TTL=58 ID=0 DF PROTO=TCP SPT=80 DPT=24586 WINDOW=29200 RES=0x00 ACK SYN URGP=0 Jun 6 08:03:02 s02 rsyslogd-2177: imuxsock begins to drop messages from pid 6754 due to rate-limiting Jun 6 08:03:06 s02 kernel: [ 46.752749] iptables-input-drop: IN=lxc OUT= MAC=01:00:5e:00:00:01:fe:12:86:6b:0f:b8:08:00 SRC=0.0.0.0 DST=224.0.0.1 L EN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=0 DF PROTO=2 Jun 6 08:03:11 s02 kernel: 472]pbsntr:Nt TM=::::::::::::: C01.58D=4621L= Sx E00T5I0FROCS= T46IO20R=0A NR= Jun 6 08:03:43 s02 kernel: 4 89 cnolf=o,doe Jun 6 08:03:43 s02 kernel: 8apamneo<82:, 2a3-#a6b>.]T<84ff6da7d 6[f4?_3 Jun 6 08:03:43 s02 kernel: 1<f8 ngx9 6[f1?slqex 7 fb kox7 7 f3 lh/430f8feuor/433f88eul0x>.r+f 6[f6?__a3d 7 fb ree7f 6[f6?ghoxc 6[f1?ea1b 7 fc ok03 7 f5 al0 Jun 6 08:03:43 s02 kernel: 9<f6 a/436f85al/639 c.dtdrotxhoe 7m 1ki5f 634r: i04kl<82-<87e u 7C0 t1 [9 b >.] : :438 i, d<84 h0:s Jun 6 08:03:43 s02 kernel: 6U hu0 7P: c 7C7 t1 [9 p: 7P:1c 6 7C1 t1 [9 b3 >.] : :437 i, d<88 h6:s Jun 6 08:03:43 s02 kernel: 1U 8hu9 8P:1c 7NNp: 8P:1c 2 7C1 t1 [9 b3 >.] : :433 i, d<86 h6:s Jun 6 08:03:43 s02 kernel: 6U 8hu5 8P:1c 5 7aa7cn3tn[9 e3n_5s_4 8ua4t6e5a<81e4bi1leb7 8m3h3t5u<80e 5mB0haaBinci v:elid:ofke8okyrkakmlleleb _0e:s0n a :gnaeb Jun 6 08:04:01 s02 rsyslogd-2177: imuxsock lost 1237 messages from pid 6754 due to rate-limiting Jun 6 08:04:02 s02 rsyslogd-2177: imuxsock begins to drop messages from pid 6754 due to rate-limiting Jun 6 08:04:11 s02 rsyslogd-2177: imuxsock lost 1322 messages from pid 6754 due to rate-limiting Jun 6 08:05:02 s02 rsyslogd-2177: imuxsock begins to drop messages from pid 6754 due to rate-limiting Jun 6 08:05:11 s02 rsyslogd-2177: imuxsock lost 1446 messages from pid 6754 due to rate-limiting Jun 6 08:08:11 s02 kernel: 2ws:2 4> 1l_e0 <89eme3i4:B9 _5 v: _4 v:2vekao e) t6l4 1ke4a4 7scl0blekekBa2ueokempc0nmn 8lr[ >.]00*1361*0 k44=k 8ND18075 9 Bk22864B 2oo2*1361:ea:95:30C.27=72L 0R0==PTTP2W 0SP:0 0N=ETDD==PN< .1anr=U=7a:43 46T684xCTI T==W2E N06 et OSFA:f3:8=20LOP0 5TP LhA:0:10C.42=0CT=FIE =6 = v9e6:76 0S06x=L3 D9=4C2=.L xE062DT 3PL DU=DL Jun 6 08:10:40 s02 kernel: :0939da5:0121T784x=L0TPTW9=KGv e6f2098R0D. 30R0== OP3D 340]tst:c =Of:83:0.S6 T 049TTO=Qe35:051D..==R015OP93 -=UYe7=8f:27 .D..==R049PC=08 Jun 6 08:11:40 s02 kernel: 0M3d:d5:12S6 T 08FT85D00Y0cT IexM:::::::C.T.NSP069 U=DL Jun 6 08:14:11 s02 kernel: hAe:bE066 D8=4<4>[ 620.699091] iptables-input-drop: IN=xc OUT HSNezO C:8::0:0.S6 T 048O CDEUNx=6b:900D.=0CT= D5=4>60ilnd xTYvxM:::::::C.S.2ET0C 44FO 8=3EM3e99400=48=61=S 0TIFOS 6I2R0 R Jun 6 08:22:40 s02 kernel: 01. 1.L3= = 6=8P=P45= et He7f6:b1:S0S7180E 6RM==61>056plppxPeL:b5:7S.=2ESR I OYD5=4 867pe-IUIrC8:ea:1 0N=ETDD==PNrO IhM e:8:700 0N=ETDD==PNaiudpIl =HNz e:be:8=2.ESR I OTDE07]tsu:cPvO=8fb10C.0LOP0 9TP L7:68:a8C0=. 0=TD T 3 UNrC8:ea:1 0N=ETDD==PNPtLe:be:0R.T684xCTI0OP 8001.016=PxLD OP5D 3pO=e9:5071=2ESR IPP94OES=eTde:9a:S4D78 0x58R 03 71:22:R01 T 043OS8 Jun 6 08:23:40 s02 kernel: 0 7. 42ESR IPP 4WR Jun 6 08:25:13 s02 kernel: a .D0N=ETDD==PNE044OTDE::a8:R01 T 047OS6 Jun 6 08:28:11 s02 kernel: 0L3= =T43DT 5TN430C23D4.86=P053==PN cUPIerLC268e:0R.T68400=9RP I =6f2098R0D. 30R0== OP4D 3r=UYeOC2b8e:0C.42=0CT=FIE=11N=NrA2:53a0S0D0EO x=5F=T Jun 6 08:37:40 s02 kernel: pr===Of:83:0.S06x=L5 D2=44]aidNTNx=6b:900D.=0CT=FU4T=66tir=TIzM1b:39:=.12LOP0 2TTO=E8TTO=EerO Ce26bf::31:00C..S462 =T0 C0T44 RIT8ED01:a:e8C. .1400= OT=I20 P hM20:10C.42=0CT=FIE=01TeL:b5:7S.=1 0x60R 33 :27 .D..==R049PCEE1EE=PxLD1RD= 34Uv7e6:05 0T.LOP0 OYD1Q 8:ea:1 0N=ETDD==PNcSzA:fb:8=2.ESR I OTDE::0a:0=.D0.NTxRxT 4DODT9TL3Of8fb:8=24.8x=L1 C=03 bnrNTIrC8:ea:1 .1400=3PM8 5 Jun 6 08:38:14 s02 kernel: 99bnpcHt 1:22:R012N=ETDFT3TI60 Jun 6 08:45:35 s02 kernel: [ 2178.791699] ipabei-:lUH=wM:::6:8=30LOP0 0TP LD6RUT85=t- x=IrC8:ea:1 0N=ETDD==PN<4>[ 2299.711247] iptables-input-drop: IN=lxcO=Y=zL=26:23:70=0T7.NO0=T 2PCEE1Eo=OPNh7C160:e25:C.S0L xE062DT 9PL 71R0SPsd===Hf:8c:0.D.=0CT=FU4T=SL:b5:7S.=2ESR I OYD1Q4d3:3S1742=0CT=OSP 2SCRz=:fb:8=2.ESR I OTDERL5 D4=4===of:8e:0.S06x=L4 D7=46:::5 0T.300=7PP55327ap: YhM20:10C.0LOP0 1TP LN7f6:b1:R.=.60E 7RP9TN456rl v7e6:05 0T.300=7PP353OHNtx =16:b2:29:0R00D1. =T0 C0L 7 O 5 5N I have a rule in iptables for droping packets: -A INPUT -m limit --limit 2/min -j LOG --log-prefix "iptables-input-drop: " --log-level 4 This rule causes first few lines, afterwards the log is pretty much messy. Could it be caused by some malformed packets? Is it some sort of attack or rather hardware issue (corrupted memory etc.)? UPDATE: I turned off rsyslog limiting $SystemLogRateLimitInterval 0 to avoid dropping messages. But still aren't many readable messages: Jun 8 04:32:15 s02 kernel: 05[f7?h01[.]f1>c+x[.]f1>seu/404ff0_ice0 Jun 8 04:32:15 s02 kernel: 05[f7?ic4166 f3 lh/401ff1mo_o4<14<ff]___1816 f0]_ue0>13f87rnksx<15<fa ctr2266 ff u_+x[.]f0>aek+xt[.]f1>mp_ +x[.]f1>dged0>10f8f_c+x[.]f1>dgex666 fb p1 Jun 8 04:32:15 s02 kernel: 07[f5?_g2 Jun 8 04:32:15 s02 kernel: 07[ff?obr1 Jun 8 04:32:15 s02 kernel: 07[f5?i_ee/<12<fd ahax1[.]f1>_+x[.]f1>ni_x5[.]f0>t_0xx>13f84orb Jun 8 04:32:15 s02 kernel: 07[fb?ef<13<f6 a/407ff7scs0116 nr..l li cmn[.]ye2i4,n5[.]y 0m77Bc408-<15dAp[.] : :403 h0:s Jun 8 04:32:15 s02 kernel: 07P: c 16 b >19 i, d<16U hu066C6 t1 [.] : :407e3c>17 i, d<17U 8hu366C2 t11[.] : :407 h6:s Jun 8 04:32:15 s02 kernel: 07P:1c 816 b3 >17 i, d<18drr<18U 8hu166C1 t11[.] : :403 h6:s Jun 8 04:32:15 s02 kernel: 07P:1c 516 b3 >15 i, d<10U 8hu466aa7n_0ln403tl9ci3of Jun 8 04:32:15 s02 kernel: 08ua6y1b6a<10r4_m1leb216 d 2ae6e[.]0r0nlB4toie0ien_ki:oakal tkk 0t0p 0bi0bleetBakaBerkkselle<12ws:2 <13dAe6: 0g4in4cnkv:ktl3nb1oakalke4m:B:Bb2p2ek_m4sra6rakt2ueokempc0nmn16 _e0 <15dre4:B5h6cn5ie2 _9Bie6nb0lnBteBn7m: 1ke9m2B:Bra4sra5et2ae0tkcwc0enlcl<16ws: 16 *862422*1B80 B66ND2 B6*23Bk213B91B66NN B8*3 k855* k97 Jun 8 04:32:15 s02 kernel: 095tae Jun 8 04:32:15 s02 kernel: 09 i <10ae:,en<10e Jun 8 04:32:15 s02 kernel: 09oaB<4>[160101.733911] 8383984 pages RAM Jun 8 04:32:15 s02 kernel: <>[160101.733929] 164294 ae eee<67]2ga41313ss Jun 8 04:32:15 s02 kernel: 67]dugt ruamen614[]082 3 0 i[190 1 9 0 Jun 8 04:32:15 s02 kernel: 67]1 9 25- -s614[]053 5 0 t>021 s<03 6 4 u614[]06 0 0 l614[]349 9 0 s>031 4 g[138 1 8 0i1.03 8 38 Jun 8 04:32:15 s02 kernel: 67]7 3 86 u<03 9376 4 w614[]309 6 0 s>061 8 g[158 1 4 0i1.63 8 06 Jun 8 04:32:15 s02 kernel: 67]8 3 06 u<03 5386 9 w614[]360 4 0 s>081 8 g[168 1 4 0i1.23 8 40 Jun 8 04:32:15 s02 kernel: 67]9 3 73 u<03 1397 6 w615[]321 7 0 s>001 5 g[188 1 01 0i1.03 8 29 Jun 8 04:32:15 s02 kernel: 67]9 3 44 u<03 7398 6 w615[]382 4 0 s>021 5 g[108 1 11 0i1.64 8 72 Jun 8 04:32:15 s02 kernel: 67]0 4 65 u<03 9309 2 w615[]326 5 0 s>041 2 g[118 1 01 0i1.34 8 14 Jun 8 04:32:15 s02 kernel: 67]1 4 95 u<03 2348 2 w615[]356 9 0 s>012 3 g[127 2 31 0i1.84 7 33 Jun 8 04:32:24 s02 kernel: 67]7 0 13 u<03 9 5 8 r>04 0 <03 5 1 4 ut[185 4 0o<03 7 7 0 ot[165 1 2 0i1.0orum: s1sc9acl[15lr ia3ko:kl:B062]oc=pgt_e413P8oot e.m1a.d Jun 8 04:32:24 s02 kernel: 62] :1.3ff7 pe8d1.5ff4 s+0413 f1ctnc+0413 f17_plroe<08 f84 io0x413 f18s_e/<08 f81 go_y/<08 f8f gh_xx414 f1apas+0414 f17_plroe<08 f81 _pc+/ I've noticed similar behaviour on other 2 servers (same hardware). It's possible that all 3 servers have corrupted memory, but all applications are still running fine and repeated memtester checks didn't show any issues (on other servers I was always able to reproduce memory issues during tests). UPDATE 2: I forgot to mention that on all 3 machines were LXC containers running. I didn't see similar issue on machine without LXC containers.
After reading this article: Linux kernel bug delivers corrupt TCP/IP, I thought these issues might be connected. Original veth driver appeared in kernel 2.6.24-rc1, the bug was introduced in 2010 with this patch (v2.6.37-rc8). Now a fix for this issue should be backported into kernels 3.14+, thus upgrading to one of those kernels might resolve this issue.
How to explain strange kernel messages?
1,444,276,466,000
Can someone explain step by step how to install a module on a kernel with headers installed? I have Debian with Kernel 3.19.0 for banana pi from http://www.igorpecovnik.com/2014/09/07/banana-pi-debian-sd-image/comment-page-2/#comment-4729 and would like to install the smi2021 module needed for somagic easycap from https://github.com/jonjonarnearne/smi2021. So there are 2 options: 1) Install module with full kernel source, by downloading kernel 3.19.0 from kernel.org - This does not work as the custom modules from debian-kernel3.19.0-bananapi are not compatible with the kernel from kernel.org 2) Install module without full kernel, with only using the already built in kernel headers. - I would like to use this option as I already have the kernel headers installed. So can anyone show how to install step by step kernel modules with kernel headers already installed? I tried to do as said in the comment from blog post posted above but can't do it. I get stuck at step 2: copy from /boot the config file to .config in /usr/src/linux
If you can go with full kernel source tree, here are the steps I have followed in order to compile and install a driver on the source tree: Lets say you have the kernel sources extracted at /sources/linux-3.19 cd /sources/linux-3.19 make mrproper make menuconfig Here make sure to select your driver with "m" label. For instance, if you select to build and install atl1c driver, the config file produced as a result of the above command, .config, should have the following line: CONFIG_ATL1C=m Choose the right driver for your case and make sure to label it with "m". make prepare make make modules make modules_install shutdown -r 0 Check to see if the driver is installed lsmod
How to install/compile module in Debian without using Full Kernel, only by using the already installed kernel headers
1,444,276,466,000
This one is pretty much a straightfoward question/answer I just can't locate the information. I'm trying to automate the re-installation of VMWare tools based off when a new kernel is installed. I seem to remember there being a directory somewhere underneath /etc and whenever new-kernel-pkg installs a new kernel and goes to build the initrd it will execute any executable scripts it finds in there. I looked through my history and have tried to locate it on my system and via google but I can't find it.
From here, I see that /etc/kernel/postinst.d is the place where scripts are placed when they need to be executed during the kernel installation time. This requires that DKMS is available on your system (many distributions, including RHEL, support it). Since you had mentioned automating the re-installation of VMWare tools, I see that you could automate it as discussed here. The link has this below script. #! /bin/bash # Following lines auto-recompile VM Tools when kernel updated VMToolsCheckFile="/lib/modules/`uname -r`/misc/.vmware_installed" VMToolsVersion=`vmware-config-tools.pl --help 2>&1 | awk '$0 ~ /^VMware Tools [0-9]/ { print $3,$4 }'` printf "\nCurrent VM Tools version: $VMToolsVersion\n\n" if [[ ! -e $VMToolsCheckFile || `grep -c "$VMToolsVersion" $VMToolsCheckFile` -eq 0 ]]; then [ -x /usr/bin/vmware-config-tools.pl ] && \ printf "Automatically compiling new build of VMware Tools\n\n" && \ /usr/bin/vmware-config-tools.pl --default && \ printf "$VMToolsVersion" > $VMToolsCheckFile && \ rmmod pcnet32 rmmod vmxnet depmod -a modprobe vmxnet fi Save the above as file on your server called vmware-check-tools. Then do the following as root. cp vmware-check-tools /etc/init.d chmod 755 /etc/init.d/vmware-check-tools cd /etc/rc.d/rc3.d ln -s ../init.d/vmware-check-tools S09vmware-check-tools However, I am not sure if that script does the job as required since I do not have a way to test it in my setup.
What directory houses the scripts that get executed with new kernel installations?
1,444,276,466,000
After looking at the package description and using kernel-wedge help, I'm not really sure what it does. Does it take a .deb kernel package and split it into smaller packages? Does it compile a kernel and turn it into a .deb package? Both? Something else?
From the manpage: kernel-wedge is used to generate kernel module udebs for the debian installer. What it does is take a regular kernel image deb and then split it out into udebs. udebs are packages used by the Debian installer and are like regular deb packages except that things that are not needed for bootstrapping an installation, but would be useful on a regular install, are removed to save space. Some core Debian packages are available as udebs (“micro debs”), and are typically used only for bootstrapping a Debian installation. Although these files use the udeb filename extension, they adhere to the same structure specification as ordinary deb files. However, unlike their deb counterparts, udeb packages contain only essential functional files.[2] In particular, documentation files are normally omitted. — Wikipedia
What does kernel-wedge do?
1,444,276,466,000
I got diff text from lkml how do I patch it into a kernel source? I am using debian
kernel.org has some excellent documentation on Applying Patches to the Linux Kernel. Essentially, you use the patch command. Once you have acquired the patch (here called patchfile), place it in your build directory and then issue the command: patch -p <num> < patchfile where <num> is the number of leading slashes to remove from the filenames contained in the patch to be applied. So, assuming your patchfile is in the top-level directory of your kernel source, you can apply it with: patch -p1 -i patchfile patch also has a helpful --dry-run option which will print out a list of what the command will do, without making any changes to your files: allowing you to fine tune any adjustments prior to committing them.
How do you patch a kernel? [duplicate]
1,444,276,466,000
To build the kernel, I do make menuconfig make make modules For step3, where do the files go? What's the location for modules? Can I change it by using any env variables?
The step 3 will only compile modules. For them to actually go somewhere, you'd have to do make modules_install. As pointed out in comments, make -n modules_install will show you where they would go. The exact location depents on the version of the kernel you're compiling, the target directory being /lib/modules/<kernel_release>. The version you're building can be found by make kernelrelease.
Where are the files created by "make modules" when building and compiling the Linux kernel?
1,444,276,466,000
Our server solution handles many tunnel operation requests (add/update/delete) using the ioctl interface, and the AF_INET address family socket. Aprox. numbers are 100 operations/minute with over 8k tunnels total on the server. We have observed a strange behavior with an increasing number of tunnels - as the number of tunnel grows, randomness of time spent in the kernel by ioctl rises. Example: for about 100 tunnels, avg. ioctl operation time ranges from 100 to 150 ms, but with over 2000 it ranges from 100 to 10000 ms. The randomness of the process is surprising. strace shows that over 97% of our process time is spent in the ioctl, and out internal timers confirm this. Are there any ways to optimize this? Maybe by tweaking kernel parameters (which ones)? How to explain the randomness? Our OS is Ubuntu Server 12.04.
It turned out that ioctl wasn't guilty here. strace showed it was, but a deeper analysis of the kernel with ftrace (or trace-cmd) showed that during ioctl processor scheduler caused most of the slow down during core/context switching.
Kernel optimiziations for ioctl AF_INET operations
1,444,276,466,000
Basic concurrent client/server architecture: There's a main loop listening for requests on a port (for example 3000), after accepting the connection the server spawns a child process that ends up having access to file descriptors where data can be read. If we have multiple clients connected to the server, the server will have a child process per request. So S1 (child server process) reads data from C1 (a client), S2 reads from C2 and so on. My question is how is it possible that all clients (C1, C2...) are sending information to the same port (3000) and yet the server processes (S1, S2...) are reading only the information sent from the client assigned to them? Where is the multiplexing being done and how?
A TCP/IP connection has both a source port and a destination port, so if the same server connects to another server on port 3000 multiple times, the Linux kernel can sort out the connections because each one has a unique IP + source port + destination port. This can be seen with the output of netstat when there are active TCP connections, which shows both the local source port and foreign destination port. As an aside, doing a fork() for each connection is a really bad idea for a server getting any significant load; fork() is a slow, resource-intensive system call. There's a reason nginx is becoming popular; it uses a difficult-to-program fork()-free model for delivering static content.
How does the kernel know which file descriptor to write data to after fork() in a concurrent server?
1,444,276,466,000
I just installed LinuxMint15 on an Acer Aspire V3-771G-73638G500Maii. Hibernation works. But suspend to RAM does not. When clicking suspend: After a few seconds the screen goes grey and then off. The network is turned off. The computer's fan stops spinning. The power LED is slowly blinking orange. The battery led still on. All in all this is what I would expect. When clicking the power button the fan turns on. The power LED goes blue. Harddisk LED blinks a few times. Up to here it looks like what I would expect. But then: Screen remains off. Network remains down. A running "cat" started before suspending does not continue running (i.e. the harddisk LED does not start blinking hectically). Clicking the power button again does nothing. Power off is needed. Ctrl-Alt-SysRq-REISUB does not boot the system. This leads me to believe that this is not just an issue re-activating the graphics card, but that the system is not running. The system has full disk encryption, so this problem could be that the system is selecting the wrong graphics card (showing nothing on the screen) and awaiting passphrase, but entering the passphrase in the blind does nothing (i.e. the running "cat" does not continue). What is going on? How can I fix it, so that suspend to ram (and restore) actually works? System info: Linux mint15 3.8.0-25-generic #37-Ubuntu SMP Thu Jun 6 20:47:07 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux Two graphics cards (lshw): description: VGA compatible controller product: GK107M [GeForce GT 740M] vendor: NVIDIA Corporation description: VGA compatible controller product: 3rd Gen Core processor Graphics Controller vendor: Intel Corporation I am pretty sure it only uses the Intel card (nothing in syslog or Xorg.0.log says anything about nv, nvidia, nouveau). I added this to /etc/default/grub to make restoring graphics from hibernation work: GRUB_GFXPAYLOAD_LINUX=text GRUB_CMDLINE_LINUX_DEFAULT="nomodeset" The system has full disk encryption. pm-suspend.log: Initial commandline parameters: Sat Oct 12 11:10:07 CEST 2013: Running hooks for suspend. Running hook /usr/lib/pm-utils/sleep.d/000kernel-change suspend suspend: /usr/lib/pm-utils/sleep.d/000kernel-change suspend suspend: success. Running hook /usr/lib/pm-utils/sleep.d/00logging suspend suspend: Linux aspire 3.8.0-25-generic #37-Ubuntu SMP Thu Jun 6 20:47:07 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux Module Size Used by autofs4 36475 1 rfcomm 42641 16 bnep 18036 2 parport_pc 28152 0 ppdev 17073 0 binfmt_misc 17500 1 nfsd 248016 2 auth_rpcgss 40632 1 nfsd nfs_acl 12837 1 nfsd nfs 164047 0 lockd 76670 2 nfs,nfsd sunrpc 235585 6 nfs,nfsd,auth_rpcgss,lockd,nfs_acl fscache 57430 1 nfs ext2 72837 1 uvcvideo 80847 0 videobuf2_vmalloc 13056 1 uvcvideo videobuf2_memops 13202 1 videobuf2_vmalloc videobuf2_core 40513 1 uvcvideo videodev 129260 2 uvcvideo,videobuf2_core coretemp 13355 0 kvm_intel 132891 0 kvm 443165 1 kvm_intel joydev 17377 0 arc4 12615 2 snd_hda_codec_hdmi 36913 1 snd_hda_codec_realtek 78399 1 ath9k 149924 0 ath9k_common 14055 1 ath9k snd_hda_intel 39619 3 ath9k_hw 413680 2 ath9k_common,ath9k snd_hda_codec 136453 3 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_intel snd_hwdep 13602 1 snd_hda_codec ath 23827 3 ath9k_common,ath9k,ath9k_hw snd_pcm 97451 3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel snd_page_alloc 18710 2 snd_pcm,snd_hda_intel mac80211 606457 1 ath9k snd_seq_midi 13324 0 snd_seq_midi_event 14899 1 snd_seq_midi snd_rawmidi 30180 1 snd_seq_midi snd_seq 61554 2 snd_seq_midi_event,snd_seq_midi snd_seq_device 14497 3 snd_seq,snd_rawmidi,snd_seq_midi cfg80211 510937 3 ath,ath9k,mac80211 snd_timer 29425 2 snd_pcm,snd_seq ath3k 12918 0 acer_wmi 32467 0 sparse_keymap 13890 1 acer_wmi mac_hid 13205 0 snd 68876 16 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec,snd_hda_intel,snd_seq_device btusb 22474 0 psmouse 95870 0 mei 41158 0 bluetooth 228619 23 bnep,ath3k,btusb,rfcomm lp 17759 0 parport 46345 3 lp,ppdev,parport_pc rtsx_pci_ms 13011 0 lpc_ich 17061 0 memstick 16554 1 rtsx_pci_ms soundcore 12680 1 snd serio_raw 13215 0 microcode 22881 0 dm_multipath 22843 0 scsi_dh 14843 1 dm_multipath btrfs 785967 0 zlib_deflate 26885 1 btrfs libcrc32c 12615 1 btrfs dm_crypt 22820 1 raid10 48088 0 raid456 65844 0 async_memcpy 12529 1 raid456 async_raid6_recov 12795 1 raid456 async_pq 12912 1 raid456 async_xor 12777 2 async_pq,raid456 async_tx 13291 5 async_pq,raid456,async_xor,async_memcpy,async_raid6_recov raid6_pq 97812 2 async_pq,async_raid6_recov raid1 35240 0 raid0 17159 0 multipath 13145 0 linear 12894 0 dm_raid45 76725 0 xor 17116 2 async_xor,dm_raid45 dm_mirror 21946 0 dm_region_hash 20820 1 dm_mirror dm_log 18529 3 dm_region_hash,dm_mirror,dm_raid45 rtsx_pci_sdmmc 17475 0 ghash_clmulni_intel 13259 0 aesni_intel 55399 2 aes_x86_64 17255 1 aesni_intel xts 12885 1 aesni_intel lrw 13257 1 aesni_intel gf128mul 14951 2 lrw,xts ablk_helper 13597 1 aesni_intel cryptd 20373 4 ghash_clmulni_intel,aesni_intel,ablk_helper i915 600396 0 video 19390 2 i915,acer_wmi i2c_algo_bit 13413 1 i915 ahci 25731 2 drm_kms_helper 49394 1 i915 libahci 31364 1 ahci rtsx_pci 33355 2 rtsx_pci_ms,rtsx_pci_sdmmc atl1c 41071 0 wmi 19070 1 acer_wmi drm 286028 2 i915,drm_kms_helper total used free shared buffers cached Mem: 7993996 902544 7091452 0 54568 441044 -/+ buffers/cache: 406932 7587064 Swap: 8200188 0 8200188 /usr/lib/pm-utils/sleep.d/00logging suspend suspend: success. Running hook /usr/lib/pm-utils/sleep.d/00powersave suspend suspend: /usr/lib/pm-utils/sleep.d/00powersave suspend suspend: success. Running hook /etc/pm/sleep.d/10_grub-common suspend suspend: /etc/pm/sleep.d/10_grub-common suspend suspend: success. Running hook /etc/pm/sleep.d/10_unattended-upgrades-hibernate suspend suspend: /etc/pm/sleep.d/10_unattended-upgrades-hibernate suspend suspend: success. Running hook /usr/lib/pm-utils/sleep.d/60_wpa_supplicant suspend suspend: Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory /usr/lib/pm-utils/sleep.d/60_wpa_supplicant suspend suspend: success. Running hook /usr/lib/pm-utils/sleep.d/75modules suspend suspend: /usr/lib/pm-utils/sleep.d/75modules suspend suspend: not applicable. Running hook /usr/lib/pm-utils/sleep.d/90clock suspend suspend: /usr/lib/pm-utils/sleep.d/90clock suspend suspend: not applicable. Running hook /usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend: /usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend: success. Running hook /usr/lib/pm-utils/sleep.d/95anacron suspend suspend: stop: Unknown instance: /usr/lib/pm-utils/sleep.d/95anacron suspend suspend: success. Running hook /usr/lib/pm-utils/sleep.d/95hdparm-apm suspend suspend: /usr/lib/pm-utils/sleep.d/95hdparm-apm suspend suspend: not applicable. Running hook /usr/lib/pm-utils/sleep.d/95led suspend suspend: /usr/lib/pm-utils/sleep.d/95led suspend suspend: not applicable. Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend: Using last known working set of quirks. /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend: success. Running hook /usr/lib/pm-utils/sleep.d/99video suspend suspend: /usr/lib/pm-utils/sleep.d/99video: 22: /usr/lib/pm-utils/sleep.d/99video: shopt: not found kernel.acpi_video_flags = 0 Allocated buffer at 0x11000 (base is 0x0) ES: 0x1100 EBX: 0x0000 /usr/lib/pm-utils/sleep.d/99video suspend suspend: success. Running hook /etc/pm/sleep.d/novatel_3g_suspend suspend suspend: /etc/pm/sleep.d/novatel_3g_suspend suspend suspend: success. Sat Oct 12 11:10:09 CEST 2013: performing suspend
I installed uswsusp and this works: s2ram -f -a 1 A big thanks to @frostschutz who made me run hibernate-ram which fails with: hibernate-ram:Warning: Tuxonice binary signature file not found. s2ram: unknown machine, see s2ram(8) and the USuspendRamForce option hibernate-ram: Aborting. And thus got me to try out s2ram. Visually it suspends exactly the same way (gray screen, then off), but the resume actually works. Unfortunately it broke hibernation. Oh well, can't win it all.
LinuxMint15: Suspend to RAM not working
1,444,276,466,000
I'm currently learning for an exam in operating systems. This includes learning some basics about page tables, which lead me to the question Why using hierarchical page tables? which mentions that access control bits take about one byte for each entry in the page table. Another source mentioned also one byte for one page. But what information is in access control bits for a hierarchical page table? tfinley.net mentions: Valid bit Dirty bit Do we have access to read (but why should we ever not have access to read?) write execute That would be 5 bit. But I don't think the source is good and I still miss 3 bit. According to Gary Shute it's 4 bit additional information (valid bit, rwx). Could somebody please tell me what's in the access control bits? Preferably with a source. I guess this question might depend on the actual system. I'm happy with any system you know this for and have sources.
This answer is for a IA-32 architecture. I took the information form Intels IA-32 Architectures Software Developer’s Manuals, Page 1751/3044(!): Table 4-6. Format of a 32-Bit Page-Table Entry that Maps a 4-KByte Page: 0 (P): Present; must be 1 to map a 4-KByte page 1 (R/W): Read/write; if 0, writes may not be allowed to the 4-KByte page referenced by this entry (see Section 4.6) 2 (U/S): User/supervisor; if 0, user-mode accesses are not allowed to the 4-KByte page referenced by this entry (see Section 4.6) 3 (PWT): Page-level write-through; indirectly determines the memory type used to access the 4-KByte page referenced by this entry (see Section 4.9) entry (see Section 4.9) 4 (PCD): Page-level cache disable; indirectly determines the memory type used to access the 4-KByte page referenced by this entry (see Section 4.9) 5 (A): Accessed; indicates whether software has accessed the 4-KByte page referenced by this entry (see Section 4.8) 6 (D): Dirty; indicates whether software has written to the 4-KByte page referenced by this entry (see Section 4.8) 7 (PAT): If the PAT is supported, indirectly determines the memory type used to access the 4-KByte page referenced by this entry (see Section 4.9.2); otherwise, reserved (must be 0) 8 (G): Global; if CR4.PGE = 1, determines whether the translation is global (see Section 4.10); ignored otherwise 11:9: Ignored 31:12: Physical address of the 4-KByte page referenced by this entry
What information exactly is in the access control bits of a page table?
1,444,276,466,000
I've got a RHEL4 machine with 1TB of memory and have discovered that malloc and mmap refuse to allocate any memory above 512GB. Meanwhile, I don't seem to have a problem with RHEL5 machines. I'm presuming, then, that it's just a matter of kernel configuration. Does anyone know what controls the maximum process size (assuming a fixed page size)?
The initial port of Linux for amd64 only supported a 40-bit virtual address space, divided in 512GB for the process and 512GB for the kernel. Current versions support 48 bits of virtual address space, divided in 128TB/128TB. This last limitation is intrinsic in the current version of the amd64 architecture: there is simply no way to configure the MMU to make more bits significant. See How does Linux support more than 512GB of virtual address range in x86-64? for an explanation of the amd64 MMU, or the AMD64 Architecture Programmer's Manual (§5.1) for the full story. I don't know exactly when this limitation changed, but your 2.6.9 kernel is really old. Red Hat publishes a table of features and limits for RHEL 3 through RHEL 6. The maximum per-process address space on RHEL4 is 512GB. RHEL5 will get you 2TB, but you might want to upgrade directly to RHEL6 which supports the full 128TB.
Where is max process size specified?
1,444,276,466,000
Since upgrading my (Gentoo) kernel from 2.6.38 to 3.3.8 (via oldconfig), I can't get the network on eth0 up anymore. It reports "SIOCSIFADDR: File exists" with a number of other SIOCSIF* errors that seem related. I have the CONFIG_BNX2=y configuration for the Broadcom NetXtreme II NIC that the machine has (which we have been using for years) enabled in the new kernel. Any hints?
The solution for me was to install the linux-firmware package. Apparently, this got split out of the kernel at some point, and I've had to install it manually on boxes that were upgraded from old kernels.
SIOCSIFADDR: File exists after upgrading kernel
1,444,276,466,000
I'm pretty confused on how linux manages I/O shared memory to communicate with devices that use it. If I understood it correctly linux kernel starts mapped at 0x100000 (to avoid the first megabyte legacy ram data and to be stored in contiguous memory locations) and then after entering protected mode: on 32 bit systems there's a mapping like this The ZONE_NORMAL should be below 896 MB, so the mapping between the kernel linear 1GB and the physical 896 MB is always possible. Let's just ignore the ZONE_DMA for now (I read that this is just for legacy systems since PCI can now use DMA transfers everywhere in memory) on 64 bit systems the kernel linear address space should start from PAGE_OFFSET= 0xffff810000000000 and forth In both cases, if an address in the kernel space is greater than PAGE_OFFSET, should refer to a ioremap mapping (to be resolved through pagination), if it's lower than PAGE_OFFSET it could be resolved with a simple NEW_ADDRESS = OLD_ADDRESS - PAGE_OFFSET. Is this correct? Bonus question: when the kernel is up and running and the tidying up has been done, does it still physically reside from 0x100000 and forth (within the first GB) ? Even on 64bit systems?
On PCs, hardware memory mapped IO ranges are assigned by the BIOS to physical memory addresses between 3GiB and 4 GiB. When a driver requests access to the memory, the kernel maps it somewhere in the kernel virtual address space. Neither of your other two questions seem to have anything to do with shared memory, but: In both cases, if an address in the kernel space is greater than PAGE_OFFSET, should refer to a ioremap mapping (to be resolved through pagination), if it's lower than PAGE_OFFSET it could be resolved with a simple NEW_ADDRESS = OLD_ADDRESS - PAGE_OFFSET. Is this correct? Mentally, yes. The hardware uses the page tables in either case.
Linux I/O shared memory access
1,444,276,466,000
I have an linux kernel 2.6.30 on an ARM based embedded device and I have to do some kernel memory usage profiling on the device. I am thinking of monitoring the ps output on various kernel threads and modules while I carry out actions like wifi on/off etc. Can you suggest me: Which threads I need to monitor? How to monitor the kernel module memory usage?
There are several ways to monitor memory usage in a Linux system. Some may or may not be available depending on What version you are running How the kernel is configured What user-space tools are included in the root file-system Since Linux typically is a virtual memory system, some statistics may be misleading and/or inaccurate. It is important to dig and understand what each statstic means. With all that said, I typically monitor memory usage by running vmstat to get an idea of the total memory usage: # vmstat -s 127168 total memory 44072 used memory 33296 active memory 2164 inactive memory 83096 free memory 0 buffer memory 20468 swap cache 0 total swap 0 used swap 0 free swap 582750 non-nice user cpu ticks 0 nice user cpu ticks 160883 system cpu ticks 7448748 idle cpu ticks 0 IO-wait cpu ticks 16066 IRQ cpu ticks 18249 softirq cpu ticks 0 stolen cpu ticks 0 pages paged in 0 pages paged out 0 pages swapped in 0 pages swapped out 15079537 interrupts 28629740 CPU context switches 1344249586 boot time 25532 forks "free" Will also give you a bird's eye view of the memory usage. If I see anything unexpected, I will look on suspect processes by examining files in procfs. Good files to look at are /proc/PID/maps - This lists all the memory currently mapped by the process /proc/PID/smaps - Provides more details about how much memory is resident/shared/dirty/etc... This file can be verbose, but a Python script could be written to generate more meaningful data
Memory profiling the linux kernel on an embedded device
1,444,276,466,000
I compiled the latest kernel, and the menu.lst is updated as follows. My aim is to keep the other kernel around, so that if the new one fails we can still boot from the other one. Is this the correct way to achieve that? # Modified by YaST2. Last modification on Thu Jan 19 17:10:38 IST 2012 # THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader # Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader default 2 timeout 8 ##YaST - generic_mbr gfxmenu (hd0,1)/boot/message ##YaST - activate ###Don't change this comment - YaST2 identifier: Original name: linux### title Desktop -- openSUSE 11.3 - 3.2.1-12 kernel (hd0,1)/boot/vmlinuz-3.2.1-12-desktop root=/dev/disk/by-id/ata-ST3250310AS_6RYNQEXY-part2 resume=/dev/disk/by-id/ata-ST3250310AS_6RYNQEXY-part1 splash=silent quiet showopts vga=0x31a ###Don't change this comment - YaST2 identifier: Original name: failsafe### title Failsafe -- openSUSE 11.3 - 3.2.1-12 kernel (hd0,1)/boot/vmlinuz-3.2.1-12-desktop root=/dev/disk/by-id/ata-ST3250310AS_6RYNQEXY-part2 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x31a ###Don't change this comment - YaST2 identifier: Original name: linux### title Desktop -- openSUSE 11.3 - 2.6.34-12 root (hd0,1) kernel /boot/vmlinuz-2.6.34-12-desktop root=/dev/disk/by-id/ata-ST3250310AS_6RYNQEXY-part2 resume=/dev/disk/by-id/ata-ST3250310AS_6RYNQEXY-part1 splash=silent quiet showopts vga=0x31a initrd /boot/initrd-2.6.34-12-desktop ###Don't change this comment - YaST2 identifier: Original name: failsafe### title Failsafe -- openSUSE 11.3 - 2.6.34-12 root (hd0,1) kernel /boot/vmlinuz-2.6.34-12-desktop root=/dev/disk/by-id/ata-ST3250310AS_6RYNQEXY-part2 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x31a initrd /boot/initrd-2.6.34-12-desktop
I am using grub1, Mine looks like this: # (0) Arch Linux title Arch Linux root (hd0,0) kernel /vmlinuz-linux root=/dev/sda3 resume=/dev/sda2 ro loglevel=3 initrd /initramfs-linux.img # (1) Arch Linux backup title Arch Linux backup root (hd0,0) kernel /vmlinuz-linux-backup root=/dev/sda3 resume=/dev/sda2 ro loglevel=3 initrd /initramfs-linux-backup.img # (2) Arch Linux FB title Arch Linux Fallback root (hd0,0) kernel /vmlinuz-linux root=/dev/sda3 ro quiet initrd /initramfs-linux-fallback.img Also, yesterday I built kernel and did mkinitcpio -p linux-new. The wireless didn't work, So, I reverted it back to old version.
Updating /boot/grub/menu.lst on OpenSuSe 11.3
1,444,276,466,000
I am using Fedora 15, and want to upgrade to version 16. I followed the official link Upgrading Fedora using yum - FedoraProject to upgrade my OS by the following command: yum update kernel* --releasever=16 yum groupupdate Base --releasever=16 reboot After reboot, the OS does not start. It just prints the following message on screen: could not start boot splash: No such file or directory and nothing else. I have installed a lot of software on my previous OS, and I don't want to format my system partition. How to bring Fedora back to life without reinstalling the OS? Reinstall the OS would mean that I have to install a lot of software and do much configuration. It's a waste of time.
Note: I dont know where you found those commands, but those are not the right procedure to upgrade a system using yum; which is actually a matter of just running yum --releasever=XX distro-sync after having updated yum to the latest version. I think your problem depends on the fact that Fedora 16 uses grub2 as default, while previous releases have grub. Actually, the upgrade should have completed successfully, because even after removing the grub rpm, grub would still be installed in your master boot record, and be used after reboot. Your best bet in this case is booting a live-cd or live-usb media, mounting all your hard drive partitions (except swap obviously) under a chosen directory, say /mnt/sysimage, then issuing as root: # chroot /mnt/sysimage (you are now in the root dir of your old system) # /sbin/grub2-mkconfig -o /boot/grub2/grub.cfg (this creates grub2 configuration file) # /sbin/grub2-install --recheck /dev/sdX (this installs grub2 in your MBR, replace sdX with your boot drive) If everything went right, you could now boot into your system again, this time using grub2. Good luck
Kernel can not boot after upgrade on Fedora OS 15
1,444,276,466,000
I keep getting an address collision warning at boot time, between ACPI and Video Rom. If I add acpi=off to grub.conf the error goes away, but then I have no power management (battery icon, proper shutdown, etc.). Anyone know the cause or a possible solution?
This can probably be solved in BIOS configuration. If there is a newer BIOS for your machine, you should use it. Other than that, try booting with pci=noacpi option. If this results in loosing some capabilities you desire, whereas presently everything works fine despite the acpi warning, you might just disable kernel warnings using loglevel=3 boot option. Note however, that this disables all kernel warnings, so if you run into problems in the future, you might need to disable this option for diagnosing those.
Fedora 15 address collision on Compaq CQ41?
1,444,276,466,000
Possible Duplicate: Understanding the linux kernel source I am sure that I must be missing something, here. I cannot for the life of me find the source code for these system calls. I can find their numbers, and I can find their prototypes, but I cannot seem to actually find the functions that implement them. In case anyone's interested: the reason that I am trying to find them is so that I can debug a problem with the kernel's floppy driver and/or my floppy drive itself. I can dd to/from it just fine. The drive works in DOS and Windows just fine. But when I mount a disk (any disk, doesn't matter what), the disk is mounted for approximately 1/10 of a second and then automatically unmounted. I am trying to find out why and if there is a way that I can patch my kernel locally to work around it. I know, I know, nobody uses floppies anymore. But I guess I am a nobody. :)
They are were in fs/super.c in Linux 2.4: sys_mount sys_umount In my machine (Linux 2.6.24) they are in fs/namespace.c: sys_mount sys_umount In Linux 2.6.39 (which is latest stable) I could not find sys_mount function but I found compat_sys_mount function in /fs/compat.c. Thanks to Gilles for pointing out obsolete information.
Linux source, where are sys_umount and sys_mount system calls? [duplicate]
1,444,276,466,000
I have a laptop that has a Bluetooth card in it, a Gateway NV series one. I'm trying to get it to turn on, as it currently isn't. The first time I booted after I wiped my drive and installed Linux Mint 11 from scratch, I saw the bluetooth light come on for the first time ever. However, it wasn't working, and after a reboot, it's no longer on. Running hcitool dev only lists my USB dongle, or nothing if the dongle isn't plugged in. I've heard that there are kernel-level things I can do to fix this, where should I look for that? Is there a way for me to at least determine what kind of Bluetooth card I have in here so I can work on getting it working? lsusb doesn't give me anything relevant to Bluetooth: Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 04f2:b044 Chicony Electronics Co., Ltd Acer CrystalEye Webcam Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 010: ID 18d1:4e12 Google Inc. Nexus One Phone (Debug) Bus 001 Device 009: ID 0bc2:3001 Seagate RSS LLC Bus 001 Device 005: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB Bus 001 Device 004: ID 046d:c526 Logitech, Inc. Nano Receiver Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB Bus 001 Device 002: ID 1a40:0101 TERMINUS TECHNOLOGY INC. USB-2.0 4-Port HUB Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Nor does lspci: 00:00.0 Host bridge: Intel Corporation Mobile 4 Series Chipset Memory Controller Hub (rev 07) 00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07) 00:02.1 Display controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07) 00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 03) 00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 03) 00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 03) 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03) 00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 03) 00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 (rev 03) 00:1c.2 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 3 (rev 03) 00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03) 00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03) 00:1d.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03) 00:1d.3 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 03) 00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03) 00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93) 00:1f.0 ISA bridge: Intel Corporation ICH9M LPC Interface Controller (rev 03) 00:1f.2 SATA controller: Intel Corporation ICH9M/M-E SATA AHCI Controller (rev 03) 00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 03) 02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5784M Gigabit Ethernet PCIe (rev 10) 04:00.0 Network controller: Intel Corporation WiFi Link 5100 One thing's for sure, the card at the very least turned on the first time I booted, and something changed, preventing it from coming on. How can I determine what kind of card I have and how to enable it?
Very strange. On my work Dell E6510 the bluetooth shows up as an "internal" USB device (visible with lspci) and I have no problems with it. Try to see if you can get to the Gateway site where it allows you to download the Windows driver, and see if that tells you what kind of chipset/etc. it might be. Otherwise you might have to take the back cover off and physically look at the chip.
Setting up internal Bluetooth card on Linux 2.6.38
1,444,276,466,000
So I managed to install Debian 5 on an eBox 3300MX (an embedded type computer). I added a custom kernel after getting a basic install done. That was to get the network card to work. After that, I finished with installing, since I was doing a net install, and it worked fine. However, since then, I am unable to get the Debian to use the network card again. The only thing I can think of is that the Kernel updated during the install. I tried booting into the previous working kernel, and that did not work either. I get the error "No network devices found." However, I can open Network Tools and view devices, and I see the network card, with its MAC address and other info. I have it listed in etc/network/interfaces as auto. Thus, I don't understand why it does not want to work. I'm not really sure what other info is relevant, so please comment and let me know.
It turns out that during the first update I did (apt-get install ntp), that ifupdown was removed. Since I did not immediately reboot, I was able to continue with the net install following this. I discovered this by completely installing Debian again, and carefully looking through the operations during that update (well, and the help of someone who knows much more about Linux than I do). Anyways, all it took to get going again was apt-get install ifupdown and now everything is good.
no network device found after Kernel update
1,660,348,260,000
I'm writing a livepatch module to hook a function and replace it with one that causes the process to terminate. I can't call abort() because that calls BUG() and my kernel will panic on oops. Importantly, the function must terminate the process immediately and must not return.
Well, I'm dumb. Turns out I was still using do_exit_group() and forgot to switch to do_exit().
What is the proper way to exit the current process from a kernel module?
1,660,348,260,000
When you boot the Linux kernel, it spews fouth a huge wall of text, which scrolls faster than any human could ever read. If you watch closely, at some point during the boot sequence, the font the text is drawn with changes ever so slightly. Does anybody know why this happens, or exactly what point it happens at? It's not a problem, I'm just curious to know.
The font change happens because setfont is run to change the font. On Debian-based distributions, this is usually done by console-setup. By default, the effect is as you describe: in Debian, on PCs with kernel mode-setting, the default switches from whatever 8×16 font is included in the kernel to Terminus 8×16, the default font in console-setup.
Font change during boot sequence
1,660,348,260,000
I checked my Linux sys file, I don’t have: /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq My kernel config doesn’t have CONFIG_X86_INTEL_PSTATE, and it still didn’t use acpi-cpufreq driver. The sys file here only created when intel_pstate enabled? I am using yocto environment, not CentOS or Ubuntu.
Short answer The reason the path won't show on your system is that the cpufreq driver isn't loaded. This driver is the one creating the /sys/devices/system/cpu/cpuY/cpufreq in sysfs and populating it with values. When trying to compile the kernel without CONFIG_X86_INTEL_PSTATE, it is forced to enabled by the pcc_freq and acpi_freq driver compilation prerequisites, so I guess you must set it in order to compile the driver. More details Looking at the kernel code under drivers/cpufreq/, we can see that the scaling_max_freq entry in sysfs is defined and maintained by cpufreq.c. There are two drivers implementing the cpufreq functionality - pcc_cpufreq and acpi_cpufreq. In order for the path to be initialized one of the cpufreq drivers must be loaded. Relevant fields in kernel config: # # CPU frequency scaling drivers # CONFIG_X86_INTEL_PSTATE=y CONFIG_X86_PCC_CPUFREQ=m CONFIG_X86_ACPI_CPUFREQ=m Check your system for pcc_cpufreq driver. If it is available you should use the cpufreq path without loading acpi_cpufreq, but since you said CONFIG_X86_INTEL_PSTATE isn't set in your kernel config file, you might be missing all of the cpufreq drivers. Hope this helps.
There is no scaling_max_freq sys file
1,660,348,260,000
I've been using /proc/self for a long time to read process-related information like /proc/self/maps etc. However, on some UNIX variants, like macOS, the procfs filesystem is not implemented; but as this link states, it should be possible to obtain similar information using sysctl. Reading output from sysctl -a, I find that information is not directly associated to any specific process, but instead relates to the system or kernel. So, how can I use sysctl to read the information, normally present in /proc/self on Linux distributions, on UNIX variants like macOS? I want to e.g. get /proc/self/maps on macOS.
Your observation that sysctl predominantly contains system-wide parameters is apt. It also follows somewhat from the name sysctl (which suggests SYStem ConTroL), and the man page's description of "sysctl - get or set kernel state." Some BSD systems do offer optional procfs filesystem support which can be mounted under /proc, such as FreeBSD: # mount -t procfs procfs /proc This provides some of the functionality, but is perhaps most often used for compatibility purposes when running Linux binaries in emulation mode, rather than for definitive inquiries into the run-time statistics of specific native BSD processes. Unfortunately, OS X doesn't support procfs filesystems, to my knowledge. And more generally, BSD systems don't use /proc, so the answer of what to use to replace a particular /proc-based query varies depending on what the specific query is. Given the recent edit to your post, you may find this command helpful to display memory usage for a specific process: $ sudo vmmap $$
How to use sysctl on UNIX variants, e.g. macOS, to read information normally found in /proc/self on Linux?
1,550,256,603,000
I just enabled netconsole on my Ubiquiti wireless LAN access points. They run a custom OpenWRT or LEDE version, based on Linux Kernel 3.3.8. It works, but the message it sends always contains an additional prefix. While dmesg reads [ 73.690000] netconsole: remote port 6666 it is sent as {d865 e557} [ 73.690000] netconsole: remote port 6666 I confirmed this with wireshark, and using netcat as the receiver. It always contains a prefix consisting of {hhhh hhhh} where h is a lowercase hex digit. The second block always seems to be e557, no matter what device sent the message, while the first block seems to change from time to time, but it does not seem to be related the the facility, time, or severity. Some samples: {32f8 e557} [ 2107.350000] br0: port 2(ath0) entered disabled state {32f8 e557} [ 2109.200000] Restarting system. {d865 e557} [ 73.690000] netconsole: local port 514 {d865 e557} [ 73.690000] netconsole: local IP 10.1.0.10 {6d77 e557} [ 1215.920000] STOPPED EVENT for vap 1 (80f50000) Unfortunately, this build does not have /dev/kmsg so testing is quite uncomfortable. What is the meaning of this prefix?
Unfortunately, this was due to a patched version of driver/net/netconsole.c. The first four hex characters are a session, that gets randomized during the loading of the netconsole kernel module. The second four hex characters are an internal model number of the AP. You can also get it by running cat /proc/ubnthal/board | grep boardid on the AP. To get the GPL tarball, you have to contact the support and wait for ages. And I also don't see any copy of the GPL packed with their APs.
netconsole prefixes every message
1,550,256,603,000
I had a big trouble. My os is Slackware,14.2,I have to backup a lot of data 2,5TB. I have tried many methods: usb3,firewire,e-sata with different control. After some hours,sometimes minutes the system totally hang no way to recover: power button,sysrq,the only way is to cut-off the AC power.On console I cannot see any error message because the keyboard is hanged. I have tried different kernels,compiled by myself or precompiled slackware. But no way I have also change all dimms,and try memtest,no errors but still hang My hw is ASUS M5A97 R2.0 with 16GB of ram I have to change my mobo?Or whatelse? I forget the most important thing: the backup is on disk encrypted with luks. Can be related to this?
Solution found. I had a custom kernel,probably some strange settings make rsync hang with the Slackware current kernel 4.4+ works fine,even with the 4.4.88 Slackware-14.2 kernel With those kernels no problems,no hang.
Linux hang on transfer of big files with rsync
1,550,256,603,000
I have used rsync to clone all my disks. Then I created partitions and gave them filesystems (ext2). I installed grub. I have done everything that I can think of or what I was able to find on the internet. The system is still not booting :( . What else can I do?
Mount: could not find filesystem '/ dev / root' During the boot process, you will mount the filesystem (ext2 in your case). The attached image will appear to fail to mount ext2. You will not be able to run ext2's /sbin/init because you have failed to mount ext2 (switchroot: mount failed: No such file or directory) Please debug that part. If Initramfs is present, you can debug the init script. (example) Does the device node you want to mount exist?) I do not know your environment exactly. (Desktop PC or embedded board, ..) In both cases, however, I think you could not mount the filesystem. First, check the device node when mounting the filesystem.
Linux clone isn't booting
1,550,256,603,000
On Fedora 24, after every kernel update, the debug version of the latest kernel is on top of the list of kernels during boot. Running grub2-mkconfig -o /boot/grub2/grub.cfg fixes the list, but I currently have to run this after every upgrade. Is there a way to fix this such that the list is properly ordered after every kernel upgrade?
This got fixed by itself after a few updates. I've also since upgraded to Fedora 25 and am not encountering the issue.
After every kernel update, debug option is first on the list at boot
1,550,256,603,000
I'm running ubuntu gnome 16.04.1 on my hp pavilion ab048tx having an Elantech touchpad. I've tried various dkms fixes available on the internet (including psmouse-elantech-x551c and psmouse-elantech-v7), but nothing seems to get multi-touch into action. Basic functions work (move, click, tap and right-click). Any idea what to do? My (partial) output for cat /proc/bus/input/devices is as follows: I: Bus=0011 Vendor=0002 Product=0001 Version=0000 N: Name="PS/2 Elantech Touchpad" P: Phys=isa0060/serio1/input0 S: Sysfs=/devices/platform/i8042/serio1/input/input5 U: Uniq= H: Handlers=mouse0 event6 B: PROP=1 B: EV=7 B: KEY=70000 0 0 0 0 B: REL=3 For demsg | grep elantech, it is: [ 2.123958] psmouse serio1: elantech: unknown hardware version, aborting... [ 2.429095] input: PS/2 Elantech Touchpad as /devices/platform/i8042/serio1/input/input5 [ 2506.145724] psmouse serio1: elantech: unknown hardware version, aborting... [ 2506.449970] input: PS/2 Elantech Touchpad as /devices/platform/i8042/serio1/input/input20 For synclient -l: Couldn't find synaptics properties. No synaptics driver loaded? Relevant output from Xorg.0.log: [ 28.346] (II) config/udev: Adding input device PS/2 Elantech Touchpad (/dev/input/event6) [ 28.346] (**) PS/2 Elantech Touchpad: Applying InputClass "evdev pointer catchall" [ 28.347] (II) systemd-logind: got fd for /dev/input/event6 13:70 fd 38 paused 0 [ 28.347] (II) Using input driver 'evdev' for 'PS/2 Elantech Touchpad' [ 28.347] (**) PS/2 Elantech Touchpad: always reports core events [ 28.347] (**) evdev: PS/2 Elantech Touchpad: Device: "/dev/input/event6" [ 28.347] (--) evdev: PS/2 Elantech Touchpad: Vendor 0x2 Product 0x1 [ 28.347] (--) evdev: PS/2 Elantech Touchpad: Found 3 mouse buttons [ 28.347] (--) evdev: PS/2 Elantech Touchpad: Found relative axes [ 28.347] (--) evdev: PS/2 Elantech Touchpad: Found x and y relative axes [ 28.347] (II) evdev: PS/2 Elantech Touchpad: Configuring as mouse [ 28.347] (**) evdev: PS/2 Elantech Touchpad: YAxisMapping: buttons 4 and 5 [ 28.347] (**) evdev: PS/2 Elantech Touchpad: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200 [ 28.347] (**) Option "config_info" "udev:/sys/devices/platform/i8042/serio1/input/input5/event6" [ 28.347] (II) XINPUT: Adding extended input device "PS/2 Elantech Touchpad" (type: MOUSE, id 13) [ 28.347] (II) evdev: PS/2 Elantech Touchpad: initialized for relative axes. [ 28.347] (**) PS/2 Elantech Touchpad: (accel) keeping acceleration scheme 1 [ 28.347] (**) PS/2 Elantech Touchpad: (accel) acceleration profile 0 [ 28.347] (**) PS/2 Elantech Touchpad: (accel) acceleration factor: 2.000 [ 28.347] (**) PS/2 Elantech Touchpad: (accel) acceleration threshold: 4 [ 28.347] (II) config/udev: Adding input device PS/2 Elantech Touchpad (/dev/input/mouse0) [ 28.347] (II) No input driver specified, ignoring this device. [ 28.347] (II) This device may have been added with another device file. I tried using modprobe psmouse proto=imps but then it is detected as PS/2 Generic Mouse and still nothing. evdev is currently handling the touchpad and I also tried using libinput, but it doesn't work. If I try to force "synaptics" driver using /usr/share/X11/xorg.conf.d, the touchpad completely stops working EDIT: My device has a touchscreen (detected as Radiyum) Please ask for more if needed!
In case somebody finds this, as cross-posted here, updating the kernel to 4.4.0-38 fixes the issue.
New Elantech touchpad lacks multitouch (latest kernel)
1,471,123,810,000
as a school project I have to add a syscall to the latest stable linux kernel. I did and recompiled the kernel using make defconfig and make. After going through several tutorials to boot the kernel (none of which worked), I finally found something here (adapting it to x86_64 version of the kernel). This tutorial makes me create a initramfs using mkinitramfs -o file. The problem is, I need to test my syscall on this new kernel but once I boot it I get redirected to a (initramfs) prompt, and I have no idea how to install packages, or if it is even the right solution. My question -> how would I get gcc on this virtual machine so I can compile a simple C test program, run it and make sure my syscall works ?
Well if anyone wants to know how to do that, here's how I did it -> I compiled on my machine, created my own initramfs (following the instructions here (don't gzip or qemu won't read it somehow)), put the executable in the initramfs before cpio it, then launched qemu and the executable, voila. I know this is not the ideal solution, it only worked because both the kernel I was testing and my machine were linux x86_64, but I was out of options. (If you want to pass gcc to your initramfs, don't, it segfaults when compiling).
Qemu - debug new syscall
1,471,123,810,000
Does a smaller page size lead to smaller page table(s)? If so, is that good or bad !? I think that this lead to more data handling. Is it possible: to test that within Linux manually or that this stuff is defined by the Linux kernel ? If so, I have no chance to test that.
The amount of paging space is fixed (but configurable) on any given system, so having smaller pages means that you have more pages available. The trade off is entirely performance based. It depends on what the application uses. Oracle for example may benefit from pages of size X, while Informatica may benefit from pages of size Y (picked two applications I've configured paging sizes for in the past). Having a smaller page size means that you have to perform more operations to get more data, but you have more pages available. Having a larger page size means you can read more contiguous page blocks (thus increased performance for larger page reads) but you have fewer available pages. I know Oracle uses a mix depending on the type and use of a database, so it can be configured to have a certain number of huge pages, and a certain number of regular/small pages. (Again, using Oracle from my own experience, but other applications do this too I'm sure.) So neither is good or bad, it just depends on the usage of a particular application. It's configured on the server layer though, so if you have two applications on the same system that need different size pages, performance will suffer. You can test it manually in a variety of ways. Depending on your OS distribution/platform (Solaris, Linux, etc.) there should be plenty of documentation on how to configure this.
What is the effect of smaller pages?
1,471,123,810,000
I'm currently trying to get my Mint 17 partition booting again. I tried to fix a booting problem with boot-repair and a live USB, but upon inputting the command sudo chroot "/mnt/boot-sav/sda7" apt-get install -y --force-yes grub-efi-amd64-signed shim-signed linux-signed-generic" I got the error The following packages have unmet dependencies: linux-signed-generic : Depends: linux-headers-generic (= 3.13.0.54.61) but it is not going to be installed E: Unable to correct problems, you have held broken packages." I reinstalled grub with a different method after lots of struggle (since this just wiped grub off), but then could only boot to a grub command prompt. Tried boot-repair again, and am now once again booting to nothing. My main problem right now is I don't know what I need to fix. I'm not sure if I can go anywhere after reaching the blank grub command prompt, but I don't know how else to fix grub. Is the blank grub simply a problem of then mounting the kernel, or should grub already recognize the kernel? Any and all help is greatly appreciated.
I wound up following several guides to boot from rescue grub. I unfortunately overlooked one problem the whole time; my grub folder in /boot was actually named grub.bak. I then followed these instructions to boot from rescue grub: set prefix=(hdx,y)/boot/grub.bak (instead of set prefix=(hdx,y)/boot/grub) set root=(hdx,y) insmod normal normal
restoring grub mint 17
1,471,123,810,000
I was trying to compile Linux kernel from source file i.e. 3.19.3 kernel version I ran the following commands for compilation first I extracted tar -xvf linux-3.19.3.tar.xz changed to its directory cd linux-3.19.9 sudo make menuconfig Didn't change anything sudo make -j4 sudo make install-modules install I was following instructions given here after reboot it is giving following message and dropping to initrafms Gave up waiting for root device. common problems: Boot args (cat /proc/cmdline) Check rootdelay= (did the system wait long enough?) Check root= (did the system wait for the right device?) Missing modules (cat /proc/modules; ls /dev) ALERT! /dev/disk/by-uuid/50ec5956-06a0-41b1-9315-0a68fd15270a doesnot exist. Dropping to shell! Busybox... I am getting this screen. what should I do? And how should I compile the kernel to avoid this kind of error
After kernel compilation, one must execute the command depmod -a to refresh the module order in directory /lib/modules/<kernel_version>
kernel compilation in ubuntu, reboot msg "gave up waiting for root device"
1,471,123,810,000
Observation: I switch on a Linux box Boot loader displays its output on screen Boot starts with first output messages Screen goes blank, and never comes back on. Note: this is about the console, NOT about X11. I keep running into the same problem, on a variety of hardware (x86, ARM) with different video connectors (VGA, HDMI). It more frequently happens with "modern" LCDs than with "ancient" CRTs. The LCDs would either say "no signal detected" (frequently), or "signal out of range" (rarely). Some example combinations: PC with VGA / CRT -- works same PC with VGA / analog monitor -- "no signal" same PC with HDMI / LCD -- "no signal" Raspberry Pi with HDMI -- "no signal" pcduino3 with HDMI -- "out of range" happened on the Raspberry Pi, too, but I don't recall the exact configuration. I'm trying to understand what exactly the kernel does to detect the "graphics" for console output, and why, on balance, it somehow is less successful in getting the configuration right than boot loaders and the early stage of the boot (which may be ramdisk; not sure). Or, if the kernel doesn't actually do any detecting, where the settings are defined that are somehow less successful than the boot loader's etc. I'm baffled that it happens on all sorts of hardware.
It works if I add video=LVDS-1:d to the kernel parameters.
How does the Linux kernel initialize console graphics?
1,471,123,810,000
The man page for adjtimex says Anyone may print out the time variables, but only the superuser may change them. How do I see the value shown by adjtimex -p as the tick variable without using adjtimex? I've browsed around in /proc/sys/kernel as well as some in /sys but haven't yet found anything that shows me that value. (I'm running Debian Jessie on a an ARM development board)
As hinted by @MarkPlotnick, there is no /sys or /proc interface for this. You have to use a program like adjtimex to make the appropriate system calls to see it.
How to see kernel time variables without using adjtimex?
1,471,123,810,000
Already installed VMware Workstation 9 on my Linux CentOS 6.5 Final with 3.10.40-1.el6.elrepo.x86_64 running kernel. When I open VMware Workstation, it asks me to locate the Kernel Headers 3.10.40-1.el6.elrepo.x86_64. THESE MESSAGE: I get on the internet, my kernel version is different of that message says. Outside, it is all the same. I've tried to download the ELRepo Headers (lt-kernel-headers-3.10.40-1.el6.elrepo.x86_64.rpm), unzip and put in the way of VMware, however it does not recognize. Apparently I must be doing something wrong. What do I actually download, install and which path should point to the VMware Kernel C Header configuration to work? The official page of the ELRepo, he talks to use the original Kernel conferring with glibc, however, already tried using the original kernel as a way to configure the VMware Kernel Headers C and does not work because the name of the kernels do not match indeed. I wonder what it is the Kernel Header?
SOLVED. 1-Downloaded the kernel-lt-devel-3.10.40-1.el6.elrepo.x86_64.rpm from http://ftp.nluug.nl/os/Linux/distr/elrepo/archive/kernel/el6/x86_64/RPMS/ 2-Installed (just executing the file) 3-Pointed de VMware configuration to /usr/src/kernels/2.6.32-431.20.3.el6.x86_64/include/linux/ When the VMware start, another error appeared. Said that just cant load the module vmci of vmware. 4-So, compile the vmci module: vmware-modconfig --console --build-mod vmci 5-install the module: vmware-modconfig --console --install-pbm vmci OR vmware-modconfig --console --install-all next, I tested: modprobe vmci SUCCESS Just fine with my vmware running.
CentOS ELRepo Kernel installing VMware
1,471,123,810,000
Init typically will start multiple instances of "getty" which waits for console logins which spawn one's user shell process. Upon shutdown, init controls the sequence and processes for shutdown. The init process is never shut down. It is a user process and not a kernel system process although it does run as root. If the init process are user process and not kernel process, how I can modify the behavior or see the log the the process remotely?
To clarify, you seem to be running systemd on Ubuntu rather than the (current) default of upstart. systemd, by default, sets up only one getty, tty1. Other gettys are set up "on the fly". There is a default setting of a maximum of 6 ttys. If you want to increase the number of gettys available to autostart, then increase the value of NAutoVTs in /etc/systemd/logind.conf. If you want to prestart gettys, continue to do what you are doing (i.e. enabling a getty service and starting it) for each getty you want. Not sure why you want to preactivate though. More details available here: https://wiki.archlinux.org/index.php/Systemd_FAQ#How_do_I_change_the_default_number_of_gettys.3F
Getty instances in init process
1,471,123,810,000
I am on Ubuntu Server 12.04 x86_64 and I need to build Android CyanogenMod 7.2 kernel module. My phone has custom ROM and a patched kernel: adb shell cat /proc/version yields Linux version 2.6.37.3-cyanogenmod-gf3345ef-dirty (subbotin@avs234) (gcc version 4.4.0 (GCC) ) #2 PREEMPT Sun Mar 13 14:55:50 MSK 2011 I have this variable setup in addition to toolchain variables etc. export LOCALVERSION="-cyanogenmod-gf3345ef-dirty (subbotin@avs234)" When I run make (note that on Ubuntu bash is dash) I get the following: CHK include/linux/version.h /bin/sh: 1: Syntax error: "(" unexpected (expecting ")") make: ***[include/generated/utsrelease.h] Error 2 However, if I remove "(subbotin@avs234)" the kernel compiles just fine. I need a full vermagic string since I suspect that this kernel module wouldn't load because of difference in the version string. What is the problem with parentheses? A more detailed description: The device is HTC Desire (bravo) GSM and the application is EDS Lite (http://play.google.com/store/apps/details?id=com.sovworks.edslite). I partially followed this http://oldwiki.cyanogenmod.org/wiki/Building_Kernel_from_source and this is a kernel module compilation guide http://www.sovworks.com/details.html#compileModule. In the latter link it is mentioned that vermagic string should probably match completely. When I try to load this module from the application mount menu I get 'failed loading kernel module' #get repo tool mkdir -p ~/bin curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo chmod a+x ~/bin/repo #clone repo for cm-kernel mkdir -p ~/Android/kernel cd ~/Android/kernel git clone git://github.com/CyanogenMod/cm-kernel.git cd cm-kernel #pull the kernel configuration from the device #my config file is here: http://pastebin.com/aHA2mETG adb pull /proc/config.gz ~/Android/kernel/cm-kernel cd ~/Android/kernel/cm-kernel gunzip config.gz #replace CONFIG_LOCALVERSION and CONFIG_LOCALVERSION_AUTO with null string sed 's/CONFIG_LOCALVERSION\([[:alnum:][:punct:]]\)*//' config > .config cp config .config #toolchain from http://developer.android.com/sdk/index.html#download (sdk tools) export CROSS_COMPILE=~/Android/Toolchain/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- export CCOMPILER=~/Android/Toolchain/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- export ARCH=arm export SUBARCH=arm export LOCALVERSION="-cyanogenmod-gf3345ef-dirty (subbotin@avs234)" make oldconfig #Answer "no" CONFIG_LOCALVERSION_AUTO (the second prompt) request. make #download EDS kernel module src http://www.sovworks.com/downloads.html #extract to ~/Android/km cd ~/km make -C ~/Android/kernel/cm-kernel\ ARCH=arm CROSS_COMPILE=~/Android/Toolchain/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-\ EXTRA_CFLAGS=-fno-pic\ SUBDIRS=~/Android/km modules #if LOCALVERSION="-cyanogenmod-gf3345ef-dirty" then vermagic string is as in the following modinfo eds.ko #... vermagic: 2.6.37.6-cyanogenmod-gf3345ef-dirty preempt mod_unload ARMv7 upd: just noticed that the stable version of currently installed kernel (which is 3) is not equal to the built kernel stable version (6). Not sure if they are compatible - maybe the problem is with installed kernel version string after all?
However, if I remove "(subbotin@avs234)" the kernel compiles just fine. You don't need this in the LOCALVERSION. "subbotin@avs234" is just the one that compiled the kernel (user@host). It's not part of the version string nor needed for anything related to the compilation of the kernel.
Running make with vermagic kernel string with parentheses causes /bin/sh syntax error
1,362,601,005,000
So, I'm attempting to compile and use the 3.6.2 kernel on my Debian 6 VM (running under Windows 7 in VMware Workstation 9). I've already had several hick ups, but I am slowly getting through them but still not there, yet. So, I'm running the following (after extracting the file into /usr/src and running the commands via su) make defconfig make -j8 make install make modules_install update-initramfs -c -k 3.6.2 update-grub I forgot to do the initramfs step, which I found from this link here but I still got the error, which resulted in me finding this link. After this, this part of the error below stopped occurring, but the rest was there: W: devtmpfs not available, falling back to tmpfs for /dev Upon the GRUB menu, I edited the root UUID to /dev/sda1 but it still doesn't find it. I finally followed this link, but still no luck. Any ideas?
Alrighty then, I found the solution! Booyakasha! :) After running lspci I did a google search for LSI Logic kernel compile (or something to that affect) and came across this site. Since it applied to an older kernel version (I assume as it looks different to the settings I have available) I applied the following and got it all working :) So, assuming you've done as I did and started off with running make defconfig run make menuconfig and go into Device Drivers. Once in there, enable Fusion MPT device support and go in there and enable all the modules (Though I don't think you need all of them. I did for now but will tinker and update my answer accordingly after I have done so). After enabling those modules, save and exit. Modify the make -j8 part as required. If you're using anything other than GRUB2 the last part will probably be different but hopefully this is generic enough for anyone to use, regardless of distro. So the entire process again, after extracting the kernel to /usr/src is: make defconfig make menuconfig make -j8 make install make modules_install update-initramfs -c -k 3.6.2 update-grub Lastly, you'll need to reinstall your VMware Tools when you're done, so you might wanna remove them first before the whole process. Cheers guys! :)
Unable to mount root fs after new kernel compile in VMware
1,362,601,005,000
I just compiled and installed the new 3.0-rc2 kernel from kernel.org on my Fedora 15 system. Everything seems to work fine and I can successfully boot into the system. However, this broke my previously installed NVIDIA driver, so I need to compile a new one. I downloaded the installer from nvidia.com, but I am having trouble with the installation. To compile the kernel I unzipped the kernel archive to my home directory, then simply reused my Fedora config for the new kernel. Everything resides in ~/linux_build/linux-3.0-rc2. After booting to runlevel 3 I get an error with the NVIDIA installer: ERROR: If you are using a Linux 2.4 kernel, please make sure you either have configured kernel sources matching your kernel or the correct set of kernel headers installed on your system. If you are using a Linux 2.6 kernel, please make sure you have configured kernel sources matching your kernel installed on your system. If you specified a separate output directory using either the "KBUILD_OUTPUT" or the "O" KBUILD parameter, make sure to specify this directory with the SYSOUT environment variable or with the equivalent nvidia-installer command line option. Depending on where and how the kernel sources (or the kernel headers) were installed, you may need to specify their location with the SYSSRC environment variable or the equivalent nvidia-installer command line option. I ran the installer like this: bash NVIDIA-Linux-x86_64-270.41.19.run --kernel-source-path=/home/tja/linux_build/linux-3.0-rc2 Usually this was solved by installing the kernel headers from yum, but here I am using a new kernel with no RPM available. How do I manually install the needed headers/source files for the NVIDIA installer?
Well, I wasn't going crazy. The NVIDIA installer needed to be patched. Kernel version 2.7.0 was hardcoded as the upper bound. That was bumped up to 3.1.0 from a simple patch. Here is the patch file: nvidia-patch @ fedoraforum.org --- conftest.sh.orig 2011-05-30 12:24:39.770031044 -0400 +++ conftest.sh 2011-05-30 12:25:49.059315428 -0400 @@ -76,7 +76,7 @@ } build_cflags() { - BASE_CFLAGS="-D__KERNEL__ \ + BASE_CFLAGS="-O2 -D__KERNEL__ \ -DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \ -nostdinc -isystem $ISYSTEM" --- nv-linux.h.orig 2011-05-30 12:27:09.341819608 -0400 +++ nv-linux.h 2011-05-30 12:27:28.854951411 -0400 @@ -32,7 +32,7 @@ # define KERNEL_2_4 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) # error This driver does not support 2.5 kernels! -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) # define KERNEL_2_6 #else # error This driver does not support development kernels! Then you need to extract the files from the nvidia installer: ./NVIDIA-Linux-x86_64-270.41.19.run -x Then, inside the 'kernel' directory are the files to be patched: cd NVIDIA-Linux-x86_64-270.41.19/kernel/ patch -p0 kernel-3.0-rc1.patch.txt Once that's done, simply supply the kernel sources as a parameter to the installer: ./nvidia-installer --kernel-source-path /home/tja/linux/linux-3.0-rc2 ...and it builds fine! Now I am up running Linux 3 with a proper Nvidia driver.
NVIDIA installer can't find kernel source/build files (compiled from kernel.org)
1,362,601,005,000
I have dual boot(triple boot) setup with Kali/Fedora and Windows 10. I'm using Fedora for my daily work and Kali for various experiments. The problem is that whenever Kali gets and kernel update it still boots with older kernel after reboot. I have following installed kernels : > root@CoreImpact:~# dpkg --list | grep linux-image > linux-image-4.3.0-kali1-amd64 4.3.3-5kali4 > amd64 Linux 4.3 for 64-bit PCs ii > linux-image-4.6.0-kali1-amd64 4.6.4-1kali1 > amd64 Linux 4.6 for 64-bit PCs ii > linux-image-4.9.0-kali2-amd64 4.9.13-1kali1 > amd64 Linux 4.9 for 64-bit PCs ii > linux-image-4.9.0-kali3-amd64 4.9.13-1kali2 > amd64 Linux 4.9 for 64-bit PCs ii linux-image-amd64 > 4.9+79+kali2 amd64 Linux for 64-bit PCs (meta-package) How do I force Kali to boot with latest linux-image 4.9.0-kali3 instead of 4.6.0? I've tried to update grub via grub-update command on Kali and grub-mkconfig on Fedora but it didn't helped. Thanks.
I've managed to fix this with selecting proper output file to grub2-mkconfig : grub2-mkconfig -o /boot/grub2/grub.cfg Not sure where it was saving it by default in previous attempts. Now everything seems to be working fine.
Kali booting old kernel
1,362,601,005,000
I have a Raspberry Pi running Raspbian (a Debian flavor: Linux version 3.12-1-rpi ([email protected]) (gcc version 4.7.2 (Debian 4.7.2-5+rpi1) ) #1 Debian 3.12.9-1+rpi1 (2014-05-19) ). I have a serial output device (electricity meter) connected via USB. The serial port is read with a Python script every minute. EDIT: The data that I'm expecting conforms to this standard: DSMR v3.0 A data-telegram is offered every ten seconds. The Python script is started by cron every minute to read one data-telegram. My dmesg, var/log/messages and /var/log/syslog are being flooded by these: Nov 2 10:32:07 electron kernel: [151762.159243] ttyUSB0: 2 input overrun(s) I've adjusted /etc/rsyslog.conf. By removing *.=kern; I managed to suppress these messages going into /var/log/messages. Unfortunately, dmesg and /var/log/syslog continue to show these messages. /var/log/syslog is mentioned nowhere in /etc/rsyslog.conf. Is it fed by a different mechanism? How can I suppress these messages from ttyUSB0 going into dmesg and /var/log/syslog? For those concerned that the cause might be found in the Python script (any improvements are appreciated). Here is the script I use (post-processing of data omitted): #! /usr/bin/python import sys, serial, re port = serial.Serial() port.baudrate = 9600 port.bytesize = serial.SEVENBITS port.parity = serial.PARITY_EVEN port.stopbits = serial.STOPBITS_ONE port.xonxoff = 1 port.rtscts = 0 port.dsrdtr = 0 port.timeout = 0 port.port = "/dev/ttyUSB0" def gettelegram(): # flag used to exit the while-loop abort = 0 # countdown counter used to prevent infinite loops loops2go = 40 # storage space for the telegram telegram = [] # end of line delimiter delim = "\x0a" try: port.open() serial.XON except: abort == 4 # open error terminates immediately return telegram, abort while abort == 0: try: # this doesn't seem to work #line = str(port.readline()).strip() line = "".join(iter(lambda:port.read(1),delim)).strip() except: # read error, terminate prematurely abort = 2 if line == "!": abort = 1 if line != "": telegram.append(line) loops2go = loops2go - 1 if loops2go < 0: abort = 3 # test for correct start of telegram if telegram[0][0] != "/": abort = 2 try: serial.XOFF port.close() except: abort == 5 # Return codes: # abort == 1 indicates a successful read # abort == 2 means that no valid data was read from the serial port # abort == 3 indicates a data overrun. More lines were received than expected. # abort == 4 indicates a serial port open error. # abort == 5 indicates a serial port close error. return (telegram, abort) if __name__ == "__main__": telegram, status = gettelegram() EDIT: I've done some extra testing. It just so happens that the input overrun error happens AFTER the above program has finished. I tried adding a port.XOFF() just before the port.close(), but that doesn't help. EDIT2: I've tried inserting serial.XON and serial.XOFF around the port.read(1) command. But, that didn't help.
Since I nolonger have this problem I'd like to share my solution: I've daemonized the Python script. This enabled me to open the serial connection on start-up of the script and then read the serial-port data every ten seconds. No more overruns since. Code of the script is here on GitHub
How to suppress input overrun messages
1,362,601,005,000
I remember for choice of swap partition, we should use (swap > 2xRAM) at least.Of course it deprecated , because max of computer's ram is very high. kernel support it. My question: i remember each partition of swap just support 2G maximum, it means if you have 2G ram you should create 2 partition of 2G swap. Did kernel solve it ? it mean can i create 4G swap for one partition?
Either you have a long memory or you've been reading obsolete documents. There used to be a 2GB swap size limit (on most 32-bit platforms), but this has not been the case for years. The limitation was removed at some point in the 2.2 kernel series. The maximum useful size of a swap area depends on the architecture and the kernel version. It is roughly 2GiB on i386, PPC, m68k, ARM, 1GiB on sparc, 512MiB on mips, 128GiB on alpha and 3TiB on sparc64. For kernels after 2.3.3 there is no such limitation.
swap partition and its laws
1,362,601,005,000
I came upon this question : What's the use of having a kernel part in the virtual memory space of Linux processes? and based on the answer and the comments on the answer : the kernel memory map includes a direct mapping of all physical memory, so everything in memory appears there; it also includes separate mappings for the kernel, modules etc., so the physical addresses containing the kernel appear in at least two different mappings Is this true? I couldn't find any source or reference for this, and why would it include a map of the entire physical memory and then again have a separate mapping of kernel modules? Isn't that redundant? Can someone explain in a simple manner what is inside the kernel part of virtual memory of processes in 64-bit Linux? and please provide a source for the answer! because I couldn't find anything related to this in any book or paper.
The kernel’s memory map on x86-64 is documented in the kernel itself. The kernel maps user-space (for the current process) PTI data structures all the physical memory the kernel’s data structures, in various blocks, with holes for ASLR the kernel itself its modules Having a full mapping of physical memory is convenient, but its relevance is debated compared to the security risks it creates, and its address-space burden (since physical memory is effectively limited to half the address space as a result; this prompted the recent expansion to five-level page tables with 56-bit addresses).
What's inside the kernel part of virtual memory of 64 bit linux processes?
1,362,601,005,000
I am reading through Salzman's Linux Kernel Module Programming Guide, and I was wondering about where the file linux/kernel.h is located. I couldn't find it with find. Or rather the files I found did not have any printk priority macros in them.
The linux/kernel.h header which gets used for module builds is the header which is part of the kernel source. When modules are built in the kernel source tree, that’s the version which is used. For external module builds, the build process looks for the header in /lib/modules/$(uname -r)/build/include/linux/sched.h. That file is provided by kernel header packages, e.g. on Debian derivatives, the linux-headers-$(uname -r) package. The /usr/include/linux/kernel.h is intended for user processes, not for kernel modules. The printk priority macros now live in linux/printk.h and linux/kern_levels.h. I’m guessing you’re reading the original guide, which is based on the 2.6 kernel series; for modern kernels you should read the updated guide (currently for 5.6.7).
Where exactly is the file linux/kernel.h?
1,362,601,005,000
Do you know what initramfs-kernel mean? I know squashfs-factory/squashfs-sysupgrade. How can I do it or what is it? which is better? I just don't understand what the initramfs-kernel mean. I have Linksys 1900ACS v2 and D-Link DL-860l B1, but I only use squashfs-factory and squashfs-sysupgrade. What does the initramfs-kernel mean? When would I use those? I would even fear to install that. So, continuing, like lede-17.01.2-ramips-mt7621-dir-860l-b1-initramfs-kernel.bin, what does this mean? can i use it and if so, what is the difference between lede-17.01.2-ramips-mt7621-dir-860l-b1-squashfs-factory.bin (which I know what it does and how) or lede-17.01.2-ramips-mt7621-dir-860l-b1-squashfs-sysupgrade.bin (which I know what it does and how).
The initramfs OpenWRT/LEDE kernel builds are including the rootfs image into initramfs, attaching it to the kernel so it will put the filesystem in a ramdisk during bootup and utilize it as /. You don't need such builds if the regular flash-based storage works for you, as it won't allow any persistent configuration by default. Such a configuration is useful during initial OpenWRT/LEDE porting efforts when you don't have the flash driver configured to use the flash chip on the device.
wrt (openwrt / lede) initramfs
1,362,601,005,000
I compiled the linux kernel by downloading it from kernel.org, put it on my desktop, and opened up terminal. I changed to the linux-3.2.13 folder, typed mr proper. Then I use make menuconfig to configure my .config file. After I am done with that and I save it I type make and terminal starts to compile the files. After 3 hours of compiling I was wondering if I did something wrong. My questions are: Did I do something wrong? If not what should I do next? What will the output be (ex. .bin, .elf)? My ultimate goal is to make an OS that I can put on a compact disc, put on another computer and run (not an Ubuntu OS with a different kernel).
Did I do something wrong? Doesn't look like it. Compiling a recent kernel is very resource-consuming. If your CPU isn't recent, and you don't have a lot of RAM, it can take very long. Make sure you only select the modules/features you actually need, and if you have a multi-core/thread machine with a bit of RAM, use the -jX option to make so that it can run the build in parallel. e.g. make -j4 will use four cores for most of the build. What will the output be? It will be a compressed kernel image. It is not an ELF file, nor really an executable in the ordinary sense. It is in a format appropriate for your platform's bootloader to handle. What should I do next? Depends on what you're up to... (See here for a simple HOWTO to install the modules and the kernel image, assuming you're using Grub. There are plenty of other ones available with a quick search, and you're better off looking in your current distribution's documentation if you plan on actually running a mainstream distribution with your new kernel - there are feature requirements, and potentially initrd specificities that need to be taken into account.) [My goal is to build my own OS] I'm afraid you're very far from that. Building an OS is a very, very complex task - and getting the kernel to build is one of the very easy parts. I'd suggest you head over to Linux From Scratch and read current stable "book". Also look on distrowatch, and search the "Source-based" category of distributions, some might be of interest to you.
Am I in the right direction for a linux os?
1,362,601,005,000
I am trying to verify When choosing a Docker container image file for my Ubuntu, what do I need to match between them? On Lubuntu, a CentOS container says it is CentOS, by $ sudo docker run centos bash -c "cat /etc/*-release " CentOS Linux release 7.6.1810 (Core) NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7" CentOS Linux release 7.6.1810 (Core) CentOS Linux release 7.6.1810 (Core) but also says it is the same Ubuntu as the host: $ sudo docker run centos bash -c "cat /proc/version" Linux version 4.15.0-46-generic (buildd@lgw01-amd64-038) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 $ cat /proc/version Linux version 4.15.0-46-generic (buildd@lgw01-amd64-038) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 I wonder why the two commands differ in OS distribution and kernel version? Does a container share the same kernel as its host? If yes, should their kernel versions be the same? When choosing a Docker container image file for my Ubuntu, what do I need to match between them? says "you don't need to match distributions or kernel versions."
cat /proc/version is showing kernel version. As containers run on the same kernel as the host. It is the same kernel as the host. cat /etc/*-release is showing the distribution release. It is the OS version, minus the kernel. A container is not virtualisation, in is an isolation system that runs directly on the Linux kernel. It uses the kernel name-spaces, and cgroups. Name-spaces allow separate networks, process ids, mount points, users, hostname, Inter-process-communication. cgroups allows limiting resources.
Why does a CentOS Docker container says it is Ubuntu?
1,362,601,005,000
I'm using Fedora and wonder if there is some way I can exclude kernel updates when I run yum update, until I specifically want to update the kernel. The reason why I am concerned about this is because sometimes it requires a lot of extra research finding patches for some programs and extra time spent recompiling them to work on the new kernel. I am thinking VMWare specifically as one example. I wonder if there is some way for yum update to NOT update the kernel and only notify me that a new one is available when it goes through its routine so that I can decide to put it off until a more convenient time. Or is this thinking likely to cause other issues?
Try this: yum --exclude=kernel\* update or: yum -x 'kernel*' update From yum man page: -x, --exclude=package Exclude a specific package by name or glob from updates on all repositories. Configuration Option: exclude And if you want to make this persistence, add a line exclude=kernel* to /etc/yum.conf: [main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://b distroverpkg=centos-release exclude=kernel* When you want to update,use --disableexcludes option to override config in yum.conf: yum --disableexcludes=main update
Is there a way to permanently exclude the kernel from updates?
1,362,601,005,000
This question is a follow-up to my previous question. Logic for me to says that an in-kernel firewall sits between the network access layer and the Internet layer, because it needs to have access to the IP-packet header to read the source and destination IP address in order to do filtering before determining if the packet is destined for the host, or it the packet should forwarded to the next hop if it is destined elsewhere. Somehow, it also seems logical to say that firewall is part of Internet layer, because that is where routing table is and a firewall is in some respects similar to routing table rules.
A firewall does not exist in a single place in the kernel network stack. In Linux, for instance, the underlying infrastructure to support firewall functionality is provided by the netfilter packet filter framework. The netfilter framework in itself is nothing more than a set of hooks at various points in the kernel protocol stack. Netfilter provides five hooks: NF_IP_PRE_ROUTING Packets which pass initial sanity checks are passed to the NF_IP_PRE_ROUTING hook. This occurs before any routing decisions have been made. NF_IP_LOCAL_IN Packets which destined to the host itself are passed to the NF_IP_LOCAL_IN hook. NF_IP_FORWARD Packets destined to another interface are passed to the NF_IP_FORWARD hook. NF_IP_LOCAL_OUT Locally created packets are passed to NF_IP_LOCAL_OUT after routing decisions have been made, although the routing can be altered as a result of the hook. NF_IP_POST_ROUTING The NF_IP_POST_ROUTING hook is the final hook packets can be passed to before being transmitted on the wire. A firewall consists of a kernel module, which registers a callback function for each of the hooks provided by the the netfilter framework; and userspace tools for configuring the firewall. Each time a packet is passed to a hook, the corresponding callback function is invoked. The callback function is free to manipulate the packet that triggered the callback. The callback function also determines if the packet is processed further; dropped; handled by the callback itself; queued, typically for userspace handling; or if the same hook should be invoked again for the packet. Netfilter is usually associated with the iptables packet filter. As Gnouc already pointed out in your previous question, iptables has a kernel module, ip_tables, which interfaces with netfilter, and a userspace program, iptables, for configuring the in-kernel packet filter. In fact, the iptables packet filter provides several tools, each associated with a different kind of packet processing: The iptables userspace tool and ip_tables kernel module concern themselves with IPv4 packet filtering. The ip6tables userspace tool and ip6_tables kernel module concern themselves with IPv6 packet filtering. The arptables userspace tool and arp_tables kernel module concern themselves with ARP packet filtering. In addition to the iptables packet filters, the ebtables userspace tool and eb_tables kernel module concern themselves with link layer Ethernet frame filtering. Collectively, these tools are sometimes referred to as xtables, because of the similar table-based architecture. This architecture provides a packet selection abstraction based on tables packets traverse along. Each table contains packet filtering rules organized in chains. The five predefined chains, PREROUTING, INPUT, FORWARD, OUTPUT and POSTROUTING correspond to the five in-kernel hooks provided by netfilter. The table a rule belongs to determines the relative ordering of rules when they are applied at a particular netfilter hook: The raw table filters packets before any of the other table. The mangle table is used for altering packets. The nat table is used for Network Address Translation (e.g. port forwarding). The filter table is used for packet filtering, it should never alter packets. The security table is used for Mandatory Access Control (MAC) networking rules implemented by Linux Security Modules (LSMs), such as SELinux. The following diagram by Jan Engelhardt shows how the tables and chains correspond to the different layers of the OSI-model: Earlier this year, a new packet filter framework called nftables was merged in the mainline Linux kernel version 3.13. The nftables framework is intended to replace the existing xtables tools. It is also based on the netfilter infrastructure. Other kernel-based firewalls in Unix-like operating systems include IPFilter (multi-platform), PF (OpenBSD, ported to various other BSD variants and Mac OS X), NPF (NetBSD), ipfirewall (FreeBSD, ported to various operating systems).
Does an in-kernel firewall sit between the network access layer and Internet layer?
1,362,601,005,000
It's fairly easy to understand EOL, mainline and stable kernel, but I'm not sure about longterm here, What does it mean, or how does it differ from stable kernel?
Check What does "stable/EOL" and "longterm" mean? @ https://www.kernel.org/category/faq.html
What does longterm mean on kernel.org?
1,362,601,005,000
In https://github.com/facebook/flashcache/ there is a saying make KERNEL_TREE=<root of the kernel source tree> This builds both the flashcache.ko and 3 utilities. flascache-sa-guide.txt has details on how to create and load flashcache volumes. Mohan Srinivasan Paul Saab What should I wrote to replace ?
CentOS Reference: Tutorial Link Quick quote from tutorial: Step 1: As normal user [user@host]$ mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} [user@host]$ echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros Step 2: As root [root@host]# yum install rpm-build redhat-rpm-config asciidoc hmaccalc [root@host]# yum install binutils-devel elfutils-libelf-devel newt-devel zlib-devel Step 3: As normal user [user@host]$ rpm -i http://vault.centos.org/6.3/updates/Source/SPackages/kernel-2.6.32-279.19.1.el6.src.rpm 2>&1 | grep -v mock kernel source tree: /home/user/rpmbuild/BUILD/kernel*/linux*/ <-- cd into it to confirm those '*'. So make KERNEL_TREE=<put in the full path above> Debian <root of the kernel source tree> is where the kernel source is. On Ubuntut/Debain, download kernel source apt-get install linux-source-3.2.0 That will put the kernel source tree in /usr/src/linux-source-3.2.0 However the actual source tree need to be de-compressed # cd /usr/src/linux-source-3.2.0 # ls -lh total 77M drwxr-xr-x 10 root root 4.0K Jan 24 22:40 debian drwxr-xr-x 8 root root 4.0K Jan 24 22:40 debian.master -rw-r--r-- 1 root root 77M Jan 8 17:46 linux-source-3.2.0.tar.bz2 # tar xf linux-source-3.2.0.tar.bz2 # ls -lh total 77M drwxr-xr-x 10 root root 4.0K Jan 24 22:40 debian drwxr-xr-x 8 root root 4.0K Jan 24 22:40 debian.master drwxrwxr-x 24 root root 4.0K Jan 8 17:45 linux-source-3.2.0 -rw-r--r-- 1 root root 77M Jan 8 17:46 linux-source-3.2.0.tar.bz2 The source tree is /usr/src/linux-source-3.2.0/linux-source-3.2.0 So make KERNEL_TREE=/usr/src/linux-source-3.2.0/linux-source-3.2.0
How to know <root of the kernel source tree>
1,362,601,005,000
This is hardly a theoretical question as many have done this, albeit there's very little information on the underlying processes. I'm developing a custom MIPS-based processor on which I would like to run Ubuntu. I'm quite baffled as to what to do next after you've designed the instruction set and the computer architecture itself. I need to be able to run a kernel and OS but how does it all tie in? At the moment I'm researching into designing a compiler for the Linux kernel to generate the appropriate assembly language. Is that a good way to go? What do I need to do after that?
On the architecture side, you need more than an instruction set and a computer architecture. You also need to have: A CPU in some form (emulator, FPGA, silicon…). A way of booting that processor: a way of getting the operating system into the memory that the processor runs at boot time. Most processors boot to code stored in ROM which either switches on some kind of flash memory and branches to it, or which loads some code from some storage media into RAM and branches to it. The next stage is an OS bootloader. Some peripherals — at a minimum, RAM, some kind of storage controller, and some input/output devices. On the software side, you will need: A compiler. Since you're using the MIPS architecture, any existing compiler targetting MIPS should be sufficient. If your instruction set extends the basic MIPS instruction set (e.g. with extra registers), you may need to extend the assembler accordingly. A kernel. Linux for MIPS already exists. You'll have to add support for what you customized in your architecture: boot, MMU, … Drivers. You'll need to write drivers for all the pieces of computer architecture that you didn't take off-the-shelf. A bootloader. There are usually things in the bootloader that are very architecture-specific, but you can probably add the requisite support to an existing bootloader, e.g. by adding a machine definition to U-Boot. And that's about all. Once you have a kernel and bootloader, userland programs should just work. Patch the kernel and bootloader from an existing distribution, cross-compile it on your PC, and install. Ubuntu doesn't support MIPS, but Debian does (mips or mipsel depending on endianness).
Running the linux kernel and Ubuntu on custom processor
1,362,601,005,000
I noticed, that the power consumption in my ASUS P53E notebook is doubled (from 10W to 20W) when I change from kernel 3.6.1 to 3.6.2 (or later). I use Ubuntu Quantal mainline kernel from kernel-ppa/mainline - Kernel Ubuntu on Mint 13 Maya (which is based on Ubuntu Precise 12.04). Please advise me, what additional information I should post, to help you answer. The power measurements agree with the significant difference in processor temperature (ca. 45 C on 10W and ca. 65 C on 20W), so it is not a glitch of the power meter.
I think there's a power utilization regression that was introduced in 3.6.x. If you can, stick with the older kernel. Supposedly, there's also an ext4 metadata block corruption bug in 3.6.2 as well, so it might be worth waiting.
Why kernel 3.6.2 is so much less energy efficient than 3.6.1 on Mint 13?
1,362,601,005,000
I have built the Linux kernel, but I wanted to do it without building the debug package. I know that it's possible to disable the flag CONFIG_DEBUG_INFO, via scripts/config (with either --set str "" or --disable). However, I'm confused, because when I invoke make deb-pkg, the flag is reset to the value y, so that the package is built. Why does this happen?
The behaviour changed slightly in 5.18, which may be why you’re seeing this. DEBUG_INFO is now a selection, so CONFIG_DEBUG_INFO is set based on other configuration settings. To disable DEBUG_INFO, you need to enable DEBUG_INFO_NONE and make sure all the other selections are disabled (DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT, DEBUG_INFO_DWARF4, DEBUG_INFO_DWARF5).
Why is the flag `CONFIG_DEBUG_INFO` reset when building the Linux kernel?
1,362,601,005,000
We know there are many files that are pseudo files, i.e. not a real file. ex: /sys/xxx /proc/xxx /dev/xxxx In my understanding, the open() will call x86 ASM code, the ASM code will do hardware interrupt to access to the disk. The problem is if the open() will eventually access to the disk, how pseudo file still get access by open()?
As Fox noted in their answer, the kernel handles the open() syscall, and meanwhile, filesystems implement file operations in their own way. Filesystems, on the other hand, implement their version of syscalls, and that's what kernel should be using. Consider, for instance, ext4 call to open directory or file operations in procfs (which notably has no .open mentioned anywhere), and pipefs which handles named and unnamed pipes. But the general idea is that the open() syscall is not going to be necessarily assembly, nor it is guaranteed to be specific to a particular architecture. And to quote an answer by the user Warren Young who noted that way before this question appeared, there is no single file where mkdir() exists. Linux supports many different file systems and each one has its own implementation of the "mkdir" operation. The abstraction layer that lets the kernel hide all that behind a single system call is called the VFS. So, you probably want to start digging in fs/namei.c, with vfs_mkdir(). The actual implementations of the low-level file system modifying code are elsewhere. For instance, the ext4 implementation is called ext4_mkdir(), defined in fs/ext4/namei.c. As for why open() works this way, this is also due to Unix design philosophy that everything is a file. If you're using an API, you want to deal with consistent interface and not reinvent the wheel for every filesystem in existence (unless a person is a kernel developer, in which case they have our gratitude and respect).
if some files are pseudo, why open() function still can access it?
1,362,601,005,000
I want to be able to intercept connection establishment, e.g. want to know when some process (any process) establishes a connection. Is there a way to achieve that? The only thing I can think of is to intercept connect() syscall. But may be there's an other way? May be when networking context is created in a kernel? The goal is to filter processes based on some requirements and enable/disable connection establishment in real-time. Thanks in advance. P.S. I'm doing that for absolutely legal purposes. P.P.S. I've searched in google but only found how to intercept the already established connection (not exactly what I want). I'm asking for an idea, a direction of search, not for a code.
For the aspect of just extracting information, it's possible to do that with iptables using AUDIT matches (or possibly LOG matches if you don't need huge amounts of info). For the case of actually allowing or disallowing connections in real-time based on some complex rules, I'm not sure you can do that on reliably on Linux. Options include: Seccomp-BPF, but I'm not certain it can do this (and the filter would be static once instantiated in a given process). Overriding various socket calls using LD_PRELOAD or some other method. This is unreliable because it's easy to bypass (making direct syscalls is trivial, and you can also dlopen() whatever libc and make calls that way). The net_cls control group. This requires firewall setup, may impact active connections, and may not work exactly as you want (it will require a daemon that moves processes into the appropriate control group as they are started). If you can tolerate some data getting onto the network, you can use the iptables NFLOG target and watch for interesting connections (if you want real-time evaluation, you'll need to log all new connections and parse things in userspace), and then reactively close the connections that you don't want. You can run each application in it's own network namespace and force outbound traffic through the host system, then use policy routing based on the source to control what gets out to the actual network. That said, you may want to reevaluate why you need this. Unless you're feeding your decision making from a neural network or some other heuristic approach (both of which are problematic options for multiple reasons), you're almost always going to be better off either coding things directly into the firewall (iptables can do some seriously complex stuff, like matching only connections using a specific IP protocol to a specific port initiated by a particular UID at a uniformly distributed random rate and sending the unmatched packets to a different destination), or using scheduling tools or other hooks to update firewall rules dynamically (for example, changing firewall rules when the system is supposed to be unused, or only allowing new connections originating from a given UID when that user is logged in).
Linux: intercepting connection establishment
1,362,601,005,000
we have kafka service ( as systemctl service ) and we configured in that service number of open files example: [Service] LimitMEMLOCK=infinity LimitNOFILE=1500000 Type=forking User=root Group=kafka now when service is up , we want to understand the consuming of number of files by kafka services from googled , I understand from - https://www.cyberciti.biz/faq/howto-linux-get-list-of-open-files/ that we can use the command fstat in order to capture the number of open files as fstat -p {PID} since we are using production RHEL 7.6 secured server , then its not clear if fstat can be installed on our server therefore we want to learn about other ideas? appreciate to get other approach other approach as suggest is by - ls "/proc/$pid/fd" but here is real example from my machine ls /proc/176909/fd |more 0 1 10 100 1000 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 1001 10010 10011 10012 . . . so we get a long list of numbers , so how to find the count of open files ?
The LimitNOFILE directive in systemd (see man systemd.exec) corresponds to the RLIMIT_NOFILE resource limit as set with setrlimit() (see man setrlimit). Can be set in some shells with ulimit -n or limit descriptors. This specifies a value one greater than the maximum file descriptor number that can be opened by this process. Attempts (open(2), pipe(2), dup(2), etc.) to exceed this limit yield the error EMFILE. (Historically, this limit was named RLIMIT_OFILE on BSD.) So it's not strictly speaking the limit of number of open file descriptors (let alone open files) in that a process with that limit could have more open files if it had fds above the limit prior to that limit being set (or inherited upon creation (clone() / fork())) and could not get a fd above the limit even if it had very few opened fds. On Linux, /proc/<pid>/fd is a special directory that contains one magic symlink file for each fd that the process has opened. You can get their number by counting them: () {print $#} /proc/$pid/fd/*(NoN) in zsh for instance (or ls "/proc/$pid/fd" | wc -l as already shown by Romeo). You can get the highest pid value by sorting them numerically in reverse and get the first. () {print $1} /proc/$pid/fd/*(NnOn:t) Or with GNU ls: ls -rv "/proc/$pid/fd" | head -n1 To get a report of number of open fds for all processes, you could do something like: (for p (/proc/<->) () {print -r $# $p:t $(<$p/comm) $p/exe(:P)} $p/fd/*(NoN)) | sort -n More portably, you could resort to lsof: lsof -ad0-2147483647 -Ff -p "$pid" | grep -c '^f' For the number of open file descriptors and: lsof -ad0-2147483647 -Ff -p "$pid" | sed -n '$s/^f//p' For the highest.
how to find the number of open files per process
1,362,601,005,000
My understanding is that fork is the system call that creates a new process by cloning the parent process. By what creates the parent process? If using a C library to create multiple processes, what was the system call to create the first process? For example when running ./main.o
The Kernel itself contains an internal call to execve() to create process 1 (init), which never exits. Init() is the root of the whole process tree. It starts off by forking processes for all the known services and other configured tasks, and for all the login devices.
What System call creates the parent process?
1,362,601,005,000
Simple, top level question (which, maddeningly has eluded my sorry level of Google-fu): Poking around in my (admittedly out of date) machine, I find the following file: /lib/modules/4.9.0-0.bpo.14-amd64/kernel/drivers/input/keyboard/max7359_keypad.ko How do I determine what type of keyboard is addressed by this driver? Looking for a source that provides info in a way such that same is accessible to a non-programmer.
There is no source of information for this which is guaranteed to be accessible to non-programmers. There are however tools you can use to determine the purpose of a given kernel module (which is what the file you’re looking at is); the first one is sudo modinfo max7359_keypad which will give you a short description of the module: MAX7359 Key Switch Controller Driver This doesn’t say much, but it does suggest that it’s not a driver supporting a specific keyboard model (or family). A web search will lead you to the manufacturer’s page on the MAX7359 which will tell you more, at least that it’s probably not relevant for most end-users.
Where to Find Linux Kernel Driver Documentation by Filename
1,362,601,005,000
Following these instructions, I downloaded and unpacked the kernel. https://priyachalakkal.wordpress.com/2013/01/19/verifying-digital-signature-using-gpg/ Then I tried to verify the signature but I get an unexpected error. That isn't one of the success or failure scenarios described by sites that document the basic approach. Is there a command line flag I need to provide to tell it where to look for the public key? ~# gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 79BE3E4300411886 gpg: /root/.gnupg/trustdb.gpg: trustdb created gpg: key 79BE3E4300411886: public key "Linus Torvalds <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1 ~# gpg --verify linux-5.6.9.tar.sign gpg: assuming signed data in 'linux-5.6.9.tar' gpg: Signature made Fri 01 May 2020 11:51:56 PM PDT gpg: using RSA key 647F28654894E3BD457199BE38DBBDC86092693E gpg: Can't check signature: No public key Update 1: Based on @StephenKitt's answer, I tried to grab the key indicated in the first message (in order to get it to find a user ID I had to specify the key server), but the result was not what was expected: ~# gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 647F28654894E3BD457199BE38DBBDC86092693E gpg: key 38DBBDC86092693E: public key "Greg Kroah-Hartman <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1 ~# gpg --verify linux-5.6.9.tar.sign gpg: assuming signed data in 'linux-5.6.9.tar' gpg: Signature made Fri 01 May 2020 11:51:56 PM PDT gpg: using RSA key 647F28654894E3BD457199BE38DBBDC86092693E gpg: Good signature from "Greg Kroah-Hartman <[email protected]>" [unknown] gpg: aka "Greg Kroah-Hartman <[email protected]>" [unknown] gpg: aka "Greg Kroah-Hartman (Linux kernel stable release signing key) <[email protected]>" [unknown] gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 647F 2865 4894 E3BD 4571 99BE 38DB BDC8 6092 693E Update 2: With some googling I was able to figure out what to do about the non-trusted signature warning (see comment/reply to Stephen in the respective answer) ~# gpg2 --tofu-policy good 647F28654894E3BD457199BE38DBBDC86092693E gpg: Setting TOFU trust policy for new binding <key: 647F28654894E3BD457199BE38DBBDC86092693E, user id: Greg Kroah-Hartman <[email protected]>> to good. gpg: Setting TOFU trust policy for new binding <key: 647F28654894E3BD457199BE38DBBDC86092693E, user id: Greg Kroah-Hartman <[email protected]>> to good. gpg: Setting TOFU trust policy for new binding <key: 647F28654894E3BD457199BE38DBBDC86092693E, user id: Greg Kroah-Hartman (Linux kernel stable release signing key) <[email protected]>> to good. ~# gpg2 --trust-model tofu --verify linux-5.6.9.tar.sign gpg: assuming signed data in 'linux-5.6.9.tar' gpg: Signature made Fri 01 May 2020 11:51:56 PM PDT gpg: using RSA key 647F28654894E3BD457199BE38DBBDC86092693E gpg: Good signature from "Greg Kroah-Hartman <[email protected]>" [full] gpg: aka "Greg Kroah-Hartman <[email protected]>" [full] gpg: aka "Greg Kroah-Hartman (Linux kernel stable release signing key) <[email protected]>" [full] gpg: [email protected]: Verified 1 signatures in the past 0 seconds. Encrypted 0 messages. gpg: [email protected]: Verified 1 signatures in the past 0 seconds. Encrypted 0 messages. gpg: [email protected]: Verified 1 signatures in the past 0 seconds. Encrypted 0 messages.
You don’t have the right key; the 5.6.9 archive is signed by Greg Kroah-Hartman, not Linus. Running gpg --recv-keys 647F28654894E3BD457199BE38DBBDC86092693E will allow you to verify the archive. (This is the fingerprint from your second gpg invocation.) The message you get after retrieving the key indicates two things: the archive’s signature is good (“Good signature from” ...); but you have no proof that the key you downloaded really is Greg’s. Basically, this means that you can trust the archive, as long as you trust the key. GPG maintains a trust database, which tracks links from your key to others; most people (including you) don’t have any. This is based on the web of trust, and is considered impractical as a general-purpose tool; in most cases, “trust on first use” (TOFU) is simpler and just as useful. You can change the trust model with the --trust-model option; see the GnuPG manual for details (and discussion).
Trouble verifying linux, even after downloading key I get "No public key"
1,362,601,005,000
Recently I've found that many processes/demons like to issue unneeded fsync() syscalls, increasing a little bit their stability, on the price of hugely decreasing the general performance of the whole system. I want to stop this non-cooperative behavior. However, first I need to somehow find them. I think, the most ideal thing would be, if I could somehow set-up a "monitor" for a specific type of system calls, and log the data of the process which called it. In my case, if any process does an fsync() syscall, I want to know it. Most ideally, it should be a syslog entry, or in the dmesg. I've read a little bit about auditd, but I am not sure, if it even could do that.
Supposing a recent distribution is being used, the bpftrace does come handy. For it, in Debian 10, there is a need to install it: apt install bpftrace Then using synsnoop.bt, to listen system-wide to *sync related syscalls: # syncsnoop.bt Attaching 7 probes... Tracing sync syscalls... Hit Ctrl-C to end. TIME PID COMM EVENT 03:15:35 443 dhclient tracepoint:syscalls:sys_enter_fsync ^C This tool works by tracing sync(2) variants via tracepoints: sync(2), syncfs(2), fsync(2), fdatasync(2), sync_file_range(2), and msync(2). The overhead of this tool is expected to be negligible, as the rate of sync(2) is typically very infrequent. Or using bpftrace scripting language: # ./sync.bt Attaching 7 probes... Tracing sync syscalls... Hit Ctrl-C to end. TIME PID COMM EVENT 08:09:53 443 dhclient tracepoint:syscalls:sys_enter_fsync ^C sync.bt source for logging all sync related system calls: #!/usr/bin/bpftrace BEGIN { printf("Tracing sync syscalls... Hit Ctrl-C to end.\n"); printf("%-9s %-6s %-16s %s\n", "TIME", "PID", "COMM", "EVENT"); } tracepoint:syscalls:sys_enter_sync, tracepoint:syscalls:sys_enter_syncfs, tracepoint:syscalls:sys_enter_fsync, tracepoint:syscalls:sys_enter_fdatasync, tracepoint:syscalls:sys_enter_sync_file_range, tracepoint:syscalls:sys_enter_msync { time("%H:%M:%S "); printf("%-6d %-16s %s\n", pid, comm, probe); } PS from pages 293 and 294 of Brendan Gregg's BPF Performance Tools
How to log, which processes did specific syscalls?
1,362,601,005,000
I'm using a docker image and trying to see which packages are installed. Specifically which kernel packages. Doing this command I get the following kernel packages rpm -qa kernel* kernel-devel-2.6.32-754.6.3.el6.i686 kernel-headers-2.6.32-754.17.1.el6.centos.plus.i686 but it's missing... how do I find verify that specific kernel is running. kernel-2.6.32-754.3.5.el6.i686.rpm From what I read the docker image uses the native OS kernel to execute commands. But I'm attempting to confirm that this is the kernel-2.6.32-754.3.5.el6.i686.rpm. the documentation states is running. thanks
A docker image doesn't have a Kernel, It uses the Kernel from the host machine that you are running Docker on. You can run this command inside your Docker container and from your CentOS host, It will show up the same result uname -sr There is a similar question on Super User Ps:// By the way, you should upgrade your CentOS host to kernel 3.10+ as recommended here
finding kernel version in the docker image
1,362,601,005,000
I read that Linux has an O(1) scheduler, but this does not tell me actually how long a context switch roughly takes. Does someone have some current numbers? I know it depends on a lot of factors like CPU type, frequency, DRAM connectivity, caches and what not, but I would be happy to know the order of magnitude in milli, micro, nano seconds or the rough number of processor cycles needed to preempt one process, decide for the next process to run and actually get it going.
The default scheduler on Linux hasn’t been the O(1) scheduler for the last ten years, it’s the Completely Fair Scheduler, which is O(log n) on the number of tasks in the runqueue. You’d have to benchmark specific scenarios you’re interested in, on your specific systems and workloads; one can find benchmarks on the Internet, with figures typically on the order of 0.5-2 µs per context switch, even when switching to tasks not previously scheduled on the CPU. As you mention, the overhead will vary a lot depending on circumstances, including code and data presence in the various caches. Nowadays the overhead also varies depending on the kernel version and configuration, in particular depending on what security countermeasures are active and how well they’re supported by the CPU. A recent paper gives relative figures for the latter, with variations from –14% to +98% compared to a 4.0 baseline.
Linux scheduling overhead in orders of magnitude?
1,362,601,005,000
When reading this Kubernetes blog post about Intel's CPU manager it mentions that you can avoid cross-socket traffic by having CPUs allocated on the socket near to the bus which connects to an external device. What does cross-socket traffic mean and what problems can it cause? These are my guesses: A CPU from one socket needs access to a device connected to a bus that is only accessible to CPUs in another socket, so instructions to that device must be written to memory to be executed by a CPU in this other socket A CPU from one socket needs access to a device connected to a bus that is only accessible to CPUs in another socket, so instructions to that device are sent directly to a CPU in this other socket to be forwarded to the device (not sure if this is even possible)
The authors of the Kubernetes blog post just speak gibberish trying to reinvent the wheel - one more PBS (portable batch system), which they call "CPU manager". Answering question: "What does cross-socket traffic mean and what problems can it cause?" - it's necessary to say first, that this is about Multiprocessor Computers, i.e. computer systems with two or more CPUs and CPU sockets respectively. Multiprocessor systems are available in two different architectures: SMP (symmetric multiprocessing) and AMP (asymmetric multiprocessing). Most of multiprocessor systems available at the moment are SMP architecture systems. Such the systems have so called shared memory which is visible to indepentent physical CPUs as common main memory. There are two types of such the systems according to type of physical CPUs interconnection: system bus and crossbar switch. Diagram of SMP system with crossbar switch: Diagram of SMP system with system bus: Mostly SMP systems have system bus type CPUs connection and the Kubernets blog post is about systems of such the kind. SMP systems with system bus CPUs connection have both advantages and disadvantages. The most significant disadvantage of this systems is that they're NUMA (non-uniform memory access) systems. What does it mean. Every CPU socket physically associates its own memory bank, but Linux kernel can't distiungish this assosiation in SMP - the memory banks are seen to Linux as single integral memory. But despite this fact, NUMA phenomenon arises - interoperation of a physical CPU with addresses of its own physical memory bank isn't same fast as with memory bank(-s) assosiated with another CPU socket(-s). Thus, we wish naturally to avoid using by a physical CPU such addresses in the common main memory of SMP which belong to physical memory bank connected to another physical CPU. The part "Limitations" of the Kubernates blog post refers to NUMA phenomenon as to "cross-socket traffic" problem (citation): Users might want to get CPUs allocated on the socket near to the bus which connects to an external device, such as an accelerator or high-performance network card, in order to avoid cross-socket traffic. This type of alignment is not yet supported by CPU manager. By the way, the disability to assign a thread to some definite CPU which "is closer" to something is quite natural. Linux kernel sees all of CPU cores of physical CPUs as equal ordinary SMP processors since it can't distinguish physical CPUs of SMP computer. There're some poor attempts to avoid using CPU cores which are "farther" using "warm cache" and "cold cache" signs, but it doesn't work effectively due to nature of SMP systems. Please, read additionally: NUMA (Non-Uniform Memory Access): An Overview Managing Process Affinity in Linux
What does cross-socket traffic mean?
1,362,601,005,000
I found a lot of instructions, how to install the latest rc kernel on Ubuntu, for example here, but none how to install it on debian jessie. How can I install the latest rc-kernel on debian (currently 4.16)? Or can I just install the Ubuntu kernel on a debian system?
You’ll usually find pre-built release candidates in experimental (as of this writing, 4.16rc6 is waiting in the upload queue). To install these: Add experimental to your repositories: echo deb http://deb.debian.org/debian experimental main > /etc/apt/sources.list.d/experimental.list (this is safe as-is, without any special pinning, because experimental is not a default candidate for package upgrades or installations; since the kernel packages don’t have many external dependencies this will work without a reference to unstable). Update: apt update Install the appropriate packages; as of this writing: apt install -t experimental linux-image-4.16.0-rc5-amd64 (along with the headers if necessary). Experimental packages aren’t automatically upgraded, so you’ll need to keep an eye on new package uploads; you can do this quite easily by subscribing to the linux package. It’s also quite easy to build your own kernel; as described in the Debian kernel handbook: Download and extract the kernel source code (or clone the repository). Configure the kernel (in most cases, you should start from the configuration of the running kernel to make this simpler). Build the kernel using make deb-pkg and install the resulting kernel package.
Install the latest rc kernel on debian
1,362,601,005,000
The following Kernel Panic occurred on my embedded board. I am using 3.10 Kernel. I am analyzing the cause of the Kernel Panic. The Kernel Panic message shows the PID(735). Feb 22 19:40:28 TEST kenel: CPU: 0 `PID: 735` Comm: cat Not tainted 3.10.73 #2 Feb 22 19:40:28 TEST kernel: Process cat `(pid: 735`, stack limit = 0xee46c238) Does the PID mean the killer of the Kernel Panic? Below is my entire Kernel Panic message. Kernel Panic seems to be a really hard friend.... :( Feb 22 19:40:28 TEST kernel: Unable to handle kernel NULL pointer dereference at virtual address 0000000c Feb 22 19:40:28 TEST kernel: pgd = c0004000 Feb 22 19:40:28 TEST kernel: [0000000c] *pgd=00000000 Feb 22 19:40:28 TEST kernel: Internal error: Oops: 17 [#1] PREEMPT SMP ARM Feb 22 19:40:28 TEST kernel: Modules linked in: m2i_trn g_m2i libcomposite iptable_filter ip_tables smsc95xx usbnet mousedev rh_special_switches pn5xx_i2c mram tsc2007 spicc buzzer cover backlight device_info [last unloaded: spi_fieldbus] Feb 22 19:40:28 TEST kernel: CPU: 0 PID: 735 Comm: cat Not tainted 3.10.73 #2 Feb 22 19:40:28 TEST kernel: task: ee404000 ti: ee46c000 task.ti: ee46c000 Feb 22 19:40:28 TEST kernel: PC is at set_page_dirty+0x20/0x68 Feb 22 19:40:28 TEST kernel: LR is at set_page_dirty+0xc/0x68 Feb 22 19:40:28 TEST kernel: pc : [<c00a3c50>] lr : [<c00a3c3c>] psr: a0000013 Feb 22 19:40:28 TEST kernel: sp : ee46de48 ip : 0002f9f9 fp : b6ffa000 Feb 22 19:40:28 TEST kernel: r10: ee46dee0 r9 : ee46de84 r8 : b6ffc000 Feb 22 19:40:28 TEST kernel: r7 : c0fd3860 r6 : 00000000 r5 : c0fd3860 r4 : ee3d87ec Feb 22 19:40:28 TEST kernel: r3 : 00000000 r2 : 40080068 r1 : c0fd3860 r0 : 00000012 Feb 22 19:40:28 TEST kernel: Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Feb 22 19:40:28 TEST kernel: Control: 10c5387d Table: 2eb3c04a DAC: 00000015 Feb 22 19:40:28 TEST kernel: Feb 22 19:40:28 TEST kernel: PC: 0xc00a3bd0: Feb 22 19:40:28 TEST kernel: 3bd0 e2505000 1a000001 e1a00005 e8bd8038 e375001c e2841048 03a0001a 13a00019 Feb 22 19:40:28 TEST kernel: 3bf0 eb0456e6 eafffff7 e92d4010 e1a04000 eb002f48 e590304c e5933010 e3130c02 Feb 22 19:40:28 TEST kernel: 3c10 08bd8010 e5943000 e3130a02 08bd8010 e1a00004 e3a0100d e8bd4010 eaffdee6 Feb 22 19:40:28 TEST kernel: 3c30 e92d4038 e1a05000 eb002f3a e3500000 0a00000a e5903044 e1a01005 e3a00012 Feb 22 19:40:28 TEST kernel: 3c50 e593400c eb044d0a e59f3034 e1a00005 e3540000 01a04003 e12fff34 e8bd8038 Feb 22 19:40:28 TEST kernel: 3c70 e5953000 e3130010 18bd8038 e1a01005 e3a00004 eb045711 e2700001 33a00000 Feb 22 19:40:28 TEST kernel: 3c90 e8bd8038 c00fd924 e92d4030 e1a04000 e24dd00c eb002f1f e5943000 e1a05000 Feb 22 19:40:28 TEST kernel: 3cb0 e3130001 0a00002b e3500000 0a000003 e590304c e5933010 e3130001 0a000004 Feb 22 19:40:28 TEST kernel: Feb 22 19:40:28 TEST kernel: LR: 0xc00a3bbc: Feb 22 19:40:28 TEST kernel: 3bbc e92d4038 e1a04002 e5923044 e5933000 e12fff33 e2505000 1a000001 e1a00005 Feb 22 19:40:28 TEST kernel: 3bdc e8bd8038 e375001c e2841048 03a0001a 13a00019 eb0456e6 eafffff7 e92d4010 Feb 22 19:40:28 TEST kernel: 3bfc e1a04000 eb002f48 e590304c e5933010 e3130c02 08bd8010 e5943000 e3130a02 Feb 22 19:40:28 TEST kernel: 3c1c 08bd8010 e1a00004 e3a0100d e8bd4010 eaffdee6 e92d4038 e1a05000 eb002f3a Feb 22 19:40:28 TEST kernel: 3c3c e3500000 0a00000a e5903044 e1a01005 e3a00012 e593400c eb044d0a e59f3034 Feb 22 19:40:28 TEST kernel: 3c5c e1a00005 e3540000 01a04003 e12fff34 e8bd8038 e5953000 e3130010 18bd8038 Feb 22 19:40:28 TEST kernel: 3c7c e1a01005 e3a00004 eb045711 e2700001 33a00000 e8bd8038 c00fd924 e92d4030 Feb 22 19:40:28 TEST kernel: 3c9c e1a04000 e24dd00c eb002f1f e5943000 e1a05000 e3130001 0a00002b e3500000 Feb 22 19:40:28 TEST kernel: Feb 22 19:40:28 TEST kernel: SP: 0xee46ddc8: Feb 22 19:40:28 TEST kernel: ddc8 000000a8 0000006d b6f6a000 c105ace0 00000000 ffffffff 0000006d c06c8f40 Feb 22 19:40:28 TEST kernel: dde8 c00a3c50 a0000013 ffffffff ee46de34 b6ffc000 c000dd98 00000012 c0fd3860 Feb 22 19:40:28 TEST kernel: de08 40080068 00000000 ee3d87ec c0fd3860 00000000 c0fd3860 b6ffc000 ee46de84 Feb 22 19:40:28 TEST kernel: de28 ee46dee0 b6ffa000 0002f9f9 ee46de48 c00a3c3c c00a3c50 a0000013 ffffffff Feb 22 19:40:28 TEST kernel: de48 326c375f ee3d87ec ee3d87e8 c00b8db0 ee46de58 ee785c00 c0f51b1c edef6f60 Feb 22 19:40:28 TEST kernel: de68 ee93edb8 326c375f ee46c000 ee93edb8 b6ffc000 b6ffbfff 60000013 00000000 Feb 22 19:40:28 TEST kernel: de88 fffffffe 00000000 ee46c000 edef6f60 ffffffff ee46dee0 00000000 00000000 Feb 22 19:40:28 TEST kernel: dea8 ee46c000 ee785c40 00000000 c00b98c0 00000000 ee46c000 edef6c60 ee46df08 Feb 22 19:40:28 TEST kernel: Feb 22 19:40:28 TEST kernel: R1: 0xc0fd37e0: Feb 22 19:40:28 TEST kernel: 37e0 40080068 ee913501 000010ea 00000000 00000001 c0fd37d4 c0fd3a34 00000000 Feb 22 19:40:28 TEST kernel: 3800 40080068 ee913501 000010e2 00000000 00000001 c0f94cf4 c0fd3754 00000000 Feb 22 19:40:28 TEST kernel: 3820 40080068 ee913501 000010da 00000000 00000001 c0fd3694 c0fd3734 00000000 Feb 22 19:40:28 TEST kernel: 3840 4002002c ef074d64 00000038 ffffffff 00000001 c0f92af4 c0f8ed94 00000000 Feb 22 19:40:28 TEST kernel: 3860 40080068 ee97a400 000b6ffa 00000000 00000001 c0fbbeb4 c0f91674 00000000 Feb 22 19:40:28 TEST kernel: 3880 4002002c ef074d64 00000033 ffffffff 00000001 c0fa6034 c0f94574 00000000 Feb 22 19:40:28 TEST kernel: 38a0 40000000 00000000 00000002 ffffffff 00000000 c0fc8a14 c0f91514 00000000 Feb 22 19:40:28 TEST kernel: 38c0 40080068 ee913501 00001146 00000000 00000001 c0fd8d54 c0f92d34 00000000 Feb 22 19:40:28 TEST kernel: Feb 22 19:40:28 TEST kernel: R4: 0xee3d876c: Feb 22 19:40:28 TEST kernel: 876c 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Feb 22 19:40:28 TEST kernel: 878c 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Feb 22 19:40:28 TEST kernel: 87ac 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Feb 22 19:40:28 TEST kernel: 87cc 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Feb 22 19:40:28 TEST kernel: 87ec 305b375f 00000000 31af57df 305d375f 00000000 00000000 00000000 00000000 Feb 22 19:40:28 TEST kernel: 880c 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Feb 22 19:40:28 TEST kernel: 882c 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Feb 22 19:40:28 TEST kernel: 884c 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Feb 22 19:40:28 TEST kernel: Feb 22 19:40:28 TEST kernel: R5: 0xc0fd37e0: Feb 22 19:40:28 TEST kernel: 37e0 40080068 ee913501 000010ea 00000000 00000001 c0fd37d4 c0fd3a34 00000000 Feb 22 19:40:28 TEST kernel: 3800 40080068 ee913501 000010e2 00000000 00000001 c0f94cf4 c0fd3754 00000000 Feb 22 19:40:28 TEST kernel: 3820 40080068 ee913501 000010da 00000000 00000001 c0fd3694 c0fd3734 00000000 Feb 22 19:40:28 TEST kernel: 3840 4002002c ef074d64 00000038 ffffffff 00000001 c0f92af4 c0f8ed94 00000000 Feb 22 19:40:28 TEST kernel: 3860 40080068 ee97a400 000b6ffa 00000000 00000001 c0fbbeb4 c0f91674 00000000 Feb 22 19:40:28 TEST kernel: 3880 4002002c ef074d64 00000033 ffffffff 00000001 c0fa6034 c0f94574 00000000 Feb 22 19:40:28 TEST kernel: 38a0 40000000 00000000 00000002 ffffffff 00000000 c0fc8a14 c0f91514 00000000 Feb 22 19:40:28 TEST kernel: 38c0 40080068 ee913501 00001146 00000000 00000001 c0fd8d54 c0f92d34 00000000 Feb 22 19:40:28 TEST kernel: Feb 22 19:40:28 TEST kernel: R7: 0xc0fd37e0: Feb 22 19:40:28 TEST kernel: 37e0 40080068 ee913501 000010ea 00000000 00000001 c0fd37d4 c0fd3a34 00000000 Feb 22 19:40:28 TEST kernel: 3800 40080068 ee913501 000010e2 00000000 00000001 c0f94cf4 c0fd3754 00000000 Feb 22 19:40:28 TEST kernel: 3820 40080068 ee913501 000010da 00000000 00000001 c0fd3694 c0fd3734 00000000 Feb 22 19:40:28 TEST kernel: 3840 4002002c ef074d64 00000038 ffffffff 00000001 c0f92af4 c0f8ed94 00000000 Feb 22 19:40:28 TEST kernel: 3860 40080068 ee97a400 000b6ffa 00000000 00000001 c0fbbeb4 c0f91674 00000000 Feb 22 19:40:28 TEST kernel: 3880 4002002c ef074d64 00000033 ffffffff 00000001 c0fa6034 c0f94574 00000000 Feb 22 19:40:28 TEST kernel: 38a0 40000000 00000000 00000002 ffffffff 00000000 c0fc8a14 c0f91514 00000000 Feb 22 19:40:28 TEST kernel: 38c0 40080068 ee913501 00001146 00000000 00000001 c0fd8d54 c0f92d34 00000000 Feb 22 19:40:28 TEST kernel: Feb 22 19:40:28 TEST kernel: R9: 0xee46de04: Feb 22 19:40:28 TEST kernel: de04 c0fd3860 40080068 00000000 ee3d87ec c0fd3860 00000000 c0fd3860 b6ffc000 Feb 22 19:40:28 TEST kernel: de24 ee46de84 ee46dee0 b6ffa000 0002f9f9 ee46de48 c00a3c3c c00a3c50 a0000013 Feb 22 19:40:28 TEST kernel: de44 ffffffff 326c375f ee3d87ec ee3d87e8 c00b8db0 ee46de58 ee785c00 c0f51b1c Feb 22 19:40:28 TEST kernel: de64 edef6f60 ee93edb8 326c375f ee46c000 ee93edb8 b6ffc000 b6ffbfff 60000013 Feb 22 19:40:28 TEST kernel: de84 00000000 fffffffe 00000000 ee46c000 edef6f60 ffffffff ee46dee0 00000000 Feb 22 19:40:28 TEST kernel: dea4 00000000 ee46c000 ee785c40 00000000 c00b98c0 00000000 ee46c000 edef6c60 Feb 22 19:40:28 TEST kernel: dec4 ee46df08 ee785c00 ee785c00 ee46c000 c00bf4ec c0f696e0 0025ceb0 ee785c00 Feb 22 19:40:28 TEST kernel: dee4 00000001 00000000 00000000 ffffffff c045ec74 00000000 00000072 00000400 Feb 22 19:40:28 TEST kernel: Feb 22 19:40:28 TEST kernel: R10: 0xee46de60: Feb 22 19:40:28 TEST kernel: de60 c0f51b1c edef6f60 ee93edb8 326c375f ee46c000 ee93edb8 b6ffc000 b6ffbfff Feb 22 19:40:28 TEST kernel: de80 60000013 00000000 fffffffe 00000000 ee46c000 edef6f60 ffffffff ee46dee0 Feb 22 19:40:28 TEST kernel: dea0 00000000 00000000 ee46c000 ee785c40 00000000 c00b98c0 00000000 ee46c000 Feb 22 19:40:28 TEST kernel: dec0 edef6c60 ee46df08 ee785c00 ee785c00 ee46c000 c00bf4ec c0f696e0 0025ceb0 Feb 22 19:40:28 TEST kernel: dee0 ee785c00 00000001 00000000 00000000 ffffffff c045ec74 00000000 00000072 Feb 22 19:40:28 TEST kernel: df00 00000400 ee912000 00000000 c045ec74 00000000 c045e9dc 00000001 c045e7f8 Feb 22 19:40:28 TEST kernel: df20 00000000 c045ec74 ee785c30 ee785c00 00000000 ee404000 ee785c00 c0029360 Feb 22 19:40:28 TEST kernel: df40 ee4042fc c00302a0 00000020 00000001 c0680eb4 00000000 00060006 c004fa88 Feb 22 19:40:28 TEST kernel: Process cat (pid: 735, stack limit = 0xee46c238) Feb 22 19:40:28 TEST kernel: Stack: (0xee46de48 to 0xee46e000) Feb 22 19:40:28 TEST kernel: de40: 326c375f ee3d87ec ee3d87e8 c00b8db0 ee46de58 ee785c00 Feb 22 19:40:28 TEST kernel: de60: c0f51b1c edef6f60 ee93edb8 326c375f ee46c000 ee93edb8 b6ffc000 b6ffbfff Feb 22 19:40:28 TEST kernel: de80: 60000013 00000000 fffffffe 00000000 ee46c000 edef6f60 ffffffff ee46dee0 Feb 22 19:40:28 TEST kernel: dea0: 00000000 00000000 ee46c000 ee785c40 00000000 c00b98c0 00000000 ee46c000 Feb 22 19:40:28 TEST kernel: dec0: edef6c60 ee46df08 ee785c00 ee785c00 ee46c000 c00bf4ec c0f696e0 0025ceb0 Feb 22 19:40:28 TEST kernel: dee0: ee785c00 00000001 00000000 00000000 ffffffff c045ec74 00000000 00000072 Feb 22 19:40:28 TEST kernel: df00: 00000400 ee912000 00000000 c045ec74 00000000 c045e9dc 00000001 c045e7f8 Feb 22 19:40:28 TEST kernel: df20: 00000000 c045ec74 ee785c30 ee785c00 00000000 ee404000 ee785c00 c0029360 Feb 22 19:40:28 TEST kernel: df40: ee4042fc c00302a0 00000020 00000001 c0680eb4 00000000 00060006 c004fa88 Feb 22 19:40:28 TEST kernel: df60: c0680eb4 ef391d40 00000000 ee46c000 000000f8 c000e3e8 ee46c000 00000000 Feb 22 19:40:28 TEST kernel: df80: 00000000 c0030a20 00000000 000700de b6fd9760 b6fd9760 000000f8 c0030aa4 Feb 22 19:40:28 TEST kernel: dfa0: 00000000 c000e240 000700de b6fd9760 00000000 000700ca b6ff84c0 00000000 Feb 22 19:40:28 TEST kernel: dfc0: 000700de b6fd9760 b6fd9760 000000f8 00000002 00000000 00010000 00000000 Feb 22 19:40:28 TEST kernel: dfe0: 000000f8 be8b5474 b6f6afc3 b6f14276 60000030 00000000 00000000 00000000 Feb 22 19:40:28 TEST kernel: [<c00a3c50>] (set_page_dirty+0x20/0x68) from [<c00b8db0>] (unmap_single_vma+0x4d0/0x63c) Feb 22 19:40:28 TEST kernel: [<c00b8db0>] (unmap_single_vma+0x4d0/0x63c) from [<c00b98c0>] (unmap_vmas+0x54/0x68) Feb 22 19:40:28 TEST kernel: [<c00b98c0>] (unmap_vmas+0x54/0x68) from [<c00bf4ec>] (exit_mmap+0xd8/0x1f8) Feb 22 19:40:28 TEST kernel: [<c00bf4ec>] (exit_mmap+0xd8/0x1f8) from [<c0029360>] (mmput+0x48/0xf4) Feb 22 19:40:28 TEST kernel: [<c0029360>] (mmput+0x48/0xf4) from [<c00302a0>] (do_exit+0x244/0x878) Feb 22 19:40:28 TEST kernel: [<c00302a0>] (do_exit+0x244/0x878) from [<c0030a20>] (do_group_exit+0x3c/0xb0) Feb 22 19:40:28 TEST kernel: [<c0030a20>] (do_group_exit+0x3c/0xb0) from [<c0030aa4>] (__wake_up_parent+0x0/0x18) Feb 22 19:40:28 TEST kernel: Code: 0a00000a e5903044 e1a01005 e3a00012 (e593400c) Feb 22 19:40:28 TEST kernel: ---[ end trace 28aa0afec355b4f9 ]--- Feb 22 19:40:28 TEST kernel: Fixing recursive fault but reboot is needed!
The cat program was running with a PID of 735 when the panic occurred, i.e. the fault happened in the context of the process with PID 735. This does not mean that the cat program did something wrong. The fault is in the kernel, a panic is something that should not happen under any circumstances (unless you really try with root privileges). The bug causing the panic can be in a device driver that is invoked when the cat program reads or writes from/to some device. Or it could be caused by a totally unrelated interrupt; all interrupt handlers are run in the context of the currently running process, even if they don't serve the process in any way. As you have noticed, debugging a kernel panic is not an easy task.
Is the [PID] of Kernel Panic the killer of Kernel Panic?
1,362,601,005,000
I installed and set up ccache and built the kernel with it. Here are the stats: cache directory /home/marcin/.ccache cache hit (direct) 1 cache hit (preprocessed) 0 cache miss 15878 called for link 31 called for preprocessing 2655 unsupported source language 102 no input file 4733 files in cache 35882 cache size 2.7 Gbytes max cache size 3.0 Gbytes Why is ccache so inefficient for me? Why do I get so many misses?
ccache will only reduce compilation time if you compile the same code several times; it's perfectly normal to see (nearly) only cache misses when compiling a project once, because the code being compiled hasn't been cached.
Ccache hits only once during kernel build
1,362,601,005,000
How can I get the number of threads in the kernel at specific sampling rate? I need to measure the utilization of the system directly by myself.
ps -eL|wc -l gives total number of lwp/thread count at any point of time
Number of Threads in Kernel
1,389,107,558,000
What does it mean for a core to run at different loads in different moments? How does a 10% load differ from a 90% load? How is this number calculated, essentially?
It should be pretty obvious: time spent executing a task / total time. So over a given interval, 10% load means 10% of that time was spent executing tasks, and 90% was idle.
Linux and CPU usage
1,389,107,558,000
I was reading The Design Of UNIX OS and had a doubt. A signal handling function can be specified in the signal() call. The handler is supposed to execute when the process receives that particular signal. An algorithm known as psig runs to handle signals if they are received by a process. In case of a user defined handler being specified, the psig algorithm modifies the user level context (i.e. pushes a frame at the top of the stack with the stack pointer pointing to the top of the stack) This frame indicates the execution of the handling function. If the above mentioned is true, the signal handling function should always be executed after a return from the signal() call (as the stack frame at the top of the stack will be seen by the kernel first). However, this is not true as i can specify a signal handler for a particular signal earlier in my code (lets say in main()) and send a signal at a later point of time in code. The signal handling function is only executed when the signal is sent (say by the kill() call) and not immediately after the signal() call. Can anyone please clarify?
I assume by "The Design Of UNIX OS" you actually mean "The Design of the UNIX Operating System" by Maurice J. Bach. My best guess at what you're running into — and guess I must, since you have given no page or section references — is section 7.2.1, spanning pages 203 to 204. He starts the section with two paragraphs describing how to set up a signal handler, then the third starts describing what the kernel does when it receives the signal your program asked it to trap. The mere fact that one paragraph follows another doesn't tell you that the things described therein happen immediately after each other in time. A book's prose is not a computer algorithm. Bach is simply describing two separate things, without explicitly telling you that other things may happen in between. So the answer is no, psig() does not run immediately after a signal(2) call completes. Bach didn't say it did. You just assumed that.
signal handling in the unix kernel
1,389,107,558,000
I need to disable some parts in ACPI, but it is simply not present in kernel 2.6.38.8 (downloaded as a tar from net)? I can see the option in kernel 2.6.34-12 (default on OpenSuse 11.3), but not in the other one. What's the point that I am missing? P.S. Screen shots are from kernel 2.6.38.8.
The ACPI block depends on PCI being enabled. Symbol: ACPI [=y] ... Depends on: !IA64_HP_SIM && (IA64 || X86 [=y]) && PCI [=y] If you disabled PCI (or didn't enable it), or selected a different architecture, you won't see any options related to ACPI.
ACPI (Advanced Configuration And Power Configuration) not present on 2.6.38.8?
1,389,107,558,000
Is there a major Linux distribution that uses 3.2.x kernel?
Yes! Backtrack 5 R2 uses 3.2.6 kernel.
linux with 3.2.x kernel [closed]
1,389,107,558,000
CentOS is "derived entirely from the Red Hat Enterprise Linux (RHEL) distribution" (more here). Does it fall into any UNIX System V family? Such as PDP-11 or etc? If not, where does CentOS stands for comparing with System V family for zero downtime or performance etc?
CentOS is a Linux variant, and therefore shares no code with AT&T Unix System V. The Linux kernel does support many System V system calls, and as such, a lot of software written for System V was able to be ported over fairly easily. These days, I'd wager that a lot more software is written first for Linux, and then maybe ported to a modern System V derivative like Solaris. Linux also supports a lot of BSD system calls, by the way. As Unix and Unix-like operating systems go, Linux is the most ecumenical in terms of facilities it supports. So, Linux is System V if you squint. It is also BSD, and it is also neither. Linux is Linux.
Does CentOS fall into System V family? How is it considered to be while comparing with Unix System V family?
1,389,107,558,000
I'm comparing two different kernel versions (one official, one from a manufacturer); there are thousands of file whose only difference is in metadata in the files. The metadata looks like '$:Key: value$'. Is there a set of tools that modify this stuff? What generates this data? Is there any way to do a diff without this polluting it without running the entire source through sed? An example: --- ./drivers/atm/idt77252.h 2010-10-05 14:53:01.787778390 -0400 +++ ../linux-2.6.21.x/drivers/atm/idt77252.h 2010-03-26 03:08:26.000000000 -0400 @@ -1,8 +1,8 @@ /******************************************************************* - * ident "$Id: idt77252.h,v 1.2 2001/11/11 08:13:54 ecd Exp $" + * ident "$Id: idt77252.h,v 1.1.1.1 2007-05-25 06:50:05 bruce Exp $" * - * $Author: ecd $ - * $Date: 2001/11/11 08:13:54 $ + * $Author: bruce $ + * $Date: 2007-05-25 06:50:05 $ * * Copyright (c) 2000 ATecoM GmbH *
As Tante says, those $Word: ...$ are inserted and updated by some version control systems (CVS and SubVersion, tipically). GNU diff has an option --ignore-lines-matching-re that can exclude lines that match a certain regular expression. This one should do the trick: diff -wu --ignore-matching-lines='\$[A-Z][a-z]*:.*\$' -r sourceA/ sourceB/ (Note the \ before $ to prevent it being interpreted as an end-of-line marker in the regexp.)
What's up with the metadata in the source? Are there tools for it?
1,389,107,558,000
I am writing my own OS loader (Boot Loader) in UEFI. The OS Loader is Microsoft Signed so it can run under secure-boot. The OS Loader will be able to load Windows or Linux Kernel based on User's Selection (Something similar to GRUB) Since I have built Linux Kernel as EFI Stub, I can load it from my OS Loader. However, I have a specific requirement. I will be self-signing the Linux Kernel. How do I establish chain of trust to make sure that I am loading my own self-signed Linux Kernel and not some other unsigned kernel? Edited on 21-Jan-2022 after working on suggestions from telcoM Continuing from the answer from telcoM, I downloaded SHIM source from https://github.com/rhboot/shim I also created PKI keys following https://www.rodsbooks.com/efi-bootloaders/secureboot.html#initial_shim $ openssl req -new -x509 -newkey rsa:2048 -keyout MOK.key -out MOK.crt -nodes -days 3650 -subj "/CN=Your Name/" $ openssl x509 -in MOK.crt -out MOK.cer -outform DER Built SHIM source using make VENDOR_CERT_FILE=MOK.cer Signed my kernel.efi with MOK.key to get signed grubx64.efi (This is because DEFAULT LOADER in SHIM is grubx64.efi. I just went ahead with defaults) sbsign --key MOK.key --cert MOK.crt --output grubx64.efi kernel.efi Finally, used shimx64.efi as loader.efi (using PreLoader https://blog.hansenpartnership.com/linux-foundation-secure-boot-system-released/) because at present I don't have shimx64.efi signed by Microsoft. In addition, mmx64.efi and fbx64.efi are also enrolled through HashTool.efi along with shimx64.efi (loader.efi) Here is the flow. PreLoader.efi --> loader.efi(shimx64.efi) --> grubx64.efi(kernel.efi) With SecureBoot disabled, everything works fine and I am able to boot Linux Kernel. However, with SecureBoot enabled, I am not able to start grubx64.efi image. Further updates I figured out that I should have used MokManager (mmx64.efi) to enroll MOK.cer. Tried using mmx64.efi and enrolled MOK.cer. However, it looks like the Key is not registered successfully. Am I missing anything?
Your OS Loader needs to include a copy of the public part (a.k.a. the certificate) of the key you'll be using to sign your own kernel. Any time that key changes, you will need to have your OS Loader re-signed by Microsoft. You might want to study the source code of the shimx64.efi Secure Boot shim bootloader that is used by many major distributions to handle Secure Boot: https://github.com/rhboot/shim Alternatively, you would have to get a copy of the public part of your kernel signing key added to the db UEFI NVRAM variable. Normally this is only possible if you replace the Secure Boot primary key (PK UEFI NVRAM variable) on your system. It depends on your system's firmware implementation how (or indeed if) this can be done. Common possible ways: If your UEFI firmware settings ("BIOS settings") include a way to directly edit the Secure Boot keystores, that could be used to add your kernel signing key directly to the db variable. You might have to reset or replace the PK primary key first, see below. If your UEFI firmware settings don't include a way to directly edit Secure Boot keystores, but include a way to zero out the PK primary key of Secure Boot, this can be enough to get you started. Zeroing out the PK places Secure Boot in Secure Boot Setup Mode, in which any kernel can be booted and all Secure Boot keystores can be edited. Setup Mode ends when a new Secure Boot primary key (i.e. a digital certificate similar to what is used in signing kernels for Secure Boot) is stored into the PK keystore variable. While in Secure Boot Setup Mode, all the Secure Boot keystores should be editable by OS-level programs, like efivar https://github.com/vathpela/efivar.git or sbsigntools https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git for example. In practice this does not always work; it depends on the properties of the UEFI implementation in your system's specific firmware. If your firmware does not allow editing Secure Boot keystores by OS-level programs, you might have better luck by using a UEFI-mode tool, like KeyTool.efi from the efitools package: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git (It is possible to protect UEFI NVRAM variables so that they are only accessible to boot-time .efi programs, not by the regular OS; I've seen some UEFI implementations that seem to restrict the Secure Boot keystores in this way, although the Secure Boot specification does not require that.)
UEFI Self-Signed Kernel loading from a Microsoft Signed OS Loader
1,389,107,558,000
I am running Ubuntu 20.04, dual-booted with my Win10 on 1TB nvme M.2 SSD with 16GB of RAM. I initially made a 32GB swap partition while installing Ubuntu, but now, I wanted to utilize that space somewhere else. So, this is what I did. But ended up with longer boot times now. As suggested in the comments, I had to do RESUME=none in my /etc/initramfs-tools/conf.d/resume file. Also here, the same thing is given. But, I can't find a resume file there! I didn't delete it ever. How to solve this now? Edit for clarification: I don't want to hibernate!!! I just shut down my computer, and then when I turn it ON, it is taking around a minute to boot up.
Okay, I found the solution.When I run systemd-analyze time, I saw that kernel was taking around 45 seconds. This gave me an idea. Actually, I set up a hibernation sequence by following this. This was creating the problem when I wanted to boot my PC freshly (NOT from Hibernation). So, I just went to /etc/default/grub file and changed [GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=YOUR_VALUE"] to [GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"]. And this did the job. Thanks to everyone who tried to help :)
I deleted my swap partition and ended up with longer boot times and no RESUME file
1,389,107,558,000
The relationship between user and kernel virtual addresses has been discussed in a few questions before (links below), but as far as I understand it, the user process cannot read nor write to the Kernel addresses. So, how does a user process share and receive data from the kernel? Is it through memory? If so, where in the memory layout? Maybe CPU registers? Related questions: What's the use of having a kernel part in the virtual memory space of Linux processes? Do the virtual address spaces of all the processes have the same content in their "Kernel" parts?
Let's consider an example: a simple x86 Hello World program for Linux, that prints a message to stdout and exits. It needs to pass a couple of data items to the kernel: Text string to output, Exit code. Here's the assembly code (to be compiled with FASM): format ELF executable segment readable executable ; system call numbers SYS_EXIT=1 SYS_WRITE=4 ; file descriptors STDOUT=1 entry $ start: mov eax, SYS_WRITE mov ebx, STDOUT mov ecx, message mov edx, messageLength int 0x80 mov eax, SYS_EXIT xor ebx, ebx ; exit code 0 int 0x80 message: db "Hello, world!",0xa messageLength=$-message All this program does to fulfill its main goal (message output) is Set appropriate CPU registers to the values representing the system call number (for sys_write syscall), file descriptor (stdout), address of the message and the message length Do the system call, in this example by means of software interrupt 0x80 Similar sequence is to exit: set the registers to the system call number and exit code, and do the system call. Which registers to set to which values is defined by the system call calling convention. After the kernel starts executing the syscall handler, this handler reads the values of the registers from the application's context and interprets them according to the calling convention. In particular, when it sees that system call is sys_write, it takes the length and address of the message, and uses them to read from the user space memory. Then these data (along with file descriptor) are passed to the drivers that will do the actual work.
Syscalls: How does a user processs pass/receive data to/from the kernel?
1,389,107,558,000
I just updated my Jessie installation to Stretch. However I am a lost with Debian kernel versions. According to the security tracker, the main repository version is 4.9.210-1 but the security version is 4.9.189-3+deb9u2. Why is the security version lower? Which one should I use? I noticed that the LTS version is also 4.9.210-1, I guess because LTS support has not started for Stretch and deb http://security.debian.org/ stretch/updates main contrib non-free points to the same version as the one in the main repository. Can someone please confirm or infirm this guess?
You should use whichever version is greater (and apt and co. will do the right thing for you), 4.9.210-1 in this case. The reason this situation arises is that, when a point-release is being prepared, kernel updates will often go straight to stable, without going through security first. A reminder about the upcoming 9.12 release was sent on January 12, 2020, and the kernel was uploaded on January 20, in time to get into the point-release (for which updates were frozen on February 1, 2020, two weeks later). Currently, the kernel packages in all supported releases are in this situation: Debian 9 has 4.9.210 in its main repository, 4.9.189 in its security repository; Debian 10 has 4.19.98 in its main repository, 4.19.67 in its security repository. Of course important security issues in the kernel are still fixed through the security repository. (All kernel upgrades fix security issues; not all those fixes are vital.) But the supported distribution is the combination of the main repository and the security repository, not the main repository updated by the security repository. LTS support for Stretch will only start once security support is no longer available from the main Debian project.
Why does the debian security kernel have a lower version than the main one?