8

I am ultimately trying to replace xhci_hcd with ehci_hcd since I think it may be causing a start up problem. In order to do so, I need to be able to recompile the kernel apparently. So I tried looking at the wiki to figure out what to do.

After running sudo apt-get build-dep linux-image-$(uname -r), I tried executing the "Modifying the configuration" instructions editconfigs command, here was the output:

linux-signed-4.15.0

➜  linux-signed-4.15.0 sudo fakeroot debian/rules editconfigs
dh editconfigs
dh: Unknown sequence editconfigs (choose from: binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep)
debian/rules:35: recipe for target 'editconfigs' failed
make: *** [editconfigs] Error 2

All the other commands seemed to work. Finally, I tried the advice here which suggested doing

apt-get source linux-source

which, as the OP says, gives an "undersirable" linux-meta folder. And sure enough it failed on edit-configs:

linux-meta-4.15.0.36.38

    ➜  linux-meta-4.15.0.36.38 sudo fakeroot debian/rules editconfigs
    make: *** No rule to make target 'editconfigs'.  Stop.

The OP suggests instead that this command put him "on the right track":

sudo apt install linux-source

giving a source file linux-source-4.15.0 in /usr/src/. However this fails on the clean and editconfig commands both:

clean

➜  linux-source-4.15.0 sudo fakeroot debian/rules clean 
sed: can't read Makefile: No such file or directory
sed: can't read Makefile: No such file or directory
sed: can't read Makefile: No such file or directory
for i in debian.master/control.stub.in; do                                      \
  new=`echo $i | sed 's/\.in$//'`;                                      \
  cat $i | sed -e 's/PKGVER/4.15.0/g'                              \
        -e 's/ABINUM/36/g'                                       \
        -e 's/SRCPKGNAME/linux/g'                             \
        -e 's/=HUMAN=/64 bit x86/g'                                    \
  > $new;                                                               \
done
flavours="debian.master/control.d/vars.generic debian.master/control.d/vars.generic-lpae debian.master/control.d/vars.lowlatency debian.master/control.d/vars.snapdragon";\
for i in $flavours; do                                                  \
  /bin/bash -e debian/scripts/control-create $i "true" |        \
        sed -e 's/PKGVER/4.15.0/g'                                  \
        -e 's/ABINUM/36/g'                                       \
        -e 's/SRCPKGNAME/linux/g'                             \
        -e 's/=HUMAN=/64 bit x86/g'                                    \
        >> debian.master/control.stub;                                          \
done
echo "# placebo control.stub for kernel-wedge flow change" >debian/control.stub
cp debian.master/control.stub debian/control
export KW_DEFCONFIG_DIR=debian.master/d-i && \
export KW_CONFIG_DIR=debian.master/d-i && \
LANG=C kernel-wedge gen-control 4.15.0-36 | \
        perl -f debian/scripts/misc/kernel-wedge-arch.pl amd64 \
        >>/usr/src/linux-source-4.15.0/debian/control
dh_testdir
dh_testroot
dh_clean
# d-i stuff
rm -rf debian.master/d-i-amd64
# Generated on the fly.
rm -f debian.master/d-i/firmware/amd64/kernel-image
# normal build junk
rm -rf debian.master/abi/4.15.0-36.39
rm -rf /usr/src/linux-source-4.15.0/debian/build
rm -f /usr/src/linux-source-4.15.0/debian/stamps/stamp-*
rm -rf debian.master/linux-*
# This gets rid of the d-i packages in control
cp -f debian.master/control.stub debian/control
cp debian.master/changelog debian/changelog
# Install the copyright information.
cp debian.master/copyright debian/copyright
# Install the retpoline extractor.
cp debian/scripts/retpoline-extract-one scripts/ubuntu-retpoline-extract-one
cp: cannot create regular file 'scripts/ubuntu-retpoline-extract-one': No such file or directory
debian/rules:110: recipe for target 'clean' failed
make: *** [clean] Error 1

editconfigs

➜  linux-source-4.15.0 sudo fakeroot debian/rules editconfigs
sed: can't read Makefile: No such file or directory
sed: can't read Makefile: No such file or directory
sed: can't read Makefile: No such file or directory
dh_testdir;
/bin/bash -e debian/scripts/misc/kernelconfig editconfigs
This does not appear to be the kernel source directory.
debian/rules.d/1-maintainer.mk:43: recipe for target 'editconfigs' failed
make: *** [editconfigs] Error 1

Here is my Ubuntu version:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic

Any further ideas?

6
  • Why not just blacklist the modules? Read askubuntu.com/questions/110341/how-to-blacklist-kernel-modules so guessing there's no kernel parameter?
    – Xen2050
    Oct 20, 2018 at 3:21
  • @Xen2050: I'm not sure I just tried adding a thing to /etc/default/grub... I would give more detail, but I also tried this answer too askubuntu.com/a/589031 and I cant seem to get into my computer now...
    – Dair
    Oct 20, 2018 at 4:18
  • Keyboard/mousepad freezes at login screen.
    – Dair
    Oct 20, 2018 at 4:19
  • @Xen2050 And I'm back... I tried adding GRUB_CMDLINE_LINUX_DEFAULT="quiet splash modprobe.blacklist=xhci_hcd" But that didn't seem to do anything if that is what you mean.
    – Dair
    Oct 20, 2018 at 4:45
  • That's unfortunate. I'm not sure what else to try, maybe it's just a minor error in the cp command, like the "scripts" folder doesn't exist
    – Xen2050
    Oct 20, 2018 at 6:47

2 Answers 2

9

I'm using 18.10 and encountered similar problems starting with sudo fakeroot debian/rules clean (ubuntu-retpoline-extract-one': No such file or directory).

What I had to do to get it working:

  • After running apt-get source linux-image-$(uname -r):

    cd /usr/src/linux-source
    bunzip2 linux-source-4.18.0.tar.bz2
    tar xf linux-source-4.18.0.tar 
    mv linux-source-4.18.0/* . # if you don't do this you will get the "ubuntu-retpoline-extract-one no such file" error
    mkdir debian/stamps # otherwise build failure because touch command fails
    
  • Before building (fakeroot debian/rules binary-headers ...):

    apt install bison flex libelf-dev fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge libncurses5 libncurses5-dev libelf-dev asciidoc binutils-dev libudev-dev pciutils-dev # some of these may have already been installed, and some may not even be needed.
    

After that, I could successfully run:

    sudo fakeroot debian/rules clean
    sudo fakeroot debian/rules binary-headers binary-generic binary-perarch
3
  • 1
    This should be the accepted answer, helped me on 18.04.2 ! Mar 5, 2019 at 20:05
  • yeah, it's amazing that there isn't a set of 3-4 commands to rebuild the ubuntu kernel, sad that there's a page with instructions that can't possibly work, but this is what got it going for me too, thanks
    – stu
    Nov 16, 2019 at 20:32
  • ln -s /usr/src/linux-headers-4.*/scripts/ubuntu-retpoline-extract-one scripts/ works. Mar 18, 2020 at 0:31
3

FYI as of 20.10 the list of packages to have installed before building has changed. Note that pciutils-dev has been replaced with libpci-dev. Also the install demands libiberty-dev.

So one needs to do this:

sudo apt install bison flex libelf-dev fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge libncurses5 libncurses5-dev libelf-dev asciidoc binutils-dev libudev-dev libpci-dev libiberty-dev 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .