Hot answers tagged

23

Maybe you misunderstood what the author of that post meant. The vmlinuz file contains other things besides the gzipped content, so you need to find out where the gzipped content starts. To do that, use: od -A d -t x1 vmlinuz | grep '1f 8b 08 00' What this does is to show you where in that file you can find the gzip header. The output looks like: ...


23

From sysfs.txt: sysfs is a ram-based filesystem [...]. It provides a means to export kernel data structures, their attributes, and the linkages between them to userspace. In essence /sys allows you to get information about the system and its components (mostly attached and installed hardware) in a structured way. See also the Wikipedia Article on ...


17

The kernel sources now contain a script for this, extract-vmlinux. You don't need to roll your own. See this SO answer.


17

This is known as a fork bomb. Does linux have any protection measure to such program which can run out of memory? Not really. Each fork produces a new process, with its own virtual address space and memory usage. So each copy is relatively small. Eventually, you'll use up all the physical+swap memory on the system, and the out-of-memory (OOM) killer ...


14

I also struggled with that issue. I just want my system to stay responsive, no matter what, and I prefer losing processes to waiting a few minutes. There seems to be no way to achieve this using the kernel oom killer. However, in the user space, we can do whatever we want. So i wrote the Early OOM Daemon ( https://github.com/rfjakob/earlyoom ) that will ...


14

(it actually drops so..) run sync first, then free pagecache: echo 1 > /proc/sys/vm/drop_caches free dentries and inodes: echo 2 > /proc/sys/vm/drop_caches free pagecache, dentries and inodes: echo 3 > /proc/sys/vm/drop_caches Then you can start with a clean cache, but of course caching will still work.


13

You need to specify a file when using the grep command. With the command you're using, you're searching in the standard input... Try grep -r "test" directory.


12

You could do a cat /lib/modules/$(uname -r)/modules.builtin From the Kernel Documentaton modules.builtin This file lists all modules that are built into the kernel. This is used by modprobe to not fail when trying to load something builtin.


10

By compiling linux kernel are we building a totally standalone OS which doesn't depend on any linux destributions? No. Linux by itself is not an operating system. It is just a kernel. A userland, comprising a collection of system libraries and basic software, is necessary to facilitate your interaction with the computer. In what we commonly mean when we ...


10

Linux 0.01 is very unlikely to work on modern hardware due to lack of driver support. Also, modern distros probably won't boot on ancient kernels because they need interfaces that weren't in the oldest Linuxes. You'll want to install a 386 simulator such as Bochs, install an ancient Linux distro such as SLS or early Debian/Slackware on it, then try to ...


10

Yes, although it may not be enabled by default on your system. The setrlimit system call defines system limits -- including the number of processes per user. Let's look at it first in the kernel API (since you mentioned "linux"): you can use the manpage for setrlimit, which will tell you to do something like #include <sys/resource.h> ... struct ...


8

You should think long and hard about why you think you're smarter than the scheduler. After that, if you still want to set the cpu affinity of a process on linux you can use the taskset command or, if you're writing the program yourself, the sched_setaffinity system call.


8

Red Hat magazine had 1 and 2 reversed. Beware of bugs that might prevent disabling overcommitting to work like that one: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/345601


8

The IPsec stack integrated in the Linux kernel since 2.6 (NETKEY) was originally based on the KAME stack (at least in regards to the API). The source code is part of the kernel repository, where the main components are found in the net/xfrm folder, including the implementation of the Netlink/XFRM configuration interface. The alternative and standardized ...


7

In all actuality, the kernel provided by your distro is probably the best one for almost everybody. What pretty much every distro is doing is compiling all options as modules and dynamically loading the modules as they are needed. It's a good exercise, especially if you're interested in learning about the kernel, but as far as day to day operation goes the ...


7

Yes, this works, done it a lot in the past. If you need to compile for different architecture (say, you're on an x86 and want to compile for an ARM processor) then you would need a cross-compiler (done that as well). But if both machines are x86/x64 there's no problem.


7

The two aren't really inconsistent - the sudo command always changes user, either to root, or to the user you specify with the -u switch. All the -s does is provide a shortcut for starting a shell as that user. It is really equivalent to: sudo $SHELL except that it will likely fallback to /bin/sh or something if SHELL is not set.


7

find / -name "*.txt" -exec grep "text here" {} \; -print 2>/dev/null Which can be explained in human speak as: find starting from / in all files named *.txt (quotes are to bypass shell interpretation) with the resulting hits, perform the following grep "test here" in the file {} end of exec (\;) escaped end of statement print the files that match ...


7

It depends if you want to use it on user level or system level. On user level the ulimit(or corresponding commands for other shells) would be easiest solution. However on system level there are mechanisms to prevent malicious users (or just not using ulimit) from stopping the system. Linux cgroups mechanism can limit the resources on per-group basis. You ...


7

Many programs (the binaries/scripts) end up in /bin or /usr/bin with other parts in various configuration directories (often in/under etc) as you already noted. For any specific command you can checkout whereis whereis prog_name and it will give you some information about where this command is to be found. You can also try which which prog_name ...


7

There no universal standard, but the kernel is usually found in the /boot directory.


7

From a quick search this problem seems to have quite many possible reasons, and seems to point to the fact that your new kernel's default for clock-source is wrong for your motherboard. One advice that worked for some was to use clocksource=hpet or clocksource=acpi_pm. In another thread, someone fixed this with clocksource=jiffies, another advised to try ...


6

The default policy of the kernel is to allow applications to keep allocating virtual memory as long as there is free physical memory. The physical memory isn't actually used until the applications touch the virtual memory they allocated, so an application can allocate much more memory than the system has, then start touching it later, causing the kernel to ...


6

Use ulimit -u from the bash shell to set a limit on "max user processes". From the C shell, you use the limit command. If you need a system call to do this, use the setrlimit call to set RLIMIT_NPROC.


6

Read the release notes on the page you linked to and read The Linux Kernel 0.01 Commentary. You'll need a machine with a floppy drive, a legacy IDE controller (or a pretty good imitation), a hard drive you can repartition at will, old compiler and assembler versions, and probably some low-level knowledge to hack around hardware quirks that Linux 0.01 ...


6

To answer my own question. This grub2 entry worked. menuentry 'Xen 4 with Linux 2.6.32.45-xen' --class ubuntu --class gnu-linux --class gnu --class os --class xen { recordfail insmod ext2 set root='(hd0,1)' search --no-floppy --fs-uuid --set 75475e50-82e2-4f74-b860-6cf92c91b42e multiboot /xen.gz placeholder ...


6

Can't beat Wikipedia's simplicity: Filesystem Hierarchy Standard > FHS compliance Modern Linux distributions include a /sys directory as a virtual filesystem (sysfs, comparable to /proc, which is a procfs), which stores and allows modification of the devices connected to the system, whereas many traditional UNIX and Unix-like operating systems use ...


6

If your linux has a /proc/config.gz That has all the built modules. Copy it elsewhere and unzip it. Open the file everything with a "=M" is built as a module. Everything with a "=Y" is statically built. hwinfo will list the "Driver:" check the above file to see if it is statically built. FYI: All statically built drivers are always loaded into memory ...


5

After a looong debug session I found that the build and source links in /lib/modules/2.6.32-openvz-042stab090.5-amd64 to /usr/src and /usr/include were missing. Added them manually and it worked. Everyime happy that I can work in Linux where I can at least look into the source and debug...


5

Fake RAID is created by motherboard by formatting disks and storing Fake RAID metadata on it. There is a special tool by Red Hat - dmraid(source). It's a some kind of bridge between Fake RAID and Linux device-mapper dm-raid target. Yes, it's confusing, don't mess dmraid and dm-raid. dmraid is utility, dm-raid is one of device-mapper targets. dmraid tool ...



Only top voted, non community-wiki answers of a minimum length are eligible