public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
@ 2013-09-01 17:30 Canek Peláez Valdés
  2013-09-01 18:01 ` Stefan G. Weichinger
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Canek Peláez Valdés @ 2013-09-01 17:30 UTC (permalink / raw
  To: gentoo-user

I am following vanilla-sources in all my machines, which is what
people like Greg Kroah-Hartman actually recommends [1][2]. Since they
are now never stabilized [3], this means that I need to update them
pretty regularly to keep them safe.

This implies that I have to change the /usr/src/linux symbolic link,
configure the kernel using make oldconfig, compile it, install it,
install its modules, reemerge any package that provides kernel modules
(if any), regenerate its initramfs, regenerate the GRUB2 config file
OR adding a new entry in GRUB.

None of this steps are particularly difficult, but any mistake in one
of them can result in an unbootable system. So I wrote a little script
that takes care of each of this steps automagically:

https://github.com/canek-pelaez/kerninst

So now everytime I need to use a new kernel version, I only do:

# eselect kernel set <new-kernel>
# kerninst

Everything is done by the script.

The script is 167 lines of Bash, and I think is pretty easy to follow
what it does. Any of the steps can be called individually, and I have
been using it in all of my machines without any problem. It works with
both GRUB and GRUB2, generating a very simple GRUB config file for
every image available in /boot, with corresponding inird line if
availabe.

WARNINGS

• If /usr/src/linux points to /usr/src/linux-3.10.10, then the script
deletes /boot vmlinuz-3.10.10, /boot/initrd-3.10.10 *and*
/lib/modules/3.10.10.
• The script *WILL* overwrite your GRUB/GRUB2 configuration file, so
make a copy before trying it.
• The script requires a valid kernel .config file which will be copied
into /usrc/src/linux, and then used to configure the kernel with:

      yes "" | make oldconfig

   Some people recommend not doing this, and it can stall if a new
option for the kernel requires an answer with no default value.
• The script only supports dracut, but adding genkernel (or any other
initramfs maker) should be easy. Patches accepted. Dracut should be
already configured.
• I have only tested it with vanilla-sources, but probably will work
with other *-sources packages.

I have been using it in all of my machines for some days now, and it
works for me; but I take no responsibility if it breaks your machine,
or if it kills your dog.

Regards.

[1] http://article.gmane.org/gmane.linux.gentoo.devel/86496
[2] http://article.gmane.org/gmane.linux.gentoo.devel/86506
[3] http://article.gmane.org/gmane.linux.gentoo.devel/87015
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
  2013-09-01 17:30 [gentoo-user] kerninst (was Optional /usr merge in Gentoo) Canek Peláez Valdés
@ 2013-09-01 18:01 ` Stefan G. Weichinger
  2013-09-01 18:16   ` Canek Peláez Valdés
  2013-09-03 15:01 ` Douglas J Hunley
  2013-10-02 11:48 ` Stefan G. Weichinger
  2 siblings, 1 reply; 12+ messages in thread
From: Stefan G. Weichinger @ 2013-09-01 18:01 UTC (permalink / raw
  To: gentoo-user

Am 01.09.2013 19:30, schrieb Canek Peláez Valdés:

> I have been using it in all of my machines for some days now, and it
> works for me; but I take no responsibility if it breaks your machine,
> or if it kills your dog.

So far the cat still lives ... your script worked fine here in the first
try.

Some syntax error in line 26 as far as syntax highlighting in vim tells
me ... everything red from down there ... but it works ...

I got to figure out why I get multiple entries for one version right now
... my /boot might need some pre-cleanup ... but otherwise: great, thanks!

I pull linux-git into a directory aside from /usr/src ... this doesn't
work with the current version AFAI see ... I will simply move my
git-repo ...

Stefan




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
  2013-09-01 18:01 ` Stefan G. Weichinger
@ 2013-09-01 18:16   ` Canek Peláez Valdés
  2013-09-01 18:29     ` Stefan G. Weichinger
  0 siblings, 1 reply; 12+ messages in thread
From: Canek Peláez Valdés @ 2013-09-01 18:16 UTC (permalink / raw
  To: gentoo-user

On Sun, Sep 1, 2013 at 1:01 PM, Stefan G. Weichinger <lists@xunil.at> wrote:
> Am 01.09.2013 19:30, schrieb Canek Peláez Valdés:
>
>> I have been using it in all of my machines for some days now, and it
>> works for me; but I take no responsibility if it breaks your machine,
>> or if it kills your dog.
>
> So far the cat still lives ... your script worked fine here in the first
> try.
>
> Some syntax error in line 26 as far as syntax highlighting in vim tells
> me ... everything red from down there ... but it works ...

Well, a proper editor, like Emacs, highlights correcty Bash regex :P

> I got to figure out why I get multiple entries for one version right now
> ... my /boot might need some pre-cleanup ... but otherwise: great, thanks!

It should put an entry for every /boot/vmlinuz-* file.

> I pull linux-git into a directory aside from /usr/src ... this doesn't
> work with the current version AFAI see ... I will simply move my
> git-repo ...

If the /usr/src/linux symlink points to linux-git, then the version
should be "git" and everything should work. Otherwise is a bug.

Thanks for trying it.

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
  2013-09-01 18:16   ` Canek Peláez Valdés
@ 2013-09-01 18:29     ` Stefan G. Weichinger
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan G. Weichinger @ 2013-09-01 18:29 UTC (permalink / raw
  To: gentoo-user

Am 01.09.2013 20:16, schrieb Canek Peláez Valdés:
> On Sun, Sep 1, 2013 at 1:01 PM, Stefan G. Weichinger <lists@xunil.at> wrote:

>> Some syntax error in line 26 as far as syntax highlighting in vim tells
>> me ... everything red from down there ... but it works ...
> 
> Well, a proper editor, like Emacs, highlights correcty Bash regex :P

open your beer, gentleman ... editor-discussions ahead ;-)  ... no, not
really ....

>> I got to figure out why I get multiple entries for one version right now
>> ... my /boot might need some pre-cleanup ... but otherwise: great, thanks!
> 
> It should put an entry for every /boot/vmlinuz-* file.

Hmm, yes ... got 2 entries for 3.10.10 ... but I clean up and retest ...

>> I pull linux-git into a directory aside from /usr/src ... this doesn't
>> work with the current version AFAI see ... I will simply move my
>> git-repo ...
> 
> If the /usr/src/linux symlink points to linux-git, then the version
> should be "git" and everything should work. Otherwise is a bug.

bug. Does not work so far here. Seems it doesn't like "git" as version
when building the modules or something.

Sorry, no time right now to further test it .. maybe more tomorrow.

Thank you, Stefan


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
  2013-09-01 17:30 [gentoo-user] kerninst (was Optional /usr merge in Gentoo) Canek Peláez Valdés
  2013-09-01 18:01 ` Stefan G. Weichinger
@ 2013-09-03 15:01 ` Douglas J Hunley
  2013-09-03 16:19   ` Canek Peláez Valdés
  2013-10-02 11:48 ` Stefan G. Weichinger
  2 siblings, 1 reply; 12+ messages in thread
From: Douglas J Hunley @ 2013-09-03 15:01 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

On Sun, Sep 1, 2013 at 1:30 PM, Canek Peláez Valdés <caneko@gmail.com>wrote:

> • If /usr/src/linux points to /usr/src/linux-3.10.10, then the script
> deletes /boot vmlinuz-3.10.10, /boot/initrd-3.10.10 *and*
> /lib/modules/3.10.10.
>

Why not call 'eclean-kernel' instead of reinventing here?


-- 
Douglas J Hunley (doug.hunley@gmail.com)
Twitter: @hunleyd                                               Web:
douglasjhunley.com
G+: http://goo.gl/sajR3

[-- Attachment #2: Type: text/html, Size: 1085 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
  2013-09-03 15:01 ` Douglas J Hunley
@ 2013-09-03 16:19   ` Canek Peláez Valdés
  2013-09-03 16:34     ` Douglas J Hunley
  0 siblings, 1 reply; 12+ messages in thread
From: Canek Peláez Valdés @ 2013-09-03 16:19 UTC (permalink / raw
  To: gentoo-user

On Tue, Sep 3, 2013 at 10:01 AM, Douglas J Hunley <doug.hunley@gmail.com> wrote:
>
> On Sun, Sep 1, 2013 at 1:30 PM, Canek Peláez Valdés <caneko@gmail.com>
> wrote:
>>
>> • If /usr/src/linux points to /usr/src/linux-3.10.10, then the script
>> deletes /boot vmlinuz-3.10.10, /boot/initrd-3.10.10 *and*
>> /lib/modules/3.10.10.
>
>
> Why not call 'eclean-kernel' instead of reinventing here?

Oh, I didn't knew about eclean-kernel until you mentioned it. But the
script does something completely different to eclean-kernel (If I
understood correctly by reading its home page).

eclean-kernel cleans *older* versions of kernel.s The part of the
script you responded to deletes the kernel, initramfs and modules
which have the same version as the kernel to which /usr/src/linux
points to.

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
  2013-09-03 16:19   ` Canek Peláez Valdés
@ 2013-09-03 16:34     ` Douglas J Hunley
  2013-09-03 18:38       ` Stefan G. Weichinger
  0 siblings, 1 reply; 12+ messages in thread
From: Douglas J Hunley @ 2013-09-03 16:34 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 542 bytes --]

On Tue, Sep 3, 2013 at 12:19 PM, Canek Peláez Valdés <caneko@gmail.com>wrote:

> eclean-kernel cleans *older* versions of kernel.s The part of the
> script you responded to deletes the kernel, initramfs and modules
> which have the same version as the kernel to which /usr/src/linux
> points to.
>

Ah, got it. I didn't grok that on the first read thru (obviously)


-- 
Douglas J Hunley (doug.hunley@gmail.com)
Twitter: @hunleyd                                               Web:
douglasjhunley.com
G+: http://goo.gl/sajR3

[-- Attachment #2: Type: text/html, Size: 1106 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
  2013-09-03 16:34     ` Douglas J Hunley
@ 2013-09-03 18:38       ` Stefan G. Weichinger
  2013-09-03 18:40         ` Canek Peláez Valdés
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan G. Weichinger @ 2013-09-03 18:38 UTC (permalink / raw
  To: gentoo-user

Am 03.09.2013 18:34, schrieb Douglas J Hunley:
> On Tue, Sep 3, 2013 at 12:19 PM, Canek Peláez Valdés <caneko@gmail.com>wrote:
> 
>> eclean-kernel cleans *older* versions of kernel.s The part of the
>> script you responded to deletes the kernel, initramfs and modules
>> which have the same version as the kernel to which /usr/src/linux
>> points to.
>>
> 
> Ah, got it. I didn't grok that on the first read thru (obviously)

It might be cool to combine both ... like

"kerninst --just-keep-latest-kernels=2"

or something ;-)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
  2013-09-03 18:38       ` Stefan G. Weichinger
@ 2013-09-03 18:40         ` Canek Peláez Valdés
  0 siblings, 0 replies; 12+ messages in thread
From: Canek Peláez Valdés @ 2013-09-03 18:40 UTC (permalink / raw
  To: gentoo-user

On Tue, Sep 3, 2013 at 1:38 PM, Stefan G. Weichinger <lists@xunil.at> wrote:
> Am 03.09.2013 18:34, schrieb Douglas J Hunley:
>> On Tue, Sep 3, 2013 at 12:19 PM, Canek Peláez Valdés <caneko@gmail.com>wrote:
>>
>>> eclean-kernel cleans *older* versions of kernel.s The part of the
>>> script you responded to deletes the kernel, initramfs and modules
>>> which have the same version as the kernel to which /usr/src/linux
>>> points to.
>>>
>>
>> Ah, got it. I didn't grok that on the first read thru (obviously)
>
> It might be cool to combine both ... like
>
> "kerninst --just-keep-latest-kernels=2"
>
> or something ;-)

It can be done.

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
  2013-09-01 17:30 [gentoo-user] kerninst (was Optional /usr merge in Gentoo) Canek Peláez Valdés
  2013-09-01 18:01 ` Stefan G. Weichinger
  2013-09-03 15:01 ` Douglas J Hunley
@ 2013-10-02 11:48 ` Stefan G. Weichinger
  2013-10-02 16:02   ` Canek Peláez Valdés
  2 siblings, 1 reply; 12+ messages in thread
From: Stefan G. Weichinger @ 2013-10-02 11:48 UTC (permalink / raw
  To: gentoo-user

Am 01.09.2013 19:30, schrieb Canek Peláez Valdés:
> I am following vanilla-sources in all my machines, which is what
> people like Greg Kroah-Hartman actually recommends [1][2]. Since they
> are now never stabilized [3], this means that I need to update them
> pretty regularly to keep them safe.
> 
> This implies that I have to change the /usr/src/linux symbolic link,
> configure the kernel using make oldconfig, compile it, install it,
> install its modules, reemerge any package that provides kernel modules
> (if any), regenerate its initramfs, regenerate the GRUB2 config file
> OR adding a new entry in GRUB.
> 
> None of this steps are particularly difficult, but any mistake in one
> of them can result in an unbootable system. So I wrote a little script
> that takes care of each of this steps automagically:
> 
> https://github.com/canek-pelaez/kerninst
> 
> So now everytime I need to use a new kernel version, I only do:
> 
> # eselect kernel set <new-kernel>
> # kerninst
> 
> Everything is done by the script.


Canek, how to handle changing configs?

AFAI understand I do:

eselect kernel set x
cd /usr/src/linux
make menuconfig
(SAVE .config)
cp .config /etc/kerninst/kernel-config
kerninst

... right?

I am currently struggling with a kernel not showing /dev/kvm ... and
toggling kvm_amd on/module ... etc

Thanks, Stefan



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
  2013-10-02 11:48 ` Stefan G. Weichinger
@ 2013-10-02 16:02   ` Canek Peláez Valdés
  2013-10-09 15:14     ` Stefan G. Weichinger
  0 siblings, 1 reply; 12+ messages in thread
From: Canek Peláez Valdés @ 2013-10-02 16:02 UTC (permalink / raw
  To: gentoo-user

On Wed, Oct 2, 2013 at 6:48 AM, Stefan G. Weichinger <lists@xunil.at> wrote:
> Am 01.09.2013 19:30, schrieb Canek Peláez Valdés:
>> I am following vanilla-sources in all my machines, which is what
>> people like Greg Kroah-Hartman actually recommends [1][2]. Since they
>> are now never stabilized [3], this means that I need to update them
>> pretty regularly to keep them safe.
>>
>> This implies that I have to change the /usr/src/linux symbolic link,
>> configure the kernel using make oldconfig, compile it, install it,
>> install its modules, reemerge any package that provides kernel modules
>> (if any), regenerate its initramfs, regenerate the GRUB2 config file
>> OR adding a new entry in GRUB.
>>
>> None of this steps are particularly difficult, but any mistake in one
>> of them can result in an unbootable system. So I wrote a little script
>> that takes care of each of this steps automagically:
>>
>> https://github.com/canek-pelaez/kerninst
>>
>> So now everytime I need to use a new kernel version, I only do:
>>
>> # eselect kernel set <new-kernel>
>> # kerninst
>>
>> Everything is done by the script.
>
>
> Canek, how to handle changing configs?
>
> AFAI understand I do:
>
> eselect kernel set x
> cd /usr/src/linux
> make menuconfig
> (SAVE .config)
> cp .config /etc/kerninst/kernel-config
> kerninst
>
> ... right?
>
> I am currently struggling with a kernel not showing /dev/kvm ... and
> toggling kvm_amd on/module ... etc

Yeah, that's the way to do it. However, kerninst is not for testing
different configurations of kernels. I suppose you could use it that
way, but I wrote exactly for the opposite case: when you finally have
your configuration nailed down, and just want to automatize the
installation of the kernel.

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] kerninst (was Optional /usr merge in Gentoo)
  2013-10-02 16:02   ` Canek Peláez Valdés
@ 2013-10-09 15:14     ` Stefan G. Weichinger
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan G. Weichinger @ 2013-10-09 15:14 UTC (permalink / raw
  To: gentoo-user

Am 02.10.2013 18:02, schrieb Canek Peláez Valdés:

> Yeah, that's the way to do it. However, kerninst is not for testing
> different configurations of kernels. I suppose you could use it that
> way, but I wrote exactly for the opposite case: when you finally have
> your configuration nailed down, and just want to automatize the
> installation of the kernel.

Another suggestion would be to make the script "save" the config via git
every time it is executed (and there is a difference).

Just an idea ;-)


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-10-09 15:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-01 17:30 [gentoo-user] kerninst (was Optional /usr merge in Gentoo) Canek Peláez Valdés
2013-09-01 18:01 ` Stefan G. Weichinger
2013-09-01 18:16   ` Canek Peláez Valdés
2013-09-01 18:29     ` Stefan G. Weichinger
2013-09-03 15:01 ` Douglas J Hunley
2013-09-03 16:19   ` Canek Peláez Valdés
2013-09-03 16:34     ` Douglas J Hunley
2013-09-03 18:38       ` Stefan G. Weichinger
2013-09-03 18:40         ` Canek Peláez Valdés
2013-10-02 11:48 ` Stefan G. Weichinger
2013-10-02 16:02   ` Canek Peláez Valdés
2013-10-09 15:14     ` Stefan G. Weichinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox