[16:02] <zx2c4> apw: sigh
[16:02] <zx2c4> https://bugs.launchpad.net/ubuntu/+source/wireguard/+bug/1856539
[16:02] <zx2c4> helping this guy involves walking him through rebuilding his dkms stuff (for whatever reason) and/or disabling secure boot
[16:03] <zx2c4> that really sucks
[16:03] <zx2c4> proper .ko cannot come soon enough :-)
[17:42] <aberrant> good morning all
[17:43] <aberrant> I filed a bug (#1856603) just now and am wondering whether I could get some feedback on it - do I need to provide more info or is it good as-is?
[17:50] <aberrant> as an aside, if someone could step me through building a patched kernel, I'd appreciate it. The docs seem to be out of date.
[18:46] <aberrant> fm
[22:01] <aberrant> so, can someone please point me to the latest guide to compiling an ubuntu kernel (with an upstream patch)?
[22:02] <aberrant> https://help.ubuntu.com/community/Kernel/Compile is a bit outdated, and https://wiki.ubuntu.com/KernelTeam/GitKernelBuild isn't specific to Ubuntu (and is also, I think, outdated)
[22:11] <connor_k> aberrant, Have you already cloned the git repository that corresponds to which Ubuntu kernel you'd like to apply the patch to?
[22:12] <aberrant> connor_k: not yet. I started doing the "generic" instructions but figured that's probably not what I want.
[22:12] <aberrant> connor_k: I'm on eoan
[22:13] <aberrant> connor_k: should I just apt install linux-source-5.3.0 ?
[22:13] <connor_k> aberrant, I suppose you could, but I prefer to use the git repository: https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/eoan
[22:13] <aberrant> ah, ok
[22:13] <aberrant> thank you
[22:14] <connor_k> ping me once that's cloned and I'll walk you through applying your patch and building the kernel :-)
[22:14] <aberrant> awesome! thanks.
[22:16] <aberrant> still going. :)
[22:16] <connor_k> It will probably take a few minutes :-) Do you already have the patch(es) you want to apply to it?
[22:16] <aberrant> yes. it's one line
[22:16] <aberrant> http://git.infradead.org/nvme.git/commitdiff/530436c45ef2e446c12538a400e465929a0b3ade?hp=400b6a7b13a3fd71cff087139ce45dd1e5fff444
[22:16] <aberrant> I hope this file is in the ubuntu kernel
[22:17] <aberrant> actually, it's like 10 lines. :)
[22:18] <connor_k> it looks like it is
[22:18] <connor_k> so on that page you linked, I clicked on the "patch" link and it'll take you here: http://git.infradead.org/nvme.git/patch/530436c45ef2e446c12538a400e465929a0b3ade?hp=400b6a7b13a3fd71cff087139ce45dd1e5fff444
[22:18] <aberrant> it's in drivers, though. Does this require a new kernel, or just a driver?
[22:19] <aberrant> "You merely need to compile a special driver. For this, you only need to install the linux-headers packages."
[22:20] <aberrant> from https://help.ubuntu.com/community/Kernel/Compile
[22:20] <aberrant> but this is useful info anyway, so let's march forward.
[22:21] <aberrant> I'll be taking notes
[22:21] <connor_k> Oof, lots of pressure for me to get it right then ha
[22:21] <aberrant> hahaha.
[22:22] <aberrant> I can build this on a different system than the one I need it on as long as the architecture's the same, right?
[22:22] <connor_k> aberrant, yeah
[22:22] <aberrant> ok, git clone finished
[22:22] <connor_k> if you right-click the "patch" link on the commit page you linked me to, click "save link as" or something to download the patch so you can have it handy
[22:24] <connor_k> or if you're ssh'ing onto a more powerful build machine then you can use a command line tool like "curl" or something: "curl http://git.infradead.org/nvme.git/patch/530436c45ef2e446c12538a400e465929a0b3ade?hp=400b6a7b13a3fd71cff087139ce45dd1e5fff444 > whatever-you-want-to-name-it.patch"
[22:25] <aberrant> yup, got it. It has the email header in there. is that a problem?
[22:25] <connor_k> no, git will ignore that when you apply it
[22:25] <aberrant> ok, got it.
[22:25] <aberrant> cd to .../nvme/host and then patch < patch1.txt ?
[22:25] <connor_k> inside the "eoan" repo, if you run "git am ../path-to-that-patch-you-downloaded.patch" there's a chance it'll just fit in without any fuss
[22:26] <aberrant> oh, use git. wow.
[22:26] <aberrant> seth@hydrogen:~/kernel/eoan$ git am ~/patch1.txt
[22:26] <aberrant> Applying: nvme: Discard workaround for non-conformant devices
[22:26] <aberrant> done :)
[22:26] <aberrant> let me just confirm some of the changed lines are there
[22:26] <connor_k> nice!
[22:27] <aberrant> yup, all good.
[22:27] <aberrant> so far you're on a roll :)
[22:29] <connor_k> Sweet! One last thing I'd do before spending time compiling it is to make sure that config option is enabled for the Ubuntu kernel you want to compile
[22:29] <aberrant> ok, where is that specified?
[22:30] <aberrant> or does make config take care of it?
[22:31] <aberrant> (I also need kvm support, just FYI)
[22:31] <connor_k> I looked in the folder where the code is that you patched (drivers/nvme/host) and saw the Kconfig specifies "NVME_CORE"
[22:32] <connor_k> I'd just run "git grep NVME_CORE debian.master"
[22:32] <connor_k> and I see in eoan: "debian.master/config/config.common.ubuntu:CONFIG_NVME_CORE=m"
[22:32] <aberrant> debian.master/config/config.common.ubuntu:CONFIG_NVME_CORE=m
[22:32] <aberrant> what's "m" mean?
[22:32] <connor_k> so it looks like it's built as a module (which isn't terribly surprising since NVME seems pretty important to have these days
[22:32] <aberrant> ah, ok
[22:32] <connor_k> module just means that it can be loaded after the fact. Another value would be "y" which means it's built directly into the kernel image
[22:33] <connor_k> er, module => "m"
[22:33] <connor_k> so since the proper config is already set you could probably build the kernel
[22:33] <aberrant> well, my boot drive is nvme, so
[22:33] <aberrant> no 'make config' ?
[22:33] <aberrant> (and what about KVM?)
[22:34] <connor_k> before doing that I'd edit the changelog "debian.master/changelog" and inside the parentheses: linux (5.3.0-blah) I'd change the number in the parentheses to be (5.3.0-blah+MyPatch) or something
[22:34]  * connor_k can't type fast enough :-)
[22:35] <aberrant> linux (5.3.0-24.26+nvme_patch) eoan; urgency=medium
[22:35] <connor_k> perfect
[22:35] <aberrant> ok.
[22:35] <connor_k> that's just so you know you're running your test kernel when you run "uname -a"
[22:35] <aberrant> understood.
[22:35] <aberrant> perfect.
[22:35] <connor_k> but I think Eoan is also built with kvm support
[22:35] <connor_k> git grep CONFIG_KVM debian.master/
[22:35] <connor_k> debian.master/config/amd64/config.common.amd64:CONFIG_KVM=m
[22:35] <aberrant> KVM worked out of the box with the iso install, so I think you're right
[22:36] <connor_k> Ok. Looks like you're ready to put your CPU to work
[22:36] <connor_k> make -j`nproc` bin-debpkg
[22:36] <aberrant> basically I'd like the iso install kernel with this one patch :)
[22:36] <aberrant> sweet.
[22:36] <aberrant> j=6
[22:36] <connor_k> at least I think that's the makefile target that produces the -image, -modules debian packages once it's all done
[22:37] <aberrant> *** Configuration file ".config" not found!
[22:37] <aberrant> ***
[22:37] <aberrant> *** Please run some configurator (e.g. "make oldconfig" or
[22:37] <aberrant> *** "make menuconfig" or "make xconfig").
[22:37] <connor_k> oh woops, also I forgot at the very beginning
[22:37] <connor_k> cp /boot/config-`uname -r` .config
[22:37] <connor_k> then "make oldconfig"
[22:37] <aberrant> config-5.3.0-24-generic ?
[22:38] <connor_k> if that's what shows up when you run `uname -r` yeah, probably
[22:38] <aberrant> oh, what packages do I need? it failed 'cause no flex
[22:39] <aberrant> sorry. I'm building inside a VM
[22:39] <connor_k> ah
[22:39] <aberrant> flex and bison so far
[22:39] <connor_k> in the eoan folder, if you open Documentation/Changes it has a list of packages
[22:39] <aberrant> I have gcc and g++
[22:40] <connor_k> probably need bc, libssl-dev, libelf-dev, libncurses5-dev
[22:40] <aberrant> ok, give me a minute :)
[22:43] <aberrant> where is mcelog?
[22:44] <connor_k> try skipping that one, I don't remember ever having to install it to build the kernel. I think you can get away with build-essential (which has gcc, g++), make, libssl-dev, libelf-dev, flex, bison, bc
[22:45] <aberrant> mcelog was removed from Debian and in turn Ubuntu bionic due to "ROM; obsolete; no kernel support in testing". Please see https://launchpad.net/ubuntu/+source/mcelog/+publishinghistory or https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=889741 for more details.
[22:45] <aberrant> erm.
[22:45] <aberrant> ok
[22:46] <sarnold> iirc mcelog has been mostly replaced by rasdaemon; I haven't had any MCEs on my own hardware (thankfully) to verify that it actually serves as a replacement
[22:46] <aberrant> ok, what's after `make oldconfig` again?
[22:46] <connor_k> should be good to go with: "make -j`nproc` bin-debpkg"
[22:47] <aberrant> got it.
[22:47] <connor_k> and then take a break to have a snack, read a book, watch a film, or maybe overnight depending on that VM :-)
[22:47] <aberrant> hahah
[22:47] <sarnold> :)
[22:47] <aberrant> 6 procs off a 3400G
[22:47] <connor_k> that make target will produce the kernel all packaged up, and you'll be interested in installing the one that has *image*.deb and *modules*.deb
[22:47] <aberrant> do I run the make in debian-master/ ?
[22:47] <connor_k> no, in the top level directory of the eoan tree
[22:47] <aberrant> the config was in the eoan root, right?
[22:48] <connor_k> yeah run it in the eoan root
[22:48] <aberrant> seth@hydrogen:~/kernel/eoan$ make -j6 bin-debpkg UPD     include/config/kernel.release
[22:48] <aberrant> make[1]: *** No rule to make target 'bin-debpkg'.  Stop.
[22:48] <aberrant> checking the makefile
[22:49] <aberrant> I can't find bin-debpkg as a target
[22:51] <connor_k> hmm, weird... I suppose running: "fakeroot debian/rules binary" should compile the kernel and produce the same packages I was going for with the "bin-debpkg" thing
[22:51] <aberrant> how about `make all`?
[22:52] <aberrant> make help shows that building vmlinux, modules, and bzImage
[22:52] <connor_k> yeah I suppose you could, I was just trying to go the route where it produces debian packages so you can uninstall the test kernel but I guess if it's a VM then you could go the route "make" "make modules_install" "make install" (but I don't know the right targets off the top of my head)
[22:52] <aberrant> nononon. I'm installing it ont he hypervisor
[22:52] <aberrant> so yeah, I'd like to be able to uninstall.
[22:52] <aberrant> I'm building on a vm, but installing on the HV
[22:53] <aberrant> seth@hydrogen:~/kernel/eoan$ fakeroot debian/rules binary
[22:53] <aberrant> Debug: prepare-indep
[22:53] <aberrant> dh_prep -i
[22:53] <aberrant> /bin/bash: dh_prep: command not found
[22:53] <aberrant> make: *** [debian/rules.d/3-binary-indep.mk:172: prepare-indep] Error 127
[22:53] <connor_k> yeah i guess the way I'm most familiar with that should result in debian packages which are easily managed by dpkg or apt would be "fakeroot debian/rules binary"
[22:54] <aberrant> let me try installing debhelper
[22:55] <aberrant> seth@hydrogen:~/kernel/eoan$ fakeroot debian/rules binary
[22:55] <aberrant> Debug: prepare-indep
[22:55] <aberrant> dh_prep -i
[22:55] <aberrant> dh_prep: "debian/control" not found. Are you sure you are in the correct directory?
[22:55] <aberrant> make: *** [debian/rules.d/3-binary-indep.mk:172: prepare-indep] Error 255
[22:55] <aberrant> hrm.
[22:56] <aberrant> trying fakeroot debian/rules clean
[22:56] <connor_k> yeah that should generate it
[22:56] <aberrant> ok. I'm following https://help.ubuntu.com/community/Kernel/Compile
[22:57] <aberrant> AUTOBUILD=1 fakeroot debian/rules binary-debs <--- does that look reasonable?
[22:57] <connor_k> did "fakeroot debian/rules clean" followed by "fakeroot debian/rules binary" not start building it?
[22:57] <aberrant> I just did the clean so far
[22:58] <aberrant> should I do binary or binary-debs?
[22:58] <connor_k> just binary
[22:58] <aberrant> ok
[22:58] <aberrant> building
[22:58] <aberrant> I also had to install kernel-wedge
[22:58] <connor_k> woo!
[22:58] <aberrant> wait
[22:59] <connor_k> not woo!
[22:59] <aberrant> is there a way to `j6` this?
[22:59] <aberrant> or will it just be single-proc?
[22:59] <aberrant> checking for libudev.h... no
[22:59] <aberrant> configure: error: Missing /usr/include/libudev.h
[22:59] <aberrant> crap.
[22:59] <aberrant> ok
[23:00] <connor_k> Hmm I'm sure there's a way to do an equivalent -j thing
[23:00] <aberrant> just installed libudev-dev
[23:01] <aberrant> utils/helpers/amd.c:8:10: fatal error: pci/pci.h: No such file or directory
[23:01] <aberrant> crap. what's going on here?
[23:04] <aberrant> let me try a `make -j6 all` and see what happens.
[23:04] <aberrant> I can always distclean
[23:05] <connor_k> frankly I'm still sad that the "make bin-debpkg" didn't work, and am wondering if I hallucinated all of my previous kernel builds
[23:06] <aberrant> https://wiki.debian.org/BuildADebianKernelPackage
[23:06] <aberrant> :)
[23:06] <aberrant> This is an obsolete now guide on how to build the Linux Kernel into a .deb package. Don't use this,
[23:08] <aberrant> what happens with a `make all` ?
[23:08] <connor_k> it'll just compile the kernel (but doesn't produce debian packages from it)
[23:09] <aberrant> maybe the fakeroot will work if the binaries already exist
[23:10] <aberrant> fakeroot debian/rules binary-arch
[23:10] <aberrant> huh.
[23:11] <connor_k> well... i've done some soul searching and realized i've misled you. I said "make bin-debpkg" but really what I should have said was "make bindeb-pkg"
[23:12] <aberrant> oooh.
[23:12] <aberrant> ok, should I stop this `make all`?
[23:12] <connor_k> no
[23:12] <connor_k> you can run "make bindeb-pkg" after the make all
[23:13] <aberrant> you got it. Thank you for persevering here.
[23:13] <connor_k> but DON'T run "make deb-pkg" make sure you run "make bindeb-pkg" because the one without the "bin" in the name executes a "make clean"
[23:13] <aberrant> yup, I took notes.
[23:13] <aberrant> wiki definitely needs an update :)
[23:13] <connor_k> cool :-) have fun kernel hacking!
[23:13] <aberrant> assuming this works.
[23:13] <aberrant> Thank you very much. Hopefully this patch 1) works, and 2) gets into a mainstream kernel build.
[23:14] <aberrant> nasty bug.
[23:15] <aberrant> ok, gonna let this crank. I'll be back to let you know outcome one way or another :)
[23:17] <connor_k> sounds good to me :-)
[23:18] <aberrant> thanks again, connor_k - greatly appreciated.
[23:19] <connor_k> no problem! happy to help
[23:22] <aberrant> just to confirm, this will build 3 .deb packages, and I just copy those over to the hypervisor and do a dpkg -i on each?
[23:23] <connor_k> you'll only need the ones that are -*image*.deb -*modules*.deb
[23:23] <connor_k> unless you're gonna compile DKMS packages on the kernel you're installing, in which case you'll want the -*headers*.deb too
[23:23] <aberrant> dunno what those are, so .. no.
[23:23] <aberrant> how do I uninstall if this gives me problems?
[23:24] <aberrant> will dpkg -r do it?
[23:24] <connor_k> there should be a version number in the *.deb name, I usually do "dpkg --get-selections | grep linux" and look for the linux-image package with the version number that's encoded in your deb name, then "apt remove THAT_PACKAGE"
[23:28] <aberrant> does that restore the old kernel?
[23:29] <connor_k> when you reboot after uninstalling, yeah it'll look for the newest kernel (which will be the one you were running before you installed your test kernel)
[23:29] <aberrant> ah, right. Cool!
[23:34] <aberrant> still building, so I'm headed home. Will check later. Thanks again.
[23:34] <connor_k> Np! have a good evening!
[23:38] <aberrant> wow, build just finished.
[23:38] <aberrant> make -j6 bindeb-pkg now