Discussion:
[foreman-users] Changing the grub configuration of a provisioned VM?
Johannes Kastl
2017-03-27 14:06:38 UTC
Permalink
Hi all,

I use Foreman to provision VMs in my local libvirt installation. When
provisioning Ubuntu 16.04, I can't access the VM after provisioning and
only get a black screen in virt-manager. The reason for this is that the
vt.handoff parameter in the VMs grub-configuration conflicts with my VMs
graphics card somehow.

Workaround: Use another graphics card inside the VM (vmvga seems to work).

Question:
Can I influence the grub2 configuration of the VM via Foreman? I mean
the configuration of the finished VM, not the PXE stuff.

Sorry for bothering the list, but I only find lots of things regarding
the *PXE* grub configuration of Foreman, not the configuration of the
resulting VM.

I'd be thankfor for RTFM or Links, I just can't seem to find them in the
whole PXE-grub-heap... ;-)

Johannes
--
Johannes Kastl
Linux Consultant & Trainer
Tel.: +49 (0) 151 2372 5802
Mail: ***@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Lukas Zapletal
2017-03-28 07:36:42 UTC
Permalink
Absolutely you can. It's just a template called "PXEGrub2 default
local boot" and you can either modify it or use host parameters with
hostgroups to do per-host or per-group options.

LZ
Post by Johannes Kastl
Hi all,
I use Foreman to provision VMs in my local libvirt installation. When
provisioning Ubuntu 16.04, I can't access the VM after provisioning and
only get a black screen in virt-manager. The reason for this is that the
vt.handoff parameter in the VMs grub-configuration conflicts with my VMs
graphics card somehow.
Workaround: Use another graphics card inside the VM (vmvga seems to work).
Can I influence the grub2 configuration of the VM via Foreman? I mean
the configuration of the finished VM, not the PXE stuff.
Sorry for bothering the list, but I only find lots of things regarding
the *PXE* grub configuration of Foreman, not the configuration of the
resulting VM.
I'd be thankfor for RTFM or Links, I just can't seem to find them in the
whole PXE-grub-heap... ;-)
Johannes
--
Johannes Kastl
Linux Consultant & Trainer
Tel.: +49 (0) 151 2372 5802
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
--
Later,
Lukas @lzap Zapletal
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Johannes Kastl
2017-03-28 07:39:39 UTC
Permalink
Hi Lukas,
Post by Lukas Zapletal
Absolutely you can. It's just a template called "PXEGrub2 default
local boot" and you can either modify it or use host parameters with
hostgroups to do per-host or per-group options.
I thought that was modifying the PXE configuration, not the one that the
machine has on its local hard drive after provisioning?

Johannes
--
Johannes Kastl
Linux Consultant & Trainer
Tel.: +49 (0) 151 2372 5802
Mail: ***@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Lukas Zapletal
2017-03-28 09:40:56 UTC
Permalink
There are two templates, one is when you are in BUILD mode, the other
is for the non-BUILD mode:

provisioning_templates/PXEGrub2/pxegrub2_default_local_boot.erb
provisioning_templates/PXEGrub2/pxegrub2_global_default.erb

LZ
Post by Johannes Kastl
Hi Lukas,
Post by Lukas Zapletal
Absolutely you can. It's just a template called "PXEGrub2 default
local boot" and you can either modify it or use host parameters with
hostgroups to do per-host or per-group options.
I thought that was modifying the PXE configuration, not the one that the
machine has on its local hard drive after provisioning?
Johannes
--
Johannes Kastl
Linux Consultant & Trainer
Tel.: +49 (0) 151 2372 5802
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
--
Later,
Lukas @lzap Zapletal
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Johannes Kastl
2017-03-28 10:36:25 UTC
Permalink
Hi Lukas,
Post by Lukas Zapletal
There are two templates, one is when you are in BUILD mode, the other
provisioning_templates/PXEGrub2/pxegrub2_default_local_boot.erb
provisioning_templates/PXEGrub2/pxegrub2_global_default.erb
Correct me if I'm wrong:
The pxegrub2_default_local_boot does nothing more than chainload the
bootloader installed on the machine's hard disk (unless it is an EFI
Post by Lukas Zapletal
menuentry "Chainload into BIOS bootloader on first disk" {
set root=(hd0,0)
chainloader +1
}
(This is actually from the pxegrub2_chainload snippet that gets included
in the pxegrub2_default_local_boot template)

So with a normal bios boot, it just boots the machine via PXE and tells
it to chainload the bootloader in the mbr and boot from that.

What I am interested in is the configuration of this bootloader in the
mbr. I.e. the one, that can be configured on the machine itself
(/boot/grub/grub.cfg).

I hope I could clarify what I want to achieve.

I tried to do some stuff via preseed, but it never got called
apparently. I'm debugging this right now, but have not got any clue this
far.

Johannes
--
Johannes Kastl
Linux Consultant & Trainer
Tel.: +49 (0) 151 2372 5802
Mail: ***@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Lukas Zapletal
2017-03-28 13:26:43 UTC
Permalink
Oh that one, I don't know. Anaconda in RHEL can configure something,
but definitely not everything. Do a post install scriplet... It's just
bunch of config files.

LZ
Post by Johannes Kastl
Hi Lukas,
Post by Lukas Zapletal
There are two templates, one is when you are in BUILD mode, the other
provisioning_templates/PXEGrub2/pxegrub2_default_local_boot.erb
provisioning_templates/PXEGrub2/pxegrub2_global_default.erb
The pxegrub2_default_local_boot does nothing more than chainload the
bootloader installed on the machine's hard disk (unless it is an EFI
Post by Lukas Zapletal
menuentry "Chainload into BIOS bootloader on first disk" {
set root=(hd0,0)
chainloader +1
}
(This is actually from the pxegrub2_chainload snippet that gets included
in the pxegrub2_default_local_boot template)
So with a normal bios boot, it just boots the machine via PXE and tells
it to chainload the bootloader in the mbr and boot from that.
What I am interested in is the configuration of this bootloader in the
mbr. I.e. the one, that can be configured on the machine itself
(/boot/grub/grub.cfg).
I hope I could clarify what I want to achieve.
I tried to do some stuff via preseed, but it never got called
apparently. I'm debugging this right now, but have not got any clue this
far.
Johannes
--
Johannes Kastl
Linux Consultant & Trainer
Tel.: +49 (0) 151 2372 5802
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
--
Later,
Lukas @lzap Zapletal
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Johannes Kastl
2017-03-28 14:17:59 UTC
Permalink
Post by Lukas Zapletal
Oh that one, I don't know. Anaconda in RHEL can configure something,
but definitely not everything. Do a post install scriplet... It's just
bunch of config files.
I was hoping for a more specific answer... ;-(

I tried the following (using preseed, as its an Ubuntu system, that is
being deployed).

I cloned the "Preseed default user data" template and added the
following lines, but they were never executed (at least I found no trace
Post by Lukas Zapletal
/bin/sed -i".BAK" 's/vt_handoff="1"/vt_handoff="0"/' /target/etc/grub.d/10_linux
+/usr/bin/touch /target/root/PRESEED_HAS_RUN
/usr/sbin/update-grub
I tried various version, with and without the /target/, with the path to
sed being "/target/bin/sed" or without full paths.

Then I cloned the "Preseed default finish" template and added these
commands, but this resulted in an error during preseed, although the
error shows the previous wget command returning an error.

In the presed finish template there are a couple of sed commands, that
do not use the /target prefix. I'll try and adapt that one again and see
if it works.

In the meantime: Has anyone enhanced the preseed finish template and
could show me an example? Or has anyone got any RTFMfor me?

Thanks in advance,
Johannes
--
Johannes Kastl
Linux Consultant & Trainer
Tel.: +49 (0) 151 2372 5802
Mail: ***@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Johannes Kastl
2017-03-28 14:47:25 UTC
Permalink
Post by Johannes Kastl
Then I cloned the "Preseed default finish" template and added these
commands, but this resulted in an error during preseed, although the
error shows the previous wget command returning an error.
I retested in the "Preseed default finish" and it worked. I'll try to
put it into a snippet and add it conditionally, but basically this is
Post by Johannes Kastl
<%
# safemode renderer does not support unary negation
%>
/bin/sed -i".BAK" 's/vt_handoff="1"/vt_handoff="0"/' /etc/grub.d/10_linux
/usr/sbin/update-grub
Johannes
--
Johannes Kastl
Linux Consultant & Trainer
Tel.: +49 (0) 151 2372 5802
Mail: ***@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Loading...