LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 08-04-2018, 04:25 AM   #1
lfsu123
LQ Newbie
 
Registered: Aug 2018
Posts: 7

Rep: Reputation: Disabled
Exclamation LFS-How to Remove old Kernel from LFS System ?


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.
 
Old 08-04-2018, 05:56 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,574
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
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.
 
Old 08-04-2018, 07:16 AM   #3
lfsu123
LQ Newbie
 
Registered: Aug 2018
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hazel View Post
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.

Last edited by lfsu123; 08-04-2018 at 07:18 AM.
 
Old 08-04-2018, 07:24 AM   #4
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
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
 
Old 08-04-2018, 07:43 AM   #5
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,574
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
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.
 
Old 08-04-2018, 07:55 AM   #6
lfsu123
LQ Newbie
 
Registered: Aug 2018
Posts: 7

Original Poster
Rep: Reputation: Disabled
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.
 
Old 08-04-2018, 09:35 AM   #7
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
Quote:
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.
 
Old 08-04-2018, 10:35 AM   #8
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,574
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
Quote:
Originally Posted by spiky0011 View Post
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.
 
Old 08-04-2018, 10:46 AM   #9
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
Hazel

Just tried make modules_install over same, no errors here.

Had to try it as I dont normally rebuild same kernel
 
Old 08-04-2018, 11:08 AM   #10
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,574
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
Ah! I think it's because my root account aliases mv to mv -i.
 
Old 08-04-2018, 02:18 PM   #11
lfsu123
LQ Newbie
 
Registered: Aug 2018
Posts: 7

Original Poster
Rep: Reputation: Disabled
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?
 
Old 08-04-2018, 02:48 PM   #12
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
You can use the config file from ubuntu/boot, dont know how this will work out tho.

cp -v ubuntu/boot/config-XXX /mnt/lfs/linux-X.X.X/.config

should do it.
 
Old 08-04-2018, 02:54 PM   #13
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,574
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
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!
 
Old 08-05-2018, 04:54 AM   #14
lfsu123
LQ Newbie
 
Registered: Aug 2018
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hazel View Post
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.
 
Old 08-05-2018, 05:52 AM   #15
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
Is there firmware required for the wifi?
An option is cp ubuntus firmware dir to lfs

But all this is defeating the object of LFS, to learn

Last edited by spiky0011; 08-05-2018 at 05:53 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LFS error: boot lfs, Kernel panic -not syncing:VFS unable to mount root fs on unknown-block(0,0) XinyuLi Linux From Scratch 4 05-16-2017 01:17 AM
[SOLVED] my new LFS system displays a my host system slackware kernel version Carl_cj Slackware 8 11-17-2014 06:22 AM
[SOLVED] LFS: Error during Linux-3.5.2 kernel compilation (LFS 7.2, Section 8.3) erkant Linux From Scratch 10 11-30-2012 02:44 PM
[SOLVED] LFS 6.7 : $LFS/sources and $LFS/tools folders missing prakashsince92 Linux From Scratch 5 12-09-2010 02:26 PM
Can't boot LFS ( kernel panic - not syncing ) LFS 6.6 Lyle Linux From Scratch 14 05-15-2010 03:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 05:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration