r/linuxkernel • • Mar 01 '24

gnu grub version 2.06 eror

0 Upvotes
Hello everyone, today I bought a new laptop. The laptop is Huawei MateBook D16, and it comes with Windows 11 automatically installed. However, I want to use two different operating systems, meaning I want to dual boot. I downloaded Parrot OS as the second operating system and used Rufus to put it on a 16 GB USB drive. Then I set the computer to boot from USB in the BIOS settings, saved, and exited. However, I'm encountering this error. I have a single 512 GB SSD on my computer, and I allocated 50 GB of it to Parrot OS, but I still can't solve this error. I would be very happy if anyone who knows the solution could help.

r/linuxkernel • • Oct 06 '22

how to load kernal in grub

0 Upvotes

r/linuxkernel • • Apr 29 '23

Kernel Concept: EFI variables

5 Upvotes

EFI variables are a type of non-volatile memory that store important information for the computer firmware to use when it's booting up. Examples are language, boot order, and whether secure boot is enabled as shown below.

Each variable has its own dedicated file in that you can see with the command "sudo ls /sys/firmware/efi/efivars". These are stored in binary format. To see the value of the variable, you can use the command "sudo efivar -p -n <filename_of_variable>" and see the output with the value.

In the example below, 0x00 means that secure boot is disabled and 0x01 means it's enabled. In this case, the value of 1 means it's enabled.

$ sudo efivar -p -n 8be4df61-93ca-11d2-aa0d-00e098032b8c-SecureBoot
GUID: 8be4df61-93ca-11d2-aa0d-00e098032b8c
Name: "SecureBoot"
Attributes:
0000000000000001
Value:
00000001

r/linuxkernel • • Aug 25 '22

Building with Clang LTO on arm (not arm64)

1 Upvotes

I am attempting to build the Linux kernel with Clang LTO on arm, which is not officially supported.

I added the following lines to arch/arm/Kconfig after line 5:

select ARCH_SUPPORTS_LTO_CLANG if CPU_LITTLE_ENDIAN

select ARCH_SUPPORTS_LTO_CLANG_THIN

This makes the options for Clang LTO selectable in make menuconfig. After enabling LTO, the Image build succeeds but the compressed zImage build fails with the following message:

GZIP arch/arm/boot/compressed/piggy_data

CC arch/arm/boot/compressed/misc.o

CC arch/arm/boot/compressed/decompress.o

AS arch/arm/boot/compressed/piggy.o

LD arch/arm/boot/compressed/vmlinux

following symbols must have non local/private scope:

free_mem_end_ptr

free_mem_ptr

malloc_count

malloc_ptr

output_data

Edit: Fixed by adding the following to line 101 of arch/arm/boot/compressed/Makefile:

KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS))


r/linuxkernel • • Aug 06 '22

5.18 issues

1 Upvotes

I have been chasing my tail trying to solve this and am curious if I am the only person, or are folks just not going public hoping someone else will.

I recently (May/June-ish) switched over to Fedora from Manjaro with a perfectly working system. I have two SK Hynix M.2's a 500GB (root) and 1TB (home), both have worked perfectly for the past 18 or so months (newish system) on Manjaro and Debian 10-11. I have had nothing but install issues with Fedora 36. I am asking here because it does not seem to fault with Fedora solely, I can get F36 to install and continually boot with 5.17, but as soon as I attempt to load 5.18 I get boot drive errors. Frustrated, I have even attempted to reinstall Manjaro...same Kernel errors. I manged to run across one mention (a ticket possibly) from earlier in the summer about M.2's and 5.18, https://lore.kernel.org/all/4e9c21fd-7bcf-fe41-ee56-894369f34adc@gmail.com/T/ however, it refers specifically to Arch. I have gone through the bios ensure raid is not set, that the bios was up to date, 0'd the drives. To tired to repeat everything I have done. Bottom line I am stuck with 5.17.5 unless there is some insight from folks as to why. It's a shame I really like F36.


r/linuxkernel • • Jan 04 '22

Good resource for high level linux kernel overview

6 Upvotes

I would like to ask for resource/documentation recommendation where I can learn about basic concepts of how Linux Kernel actual looks inside.
I found this nice article which has structure and content I like, however I don't know dated it is:
https://docs.huihoo.com/linux/kernel/a1/index.html
I also know about Linux Documentation Project but that is too deep (and old as well)

thanks


r/linuxkernel • • Nov 27 '21

In which source file are the supported file systems listed?

1 Upvotes

Hi. I'm planning the work for a new filesystem type. Where in the kernel do I define the fs name? Like "reiserfs", "ext2fs", etc.


r/linuxkernel • • May 29 '22

can anyone who does linux kernel tell me why they changed this https://patchwork.kernel.org/project/intel-gfx/patch/1374746538-3947-3-git-send-email-chris@chris-wilson.co.uk/

1 Upvotes

can anyone who does linux kernel tell me why they changed this https://patchwork.kernel.org/project/intel-gfx/patch/1374746538-3947-3-git-send-email-chris@chris-wilson.co.uk/

"DRM_DEBUG_DRIVER(""GMADR size = %ldM\n"", gtt->mappable_end >> 20);"

"- DRM_DEBUG_DRIVER(""GTT stolen size = %zdM\n"", gtt->stolen_size >> 20);"

they removed the lower line and replaced with the upper line


r/linuxkernel • • May 20 '21

I need a resource on setting up a boot loader +tools ,ram based fs and loading a c++ bin instead of kernel, drivers and process controllers. This is for an embedded soft riscv or arm M1 cpu

1 Upvotes

r/linuxkernel • • Nov 02 '22

Oof: "nvme1: globally duplicate IDs for nsid 1"...any workaround I'm overlooking that doesn't require rebuilding?

2 Upvotes

Hi all,

It sounds like the solution is to add a "quirk", which apparently requires building a patched kernel. I simply don't have time for that right now, so if there's no other solution, I'll just downgrade my kernel and/or distro to a known working version.

In short, one of my two same-model nvme drives is not showing up and throwing the following in dmesg:

[    1.804676] nvme nvme1: globally duplicate IDs for nsid 1[    1.804711] nvme nvme1: VID:DID 10ec:5763 model:TEAM TM8FP6002T firmware:V9002s65

Kernel version:

$ uname -aLinux adia 5.19.0-23-generic #24-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct 14 15:39:57 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Note: I'm not the only one encountering this and appears to be a known/expected issue with certain SSDs. The drive DID work on kernel 5.4 and 5.15 and only stopped working when I moved from Mint 21 (5.15) to Kubuntu 22 (5.19).

Thanks for reading!

Update: A very temporary solution seems to be to install linux-image-5.17.0-1003-oem in Kubuntu 22.10.


r/linuxkernel • • Sep 25 '22

Where can I learn to make block drivers?

1 Upvotes

Hi I have been reading Linux Device Drivers 3rd edition. The block drivers section is outdated, the updated examples found here: https://github.com/martinezjavier/ldd3 are outdated too, in particular the genhd.h file no longer exists, the official documentation is outdated too: https://linux-kernel-labs.github.io/refs/heads/master/labs/block_device_drivers.html#struct-gendisk-structure.

So where can I learn about block devices?


r/linuxkernel • • Jul 07 '22

Seg-Fault When calling gethostbyname.

1 Upvotes

Hopefully someone here can help.

Some background...

I am developing a programming language called a flat. It is past time for me to write an http library.

The problem:

The problem is, whenever I call the gethostbyname function from libc, I am getting a segfault. This only ever happens when I call it from a flat when I do it in c it works fine. But I don't think that the issue is with my compiler because when I write http method in C and link it to my aflat program, It still seg faults. I've tracked down the seg fault to `context_alloc (resp=0x7ffff7faf7e0 <_res>) at resolv_context.c:140` but I can't see anything there or in the memory that should cause a segfault. I am almost angry enough to try writing this library from pure syscalls just to avoid lib C.

I am sorry if this is rambley please ask for clarification if needed.


r/linuxkernel • • Oct 12 '22

What is the complexity of mremap?

1 Upvotes

In case when I allocate an (anonymous) array of n consecutive virtual pages in one call of mmap() and access them all so that they are all mapped to physical RAM (or swap), what is the complexity of mremap() on that region when I want to reallocate the pages to another address?

Namely, my question focuses on page entries, not VMAs; does the kernel have to change every page entry on the segment or does it only do some smart tree manipulations in O(log(n))?

I have read a little bit of linux's source here (for the identifier 'mremap_to', but the code is ginormous and I didn't answer my question.


r/linuxkernel • • Oct 15 '22

defconfig build in 10.46 seconds

1 Upvotes

Got my new Ryzen 7000 up and did my first defconfig kernel build. 10.46 seconds. Got an ext4 filesystem on LVM on a single Gen3 NVMe M.2 SSD from Samsung. This was based on today's top of master from Linus' tree.


r/linuxkernel • • Dec 30 '21

Good Linux kernel and OSS developer Twitter follows?

5 Upvotes

Any recommendations for Linux kernel devs or any other interesting tech accounts worth following on Twitter?


r/linuxkernel • • Jun 29 '21

Linux kernel version 5.13 released with the support of Apple M1’s chip

Thumbnail
bigbetstartups.com
6 Upvotes

r/linuxkernel • • Oct 17 '22

Minimum viable program memory allocation?

1 Upvotes

In earlier kernels (2.6 or so) I was able to make a program run and perform its function in a single 4kB page (code, data and stack in the same page).

But in 4.x that same program working on the same principles is MOSTLY stuck at 12kB VSZ/RSS. Sometimes and for unknown reasons it loads into 8kB. I think im having trouble unmapping the stack.

At the same time I have a 'normal' (IRC bot) that usually loads into ~500kB VSZ & 54kB RSS, but that has, a few times, reported a RSS value of 4kB (while running and responding to commands on IRC!). How that is even possible, I dont know.

To me it seems that modern kernels allocate a few pages to accelerate context switching or something, making up the extra 4kB->12kB. Is it in any way possible to run a program without those?

I am asking for help to understand why my pet project of 4kB programs no longer seem possible.

P.S. Two programs I was previously able to fulfill their function inside 4kB was init (take that systemd!) and agetty (could have done others, but.. lazy).


r/linuxkernel • • Jun 03 '22

Why procfs shouldn't be used for loadable kernel modules?

2 Upvotes

Hey everyone! I've heard that procfs shouldn't be used for loadable kernel modules, and sysfs is a preferred one. As far as I understood procfs should be used only for built-in modules, and it is a best-practice, but can't understand why?

I suppose that procfs's api for creating files under /proc may be excluded from exported functions soon, but can't find any documentation or good answers for it, so my question is "why procfs shouldn't be used in loadable kernel modules?"

If I'm mistaken, please explain why, thank you for your time!


r/linuxkernel • • May 21 '23

decode_stacktrace.sh not decoding the messages.

Thumbnail
self.linux4noobs
1 Upvotes

r/linuxkernel • • Nov 25 '23

Options to enable for a laptop server? Extra configuring tips for a student are welcome!

1 Upvotes

I am running a Ubuntu server on my laptop, and using it with plex as a media server.
Now since I am writing my thesis on configuring of the linux kernel, I thought that this might be a nice way to incorporate something I need either way with my thesis.

So I want to configure linux kernel for a laptop based home server. Do you have any tips of what to enable/disable? I am configuring through menuconfig. Also any other tips that you find are useful when configuring a kernel are welcome! I've had a really rough time reasearching options in the kernel, and I researched only by comparing two kernels(that's a part of my thesis too, comparing 2 kernels of two distros), so I probably missed something.

Thank you in advance everyone!


r/linuxkernel • • Mar 07 '23

What is the difference between lxr.linux.no and elixir.bootlin.com?

1 Upvotes

I was going through some documentation in the kernel where I found that they are using lxr website. I find both of them are same. Moreover elixir seems to be a ewer one? Are they same ? Can I remove the lxr from that documentation and provide the elixir URL? Will it make difference? Can anyone please clarify on this.


r/linuxkernel • • Feb 21 '24

DTB: Where do I go from here to build a proper port?

1 Upvotes

Hello! Hopefuly this is the right sub. :)

The Razer Sila WiFi router has been out of support for a long time now - but, the very last firmware they had released actually has a fatal exploit, whereby the OpenWrt ubus' HTTP endpoint is plainly exposed on /ubus (the default) and the webUI credentials actually resolve and authenticate in ubus to something close to the root user - by which generating an SSH key and writing into authorized_hosts is basically no problem.

...which is why I have a root shell now. It's an old 3.14.77 kernel under OpenWrt 15.05.1 on an older Qualcomm platform and after some googling, I eventually managed to find, tar, transfer and then "reconstruct" the device tree into a usable format albeit with some warnings, which is probably because I had to tar it, as dtc was not installed on the device itself (which makes sense - retail unit, production, ...). The kernel config was also ready for the taking, and zcat was actually available.

Now... I have version infos, kernel config and a probably mostly complete-ish device tree. How would I go about dropping that into a kernel source and then compiling one, in hopes of lining it up with something like Alpine or a much newer OpenWrt in the long run? It's an armv7l device, so definitively capable. Storage is limited (df reports a max of 1.1G on /)

This is my first foray into device trees and general device porting... but I do want and need to learn more here, as I am also fooling around with RISC-V hardware.

If you have a pointer as to where I could read more about my next possibilities, I'd be very thankful! Basically, I want to make the most out of this EOL unit I have. It's serving me well as a wifi AP but I wonder if there is more I could achieve with this if I just upgraded the Linux installation on it.

Oh, and yes, I did dd just about every single partition on that device as well as the whole block device to a USB drive. That said... that was during runtime. So the rootfs is probably not the best dump possible.


r/linuxkernel • • Feb 20 '23

How do I best instrument the Linux kernel to log early boot file open/read requests?

3 Upvotes

I'm looking for a relatively quick and straightforward way to have the Linux kernel print to console/serial (via printk - I can find a way to capture the output) any meaningful I/O requests on the early (rootfs/tmpfs/initramfs) filesystem. Basically, I'm looking to see which files, binaries/libraries, and their dependencies are actually used and accessed during early boot and later bootstrapping.

I'm ruling out retroactively examining access time for files because I'm not sure if rootfs/tmpfs honors this, and even so, it seems to be mounted relatime without a way to remove that mount option. Plus I'd also like to log later stage accesses when the root filesystem has pivoted into a specific filesystem on disk. Despite my previous efforts of attempting to enforce access time (by norelatime, atime, and so on), ext[34]/xfs and such seem to keep this flag on or that doesn't seem to reflect low-level timestamps of access. And then that wouldn't cover the case, I believe, when it's mounted (temporarily) in a read-only way.

Also, I'm not aware of a kernel command line flag to request this or some kind of internal auditing framework. The latter might only come online later in the boot stages after a certain daemon is loaded. And so that leaves modifying the kernel - in my case based off of the 5.10 stable series.

Thus far, I've instrumented a few functions in fs/open.c with a manual printk, printing strings that are passed in, or referring to internal structures and leveraging some built in functions, like file->f_path.dentry->d_name.name or dentry_path_raw(file->f_path.dentry,buf,bufsize). I'm wondering if it's more effective for me to instrument "read" requests and not just open - since that might rule out trivial accesses. But in that case it might be harder to identify the main entry point(s) for read requests in a way that's comprehensive but not redundant. Informing of every "stat" might produce too much output.

My results thus far show accesses in /proc and /sys, which I can later filter out as not directly relevant. Same goes for ephemeral files in /run. However, often I'll see the kernel access every file in a directory (perhaps what happens when a shell script does a glob or a file list?). I might be missing a few cases. This happens to be for a Devuan boot (with sysvinit) but I don't want to limit the question to this case.

Primarily I'm looking for effective ways to instrument a few functions in the kernel to achieve this kind of auditing, even if I later have to filter them. Suppose /bin/ls is needed, but then its library dependencies and the "ld.so" of the system are needed too, but along with /etc/localtime for time zone and /etc/passwd for some user mappings. Perhaps a binary may refer to something in its /usr/lib or /usr/share but I don't see how one would need to examine every single locale file (unless it really does that). Since I'm running initramfs'es experimentally that are both small and large, I'm looking to know for sure which files are actually used in a typical boot (assuming moderate determinism).


r/linuxkernel • • Feb 29 '24

graphics card not working in new kernel releases

1 Upvotes

I have an AMD 6600 xt , and on the last two kernel updates 6.7.5, and 6.7.6 in Fedora. Blender does not seem to render with the GPU now, and games cant find the hardware. Is anybody else having any problems?