3

Is it possible to develop the Ubuntu kernel on the same computer that one works on?

How?

Note: Really couldn't discover the answer from the website.


https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel#Testing_the_new_kernel

partially suggests to test it on the same machine. But it does not say anything about what to do if the system does not work after reboot. However, it also doesn't specify whether upgrading via dpkg is anything similar to installing it from a USB stick.

mavavilj
  • 211
  • 1
    What do you mean by "develop Ubuntu"? Could you explain? Developing a kernel? A part of GUI? A particular application? I'm pretty sure you can do this. However testing the code you develop is another thing and this will probably require a separate computer or a VM. – raj Mar 03 '23 at 14:39
  • What do you mean by develop and why you think it might not be possible to do on the computer one works on and what's different about the computer one works on that makes it debatable? – Raffa Mar 03 '23 at 14:40
  • @Raffa Because if the new build breaks, then one may also lose the earlier. – mavavilj Mar 03 '23 at 14:41
  • @raj Yes, but I couldn't find info on the official website. I also didn't understand whether it's possible to setup a VM that behaves exactly the same as a native installation. A good answer should consider the kernel and user space cases. – mavavilj Mar 03 '23 at 14:41
  • 1
    I guess you need to dive into terminology a little bit ... Developing an OS using another running OS i.e. designing, writing code, making graphics, compiling ... etc. will not interfere with the running OS ... The new OS can then be tested in a VM or on bare metal at a different machine used for testing ... So, developing is normally done in a running OS and it can be Ubuntu as well ... Plus this is a general question and unless you narrow it down to a clear reproducible situation, I doubt it can be answered squarely. – Raffa Mar 03 '23 at 14:51
  • @Raffa The core issue is that I cannot find an official recommendation about what to do. – mavavilj Mar 03 '23 at 15:01
  • sure by why would you? use a virtual instance and you can make easy copies of your work. If the current one breaks use the previous one. – Rinzwind Mar 03 '23 at 15:01
  • @Rinzwind How do I set up such? – mavavilj Mar 03 '23 at 15:01
  • That's a very general and wide criteria ... Think what is it that you want ... e.g. customize the installation ISO like e.g. https://itsfoss.com/create-custom-linux-mint-iso/ or is it another specific thing? what is it? ... Do you get what I mean? I hope I explained well. Tell us exactly what you intend to do step by step ... and notice each step might take a whole separate post/question to answer it ... It's that big ... So, narrow it :-) – Raffa Mar 03 '23 at 15:09
  • install virtual box, install ubuntu in that and edit that version – Rinzwind Mar 03 '23 at 15:14
  • @user535733 Or answer that it is possible, but not recommended, and there is or isn't an official doc for it. – mavavilj Mar 03 '23 at 15:15
  • 1
    @Raffa I think it's OK now. – karel Mar 03 '23 at 15:26
  • For over a decade I have done kernel development on the same computer I run the test kernels on. I've never had a problem where simply re-booting to a known proper Ubuntu release kernel didn't provide an escape path. However, the computer is a dedicated test computer, just in case. I can not use a VM for a lot of the work I do. – Doug Smythies Mar 03 '23 at 16:42

1 Answers1

3

Generally, you protect your machine from development mistakes the same way you protect it from all other mistakes.

  • Do risky operations in a virtual environment.
  • Backups and handy reinstall media.
  • Safe and secure habits.

For some hardware-specific kernel development, a virtual environment simply is not possible. Then you must mitigate your risk other ways. For example, by simulating the hardware. Or by asking another person to review your code. Or by using different hardware for your testing.

The key to good risk management (keeping your system running well) is to be honest about the likelihood and severity of your risks, and to be creative and open to effective mitigations.

user535733
  • 62,253
  • On the first point, it’s worth noting that QEMU can be passed a Linux kernel image to boot into directly (instead of needing a virtual disk image with a bootloader and everything else a ‘normal’ distro needs). This is essentially the de-facto standard method among most kernel developers for testing kernel code that does not require specific hardware and does not involve interaction with a bootloader. – Austin Hemmelgarn Mar 03 '23 at 23:51