Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Greetings everyone, I build my own Linux From Scratch System couple of days ago,I Want to remove the linux kernel it is currently runing, like completely remove it from LFS system (Not the OS--Im using ubuntu btw). Is there any way to do that?
Any Sort of help would be appreciated Thanks!.
P.S Bare with me as im new to linux world.
Edit : I have LFS 8.2. Also if there is any information needed,please let me know.
You can't boot any kind of Linux without a kernel! The kernel is the thing the bootloader looks for and loads. Then the kernel loads init (or systemd) and that brings up the rest of your system. So why would you want to remove the kernel from your new LFS system? You would make it unbootable. Or are you planning to use your Ubuntu kernel instead, in a kind of hybrid system? Please be a bit more explicit.
You can't boot any kind of Linux without a kernel! The kernel is the thing the bootloader looks for and loads. Then the kernel loads init (or systemd) and that brings up the rest of your system. So why would you want to remove the kernel from your new LFS system? You would make it unbootable. Or are you planning to use your Ubuntu kernel instead, in a kind of hybrid system? Please be a bit more explicit.
I understand your point, kernel is must to boot into the OS. But the thing is,in attempt to fix the networking issue in my LFS system, I messed around in kernel files and directories, and honestly I didnt know what I was doing, Now I have lost track of the changes I did, and want to remove the linux kernels (I have 2 kernels in there, only the lastest version is used to boot up the system) from the LFS and replace it with clean new version of linux kernel so that I can properly configure everything in there using the configuration I have in my Ubuntu system.
Is there any way to remove the kernels in LFS system via Host System ?
P.S: LFS boots up, but still I want the kernels in there removed and replaced with the linux kernel I want with my settings so that it can be properly configured with my drives and so on. Cheers.
You can simple remove the vmlinuz-X.X.X from /boot. keeping the 1 you are using. What I would do is mv the old 1 somewhere just to make sure it's the correct 1 then reboot LFS if all ok you can rm the 1 you moved.itit
Of course, having done all that, you'll also have to update grub. In standard LFS, you don't have scripts to do that automatically, so you'll have to do a hand edit of grub.cfg.
By just removing vmlinuz-X.X.X from /boot, would it remove all the files associated with the linux kernel ? Like different directories and drivers etc ? If not, then this is not the solution I am looking for.I want to remove both of the kernels via Host System such that It would remove the linux kernel and all the files associated with it, and have LFS system like it was before we install any kernel in it, is it possible to make it like that without having to rebuilt the system ? If yes, then please tell me how, Im struggling with the system for a few days now.
By just removing vmlinuz-X.X.X from /boot, would it remove all the files associated with the linux kernel
Yes. they are all built in to the vmlinuz, there is also /lib/modules/X.X.X But if you built the same version kernel they get over written. If for example you built kernel 4.15.3 then built a newer version kernel 4.17.10 then in /lib/modules you will have 2 dirs each 1 correspondes to the kernel, so you can remove which 1 you dont want. Again I would save them somewhere else 1st, just incase.
As hazel said you have to have a kernel to boot LFS, otherwise you will have to chroot back in rebuild a kernel.
Yes. they are all built in to the vmlinuz, there is also /lib/modules/X.X.X But if you built the same version kernel they get over written.
In my experience they don't unless I have used the option to add a suffix to the internal version number. Otherwise I just get an error message when I try to run make modules_install. What I need to do is to first rename /lib/modules/x.y.z to /lib/modules/x.y.z.old. Then I run make modules_install, so that it creates a new modules directory. If I've added a suffix, I don't get that problem.
Remember to copy .config to /boot/config-x.y.z. That way you'll have a permanent record of all your kernel settings.
Thanks alot for helpful replies, I think I will get latest stable kernel and chroot in to rebuilt kernel. One more thing, since i dont want to configure my hardware and pheriphal drivers, can I use kernel setting of ubuntu since all of my hardware works well with ubuntu including my wifi adapter, which caused me all this trouble in LFS, so I want ubuntu settings in ther LFS kernel, how do I do that?
If you really want to do that, it's easy. Just copy the config file from the Ubuntu boot directory to be your .config for the build. But I wouldn't recommend it. Stock kernels include driver modules for every kind of hardware imaginable, since the distro devs have no idea what kind of hardware the system will be running on. And they need an initrd image so that the appropriate disk controllers and filesystem drivers can be loaded.
The whole point of building your own kernel is that you can scrap all drivers for hardware you don't have and all filesystems that you don't use, and build what you do use right into the core of the kernel so that you don't need an initrd. Result: a small kernel and a fast boot. Also it's a good learning experience. But: your system, your rules!
If you really want to do that, it's easy. Just copy the config file from the Ubuntu boot directory to be your .config for the build. But I wouldn't recommend it. Stock kernels include driver modules for every kind of hardware imaginable, since the distro devs have no idea what kind of hardware the system will be running on. And they need an initrd image so that the appropriate disk controllers and filesystem drivers can be loaded.
The whole point of building your own kernel is that you can scrap all drivers for hardware you don't have and all filesystems that you don't use, and build what you do use right into the core of the kernel so that you don't need an initrd. Result: a small kernel and a fast boot. Also it's a good learning experience. But: your system, your rules!
I understand that ideally I would want kernel customized to my machine for better performance, but even before ending up with 2 kernels, I tried that, but with that my keyboard and Wifi adapter was not working when booted in LFS system, after that I copied config file from ubuntu to LFS even though it fixed my issue with keyboard I couldnt get around the wifi adapter issue, whenever I booted the LFS system, it said that it failed to load my wifi drivers. But again now I know how to play around with kernel more than i did, I will hopefully find solution to this too, and would avoid ubuntu config, but if I had to i would.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.