Frogging-Family / linux-tkg

linux-tkg custom kernels
GNU General Public License v2.0
1.32k stars 163 forks source link

Cannot get running-kernel config on Alpine Linux, plus it makes calls for some non existent binaries. #553

Open ghost opened 2 years ago

ghost commented 2 years ago

Both the generic install and the arch install (more on that later) fail to grab the running-kernel config, and the installation promptly exits thereafter. The script command does not seem to exist on Alpine Linux, and neither does shell-output.log, and checks for it prevent the installation from running without some tweaking... (See below...)

Distro: Alpine Linux, hijacked with bedrock and Artix stratum added. Using "edge" repositories (latest releases of available Alpine packages) Arch repos are enabled in the pacman.conf. (More on that later...)

The issue: The generic install.sh refuses to start without hacking the shell script, and it cannot detect the config file of the running kernel.

When I use the Arch install, I do not have to hack the shell script, but it still cannot detect the config file of the running kernel. (Skipping over some more complicated stuff that isn't relevant right now, Bedrock allow me to basically meld Artix, and by proxy, Arch, into Alpine, with all of their tools and pacman included.)

(shell-output.log inherently cannot be provided. This is what I meant by hacking the shell script; the section at the start of the install.sh that deals with shell-output.log needed to be deleted in order to start the generic install.)

All other elements of the installation up until it failed to grab the running kernel config appeared to work just fine. The installation then stopped there before it could continue.

Here's what happened in the cli, I guess. More context available here --> https://www.reddit.com/r/AlpineLinux/comments/vyazb8/what_am_i_missing_installing_tkg_kernel/

[START]

alpine:~$ cd ~/linux-tkg
alpine:~/linux-tkg$ doas nano customization.cfg
doas (ec@alpine) password: 
alpine:~/linux-tkg$ doas nano install.sh
alpine:~/linux-tkg$ ./install.sh install
Which compiler do you want to use?
  > 0) GCC (recommended)
    1) Clang/LLVM
[0-1]: 
Selected: GCC (recommended)
 -> First initialization of the linux source code git folder
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint:   git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint:   git branch -m <name>
Initialized empty Git repository in /home/ec/linux-tkg/linux-src-git/.git/
 -> Switching to linux-5.18.y
 -> 5.18.y branch doesn't locally exist, shallow cloning...
remote: Enumerating objects: 80484, done.
remote: Counting objects: 100% (80484/80484), done.
remote: Compressing objects: 100% (78467/78467), done.
remote: Total 80484 (delta 5626), reused 16407 (delta 1169), pack-reused 0
Receiving objects: 100% (80484/80484), 219.66 MiB | 2.79 MiB/s, done.
Resolving deltas: 100% (5626/5626), done.
From https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
 * branch                linux-5.18.y -> FETCH_HEAD
 * [new branch]          linux-5.18.y -> kernel.org/linux-5.18.y
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), 811 bytes | 811.00 KiB/s, done.
From https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
 * [new tag]             v5.18.11   -> v5.18.11
Updating files: 100% (75883/75883), done.
branch 'linux-5.18-kernel.org' set up to track 'kernel.org/linux-5.18.y'.
Switched to a new branch 'linux-5.18-kernel.org'
 -> Checking out latest release: v5.18.11
Note: switching to 'v5.18.11'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at d39cd8e45 Linux 5.18.11
 -> Setting version...
 -> Using Arch patches
--2022-07-14 19:02:27--  https://raw.githubusercontent.com/graysky2/kernel_compiler_patch/master/more-uarches-for-kernel-5.17%2B.patch
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.110.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25738 (25K) [text/plain]
Saving to: '/home/ec/linux-tkg/more-uarches-for-kernel-5.17%2B.patch'

/home/ec/linux-tkg 100%[==============>]  25.13K  --.-KB/s    in 0.002s  

2022-07-14 19:02:27 (14.1 MB/s) - '/home/ec/linux-tkg/more-uarches-for-kernel-5.17%2B.patch' saved [25738/25738]

 -> Applying graysky's cpu opts patch
 -> Applying clear linux patches
 -> Applying glitched base patch
 -> Applying misc additions patch
 -> Applying patches for WRITE_WATCH support in Wine
 -> Applying patches for WRITE_WATCH support in Wine
 -> Applying PDS base patch
 -> Applying prjc PDS/BMQ agressive ondemand governor patch
 -> Applying Glitched PDS patch
 ==> WARNING: Cannot get config file of running kernel
 -> exit cleanup done

alpine:~/linux-tkg$ 

[END]

AdelKS commented 2 years ago

Hello,

The kernel actually has a config entry for exposing its config file through sysfs. My first guess is that your running kernel has that option disabled or the config is exposed at a non standard location.

ghost commented 2 years ago

Hello,

The kernel actually has a config entry for exposing its config file through sysfs. My first guess is that your running kernel has that option disabled or the config is exposed at a non standard location.

I know where my kernel config is (/boot/config-lts/), so how do I force the script to go to the right place?

AdelKS commented 2 years ago

Is that a standard location or user-set ?

Simply copy the config from there to a file somewhere and use the _configfile option in the customization.cfg file to refer to it.

AdelKS commented 2 years ago

Also, I believe /boot/config-lts is the path where the config gets installed along with the kernel no ? Or is that really the path where the running kernel actually exposes its config ? Which means the file there is different for each kernel you boot?

ghost commented 2 years ago

Also, I believe /boot/config-lts is the path where the config gets installed along with the kernel no ? Or is that really the path where the running kernel actually exposes its config ? Which means the file there is different for each kernel you boot?

Not sure if it's a static config file or if it's the running kernel's config, can't really test it without having multiple kernels installed, and unfortunately Alpine doesn't provide any options to install prebuilt kernels other than the one that comes with the iso. Regardless, I followed the steps to provide my own config and I'm getting further in the install, but now it doesn't know where to get ncurses (Yes, I have it installed.)

[Installation is normal up until this point...]

 -> Setting config
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
*
* Unable to find the ncurses package.
* Install ncurses (ncurses-devel or libncurses-dev
* depending on your distribution).
*
* You may also need to install pkg-config to find the
* ncurses installed in a non-default location.
*
make[1]: *** [scripts/kconfig/Makefile:212: scripts/kconfig/mconf-cfg] Error 1
make: *** [Makefile:628: menuconfig] Error 2
 -> exit cleanup done

alpine:~/linux-tkg$ 

[END]

Seems like a running theme of Alpine having everything needed to work, but the script not knowing where to find it. It DOES detect ncurses properly when I tried to use the arch installation again, so I guess I'll try to compile it that way in the meantime?

ghost commented 2 years ago

Well nevermind! The ncurses tui doesn't load for some reason when using makepkg -si, though I still get the crappy CLI configuration thing. Yippee.

AdelKS commented 2 years ago

Do you have pkg-config installed and available, as it suggests ? Although ncurses may not have pkg-config entry 🤔

AdelKS commented 2 years ago

Otherwise, you can look up where the ncurses .so file is and add its parent folder in the LD_LIBRARY_PATH environment variable.

ghost commented 2 years ago

Uh... weird thing. When I use the default archlinux config file provided, make menuconfig works fine (probsbly won't boot, since systemd definitely isn't gonna work with openrc, so I won't compile that) and doing the stuff you suggested didn't help when I used my own. So... I guess I'll just go without configuring the kernel for now and try to build it now?

ghost commented 2 years ago

Finished compiling. Kernel won't boot. There's a chance that me pressing enter on all of the config prompts didn't actually draw from my provided config, though I didn't pay attention to check. Had this same issue when trying to run the zen kernel; during the initialization nothing happens and the cursor doesn't blink. Odd stuff...