verify-bugs-and-bisect-regressions.rst 92 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222
  1. .. SPDX-License-Identifier: (GPL-2.0+ OR CC-BY-4.0)
  2. .. [see the bottom of this file for redistribution information]
  3. =========================================
  4. How to verify bugs and bisect regressions
  5. =========================================
  6. This document describes how to check if some Linux kernel problem occurs in code
  7. currently supported by developers -- to then explain how to locate the change
  8. causing the issue, if it is a regression (e.g. did not happen with earlier
  9. versions).
  10. The text aims at people running kernels from mainstream Linux distributions on
  11. commodity hardware who want to report a kernel bug to the upstream Linux
  12. developers. Despite this intent, the instructions work just as well for users
  13. who are already familiar with building their own kernels: they help avoid
  14. mistakes occasionally made even by experienced developers.
  15. ..
  16. Note: if you see this note, you are reading the text's source file. You
  17. might want to switch to a rendered version: it makes it a lot easier to
  18. read and navigate this document -- especially when you want to look something
  19. up in the reference section, then jump back to where you left off.
  20. ..
  21. Find the latest rendered version of this text here:
  22. https://docs.kernel.org/admin-guide/verify-bugs-and-bisect-regressions.html
  23. The essence of the process (aka 'TL;DR')
  24. ========================================
  25. *[If you are new to building or bisecting Linux, ignore this section and head
  26. over to the* ':ref:`step-by-step guide <introguide_bissbs>`' *below. It utilizes
  27. the same commands as this section while describing them in brief fashion. The
  28. steps are nevertheless easy to follow and together with accompanying entries
  29. in a reference section mention many alternatives, pitfalls, and additional
  30. aspects, all of which might be essential in your present case.]*
  31. **In case you want to check if a bug is present in code currently supported by
  32. developers**, execute just the *preparations* and *segment 1*; while doing so,
  33. consider the newest Linux kernel you regularly use to be the 'working' kernel.
  34. In the following example that's assumed to be 6.0, which is why its sources
  35. will be used to prepare the .config file.
  36. **In case you face a regression**, follow the steps at least till the end of
  37. *segment 2*. Then you can submit a preliminary report -- or continue with
  38. *segment 3*, which describes how to perform a bisection needed for a
  39. full-fledged regression report. In the following example 6.0.13 is assumed to be
  40. the 'working' kernel and 6.1.5 to be the first 'broken', which is why 6.0
  41. will be considered the 'good' release and used to prepare the .config file.
  42. * **Preparations**: set up everything to build your own kernels::
  43. # * Remove any software that depends on externally maintained kernel modules
  44. # or builds any automatically during bootup.
  45. # * Ensure Secure Boot permits booting self-compiled Linux kernels.
  46. # * If you are not already running the 'working' kernel, reboot into it.
  47. # * Install compilers and everything else needed for building Linux.
  48. # * Ensure to have 15 Gigabyte free space in your home directory.
  49. git clone -o mainline --no-checkout \
  50. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ~/linux/
  51. cd ~/linux/
  52. git remote add -t master stable \
  53. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
  54. git switch --detach v6.0
  55. # * Hint: if you used an existing clone, ensure no stale .config is around.
  56. make olddefconfig
  57. # * Ensure the former command picked the .config of the 'working' kernel.
  58. # * Connect external hardware (USB keys, tokens, ...), start a VM, bring up
  59. # VPNs, mount network shares, and briefly try the feature that is broken.
  60. yes '' | make localmodconfig
  61. ./scripts/config --set-str CONFIG_LOCALVERSION '-local'
  62. ./scripts/config -e CONFIG_LOCALVERSION_AUTO
  63. # * Note, when short on storage space, check the guide for an alternative:
  64. ./scripts/config -d DEBUG_INFO_NONE -e KALLSYMS_ALL -e DEBUG_KERNEL \
  65. -e DEBUG_INFO -e DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT -e KALLSYMS
  66. # * Hint: at this point you might want to adjust the build configuration;
  67. # you'll have to, if you are running Debian.
  68. make olddefconfig
  69. cp .config ~/kernel-config-working
  70. * **Segment 1**: build a kernel from the latest mainline codebase.
  71. This among others checks if the problem was fixed already and which developers
  72. later need to be told about the problem; in case of a regression, this rules
  73. out a .config change as root of the problem.
  74. a) Checking out latest mainline code::
  75. cd ~/linux/
  76. git switch --discard-changes --detach mainline/master
  77. b) Build, install, and boot a kernel::
  78. cp ~/kernel-config-working .config
  79. make olddefconfig
  80. make -j $(nproc --all)
  81. # * Make sure there is enough disk space to hold another kernel:
  82. df -h /boot/ /lib/modules/
  83. # * Note: on Arch Linux, its derivatives and a few other distributions
  84. # the following commands will do nothing at all or only part of the
  85. # job. See the step-by-step guide for further details.
  86. sudo make modules_install
  87. command -v installkernel && sudo make install
  88. # * Check how much space your self-built kernel actually needs, which
  89. # enables you to make better estimates later:
  90. du -ch /boot/*$(make -s kernelrelease)* | tail -n 1
  91. du -sh /lib/modules/$(make -s kernelrelease)/
  92. # * Hint: the output of the following command will help you pick the
  93. # right kernel from the boot menu:
  94. make -s kernelrelease | tee -a ~/kernels-built
  95. reboot
  96. # * Once booted, ensure you are running the kernel you just built by
  97. # checking if the output of the next two commands matches:
  98. tail -n 1 ~/kernels-built
  99. uname -r
  100. cat /proc/sys/kernel/tainted
  101. c) Check if the problem occurs with this kernel as well.
  102. * **Segment 2**: ensure the 'good' kernel is also a 'working' kernel.
  103. This among others verifies the trimmed .config file actually works well, as
  104. bisecting with it otherwise would be a waste of time:
  105. a) Start by checking out the sources of the 'good' version::
  106. cd ~/linux/
  107. git switch --discard-changes --detach v6.0
  108. b) Build, install, and boot a kernel as described earlier in *segment 1,
  109. section b* -- just feel free to skip the 'du' commands, as you have a rough
  110. estimate already.
  111. c) Ensure the feature that regressed with the 'broken' kernel actually works
  112. with this one.
  113. * **Segment 3**: perform and validate the bisection.
  114. a) Retrieve the sources for your 'bad' version::
  115. git remote set-branches --add stable linux-6.1.y
  116. git fetch stable
  117. b) Initialize the bisection::
  118. cd ~/linux/
  119. git bisect start
  120. git bisect good v6.0
  121. git bisect bad v6.1.5
  122. c) Build, install, and boot a kernel as described earlier in *segment 1,
  123. section b*.
  124. In case building or booting the kernel fails for unrelated reasons, run
  125. ``git bisect skip``. In all other outcomes, check if the regressed feature
  126. works with the newly built kernel. If it does, tell Git by executing
  127. ``git bisect good``; if it does not, run ``git bisect bad`` instead.
  128. All three commands will make Git check out another commit; then re-execute
  129. this step (e.g. build, install, boot, and test a kernel to then tell Git
  130. the outcome). Do so again and again until Git shows which commit broke
  131. things. If you run short of disk space during this process, check the
  132. section 'Complementary tasks: cleanup during and after the process'
  133. below.
  134. d) Once your finished the bisection, put a few things away::
  135. cd ~/linux/
  136. git bisect log > ~/bisect-log
  137. cp .config ~/bisection-config-culprit
  138. git bisect reset
  139. e) Try to verify the bisection result::
  140. git switch --discard-changes --detach mainline/master
  141. git revert --no-edit cafec0cacaca0
  142. cp ~/kernel-config-working .config
  143. ./scripts/config --set-str CONFIG_LOCALVERSION '-local-cafec0cacaca0-reverted'
  144. This is optional, as some commits are impossible to revert. But if the
  145. second command worked flawlessly, build, install, and boot one more kernel
  146. kernel; just this time skip the first command copying the base .config file
  147. over, as that already has been taken care off.
  148. * **Complementary tasks**: cleanup during and after the process.
  149. a) To avoid running out of disk space during a bisection, you might need to
  150. remove some kernels you built earlier. You most likely want to keep those
  151. you built during segment 1 and 2 around for a while, but you will most
  152. likely no longer need kernels tested during the actual bisection
  153. (Segment 3 c). You can list them in build order using::
  154. ls -ltr /lib/modules/*-local*
  155. To then for example erase a kernel that identifies itself as
  156. '6.0-rc1-local-gcafec0cacaca0', use this::
  157. sudo rm -rf /lib/modules/6.0-rc1-local-gcafec0cacaca0
  158. sudo kernel-install -v remove 6.0-rc1-local-gcafec0cacaca0
  159. # * Note, on some distributions kernel-install is missing
  160. # or does only part of the job.
  161. b) If you performed a bisection and successfully validated the result, feel
  162. free to remove all kernels built during the actual bisection (Segment 3 c);
  163. the kernels you built earlier and later you might want to keep around for
  164. a week or two.
  165. * **Optional task**: test a debug patch or a proposed fix later::
  166. git fetch mainline
  167. git switch --discard-changes --detach mainline/master
  168. git apply /tmp/foobars-proposed-fix-v1.patch
  169. cp ~/kernel-config-working .config
  170. ./scripts/config --set-str CONFIG_LOCALVERSION '-local-foobars-fix-v1'
  171. Build, install, and boot a kernel as described in *segment 1, section b* --
  172. but this time omit the first command copying the build configuration over,
  173. as that has been taken care of already.
  174. .. _introguide_bissbs:
  175. Step-by-step guide on how to verify bugs and bisect regressions
  176. ===============================================================
  177. This guide describes how to set up your own Linux kernels for investigating bugs
  178. or regressions you intend to report. How far you want to follow the instructions
  179. depends on your issue:
  180. Execute all steps till the end of *segment 1* to **verify if your kernel problem
  181. is present in code supported by Linux kernel developers**. If it is, you are all
  182. set to report the bug -- unless it did not happen with earlier kernel versions,
  183. as then your want to at least continue with *segment 2* to **check if the issue
  184. qualifies as regression** which receive priority treatment. Depending on the
  185. outcome you then are ready to report a bug or submit a preliminary regression
  186. report; instead of the latter your could also head straight on and follow
  187. *segment 3* to **perform a bisection** for a full-fledged regression report
  188. developers are obliged to act upon.
  189. :ref:`Preparations: set up everything to build your own kernels <introprep_bissbs>`.
  190. :ref:`Segment 1: try to reproduce the problem with the latest codebase <introlatestcheck_bissbs>`.
  191. :ref:`Segment 2: check if the kernels you build work fine <introworkingcheck_bissbs>`.
  192. :ref:`Segment 3: perform a bisection and validate the result <introbisect_bissbs>`.
  193. :ref:`Complementary tasks: cleanup during and after following this guide <introclosure_bissbs>`.
  194. :ref:`Optional tasks: test reverts, patches, or later versions <introoptional_bissbs>`.
  195. The steps in each segment illustrate the important aspects of the process, while
  196. a comprehensive reference section holds additional details for almost all of the
  197. steps. The reference section sometimes also outlines alternative approaches,
  198. pitfalls, as well as problems that might occur at the particular step -- and how
  199. to get things rolling again.
  200. For further details on how to report Linux kernel issues or regressions check
  201. out Documentation/admin-guide/reporting-issues.rst, which works in conjunction
  202. with this document. It among others explains why you need to verify bugs with
  203. the latest 'mainline' kernel (e.g. versions like 6.0, 6.1-rc1, or 6.1-rc6),
  204. even if you face a problem with a kernel from a 'stable/longterm' series
  205. (say 6.0.13).
  206. For users facing a regression that document also explains why sending a
  207. preliminary report after segment 2 might be wise, as the regression and its
  208. culprit might be known already. For further details on what actually qualifies
  209. as a regression check out Documentation/admin-guide/reporting-regressions.rst.
  210. If you run into any problems while following this guide or have ideas how to
  211. improve it, :ref:`please let the kernel developers know <submit_improvements>`.
  212. .. _introprep_bissbs:
  213. Preparations: set up everything to build your own kernels
  214. ---------------------------------------------------------
  215. The following steps lay the groundwork for all further tasks.
  216. Note: the instructions assume you are building and testing on the same
  217. machine; if you want to compile the kernel on another system, check
  218. :ref:`Build kernels on a different machine <buildhost_bis>` below.
  219. .. _backup_bissbs:
  220. * Create a fresh backup and put system repair and restore tools at hand, just
  221. to be prepared for the unlikely case of something going sideways.
  222. [:ref:`details <backup_bisref>`]
  223. .. _vanilla_bissbs:
  224. * Remove all software that depends on externally developed kernel drivers or
  225. builds them automatically. That includes but is not limited to DKMS, openZFS,
  226. VirtualBox, and Nvidia's graphics drivers (including the GPLed kernel module).
  227. [:ref:`details <vanilla_bisref>`]
  228. .. _secureboot_bissbs:
  229. * On platforms with 'Secure Boot' or similar solutions, prepare everything to
  230. ensure the system will permit your self-compiled kernel to boot. The
  231. quickest and easiest way to achieve this on commodity x86 systems is to
  232. disable such techniques in the BIOS setup utility; alternatively, remove
  233. their restrictions through a process initiated by
  234. ``mokutil --disable-validation``.
  235. [:ref:`details <secureboot_bisref>`]
  236. .. _rangecheck_bissbs:
  237. * Determine the kernel versions considered 'good' and 'bad' throughout this
  238. guide:
  239. * Do you follow this guide to verify if a bug is present in the code the
  240. primary developers care for? Then consider the version of the newest kernel
  241. you regularly use currently as 'good' (e.g. 6.0, 6.0.13, or 6.1-rc2).
  242. * Do you face a regression, e.g. something broke or works worse after
  243. switching to a newer kernel version? In that case it depends on the version
  244. range during which the problem appeared:
  245. * Something regressed when updating from a stable/longterm release
  246. (say 6.0.13) to a newer mainline series (like 6.1-rc7 or 6.1) or a
  247. stable/longterm version based on one (say 6.1.5)? Then consider the
  248. mainline release your working kernel is based on to be the 'good'
  249. version (e.g. 6.0) and the first version to be broken as the 'bad' one
  250. (e.g. 6.1-rc7, 6.1, or 6.1.5). Note, at this point it is merely assumed
  251. that 6.0 is fine; this hypothesis will be checked in segment 2.
  252. * Something regressed when switching from one mainline version (say 6.0) to
  253. a later one (like 6.1-rc1) or a stable/longterm release based on it
  254. (say 6.1.5)? Then regard the last working version (e.g. 6.0) as 'good' and
  255. the first broken (e.g. 6.1-rc1 or 6.1.5) as 'bad'.
  256. * Something regressed when updating within a stable/longterm series (say
  257. from 6.0.13 to 6.0.15)? Then consider those versions as 'good' and 'bad'
  258. (e.g. 6.0.13 and 6.0.15), as you need to bisect within that series.
  259. *Note, do not confuse 'good' version with 'working' kernel; the latter term
  260. throughout this guide will refer to the last kernel that has been working
  261. fine.*
  262. [:ref:`details <rangecheck_bisref>`]
  263. .. _bootworking_bissbs:
  264. * Boot into the 'working' kernel and briefly use the apparently broken feature.
  265. [:ref:`details <bootworking_bisref>`]
  266. .. _diskspace_bissbs:
  267. * Ensure to have enough free space for building Linux. 15 Gigabyte in your home
  268. directory should typically suffice. If you have less available, be sure to pay
  269. attention to later steps about retrieving the Linux sources and handling of
  270. debug symbols: both explain approaches reducing the amount of space, which
  271. should allow you to master these tasks with about 4 Gigabytes free space.
  272. [:ref:`details <diskspace_bisref>`]
  273. .. _buildrequires_bissbs:
  274. * Install all software required to build a Linux kernel. Often you will need:
  275. 'bc', 'binutils' ('ld' et al.), 'bison', 'flex', 'gcc', 'git', 'openssl',
  276. 'pahole', 'perl', and the development headers for 'libelf' and 'openssl'. The
  277. reference section shows how to quickly install those on various popular Linux
  278. distributions.
  279. [:ref:`details <buildrequires_bisref>`]
  280. .. _sources_bissbs:
  281. * Retrieve the mainline Linux sources; then change into the directory holding
  282. them, as all further commands in this guide are meant to be executed from
  283. there.
  284. *Note, the following describe how to retrieve the sources using a full
  285. mainline clone, which downloads about 2,75 GByte as of early 2024. The*
  286. :ref:`reference section describes two alternatives <sources_bisref>` *:
  287. one downloads less than 500 MByte, the other works better with unreliable
  288. internet connections.*
  289. Execute the following command to retrieve a fresh mainline codebase while
  290. preparing things to add branches for stable/longterm series later::
  291. git clone -o mainline --no-checkout \
  292. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ~/linux/
  293. cd ~/linux/
  294. git remote add -t master stable \
  295. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
  296. [:ref:`details <sources_bisref>`]
  297. .. _stablesources_bissbs:
  298. * Is one of the versions you earlier established as 'good' or 'bad' a stable or
  299. longterm release (say 6.1.5)? Then download the code for the series it belongs
  300. to ('linux-6.1.y' in this example)::
  301. git remote set-branches --add stable linux-6.1.y
  302. git fetch stable
  303. .. _oldconfig_bissbs:
  304. * Start preparing a kernel build configuration (the '.config' file).
  305. Before doing so, ensure you are still running the 'working' kernel an earlier
  306. step told you to boot; if you are unsure, check the current kernelrelease
  307. identifier using ``uname -r``.
  308. Afterwards check out the source code for the version earlier established as
  309. 'good'. In the following example command this is assumed to be 6.0; note that
  310. the version number in this and all later Git commands needs to be prefixed
  311. with a 'v'::
  312. git switch --discard-changes --detach v6.0
  313. Now create a build configuration file::
  314. make olddefconfig
  315. The kernel build scripts then will try to locate the build configuration file
  316. for the running kernel and then adjust it for the needs of the kernel sources
  317. you checked out. While doing so, it will print a few lines you need to check.
  318. Look out for a line starting with '# using defaults found in'. It should be
  319. followed by a path to a file in '/boot/' that contains the release identifier
  320. of your currently working kernel. If the line instead continues with something
  321. like 'arch/x86/configs/x86_64_defconfig', then the build infra failed to find
  322. the .config file for your running kernel -- in which case you have to put one
  323. there manually, as explained in the reference section.
  324. In case you can not find such a line, look for one containing '# configuration
  325. written to .config'. If that's the case you have a stale build configuration
  326. lying around. Unless you intend to use it, delete it; afterwards run
  327. 'make olddefconfig' again and check if it now picked up the right config file
  328. as base.
  329. [:ref:`details <oldconfig_bisref>`]
  330. .. _localmodconfig_bissbs:
  331. * Disable any kernel modules apparently superfluous for your setup. This is
  332. optional, but especially wise for bisections, as it speeds up the build
  333. process enormously -- at least unless the .config file picked up in the
  334. previous step was already tailored to your and your hardware needs, in which
  335. case you should skip this step.
  336. To prepare the trimming, connect external hardware you occasionally use (USB
  337. keys, tokens, ...), quickly start a VM, and bring up VPNs. And if you rebooted
  338. since you started that guide, ensure that you tried using the feature causing
  339. trouble since you started the system. Only then trim your .config::
  340. yes '' | make localmodconfig
  341. There is a catch to this, as the 'apparently' in initial sentence of this step
  342. and the preparation instructions already hinted at:
  343. The 'localmodconfig' target easily disables kernel modules for features only
  344. used occasionally -- like modules for external peripherals not yet connected
  345. since booting, virtualization software not yet utilized, VPN tunnels, and a
  346. few other things. That's because some tasks rely on kernel modules Linux only
  347. loads when you execute tasks like the aforementioned ones for the first time.
  348. This drawback of localmodconfig is nothing you should lose sleep over, but
  349. something to keep in mind: if something is misbehaving with the kernels built
  350. during this guide, this is most likely the reason. You can reduce or nearly
  351. eliminate the risk with tricks outlined in the reference section; but when
  352. building a kernel just for quick testing purposes this is usually not worth
  353. spending much effort on, as long as it boots and allows to properly test the
  354. feature that causes trouble.
  355. [:ref:`details <localmodconfig_bisref>`]
  356. .. _tagging_bissbs:
  357. * Ensure all the kernels you will build are clearly identifiable using a special
  358. tag and a unique version number::
  359. ./scripts/config --set-str CONFIG_LOCALVERSION '-local'
  360. ./scripts/config -e CONFIG_LOCALVERSION_AUTO
  361. [:ref:`details <tagging_bisref>`]
  362. .. _debugsymbols_bissbs:
  363. * Decide how to handle debug symbols.
  364. In the context of this document it is often wise to enable them, as there is a
  365. decent chance you will need to decode a stack trace from a 'panic', 'Oops',
  366. 'warning', or 'BUG'::
  367. ./scripts/config -d DEBUG_INFO_NONE -e KALLSYMS_ALL -e DEBUG_KERNEL \
  368. -e DEBUG_INFO -e DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT -e KALLSYMS
  369. But if you are extremely short on storage space, you might want to disable
  370. debug symbols instead::
  371. ./scripts/config -d DEBUG_INFO -d DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \
  372. -d DEBUG_INFO_DWARF4 -d DEBUG_INFO_DWARF5 -e CONFIG_DEBUG_INFO_NONE
  373. [:ref:`details <debugsymbols_bisref>`]
  374. .. _configmods_bissbs:
  375. * Check if you may want or need to adjust some other kernel configuration
  376. options:
  377. * Are you running Debian? Then you want to avoid known problems by performing
  378. additional adjustments explained in the reference section.
  379. [:ref:`details <configmods_distros_bisref>`].
  380. * If you want to influence other aspects of the configuration, do so now using
  381. your preferred tool. Note, to use make targets like 'menuconfig' or
  382. 'nconfig', you will need to install the development files of ncurses; for
  383. 'xconfig' you likewise need the Qt5 or Qt6 headers.
  384. [:ref:`details <configmods_individual_bisref>`].
  385. .. _saveconfig_bissbs:
  386. * Reprocess the .config after the latest adjustments and store it in a safe
  387. place::
  388. make olddefconfig
  389. cp .config ~/kernel-config-working
  390. [:ref:`details <saveconfig_bisref>`]
  391. .. _introlatestcheck_bissbs:
  392. Segment 1: try to reproduce the problem with the latest codebase
  393. ----------------------------------------------------------------
  394. The following steps verify if the problem occurs with the code currently
  395. supported by developers. In case you face a regression, it also checks that the
  396. problem is not caused by some .config change, as reporting the issue then would
  397. be a waste of time. [:ref:`details <introlatestcheck_bisref>`]
  398. .. _checkoutmaster_bissbs:
  399. * Check out the latest Linux codebase.
  400. * Are your 'good' and 'bad' versions from the same stable or longterm series?
  401. Then check the `front page of kernel.org <https://kernel.org/>`_: if it
  402. lists a release from that series without an '[EOL]' tag, checkout the series
  403. latest version ('linux-6.1.y' in the following example)::
  404. cd ~/linux/
  405. git switch --discard-changes --detach stable/linux-6.1.y
  406. Your series is unsupported, if is not listed or carrying a 'end of life'
  407. tag. In that case you might want to check if a successor series (say
  408. linux-6.2.y) or mainline (see next point) fix the bug.
  409. * In all other cases, run::
  410. cd ~/linux/
  411. git switch --discard-changes --detach mainline/master
  412. [:ref:`details <checkoutmaster_bisref>`]
  413. .. _build_bissbs:
  414. * Build the image and the modules of your first kernel using the config file you
  415. prepared::
  416. cp ~/kernel-config-working .config
  417. make olddefconfig
  418. make -j $(nproc --all)
  419. If you want your kernel packaged up as deb, rpm, or tar file, see the
  420. reference section for alternatives, which obviously will require other
  421. steps to install as well.
  422. [:ref:`details <build_bisref>`]
  423. .. _install_bissbs:
  424. * Install your newly built kernel.
  425. Before doing so, consider checking if there is still enough space for it::
  426. df -h /boot/ /lib/modules/
  427. For now assume 150 MByte in /boot/ and 200 in /lib/modules/ will suffice; how
  428. much your kernels actually require will be determined later during this guide.
  429. Now install the kernel's modules and its image, which will be stored in
  430. parallel to the your Linux distribution's kernels::
  431. sudo make modules_install
  432. command -v installkernel && sudo make install
  433. The second command ideally will take care of three steps required at this
  434. point: copying the kernel's image to /boot/, generating an initramfs, and
  435. adding an entry for both to the boot loader's configuration.
  436. Sadly some distributions (among them Arch Linux, its derivatives, and many
  437. immutable Linux distributions) will perform none or only some of those tasks.
  438. You therefore want to check if all of them were taken care of and manually
  439. perform those that were not. The reference section provides further details on
  440. that; your distribution's documentation might help, too.
  441. Once you figured out the steps needed at this point, consider writing them
  442. down: if you will build more kernels as described in segment 2 and 3, you will
  443. have to perform those again after executing ``command -v installkernel [...]``.
  444. [:ref:`details <install_bisref>`]
  445. .. _storagespace_bissbs:
  446. * In case you plan to follow this guide further, check how much storage space
  447. the kernel, its modules, and other related files like the initramfs consume::
  448. du -ch /boot/*$(make -s kernelrelease)* | tail -n 1
  449. du -sh /lib/modules/$(make -s kernelrelease)/
  450. Write down or remember those two values for later: they enable you to prevent
  451. running out of disk space accidentally during a bisection.
  452. [:ref:`details <storagespace_bisref>`]
  453. .. _kernelrelease_bissbs:
  454. * Show and store the kernelrelease identifier of the kernel you just built::
  455. make -s kernelrelease | tee -a ~/kernels-built
  456. Remember the identifier momentarily, as it will help you pick the right kernel
  457. from the boot menu upon restarting.
  458. * Reboot into your newly built kernel. To ensure your actually started the one
  459. you just built, you might want to verify if the output of these commands
  460. matches::
  461. tail -n 1 ~/kernels-built
  462. uname -r
  463. .. _tainted_bissbs:
  464. * Check if the kernel marked itself as 'tainted'::
  465. cat /proc/sys/kernel/tainted
  466. If that command does not return '0', check the reference section, as the cause
  467. for this might interfere with your testing.
  468. [:ref:`details <tainted_bisref>`]
  469. .. _recheckbroken_bissbs:
  470. * Verify if your bug occurs with the newly built kernel. If it does not, check
  471. out the instructions in the reference section to ensure nothing went sideways
  472. during your tests.
  473. [:ref:`details <recheckbroken_bisref>`]
  474. .. _recheckstablebroken_bissbs:
  475. * Did you just built a stable or longterm kernel? And were you able to reproduce
  476. the regression with it? Then you should test the latest mainline codebase as
  477. well, because the result determines which developers the bug must be submitted
  478. to.
  479. To prepare that test, check out current mainline::
  480. cd ~/linux/
  481. git switch --discard-changes --detach mainline/master
  482. Now use the checked out code to build and install another kernel using the
  483. commands the earlier steps already described in more detail::
  484. cp ~/kernel-config-working .config
  485. make olddefconfig
  486. make -j $(nproc --all)
  487. # * Check if the free space suffices holding another kernel:
  488. df -h /boot/ /lib/modules/
  489. sudo make modules_install
  490. command -v installkernel && sudo make install
  491. make -s kernelrelease | tee -a ~/kernels-built
  492. reboot
  493. Confirm you booted the kernel you intended to start and check its tainted
  494. status::
  495. tail -n 1 ~/kernels-built
  496. uname -r
  497. cat /proc/sys/kernel/tainted
  498. Now verify if this kernel is showing the problem. If it does, then you need
  499. to report the bug to the primary developers; if it does not, report it to the
  500. stable team. See Documentation/admin-guide/reporting-issues.rst for details.
  501. [:ref:`details <recheckstablebroken_bisref>`]
  502. Do you follow this guide to verify if a problem is present in the code
  503. currently supported by Linux kernel developers? Then you are done at this
  504. point. If you later want to remove the kernel you just built, check out
  505. :ref:`Complementary tasks: cleanup during and after following this guide <introclosure_bissbs>`.
  506. In case you face a regression, move on and execute at least the next segment
  507. as well.
  508. .. _introworkingcheck_bissbs:
  509. Segment 2: check if the kernels you build work fine
  510. ---------------------------------------------------
  511. In case of a regression, you now want to ensure the trimmed configuration file
  512. you created earlier works as expected; a bisection with the .config file
  513. otherwise would be a waste of time. [:ref:`details <introworkingcheck_bisref>`]
  514. .. _recheckworking_bissbs:
  515. * Build your own variant of the 'working' kernel and check if the feature that
  516. regressed works as expected with it.
  517. Start by checking out the sources for the version earlier established as
  518. 'good' (once again assumed to be 6.0 here)::
  519. cd ~/linux/
  520. git switch --discard-changes --detach v6.0
  521. Now use the checked out code to configure, build, and install another kernel
  522. using the commands the previous subsection explained in more detail::
  523. cp ~/kernel-config-working .config
  524. make olddefconfig
  525. make -j $(nproc --all)
  526. # * Check if the free space suffices holding another kernel:
  527. df -h /boot/ /lib/modules/
  528. sudo make modules_install
  529. command -v installkernel && sudo make install
  530. make -s kernelrelease | tee -a ~/kernels-built
  531. reboot
  532. When the system booted, you may want to verify once again that the
  533. kernel you started is the one you just built::
  534. tail -n 1 ~/kernels-built
  535. uname -r
  536. Now check if this kernel works as expected; if not, consult the reference
  537. section for further instructions.
  538. [:ref:`details <recheckworking_bisref>`]
  539. .. _introbisect_bissbs:
  540. Segment 3: perform the bisection and validate the result
  541. --------------------------------------------------------
  542. With all the preparations and precaution builds taken care of, you are now ready
  543. to begin the bisection. This will make you build quite a few kernels -- usually
  544. about 15 in case you encountered a regression when updating to a newer series
  545. (say from 6.0.13 to 6.1.5). But do not worry, due to the trimmed build
  546. configuration created earlier this works a lot faster than many people assume:
  547. overall on average it will often just take about 10 to 15 minutes to compile
  548. each kernel on commodity x86 machines.
  549. .. _bisectstart_bissbs:
  550. * Start the bisection and tell Git about the versions earlier established as
  551. 'good' (6.0 in the following example command) and 'bad' (6.1.5)::
  552. cd ~/linux/
  553. git bisect start
  554. git bisect good v6.0
  555. git bisect bad v6.1.5
  556. [:ref:`details <bisectstart_bisref>`]
  557. .. _bisectbuild_bissbs:
  558. * Now use the code Git checked out to build, install, and boot a kernel using
  559. the commands introduced earlier::
  560. cp ~/kernel-config-working .config
  561. make olddefconfig
  562. make -j $(nproc --all)
  563. # * Check if the free space suffices holding another kernel:
  564. df -h /boot/ /lib/modules/
  565. sudo make modules_install
  566. command -v installkernel && sudo make install
  567. make -s kernelrelease | tee -a ~/kernels-built
  568. reboot
  569. If compilation fails for some reason, run ``git bisect skip`` and restart
  570. executing the stack of commands from the beginning.
  571. In case you skipped the 'test latest codebase' step in the guide, check its
  572. description as for why the 'df [...]' and 'make -s kernelrelease [...]'
  573. commands are here.
  574. Important note: the latter command from this point on will print release
  575. identifiers that might look odd or wrong to you -- which they are not, as it's
  576. totally normal to see release identifiers like '6.0-rc1-local-gcafec0cacaca0'
  577. if you bisect between versions 6.1 and 6.2 for example.
  578. [:ref:`details <bisectbuild_bisref>`]
  579. .. _bisecttest_bissbs:
  580. * Now check if the feature that regressed works in the kernel you just built.
  581. You again might want to start by making sure the kernel you booted is the one
  582. you just built::
  583. cd ~/linux/
  584. tail -n 1 ~/kernels-built
  585. uname -r
  586. Now verify if the feature that regressed works at this kernel bisection point.
  587. If it does, run this::
  588. git bisect good
  589. If it does not, run this::
  590. git bisect bad
  591. Be sure about what you tell Git, as getting this wrong just once will send the
  592. rest of the bisection totally off course.
  593. While the bisection is ongoing, Git will use the information you provided to
  594. find and check out another bisection point for you to test. While doing so, it
  595. will print something like 'Bisecting: 675 revisions left to test after this
  596. (roughly 10 steps)' to indicate how many further changes it expects to be
  597. tested. Now build and install another kernel using the instructions from the
  598. previous step; afterwards follow the instructions in this step again.
  599. Repeat this again and again until you finish the bisection -- that's the case
  600. when Git after tagging a change as 'good' or 'bad' prints something like
  601. 'cafecaca0c0dacafecaca0c0dacafecaca0c0da is the first bad commit'; right
  602. afterwards it will show some details about the culprit including the patch
  603. description of the change. The latter might fill your terminal screen, so you
  604. might need to scroll up to see the message mentioning the culprit;
  605. alternatively, run ``git bisect log > ~/bisection-log``.
  606. [:ref:`details <bisecttest_bisref>`]
  607. .. _bisectlog_bissbs:
  608. * Store Git's bisection log and the current .config file in a safe place before
  609. telling Git to reset the sources to the state before the bisection::
  610. cd ~/linux/
  611. git bisect log > ~/bisection-log
  612. cp .config ~/bisection-config-culprit
  613. git bisect reset
  614. [:ref:`details <bisectlog_bisref>`]
  615. .. _revert_bissbs:
  616. * Try reverting the culprit on top of latest mainline to see if this fixes your
  617. regression.
  618. This is optional, as it might be impossible or hard to realize. The former is
  619. the case, if the bisection determined a merge commit as the culprit; the
  620. latter happens if other changes depend on the culprit. But if the revert
  621. succeeds, it is worth building another kernel, as it validates the result of
  622. a bisection, which can easily deroute; it furthermore will let kernel
  623. developers know, if they can resolve the regression with a quick revert.
  624. Begin by checking out the latest codebase depending on the range you bisected:
  625. * Did you face a regression within a stable/longterm series (say between
  626. 6.0.13 and 6.0.15) that does not happen in mainline? Then check out the
  627. latest codebase for the affected series like this::
  628. git fetch stable
  629. git switch --discard-changes --detach linux-6.0.y
  630. * In all other cases check out latest mainline::
  631. git fetch mainline
  632. git switch --discard-changes --detach mainline/master
  633. If you bisected a regression within a stable/longterm series that also
  634. happens in mainline, there is one more thing to do: look up the mainline
  635. commit-id. To do so, use a command like ``git show abcdcafecabcd`` to
  636. view the patch description of the culprit. There will be a line near
  637. the top which looks like 'commit cafec0cacaca0 upstream.' or
  638. 'Upstream commit cafec0cacaca0'; use that commit-id in the next command
  639. and not the one the bisection blamed.
  640. Now try reverting the culprit by specifying its commit id::
  641. git revert --no-edit cafec0cacaca0
  642. If that fails, give up trying and move on to the next step; if it works,
  643. adjust the tag to facilitate the identification and prevent accidentally
  644. overwriting another kernel::
  645. cp ~/kernel-config-working .config
  646. ./scripts/config --set-str CONFIG_LOCALVERSION '-local-cafec0cacaca0-reverted'
  647. Build a kernel using the familiar command sequence, just without copying the
  648. the base .config over::
  649. make olddefconfig &&
  650. make -j $(nproc --all)
  651. # * Check if the free space suffices holding another kernel:
  652. df -h /boot/ /lib/modules/
  653. sudo make modules_install
  654. command -v installkernel && sudo make install
  655. make -s kernelrelease | tee -a ~/kernels-built
  656. reboot
  657. Now check one last time if the feature that made you perform a bisection works
  658. with that kernel: if everything went well, it should not show the regression.
  659. [:ref:`details <revert_bisref>`]
  660. .. _introclosure_bissbs:
  661. Complementary tasks: cleanup during and after the bisection
  662. -----------------------------------------------------------
  663. During and after following this guide you might want or need to remove some of
  664. the kernels you installed: the boot menu otherwise will become confusing or
  665. space might run out.
  666. .. _makeroom_bissbs:
  667. * To remove one of the kernels you installed, look up its 'kernelrelease'
  668. identifier. This guide stores them in '~/kernels-built', but the following
  669. command will print them as well::
  670. ls -ltr /lib/modules/*-local*
  671. You in most situations want to remove the oldest kernels built during the
  672. actual bisection (e.g. segment 3 of this guide). The two ones you created
  673. beforehand (e.g. to test the latest codebase and the version considered
  674. 'good') might become handy to verify something later -- thus better keep them
  675. around, unless you are really short on storage space.
  676. To remove the modules of a kernel with the kernelrelease identifier
  677. '*6.0-rc1-local-gcafec0cacaca0*', start by removing the directory holding its
  678. modules::
  679. sudo rm -rf /lib/modules/6.0-rc1-local-gcafec0cacaca0
  680. Afterwards try the following command::
  681. sudo kernel-install -v remove 6.0-rc1-local-gcafec0cacaca0
  682. On quite a few distributions this will delete all other kernel files installed
  683. while also removing the kernel's entry from the boot menu. But on some
  684. distributions kernel-install does not exist or leaves boot-loader entries or
  685. kernel image and related files behind; in that case remove them as described
  686. in the reference section.
  687. [:ref:`details <makeroom_bisref>`]
  688. .. _finishingtouch_bissbs:
  689. * Once you have finished the bisection, do not immediately remove anything you
  690. set up, as you might need a few things again. What is safe to remove depends
  691. on the outcome of the bisection:
  692. * Could you initially reproduce the regression with the latest codebase and
  693. after the bisection were able to fix the problem by reverting the culprit on
  694. top of the latest codebase? Then you want to keep those two kernels around
  695. for a while, but safely remove all others with a '-local' in the release
  696. identifier.
  697. * Did the bisection end on a merge-commit or seems questionable for other
  698. reasons? Then you want to keep as many kernels as possible around for a few
  699. days: it's pretty likely that you will be asked to recheck something.
  700. * In other cases it likely is a good idea to keep the following kernels around
  701. for some time: the one built from the latest codebase, the one created from
  702. the version considered 'good', and the last three or four you compiled
  703. during the actual bisection process.
  704. [:ref:`details <finishingtouch_bisref>`]
  705. .. _introoptional_bissbs:
  706. Optional: test reverts, patches, or later versions
  707. --------------------------------------------------
  708. While or after reporting a bug, you might want or potentially will be asked to
  709. test reverts, debug patches, proposed fixes, or other versions. In that case
  710. follow these instructions.
  711. * Update your Git clone and check out the latest code.
  712. * In case you want to test mainline, fetch its latest changes before checking
  713. its code out::
  714. git fetch mainline
  715. git switch --discard-changes --detach mainline/master
  716. * In case you want to test a stable or longterm kernel, first add the branch
  717. holding the series you are interested in (6.2 in the example), unless you
  718. already did so earlier::
  719. git remote set-branches --add stable linux-6.2.y
  720. Then fetch the latest changes and check out the latest version from the
  721. series::
  722. git fetch stable
  723. git switch --discard-changes --detach stable/linux-6.2.y
  724. * Copy your kernel build configuration over::
  725. cp ~/kernel-config-working .config
  726. * Your next step depends on what you want to do:
  727. * In case you just want to test the latest codebase, head to the next step,
  728. you are already all set.
  729. * In case you want to test if a revert fixes an issue, revert one or multiple
  730. changes by specifying their commit ids::
  731. git revert --no-edit cafec0cacaca0
  732. Now give that kernel a special tag to facilitates its identification and
  733. prevent accidentally overwriting another kernel::
  734. ./scripts/config --set-str CONFIG_LOCALVERSION '-local-cafec0cacaca0-reverted'
  735. * In case you want to test a patch, store the patch in a file like
  736. '/tmp/foobars-proposed-fix-v1.patch' and apply it like this::
  737. git apply /tmp/foobars-proposed-fix-v1.patch
  738. In case of multiple patches, repeat this step with the others.
  739. Now give that kernel a special tag to facilitates its identification and
  740. prevent accidentally overwriting another kernel::
  741. ./scripts/config --set-str CONFIG_LOCALVERSION '-local-foobars-fix-v1'
  742. * Build a kernel using the familiar commands, just without copying the kernel
  743. build configuration over, as that has been taken care of already::
  744. make olddefconfig &&
  745. make -j $(nproc --all)
  746. # * Check if the free space suffices holding another kernel:
  747. df -h /boot/ /lib/modules/
  748. sudo make modules_install
  749. command -v installkernel && sudo make install
  750. make -s kernelrelease | tee -a ~/kernels-built
  751. reboot
  752. * Now verify you booted the newly built kernel and check it.
  753. [:ref:`details <introoptional_bisref>`]
  754. .. _submit_improvements:
  755. Conclusion
  756. ----------
  757. You have reached the end of the step-by-step guide.
  758. Did you run into trouble following any of the above steps not cleared up by the
  759. reference section below? Did you spot errors? Or do you have ideas how to
  760. improve the guide?
  761. If any of that applies, please take a moment and let the maintainer of this
  762. document know by email (Thorsten Leemhuis <linux@leemhuis.info>), ideally while
  763. CCing the Linux docs mailing list (linux-doc@vger.kernel.org). Such feedback is
  764. vital to improve this text further, which is in everybody's interest, as it
  765. will enable more people to master the task described here -- and hopefully also
  766. improve similar guides inspired by this one.
  767. Reference section for the step-by-step guide
  768. ============================================
  769. This section holds additional information for almost all the items in the above
  770. step-by-step guide.
  771. Preparations for building your own kernels
  772. ------------------------------------------
  773. *The steps in this section lay the groundwork for all further tests.*
  774. [:ref:`... <introprep_bissbs>`]
  775. The steps in all later sections of this guide depend on those described here.
  776. [:ref:`back to step-by-step guide <introprep_bissbs>`].
  777. .. _backup_bisref:
  778. Prepare for emergencies
  779. ~~~~~~~~~~~~~~~~~~~~~~~
  780. *Create a fresh backup and put system repair and restore tools at hand.*
  781. [:ref:`... <backup_bissbs>`]
  782. Remember, you are dealing with computers, which sometimes do unexpected things
  783. -- especially if you fiddle with crucial parts like the kernel of an operating
  784. system. That's what you are about to do in this process. Hence, better prepare
  785. for something going sideways, even if that should not happen.
  786. [:ref:`back to step-by-step guide <backup_bissbs>`]
  787. .. _vanilla_bisref:
  788. Remove anything related to externally maintained kernel modules
  789. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  790. *Remove all software that depends on externally developed kernel drivers or
  791. builds them automatically.* [:ref:`...<vanilla_bissbs>`]
  792. Externally developed kernel modules can easily cause trouble during a bisection.
  793. But there is a more important reason why this guide contains this step: most
  794. kernel developers will not care about reports about regressions occurring with
  795. kernels that utilize such modules. That's because such kernels are not
  796. considered 'vanilla' anymore, as Documentation/admin-guide/reporting-issues.rst
  797. explains in more detail.
  798. [:ref:`back to step-by-step guide <vanilla_bissbs>`]
  799. .. _secureboot_bisref:
  800. Deal with techniques like Secure Boot
  801. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  802. *On platforms with 'Secure Boot' or similar techniques, prepare everything to
  803. ensure the system will permit your self-compiled kernel to boot later.*
  804. [:ref:`... <secureboot_bissbs>`]
  805. Many modern systems allow only certain operating systems to start; that's why
  806. they reject booting self-compiled kernels by default.
  807. You ideally deal with this by making your platform trust your self-built kernels
  808. with the help of a certificate. How to do that is not described
  809. here, as it requires various steps that would take the text too far away from
  810. its purpose; 'Documentation/admin-guide/module-signing.rst' and various web
  811. sides already explain everything needed in more detail.
  812. Temporarily disabling solutions like Secure Boot is another way to make your own
  813. Linux boot. On commodity x86 systems it is possible to do this in the BIOS Setup
  814. utility; the required steps vary a lot between machines and therefore cannot be
  815. described here.
  816. On mainstream x86 Linux distributions there is a third and universal option:
  817. disable all Secure Boot restrictions for your Linux environment. You can
  818. initiate this process by running ``mokutil --disable-validation``; this will
  819. tell you to create a one-time password, which is safe to write down. Now
  820. restart; right after your BIOS performed all self-tests the bootloader Shim will
  821. show a blue box with a message 'Press any key to perform MOK management'. Hit
  822. some key before the countdown exposes, which will open a menu. Choose 'Change
  823. Secure Boot state'. Shim's 'MokManager' will now ask you to enter three
  824. randomly chosen characters from the one-time password specified earlier. Once
  825. you provided them, confirm you really want to disable the validation.
  826. Afterwards, permit MokManager to reboot the machine.
  827. [:ref:`back to step-by-step guide <secureboot_bissbs>`]
  828. .. _bootworking_bisref:
  829. Boot the last kernel that was working
  830. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  831. *Boot into the last working kernel and briefly recheck if the feature that
  832. regressed really works.* [:ref:`...<bootworking_bissbs>`]
  833. This will make later steps that cover creating and trimming the configuration do
  834. the right thing.
  835. [:ref:`back to step-by-step guide <bootworking_bissbs>`]
  836. .. _diskspace_bisref:
  837. Space requirements
  838. ~~~~~~~~~~~~~~~~~~
  839. *Ensure to have enough free space for building Linux.*
  840. [:ref:`... <diskspace_bissbs>`]
  841. The numbers mentioned are rough estimates with a big extra charge to be on the
  842. safe side, so often you will need less.
  843. If you have space constraints, be sure to hay attention to the :ref:`step about
  844. debug symbols' <debugsymbols_bissbs>` and its :ref:`accompanying reference
  845. section' <debugsymbols_bisref>`, as disabling then will reduce the consumed disk
  846. space by quite a few gigabytes.
  847. [:ref:`back to step-by-step guide <diskspace_bissbs>`]
  848. .. _rangecheck_bisref:
  849. Bisection range
  850. ~~~~~~~~~~~~~~~
  851. *Determine the kernel versions considered 'good' and 'bad' throughout this
  852. guide.* [:ref:`...<rangecheck_bissbs>`]
  853. Establishing the range of commits to be checked is mostly straightforward,
  854. except when a regression occurred when switching from a release of one stable
  855. series to a release of a later series (e.g. from 6.0.13 to 6.1.5). In that case
  856. Git will need some hand holding, as there is no straight line of descent.
  857. That's because with the release of 6.0 mainline carried on to 6.1 while the
  858. stable series 6.0.y branched to the side. It's therefore theoretically possible
  859. that the issue you face with 6.1.5 only worked in 6.0.13, as it was fixed by a
  860. commit that went into one of the 6.0.y releases, but never hit mainline or the
  861. 6.1.y series. Thankfully that normally should not happen due to the way the
  862. stable/longterm maintainers maintain the code. It's thus pretty safe to assume
  863. 6.0 as a 'good' kernel. That assumption will be tested anyway, as that kernel
  864. will be built and tested in the segment '2' of this guide; Git would force you
  865. to do this as well, if you tried bisecting between 6.0.13 and 6.1.15.
  866. [:ref:`back to step-by-step guide <rangecheck_bissbs>`]
  867. .. _buildrequires_bisref:
  868. Install build requirements
  869. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  870. *Install all software required to build a Linux kernel.*
  871. [:ref:`...<buildrequires_bissbs>`]
  872. The kernel is pretty stand-alone, but besides tools like the compiler you will
  873. sometimes need a few libraries to build one. How to install everything needed
  874. depends on your Linux distribution and the configuration of the kernel you are
  875. about to build.
  876. Here are a few examples what you typically need on some mainstream
  877. distributions:
  878. * Arch Linux and derivatives::
  879. sudo pacman --needed -S bc binutils bison flex gcc git kmod libelf openssl \
  880. pahole perl zlib ncurses qt6-base
  881. * Debian, Ubuntu, and derivatives::
  882. sudo apt install bc binutils bison dwarves flex gcc git kmod libelf-dev \
  883. libssl-dev make openssl pahole perl-base pkg-config zlib1g-dev \
  884. libncurses-dev qt6-base-dev g++
  885. * Fedora and derivatives::
  886. sudo dnf install binutils \
  887. /usr/bin/{bc,bison,flex,gcc,git,openssl,make,perl,pahole,rpmbuild} \
  888. /usr/include/{libelf.h,openssl/pkcs7.h,zlib.h,ncurses.h,qt6/QtGui/QAction}
  889. * openSUSE and derivatives::
  890. sudo zypper install bc binutils bison dwarves flex gcc git \
  891. kernel-install-tools libelf-devel make modutils openssl openssl-devel \
  892. perl-base zlib-devel rpm-build ncurses-devel qt6-base-devel
  893. These commands install a few packages that are often, but not always needed. You
  894. for example might want to skip installing the development headers for ncurses,
  895. which you will only need in case you later might want to adjust the kernel build
  896. configuration using make the targets 'menuconfig' or 'nconfig'; likewise omit
  897. the headers of Qt6 if you do not plan to adjust the .config using 'xconfig'.
  898. You furthermore might need additional libraries and their development headers
  899. for tasks not covered in this guide -- for example when building utilities from
  900. the kernel's tools/ directory.
  901. [:ref:`back to step-by-step guide <buildrequires_bissbs>`]
  902. .. _sources_bisref:
  903. Download the sources using Git
  904. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  905. *Retrieve the Linux mainline sources.*
  906. [:ref:`...<sources_bissbs>`]
  907. The step-by-step guide outlines how to download the Linux sources using a full
  908. Git clone of Linus' mainline repository. There is nothing more to say about
  909. that -- but there are two alternatives ways to retrieve the sources that might
  910. work better for you:
  911. * If you have an unreliable internet connection, consider
  912. :ref:`using a 'Git bundle'<sources_bundle_bisref>`.
  913. * If downloading the complete repository would take too long or requires too
  914. much storage space, consider :ref:`using a 'shallow
  915. clone'<sources_shallow_bisref>`.
  916. .. _sources_bundle_bisref:
  917. Downloading Linux mainline sources using a bundle
  918. """""""""""""""""""""""""""""""""""""""""""""""""
  919. Use the following commands to retrieve the Linux mainline sources using a
  920. bundle::
  921. wget -c \
  922. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/clone.bundle
  923. git clone --no-checkout clone.bundle ~/linux/
  924. cd ~/linux/
  925. git remote remove origin
  926. git remote add mainline \
  927. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
  928. git fetch mainline
  929. git remote add -t master stable \
  930. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
  931. In case the 'wget' command fails, just re-execute it, it will pick up where
  932. it left off.
  933. [:ref:`back to step-by-step guide <sources_bissbs>`]
  934. [:ref:`back to section intro <sources_bisref>`]
  935. .. _sources_shallow_bisref:
  936. Downloading Linux mainline sources using a shallow clone
  937. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  938. First, execute the following command to retrieve the latest mainline codebase::
  939. git clone -o mainline --no-checkout --depth 1 -b master \
  940. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ~/linux/
  941. cd ~/linux/
  942. git remote add -t master stable \
  943. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
  944. Now deepen your clone's history to the second predecessor of the mainline
  945. release of your 'good' version. In case the latter are 6.0 or 6.0.13, 5.19 would
  946. be the first predecessor and 5.18 the second -- hence deepen the history up to
  947. that version::
  948. git fetch --shallow-exclude=v5.18 mainline
  949. Afterwards add the stable Git repository as remote and all required stable
  950. branches as explained in the step-by-step guide.
  951. Note, shallow clones have a few peculiar characteristics:
  952. * For bisections the history needs to be deepened a few mainline versions
  953. farther than it seems necessary, as explained above already. That's because
  954. Git otherwise will be unable to revert or describe most of the commits within
  955. a range (say 6.1..6.2), as they are internally based on earlier kernels
  956. releases (like 6.0-rc2 or 5.19-rc3).
  957. * This document in most places uses ``git fetch`` with ``--shallow-exclude=``
  958. to specify the earliest version you care about (or to be precise: its git
  959. tag). You alternatively can use the parameter ``--shallow-since=`` to specify
  960. an absolute (say ``'2023-07-15'``) or relative (``'12 months'``) date to
  961. define the depth of the history you want to download. When using them while
  962. bisecting mainline, ensure to deepen the history to at least 7 months before
  963. the release of the mainline release your 'good' kernel is based on.
  964. * Be warned, when deepening your clone you might encounter an error like
  965. 'fatal: error in object: unshallow cafecaca0c0dacafecaca0c0dacafecaca0c0da'.
  966. In that case run ``git repack -d`` and try again.
  967. [:ref:`back to step-by-step guide <sources_bissbs>`]
  968. [:ref:`back to section intro <sources_bisref>`]
  969. .. _oldconfig_bisref:
  970. Start defining the build configuration for your kernel
  971. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  972. *Start preparing a kernel build configuration (the '.config' file).*
  973. [:ref:`... <oldconfig_bissbs>`]
  974. *Note, this is the first of multiple steps in this guide that create or modify
  975. build artifacts. The commands used in this guide store them right in the source
  976. tree to keep things simple. In case you prefer storing the build artifacts
  977. separately, create a directory like '~/linux-builddir/' and add the parameter
  978. ``O=~/linux-builddir/`` to all make calls used throughout this guide. You will
  979. have to point other commands there as well -- among them the ``./scripts/config
  980. [...]`` commands, which will require ``--file ~/linux-builddir/.config`` to
  981. locate the right build configuration.*
  982. Two things can easily go wrong when creating a .config file as advised:
  983. * The oldconfig target will use a .config file from your build directory, if
  984. one is already present there (e.g. '~/linux/.config'). That's totally fine if
  985. that's what you intend (see next step), but in all other cases you want to
  986. delete it. This for example is important in case you followed this guide
  987. further, but due to problems come back here to redo the configuration from
  988. scratch.
  989. * Sometimes olddefconfig is unable to locate the .config file for your running
  990. kernel and will use defaults, as briefly outlined in the guide. In that case
  991. check if your distribution ships the configuration somewhere and manually put
  992. it in the right place (e.g. '~/linux/.config') if it does. On distributions
  993. where /proc/config.gz exists this can be achieved using this command::
  994. zcat /proc/config.gz > .config
  995. Once you put it there, run ``make olddefconfig`` again to adjust it to the
  996. needs of the kernel about to be built.
  997. Note, the olddefconfig target will set any undefined build options to their
  998. default value. If you prefer to set such configuration options manually, use
  999. ``make oldconfig`` instead. Then for each undefined configuration option you
  1000. will be asked how to proceed; in case you are unsure what to answer, simply hit
  1001. 'enter' to apply the default value. Note though that for bisections you normally
  1002. want to go with the defaults, as you otherwise might enable a new feature that
  1003. causes a problem looking like regressions (for example due to security
  1004. restrictions).
  1005. Occasionally odd things happen when trying to use a config file prepared for one
  1006. kernel (say 6.1) on an older mainline release -- especially if it is much older
  1007. (say 5.15). That's one of the reasons why the previous step in the guide told
  1008. you to boot the kernel where everything works. If you manually add a .config
  1009. file you thus want to ensure it's from the working kernel and not from a one
  1010. that shows the regression.
  1011. In case you want to build kernels for another machine, locate its kernel build
  1012. configuration; usually ``ls /boot/config-$(uname -r)`` will print its name. Copy
  1013. that file to the build machine and store it as ~/linux/.config; afterwards run
  1014. ``make olddefconfig`` to adjust it.
  1015. [:ref:`back to step-by-step guide <oldconfig_bissbs>`]
  1016. .. _localmodconfig_bisref:
  1017. Trim the build configuration for your kernel
  1018. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1019. *Disable any kernel modules apparently superfluous for your setup.*
  1020. [:ref:`... <localmodconfig_bissbs>`]
  1021. As explained briefly in the step-by-step guide already: with localmodconfig it
  1022. can easily happen that your self-built kernels will lack modules for tasks you
  1023. did not perform at least once before utilizing this make target. That happens
  1024. when a task requires kernel modules which are only autoloaded when you execute
  1025. it for the first time. So when you never performed that task since starting your
  1026. kernel the modules will not have been loaded -- and from localmodonfig's point
  1027. of view look superfluous, which thus disables them to reduce the amount of code
  1028. to be compiled.
  1029. You can try to avoid this by performing typical tasks that often will autoload
  1030. additional kernel modules: start a VM, establish VPN connections, loop-mount a
  1031. CD/DVD ISO, mount network shares (CIFS, NFS, ...), and connect all external
  1032. devices (2FA keys, headsets, webcams, ...) as well as storage devices with file
  1033. systems you otherwise do not utilize (btrfs, ext4, FAT, NTFS, XFS, ...). But it
  1034. is hard to think of everything that might be needed -- even kernel developers
  1035. often forget one thing or another at this point.
  1036. Do not let that risk bother you, especially when compiling a kernel only for
  1037. testing purposes: everything typically crucial will be there. And if you forget
  1038. something important you can turn on a missing feature manually later and quickly
  1039. run the commands again to compile and install a kernel that has everything you
  1040. need.
  1041. But if you plan to build and use self-built kernels regularly, you might want to
  1042. reduce the risk by recording which modules your system loads over the course of
  1043. a few weeks. You can automate this with `modprobed-db
  1044. <https://github.com/graysky2/modprobed-db>`_. Afterwards use ``LSMOD=<path>`` to
  1045. point localmodconfig to the list of modules modprobed-db noticed being used::
  1046. yes '' | make LSMOD='${HOME}'/.config/modprobed.db localmodconfig
  1047. That parameter also allows you to build trimmed kernels for another machine in
  1048. case you copied a suitable .config over to use as base (see previous step). Just
  1049. run ``lsmod > lsmod_foo-machine`` on that system and copy the generated file to
  1050. your build's host home directory. Then run these commands instead of the one the
  1051. step-by-step guide mentions::
  1052. yes '' | make LSMOD=~/lsmod_foo-machine localmodconfig
  1053. [:ref:`back to step-by-step guide <localmodconfig_bissbs>`]
  1054. .. _tagging_bisref:
  1055. Tag the kernels about to be build
  1056. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1057. *Ensure all the kernels you will build are clearly identifiable using a
  1058. special tag and a unique version identifier.* [:ref:`... <tagging_bissbs>`]
  1059. This allows you to differentiate your distribution's kernels from those created
  1060. during this process, as the file or directories for the latter will contain
  1061. '-local' in the name; it also helps picking the right entry in the boot menu and
  1062. not lose track of you kernels, as their version numbers will look slightly
  1063. confusing during the bisection.
  1064. [:ref:`back to step-by-step guide <tagging_bissbs>`]
  1065. .. _debugsymbols_bisref:
  1066. Decide to enable or disable debug symbols
  1067. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1068. *Decide how to handle debug symbols.* [:ref:`... <debugsymbols_bissbs>`]
  1069. Having debug symbols available can be important when your kernel throws a
  1070. 'panic', 'Oops', 'warning', or 'BUG' later when running, as then you will be
  1071. able to find the exact place where the problem occurred in the code. But
  1072. collecting and embedding the needed debug information takes time and consumes
  1073. quite a bit of space: in late 2022 the build artifacts for a typical x86 kernel
  1074. trimmed with localmodconfig consumed around 5 Gigabyte of space with debug
  1075. symbols, but less than 1 when they were disabled. The resulting kernel image and
  1076. modules are bigger as well, which increases storage requirements for /boot/ and
  1077. load times.
  1078. In case you want a small kernel and are unlikely to decode a stack trace later,
  1079. you thus might want to disable debug symbols to avoid those downsides. If it
  1080. later turns out that you need them, just enable them as shown and rebuild the
  1081. kernel.
  1082. You on the other hand definitely want to enable them for this process, if there
  1083. is a decent chance that you need to decode a stack trace later. The section
  1084. 'Decode failure messages' in Documentation/admin-guide/reporting-issues.rst
  1085. explains this process in more detail.
  1086. [:ref:`back to step-by-step guide <debugsymbols_bissbs>`]
  1087. .. _configmods_bisref:
  1088. Adjust build configuration
  1089. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1090. *Check if you may want or need to adjust some other kernel configuration
  1091. options:*
  1092. Depending on your needs you at this point might want or have to adjust some
  1093. kernel configuration options.
  1094. .. _configmods_distros_bisref:
  1095. Distro specific adjustments
  1096. """""""""""""""""""""""""""
  1097. *Are you running* [:ref:`... <configmods_bissbs>`]
  1098. The following sections help you to avoid build problems that are known to occur
  1099. when following this guide on a few commodity distributions.
  1100. **Debian:**
  1101. * Remove a stale reference to a certificate file that would cause your build to
  1102. fail::
  1103. ./scripts/config --set-str SYSTEM_TRUSTED_KEYS ''
  1104. Alternatively, download the needed certificate and make that configuration
  1105. option point to it, as `the Debian handbook explains in more detail
  1106. <https://debian-handbook.info/browse/stable/sect.kernel-compilation.html>`_
  1107. -- or generate your own, as explained in
  1108. Documentation/admin-guide/module-signing.rst.
  1109. [:ref:`back to step-by-step guide <configmods_bissbs>`]
  1110. .. _configmods_individual_bisref:
  1111. Individual adjustments
  1112. """"""""""""""""""""""
  1113. *If you want to influence the other aspects of the configuration, do so
  1114. now.* [:ref:`... <configmods_bissbs>`]
  1115. At this point you can use a command like ``make menuconfig`` or ``make nconfig``
  1116. to enable or disable certain features using a text-based user interface; to use
  1117. a graphical configuration utility, run ``make xconfig`` instead. Both of them
  1118. require development libraries from toolkits they are rely on (ncurses
  1119. respectively Qt5 or Qt6); an error message will tell you if something required
  1120. is missing.
  1121. [:ref:`back to step-by-step guide <configmods_bissbs>`]
  1122. .. _saveconfig_bisref:
  1123. Put the .config file aside
  1124. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1125. *Reprocess the .config after the latest changes and store it in a safe place.*
  1126. [:ref:`... <saveconfig_bissbs>`]
  1127. Put the .config you prepared aside, as you want to copy it back to the build
  1128. directory every time during this guide before you start building another
  1129. kernel. That's because going back and forth between different versions can alter
  1130. .config files in odd ways; those occasionally cause side effects that could
  1131. confuse testing or in some cases render the result of your bisection
  1132. meaningless.
  1133. [:ref:`back to step-by-step guide <saveconfig_bissbs>`]
  1134. .. _introlatestcheck_bisref:
  1135. Try to reproduce the problem with the latest codebase
  1136. -----------------------------------------------------
  1137. *Verify the regression is not caused by some .config change and check if it
  1138. still occurs with the latest codebase.* [:ref:`... <introlatestcheck_bissbs>`]
  1139. For some readers it might seem unnecessary to check the latest codebase at this
  1140. point, especially if you did that already with a kernel prepared by your
  1141. distributor or face a regression within a stable/longterm series. But it's
  1142. highly recommended for these reasons:
  1143. * You will run into any problems caused by your setup before you actually begin
  1144. a bisection. That will make it a lot easier to differentiate between 'this
  1145. most likely is some problem in my setup' and 'this change needs to be skipped
  1146. during the bisection, as the kernel sources at that stage contain an unrelated
  1147. problem that causes building or booting to fail'.
  1148. * These steps will rule out if your problem is caused by some change in the
  1149. build configuration between the 'working' and the 'broken' kernel. This for
  1150. example can happen when your distributor enabled an additional security
  1151. feature in the newer kernel which was disabled or not yet supported by the
  1152. older kernel. That security feature might get into the way of something you
  1153. do -- in which case your problem from the perspective of the Linux kernel
  1154. upstream developers is not a regression, as
  1155. Documentation/admin-guide/reporting-regressions.rst explains in more detail.
  1156. You thus would waste your time if you'd try to bisect this.
  1157. * If the cause for your regression was already fixed in the latest mainline
  1158. codebase, you'd perform the bisection for nothing. This holds true for a
  1159. regression you encountered with a stable/longterm release as well, as they are
  1160. often caused by problems in mainline changes that were backported -- in which
  1161. case the problem will have to be fixed in mainline first. Maybe it already was
  1162. fixed there and the fix is already in the process of being backported.
  1163. * For regressions within a stable/longterm series it's furthermore crucial to
  1164. know if the issue is specific to that series or also happens in the mainline
  1165. kernel, as the report needs to be sent to different people:
  1166. * Regressions specific to a stable/longterm series are the stable team's
  1167. responsibility; mainline Linux developers might or might not care.
  1168. * Regressions also happening in mainline are something the regular Linux
  1169. developers and maintainers have to handle; the stable team does not care
  1170. and does not need to be involved in the report, they just should be told
  1171. to backport the fix once it's ready.
  1172. Your report might be ignored if you send it to the wrong party -- and even
  1173. when you get a reply there is a decent chance that developers tell you to
  1174. evaluate which of the two cases it is before they take a closer look.
  1175. [:ref:`back to step-by-step guide <introlatestcheck_bissbs>`]
  1176. .. _checkoutmaster_bisref:
  1177. Check out the latest Linux codebase
  1178. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1179. *Check out the latest Linux codebase.*
  1180. [:ref:`... <checkoutmaster_bissbs>`]
  1181. In case you later want to recheck if an ever newer codebase might fix the
  1182. problem, remember to run that ``git fetch --shallow-exclude [...]`` command
  1183. again mentioned earlier to update your local Git repository.
  1184. [:ref:`back to step-by-step guide <checkoutmaster_bissbs>`]
  1185. .. _build_bisref:
  1186. Build your kernel
  1187. ~~~~~~~~~~~~~~~~~
  1188. *Build the image and the modules of your first kernel using the config file
  1189. you prepared.* [:ref:`... <build_bissbs>`]
  1190. A lot can go wrong at this stage, but the instructions below will help you help
  1191. yourself. Another subsection explains how to directly package your kernel up as
  1192. deb, rpm or tar file.
  1193. Dealing with build errors
  1194. """""""""""""""""""""""""
  1195. When a build error occurs, it might be caused by some aspect of your machine's
  1196. setup that often can be fixed quickly; other times though the problem lies in
  1197. the code and can only be fixed by a developer. A close examination of the
  1198. failure messages coupled with some research on the internet will often tell you
  1199. which of the two it is. To perform such investigation, restart the build
  1200. process like this::
  1201. make V=1
  1202. The ``V=1`` activates verbose output, which might be needed to see the actual
  1203. error. To make it easier to spot, this command also omits the ``-j $(nproc
  1204. --all)`` used earlier to utilize every CPU core in the system for the job -- but
  1205. this parallelism also results in some clutter when failures occur.
  1206. After a few seconds the build process should run into the error again. Now try
  1207. to find the most crucial line describing the problem. Then search the internet
  1208. for the most important and non-generic section of that line (say 4 to 8 words);
  1209. avoid or remove anything that looks remotely system-specific, like your username
  1210. or local path names like ``/home/username/linux/``. First try your regular
  1211. internet search engine with that string, afterwards search Linux kernel mailing
  1212. lists via `lore.kernel.org/all/ <https://lore.kernel.org/all/>`_.
  1213. This most of the time will find something that will explain what is wrong; quite
  1214. often one of the hits will provide a solution for your problem, too. If you
  1215. do not find anything that matches your problem, try again from a different angle
  1216. by modifying your search terms or using another line from the error messages.
  1217. In the end, most issues you run into have likely been encountered and
  1218. reported by others already. That includes issues where the cause is not your
  1219. system, but lies in the code. If you run into one of those, you might thus find
  1220. a solution (e.g. a patch) or workaround for your issue, too.
  1221. Package your kernel up
  1222. """"""""""""""""""""""
  1223. The step-by-step guide uses the default make targets (e.g. 'bzImage' and
  1224. 'modules' on x86) to build the image and the modules of your kernel, which later
  1225. steps of the guide then install. You instead can also directly build everything
  1226. and directly package it up by using one of the following targets:
  1227. * ``make -j $(nproc --all) bindeb-pkg`` to generate a deb package
  1228. * ``make -j $(nproc --all) binrpm-pkg`` to generate a rpm package
  1229. * ``make -j $(nproc --all) tarbz2-pkg`` to generate a bz2 compressed tarball
  1230. This is just a selection of available make targets for this purpose, see
  1231. ``make help`` for others. You can also use these targets after running
  1232. ``make -j $(nproc --all)``, as they will pick up everything already built.
  1233. If you employ the targets to generate deb or rpm packages, ignore the
  1234. step-by-step guide's instructions on installing and removing your kernel;
  1235. instead install and remove the packages using the package utility for the format
  1236. (e.g. dpkg and rpm) or a package management utility build on top of them (apt,
  1237. aptitude, dnf/yum, zypper, ...). Be aware that the packages generated using
  1238. these two make targets are designed to work on various distributions utilizing
  1239. those formats, they thus will sometimes behave differently than your
  1240. distribution's kernel packages.
  1241. [:ref:`back to step-by-step guide <build_bissbs>`]
  1242. .. _install_bisref:
  1243. Put the kernel in place
  1244. ~~~~~~~~~~~~~~~~~~~~~~~
  1245. *Install the kernel you just built.* [:ref:`... <install_bissbs>`]
  1246. What you need to do after executing the command in the step-by-step guide
  1247. depends on the existence and the implementation of ``/sbin/installkernel``
  1248. executable on your distribution.
  1249. If installkernel is found, the kernel's build system will delegate the actual
  1250. installation of your kernel image to this executable, which then performs some
  1251. or all of these tasks:
  1252. * On almost all Linux distributions installkernel will store your kernel's
  1253. image in /boot/, usually as '/boot/vmlinuz-<kernelrelease_id>'; often it will
  1254. put a 'System.map-<kernelrelease_id>' alongside it.
  1255. * On most distributions installkernel will then generate an 'initramfs'
  1256. (sometimes also called 'initrd'), which usually are stored as
  1257. '/boot/initramfs-<kernelrelease_id>.img' or
  1258. '/boot/initrd-<kernelrelease_id>'. Commodity distributions rely on this file
  1259. for booting, hence ensure to execute the make target 'modules_install' first,
  1260. as your distribution's initramfs generator otherwise will be unable to find
  1261. the modules that go into the image.
  1262. * On some distributions installkernel will then add an entry for your kernel
  1263. to your bootloader's configuration.
  1264. You have to take care of some or all of the tasks yourself, if your
  1265. distribution lacks a installkernel script or does only handle part of them.
  1266. Consult the distribution's documentation for details. If in doubt, install the
  1267. kernel manually::
  1268. sudo install -m 0600 $(make -s image_name) /boot/vmlinuz-$(make -s kernelrelease)
  1269. sudo install -m 0600 System.map /boot/System.map-$(make -s kernelrelease)
  1270. Now generate your initramfs using the tools your distribution provides for this
  1271. process. Afterwards add your kernel to your bootloader configuration and reboot.
  1272. [:ref:`back to step-by-step guide <install_bissbs>`]
  1273. .. _storagespace_bisref:
  1274. Storage requirements per kernel
  1275. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1276. *Check how much storage space the kernel, its modules, and other related files
  1277. like the initramfs consume.* [:ref:`... <storagespace_bissbs>`]
  1278. The kernels built during a bisection consume quite a bit of space in /boot/ and
  1279. /lib/modules/, especially if you enabled debug symbols. That makes it easy to
  1280. fill up volumes during a bisection -- and due to that even kernels which used to
  1281. work earlier might fail to boot. To prevent that you will need to know how much
  1282. space each installed kernel typically requires.
  1283. Note, most of the time the pattern '/boot/*$(make -s kernelrelease)*' used in
  1284. the guide will match all files needed to boot your kernel -- but neither the
  1285. path nor the naming scheme are mandatory. On some distributions you thus will
  1286. need to look in different places.
  1287. [:ref:`back to step-by-step guide <storagespace_bissbs>`]
  1288. .. _tainted_bisref:
  1289. Check if your newly built kernel considers itself 'tainted'
  1290. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1291. *Check if the kernel marked itself as 'tainted'.*
  1292. [:ref:`... <tainted_bissbs>`]
  1293. Linux marks itself as tainted when something happens that potentially leads to
  1294. follow-up errors that look totally unrelated. That is why developers might
  1295. ignore or react scantly to reports from tainted kernels -- unless of course the
  1296. kernel set the flag right when the reported bug occurred.
  1297. That's why you want check why a kernel is tainted as explained in
  1298. Documentation/admin-guide/tainted-kernels.rst; doing so is also in your own
  1299. interest, as your testing might be flawed otherwise.
  1300. [:ref:`back to step-by-step guide <tainted_bissbs>`]
  1301. .. _recheckbroken_bisref:
  1302. Check the kernel built from a recent mainline codebase
  1303. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1304. *Verify if your bug occurs with the newly built kernel.*
  1305. [:ref:`... <recheckbroken_bissbs>`]
  1306. There are a couple of reasons why your bug or regression might not show up with
  1307. the kernel you built from the latest codebase. These are the most frequent:
  1308. * The bug was fixed meanwhile.
  1309. * What you suspected to be a regression was caused by a change in the build
  1310. configuration the provider of your kernel carried out.
  1311. * Your problem might be a race condition that does not show up with your kernel;
  1312. the trimmed build configuration, a different setting for debug symbols, the
  1313. compiler used, and various other things can cause this.
  1314. * In case you encountered the regression with a stable/longterm kernel it might
  1315. be a problem that is specific to that series; the next step in this guide will
  1316. check this.
  1317. [:ref:`back to step-by-step guide <recheckbroken_bissbs>`]
  1318. .. _recheckstablebroken_bisref:
  1319. Check the kernel built from the latest stable/longterm codebase
  1320. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1321. *Are you facing a regression within a stable/longterm release, but failed to
  1322. reproduce it with the kernel you just built using the latest mainline sources?
  1323. Then check if the latest codebase for the particular series might already fix
  1324. the problem.* [:ref:`... <recheckstablebroken_bissbs>`]
  1325. If this kernel does not show the regression either, there most likely is no need
  1326. for a bisection.
  1327. [:ref:`back to step-by-step guide <recheckstablebroken_bissbs>`]
  1328. .. _introworkingcheck_bisref:
  1329. Ensure the 'good' version is really working well
  1330. ------------------------------------------------
  1331. *Check if the kernels you build work fine.*
  1332. [:ref:`... <introworkingcheck_bissbs>`]
  1333. This section will reestablish a known working base. Skipping it might be
  1334. appealing, but is usually a bad idea, as it does something important:
  1335. It will ensure the .config file you prepared earlier actually works as expected.
  1336. That is in your own interest, as trimming the configuration is not foolproof --
  1337. and you might be building and testing ten or more kernels for nothing before
  1338. starting to suspect something might be wrong with the build configuration.
  1339. That alone is reason enough to spend the time on this, but not the only reason.
  1340. Many readers of this guide normally run kernels that are patched, use add-on
  1341. modules, or both. Those kernels thus are not considered 'vanilla' -- therefore
  1342. it's possible that the thing that regressed might never have worked in vanilla
  1343. builds of the 'good' version in the first place.
  1344. There is a third reason for those that noticed a regression between
  1345. stable/longterm kernels of different series (e.g. 6.0.13..6.1.5): it will
  1346. ensure the kernel version you assumed to be 'good' earlier in the process (e.g.
  1347. 6.0) actually is working.
  1348. [:ref:`back to step-by-step guide <introworkingcheck_bissbs>`]
  1349. .. _recheckworking_bisref:
  1350. Build your own version of the 'good' kernel
  1351. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1352. *Build your own variant of the working kernel and check if the feature that
  1353. regressed works as expected with it.* [:ref:`... <recheckworking_bissbs>`]
  1354. In case the feature that broke with newer kernels does not work with your first
  1355. self-built kernel, find and resolve the cause before moving on. There are a
  1356. multitude of reasons why this might happen. Some ideas where to look:
  1357. * Check the taint status and the output of ``dmesg``, maybe something unrelated
  1358. went wrong.
  1359. * Maybe localmodconfig did something odd and disabled the module required to
  1360. test the feature? Then you might want to recreate a .config file based on the
  1361. one from the last working kernel and skip trimming it down; manually disabling
  1362. some features in the .config might work as well to reduce the build time.
  1363. * Maybe it's not a kernel regression and something that is caused by some fluke,
  1364. a broken initramfs (also known as initrd), new firmware files, or an updated
  1365. userland software?
  1366. * Maybe it was a feature added to your distributor's kernel which vanilla Linux
  1367. at that point never supported?
  1368. Note, if you found and fixed problems with the .config file, you want to use it
  1369. to build another kernel from the latest codebase, as your earlier tests with
  1370. mainline and the latest version from an affected stable/longterm series were
  1371. most likely flawed.
  1372. [:ref:`back to step-by-step guide <recheckworking_bissbs>`]
  1373. Perform a bisection and validate the result
  1374. -------------------------------------------
  1375. *With all the preparations and precaution builds taken care of, you are now
  1376. ready to begin the bisection.* [:ref:`... <introbisect_bissbs>`]
  1377. The steps in this segment perform and validate the bisection.
  1378. [:ref:`back to step-by-step guide <introbisect_bissbs>`].
  1379. .. _bisectstart_bisref:
  1380. Start the bisection
  1381. ~~~~~~~~~~~~~~~~~~~
  1382. *Start the bisection and tell Git about the versions earlier established as
  1383. 'good' and 'bad'.* [:ref:`... <bisectstart_bissbs>`]
  1384. This will start the bisection process; the last of the commands will make Git
  1385. check out a commit round about half-way between the 'good' and the 'bad' changes
  1386. for you to test.
  1387. [:ref:`back to step-by-step guide <bisectstart_bissbs>`]
  1388. .. _bisectbuild_bisref:
  1389. Build a kernel from the bisection point
  1390. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1391. *Build, install, and boot a kernel from the code Git checked out using the
  1392. same commands you used earlier.* [:ref:`... <bisectbuild_bissbs>`]
  1393. There are two things worth of note here:
  1394. * Occasionally building the kernel will fail or it might not boot due some
  1395. problem in the code at the bisection point. In that case run this command::
  1396. git bisect skip
  1397. Git will then check out another commit nearby which with a bit of luck should
  1398. work better. Afterwards restart executing this step.
  1399. * Those slightly odd looking version identifiers can happen during bisections,
  1400. because the Linux kernel subsystems prepare their changes for a new mainline
  1401. release (say 6.2) before its predecessor (e.g. 6.1) is finished. They thus
  1402. base them on a somewhat earlier point like 6.1-rc1 or even 6.0 -- and then
  1403. get merged for 6.2 without rebasing nor squashing them once 6.1 is out. This
  1404. leads to those slightly odd looking version identifiers coming up during
  1405. bisections.
  1406. [:ref:`back to step-by-step guide <bisectbuild_bissbs>`]
  1407. .. _bisecttest_bisref:
  1408. Bisection checkpoint
  1409. ~~~~~~~~~~~~~~~~~~~~
  1410. *Check if the feature that regressed works in the kernel you just built.*
  1411. [:ref:`... <bisecttest_bissbs>`]
  1412. Ensure what you tell Git is accurate: getting it wrong just one time will bring
  1413. the rest of the bisection totally off course, hence all testing after that point
  1414. will be for nothing.
  1415. [:ref:`back to step-by-step guide <bisecttest_bissbs>`]
  1416. .. _bisectlog_bisref:
  1417. Put the bisection log away
  1418. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1419. *Store Git's bisection log and the current .config file in a safe place.*
  1420. [:ref:`... <bisectlog_bissbs>`]
  1421. As indicated above: declaring just one kernel wrongly as 'good' or 'bad' will
  1422. render the end result of a bisection useless. In that case you'd normally have
  1423. to restart the bisection from scratch. The log can prevent that, as it might
  1424. allow someone to point out where a bisection likely went sideways -- and then
  1425. instead of testing ten or more kernels you might only have to build a few to
  1426. resolve things.
  1427. The .config file is put aside, as there is a decent chance that developers might
  1428. ask for it after you report the regression.
  1429. [:ref:`back to step-by-step guide <bisectlog_bissbs>`]
  1430. .. _revert_bisref:
  1431. Try reverting the culprit
  1432. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1433. *Try reverting the culprit on top of the latest codebase to see if this fixes
  1434. your regression.* [:ref:`... <revert_bissbs>`]
  1435. This is an optional step, but whenever possible one you should try: there is a
  1436. decent chance that developers will ask you to perform this step when you bring
  1437. the bisection result up. So give it a try, you are in the flow already, building
  1438. one more kernel shouldn't be a big deal at this point.
  1439. The step-by-step guide covers everything relevant already except one slightly
  1440. rare thing: did you bisected a regression that also happened with mainline using
  1441. a stable/longterm series, but Git failed to revert the commit in mainline? Then
  1442. try to revert the culprit in the affected stable/longterm series -- and if that
  1443. succeeds, test that kernel version instead.
  1444. [:ref:`back to step-by-step guide <revert_bissbs>`]
  1445. Cleanup steps during and after following this guide
  1446. ---------------------------------------------------
  1447. *During and after following this guide you might want or need to remove some
  1448. of the kernels you installed.* [:ref:`... <introclosure_bissbs>`]
  1449. The steps in this section describe clean-up procedures.
  1450. [:ref:`back to step-by-step guide <introclosure_bissbs>`].
  1451. .. _makeroom_bisref:
  1452. Cleaning up during the bisection
  1453. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1454. *To remove one of the kernels you installed, look up its 'kernelrelease'
  1455. identifier.* [:ref:`... <makeroom_bissbs>`]
  1456. The kernels you install during this process are easy to remove later, as its
  1457. parts are only stored in two places and clearly identifiable. You thus do not
  1458. need to worry to mess up your machine when you install a kernel manually (and
  1459. thus bypass your distribution's packaging system): all parts of your kernels are
  1460. relatively easy to remove later.
  1461. One of the two places is a directory in /lib/modules/, which holds the modules
  1462. for each installed kernel. This directory is named after the kernel's release
  1463. identifier; hence, to remove all modules for one of the kernels you built,
  1464. simply remove its modules directory in /lib/modules/.
  1465. The other place is /boot/, where typically two up to five files will be placed
  1466. during installation of a kernel. All of them usually contain the release name in
  1467. their file name, but how many files and their exact names depend somewhat on
  1468. your distribution's installkernel executable and its initramfs generator. On
  1469. some distributions the ``kernel-install remove...`` command mentioned in the
  1470. step-by-step guide will delete all of these files for you while also removing
  1471. the menu entry for the kernel from your bootloader configuration. On others you
  1472. have to take care of these two tasks yourself. The following command should
  1473. interactively remove the three main files of a kernel with the release name
  1474. '6.0-rc1-local-gcafec0cacaca0'::
  1475. rm -i /boot/{System.map,vmlinuz,initr}-6.0-rc1-local-gcafec0cacaca0
  1476. Afterwards check for other files in /boot/ that have
  1477. '6.0-rc1-local-gcafec0cacaca0' in their name and consider deleting them as well.
  1478. Now remove the boot entry for the kernel from your bootloader's configuration;
  1479. the steps to do that vary quite a bit between Linux distributions.
  1480. Note, be careful with wildcards like '*' when deleting files or directories
  1481. for kernels manually: you might accidentally remove files of a 6.0.13 kernel
  1482. when all you want is to remove 6.0 or 6.0.1.
  1483. [:ref:`back to step-by-step guide <makeroom_bissbs>`]
  1484. Cleaning up after the bisection
  1485. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1486. .. _finishingtouch_bisref:
  1487. *Once you have finished the bisection, do not immediately remove anything
  1488. you set up, as you might need a few things again.*
  1489. [:ref:`... <finishingtouch_bissbs>`]
  1490. When you are really short of storage space removing the kernels as described in
  1491. the step-by-step guide might not free as much space as you would like. In that
  1492. case consider running ``rm -rf ~/linux/*`` as well now. This will remove the
  1493. build artifacts and the Linux sources, but will leave the Git repository
  1494. (~/linux/.git/) behind -- a simple ``git reset --hard`` thus will bring the
  1495. sources back.
  1496. Removing the repository as well would likely be unwise at this point: there
  1497. is a decent chance developers will ask you to build another kernel to
  1498. perform additional tests -- like testing a debug patch or a proposed fix.
  1499. Details on how to perform those can be found in the section :ref:`Optional
  1500. tasks: test reverts, patches, or later versions <introoptional_bissbs>`.
  1501. Additional tests are also the reason why you want to keep the
  1502. ~/kernel-config-working file around for a few weeks.
  1503. [:ref:`back to step-by-step guide <finishingtouch_bissbs>`]
  1504. .. _introoptional_bisref:
  1505. Test reverts, patches, or later versions
  1506. ----------------------------------------
  1507. *While or after reporting a bug, you might want or potentially will be asked
  1508. to test reverts, patches, proposed fixes, or other versions.*
  1509. [:ref:`... <introoptional_bissbs>`]
  1510. All the commands used in this section should be pretty straight forward, so
  1511. there is not much to add except one thing: when setting a kernel tag as
  1512. instructed, ensure it is not much longer than the one used in the example, as
  1513. problems will arise if the kernelrelease identifier exceeds 63 characters.
  1514. [:ref:`back to step-by-step guide <introoptional_bissbs>`].
  1515. Additional information
  1516. ======================
  1517. .. _buildhost_bis:
  1518. Build kernels on a different machine
  1519. ------------------------------------
  1520. To compile kernels on another system, slightly alter the step-by-step guide's
  1521. instructions:
  1522. * Start following the guide on the machine where you want to install and test
  1523. the kernels later.
  1524. * After executing ':ref:`Boot into the working kernel and briefly use the
  1525. apparently broken feature <bootworking_bissbs>`', save the list of loaded
  1526. modules to a file using ``lsmod > ~/test-machine-lsmod``. Then locate the
  1527. build configuration for the running kernel (see ':ref:`Start defining the
  1528. build configuration for your kernel <oldconfig_bisref>`' for hints on where
  1529. to find it) and store it as '~/test-machine-config-working'. Transfer both
  1530. files to the home directory of your build host.
  1531. * Continue the guide on the build host (e.g. with ':ref:`Ensure to have enough
  1532. free space for building [...] <diskspace_bissbs>`').
  1533. * When you reach ':ref:`Start preparing a kernel build configuration[...]
  1534. <oldconfig_bissbs>`': before running ``make olddefconfig`` for the first time,
  1535. execute the following command to base your configuration on the one from the
  1536. test machine's 'working' kernel::
  1537. cp ~/test-machine-config-working ~/linux/.config
  1538. * During the next step to ':ref:`disable any apparently superfluous kernel
  1539. modules <localmodconfig_bissbs>`' use the following command instead::
  1540. yes '' | make localmodconfig LSMOD=~/lsmod_foo-machine localmodconfig
  1541. * Continue the guide, but ignore the instructions outlining how to compile,
  1542. install, and reboot into a kernel every time they come up. Instead build
  1543. like this::
  1544. cp ~/kernel-config-working .config
  1545. make olddefconfig &&
  1546. make -j $(nproc --all) targz-pkg
  1547. This will generate a gzipped tar file whose name is printed in the last
  1548. line shown; for example, a kernel with the kernelrelease identifier
  1549. '6.0.0-rc1-local-g928a87efa423' built for x86 machines usually will
  1550. be stored as '~/linux/linux-6.0.0-rc1-local-g928a87efa423-x86.tar.gz'.
  1551. Copy that file to your test machine's home directory.
  1552. * Switch to the test machine to check if you have enough space to hold another
  1553. kernel. Then extract the file you transferred::
  1554. sudo tar -xvzf ~/linux-6.0.0-rc1-local-g928a87efa423-x86.tar.gz -C /
  1555. Afterwards :ref:`generate the initramfs and add the kernel to your boot
  1556. loader's configuration <install_bisref>`; on some distributions the following
  1557. command will take care of both these tasks::
  1558. sudo /sbin/installkernel 6.0.0-rc1-local-g928a87efa423 /boot/vmlinuz-6.0.0-rc1-local-g928a87efa423
  1559. Now reboot and ensure you started the intended kernel.
  1560. This approach even works when building for another architecture: just install
  1561. cross-compilers and add the appropriate parameters to every invocation of make
  1562. (e.g. ``make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- [...]``).
  1563. Additional reading material
  1564. ---------------------------
  1565. * The `man page for 'git bisect' <https://git-scm.com/docs/git-bisect>`_ and
  1566. `fighting regressions with 'git bisect' <https://git-scm.com/docs/git-bisect-lk2009.html>`_
  1567. in the Git documentation.
  1568. * `Working with git bisect <https://nathanchance.dev/posts/working-with-git-bisect/>`_
  1569. from kernel developer Nathan Chancellor.
  1570. * `Using Git bisect to figure out when brokenness was introduced <http://webchick.net/node/99>`_.
  1571. * `Fully automated bisecting with 'git bisect run' <https://lwn.net/Articles/317154>`_.
  1572. ..
  1573. end-of-content
  1574. ..
  1575. This document is maintained by Thorsten Leemhuis <linux@leemhuis.info>. If
  1576. you spot a typo or small mistake, feel free to let him know directly and
  1577. he'll fix it. You are free to do the same in a mostly informal way if you
  1578. want to contribute changes to the text -- but for copyright reasons please CC
  1579. linux-doc@vger.kernel.org and 'sign-off' your contribution as
  1580. Documentation/process/submitting-patches.rst explains in the section 'Sign
  1581. your work - the Developer's Certificate of Origin'.
  1582. ..
  1583. This text is available under GPL-2.0+ or CC-BY-4.0, as stated at the top
  1584. of the file. If you want to distribute this text under CC-BY-4.0 only,
  1585. please use 'The Linux kernel development community' for author attribution
  1586. and link this as source:
  1587. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/admin-guide/verify-bugs-and-bisect-regressions.rst
  1588. ..
  1589. Note: Only the content of this RST file as found in the Linux kernel sources
  1590. is available under CC-BY-4.0, as versions of this text that were processed
  1591. (for example by the kernel's build system) might contain content taken from
  1592. files which use a more restrictive license.