generating kickstart ISO for post-fd OSes (eg CentOS 8) and using it in packer vsphere-iso invocation - iso

I'm having a problem specifying the kickstart source on my Packer vsphere-iso template build. I suspect I'm close, but I'm still seeing that the ks is not found during boot and the install goes Interactive at that point.
In my vsphere-iso packer, I'm saying:
{
"variables":
{
:
"ks" : "CentOS-8-x86_64.ks",
:
"cd_label" : "OEMDRV",
"vmipaddress" : "10.1.8.47",
"vmnetmask" : "255.255.254.0",
"vmgateway" : "10.1.9.254",
"vmnameserver" : "10.1.9.210",
:
},
"builders":
[
{
"type" : "vsphere-iso",
:
"boot_wait" : "5s",
"boot_command":
[
"<esc>",
" linux ks=hd:LABEL={{user `cd_label`}}:/{{user `ks`}}",
" ip={{user `vmipaddress`}}::{{user `vmgateway`}}:{{user `vmnetmask`}}:template:eth0:none",
" nameserver={{user `vmnameserver`}}",
" biosdevname=0 net.ifnames=0",
"<enter>",
"<wait>"
],
:
"cd_files" : ["ks/{{user `ks`}}"],
"cd_label" : "{{user `cd_label`}}",
:
:
}
No, I can't refer it back to an HTTP URL. Trust me, I can't !
I can confirm that ks/CentOS-8-x86_64.ks exists, so I half assume anaconda should find it. Mounting a generated ISO image out of the packer cache dir on the DS shows that yes, it is being built with a non-empty ks file on-board.
I don't think the devname tunings (for actually consistent device naming) is causing a problem here, but I don't discount it.
The boot command ends up rendered as (manual copy, watch for typos):
boot: linux ks=hd:LABEL=OEMDRV:/CentOS-8-x86_64.ks ip=10.1.8.47::10.1.9.254:255.255
.254.0:template:eth0:none nameserver=10.1.9.210 biosdevname=0 net.ifnames=0
Loading ... failed: No such file or directory
boot: _
Something's not right. It's gotta be a dumb typo, as I've got the typical "at wits' end" feeling that always precedes a typo fix.
Can you help me spot it?

I too had the same problem. I didn't want to use HTTP because, reasons.
I wasn't able to get the ks=hd:LABEL=OEMDRV working.
I switched to using cdrom but for some odd reason, I had to explicitly specify /dev/sr1 when using cdrom. sr0 would be the CentOS ISO i'm booting from, so sr1 is the second ISO (that Packer builds and uploads on the fly)
Following your naming convention, I used the equivalent of inst.ks=cdrom:/dev/sr1:/CentOS-8-x86_64.ks and was able to get it working.
Tested using CentOS-8.2.2004-x86_64-minimal.iso

Related

puppet delete a directory and replace it with a link

I am working a Puppet manifest that configures a router in the equipment that I support. The router runs pretty much plain vanilla Debian 8 or 9.
The problem is in the way the SSD on the router is partitioned.I am not able to change the partitioning, so have to work around the fact that the root file system is small. I have found a solution that I am trying to implement in Puppet but my first attempt doesn't feel right to me so I thought I would ask the community.
I have been and am reading the Puppet docs. Unfortunately I don't have my router hand to play with today so I am unable to test my current solution.
My issue is that by df -H the root file system is at 95% capacity and puppet is failing complaining about not enough space. Because of quirky decisions made a long time ago by others, the /opt/ file system is 5 times the size of / and is at 10% usage.
So my solution, tested manually, is to move /var/cache/apt/archives/ to /opt/apt-archives and then create a symlink using:
ln -s /opt/apt-archives /var/cache/apt/archives
That works and allows the puppet run to finish without errors.
My challenge is to implement this operation in a Puppet class
class bh::profiles::move_files {
$source_dir = '/var/cache/apt/archives'
$target_dir = '/opt/apt-cache'
file { $targetDir :
ensure => 'directory',
source => "file://${source_dir}",
recurse => true,
before => File[$source_dir]
}
file { $source_dir :
ensure => 'absent',
purge => true,
resurse => true,
force => true,
ensure => link,
target => "file://${target_dir}"
}
}
It just doesn't feel right to have ensure repeated in one file resource. And based on what I understand of creating links in puppet I would need the same name for the file resource that deletes the archives directory and the one that creates the link.
What am I missing?
Use exec:
exec { 'Link /var/cache/apt/archives':
command => 'mv /var/cache/apt/archives /opt/apt-archives
ln -s /opt/apt-archives /var/cache/apt/archives',
path => '/bin',
unless => 'test -L /var/cache/apt/archives',
}
Note that Puppet was not really designed to solve automation problems like this one, although using Exec it is possible to do most things anyway.
Your solution sounds like a work-around and it is therefore totally ok to implement a work-around using Exec. I would say, just make sure you add some comments explaining why you had to do something like this.

Amend boot cmdline in custom image build

I'm building a custom image that uses the meta-intel layer (I'm targeting Intel boards, such as the Minnowboard Turbot, for instance), and I want to tweak the options for booting.
First problem
As far as I understand, meta-intel uses systemd-boot (via rmc-boot) as EFI_PROVIDER.
So I should be able to override the specific BOOT_TIMEOUT parameter by setting :
SYSTEMD_BOOT_TIMEOUT := "0"
in my custom image, as far as I can see in this file
Unfortunately, that doesn't work (the boot timeout is still 4 seconds). How come ?
Second problem
As well, I would like to append options to the boot.conf file (in /boot/loader/entries, loaded by /boot/loader/loader.conf), such as quiet, or vt.global_cursor_default=0 for instance.
I see in the Intel machine conf that there is an APPEND configuration, but overriding it or appending to it in my custom image doesn't work (it's still not written in the boot.conf file) :
APPEND += "quiet vt.global_cursor_default=0"
I've checked that the configuration is correctly read and it's the case :
$ bitbake my-custom-image -e | grep ^APPEND= -A1 -B1
# " quiet rootwait console=ttyS0,115200 console=tty0${#bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " ro", "", d)}"
APPEND=" quiet vt.global_cursor_default=0 rootwait console=ttyS0,115200 console=tty0"
#
But no matter what I do, the command line doesn't change on the built image.
What do I miss ? There should be a relatively easy way to achieve what I'm after I guess, but so far I have not managed to do it.
Thanks a lot !
I have been looking at the kernel command line parameters for intel platform in Yocto with the meta-intel.
I have noticed differences between the wic and hddimg yocto images.
The hddimg seems to use the rmc boot entry definition whereas the wic image uses the boot entry defined in the wks kickstart.
My machine conf has the following :
WKS_FILE ?= "${#bb.utils.contains_any("EFI_PROVIDER", "systemd-boot rmc-boot", "systemd-bootdisk.wks", "mkefidisk.wks", d)}"
In turns systemd-bootdisk.wks has the following boot entry "boot" :
bootloader --ptable gpt --timeout=5 --append="rootwait rootfstype=ext4 console=ttyS0,115200 console=tty0"
The RMC definition for my Minnowboard Max has 2 entry a boot and an install.
Minnow Max B3 boot
Minnow Max B3 install
I am using the pyro release for Yocto. Perhaps integration of RMC boot definition has been integrated into the wic images.
I am looking for a common place to add the kernel command line parameter. Any idea ?

Unable to run JaCaMo project: how to configure it properly?

I already have a jason project which is running well in Jason and now I am trying to run using JaCaMo. I have both plugins (Jason and JaCaMo) in eclipse. What I am trying to do is in a simple way to compile this current Jason project in JaCaMo for further improvements.
My mas2j file which is running well:
MAS tp_cnp {
infrastructure: Centralised
agents:
i initiator [beliefs="expectedResponses(2)"] #2;
p participant #2;
r rejector #1;
c controller [beliefs="expectedDones(2)"] #1;
aslSourcePath:
"src/asl";
}
The jcm I've created:
mas tp_cnp {
agent i : initiator {
beliefs: message("expectedResponses(2)"),
instances: 2
}
agent p : participant {
instances: 2
}
agent r : rejector
agent c : controller {
beliefs: message("expectedDones(2)"),
}
asl-path: src/asl
}
When I've tryed to run this JaCaMo project the system returned this:
BUILD SUCCESSFUL
Total time: 2 seconds
Launching tp_cnp
reading from file /home/cleber/Projetos/tp_cnp/tp_cnp.jcm ...
JaCaMo is not configured, creating a default configuration.
Wrong configuration for jacamo, current is null
jacamo not found
Wrong configuration for jason, current is null
jason not found
Wrong configuration for jade, current is null
jade not found
Wrong configuration for jason, current is null
jason not found
file /home/cleber/Projetos/tp_cnp/tp_cnp.jcm parsed successfully!
Ant is not properly configured! Current value is /libs
Problem defining the command to run the MAS!
How to configure JaCaMo properly? Is this "translation" (mas2j to jcm) right?
you can configure JaCaMo by running jacamo-XXX.jar application (where XXX is the version). You can either double click on the jar file or run
java -jar jacamo-XXX.jar
You find more details in the JaCaMo "hello world" tutorial, where links for configuring the eclipse plugin or the shell command environment are provided.
Regarding your .jcm file, file names (after ":") must include the .asl:
...
agent i : initiator.asl {
beliefs: message("expectedResponses(2)"),
instances: 2
}
Best,
Jomi

QEMU simple backend tracing dosen't print anything

I'm doing get simple trace file from QEMU.
I followed instructions docs/tracing.txt
with this command "qemu-system-x86_64 -m 2G -trace events=/tmp/events ../qemu/test.img"
i'd like to get just simple trace file.
i've got trace-pid file, however, it dosen't have anything in it.
Build with the 'simple' trace backend:
./configure --enable-trace-backends=simple
make
Create a file with the events you want to trace:
echo bdrv_aio_readv > /tmp/events
echo bdrv_aio_writev >> /tmp/events
Run the virtual machine to produce a trace file:
qemu -trace events=/tmp/events ... # your normal QEMU invocation
Pretty-print the binary trace file:
./scripts/simpletrace.py trace-events trace-* # Override * with QEMU
i followd this instructions.
please somebody give me some advise for this situation.
THANKS!
I got same problem by following the same document.
https://fossies.org/linux/qemu/docs/tracing.txt
got nothing because
bdrv_aio_readv and bdrv_aio_writev was not enabled by default, at least the version I complied, was not enabled. you need to open trace-events under source directory, looking for some line without disabled, e.g. I using:
echo "load_file" > /tmp/events
Then start qemu,
after a guest started, I run
./scripts/simpletrace.py trace-events trace-Pid
I got
load_file 1474.156 pid=5249 name=kvmvapic.bin path=qemu-2.8.0-rc0/pc-bios/kvmvapic.bin
load_file 22437.571 pid=5249 name=vgabios-stdvga.bin path=qemu-2.8.0-rc0/pc-bios/vgabios-stdvga.bin
load_file 10034.465 pid=5249 name=efi-e1000.rom
you can also add -monitor stdio to qemu command line, after it started, you can the following command in qemu CLI:
(qemu) info trace-events
load_file : state 1
vm_state_notify : state 1
balloon_event : state 0
cpu_out : state 0
cpu_in : state 0
1 means enabled events.
Modify the trace-events file in the source tree
As of v2.9.0 you also have to remove the disable from the lines you want to enable there, e.g.:
-disable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
+exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
and recompile.
Here is a minimal fully automated runnable example that boots Linux and produces traces: https://github.com/cirosantilli/linux-kernel-module-cheat
For example, I used the traces to count how many boot instructions Linux has: https://github.com/cirosantilli/linux-kernel-module-cheat/blob/c7bbc6029af7f4fab0a23a380d1607df0b2a3701/count-boot-instructions.md
I have a lightly patched QEMU as a submodule, the key commit is: https://github.com/cirosantilli/qemu/commit/e583d175e4cdfb12b4812a259e45c679743b32ad

Can't use augeas to create a new entry in hosts.allow

I try to create a new entry in hosts.allow
augeas { "Add in hosts allow" :
context => '/files/etc/hosts.allow',
changes => [
'ins 01 after *[last()]',
'set 01/process[1] ssh',
'set 01/process[2] ssh2',
'set 01/client ipaddr'
],
}
But it doesn't work I get this error
Notice: Compiled catalog for server.local in environment production in 0.96 seconds
Error: /Stage[main]/Nfs::Server/Augeas[Add in hosts allow]: Could not evaluate: Error sending
command 'ins' with params ["01", "after", "/files/etc/hosts.allow/*[last()]"]/Error sending
command 'ins' with params ["01", "after", "/files/etc/hosts.allow/*[last()]"]
I can't see how to use the ins command, the message don't let me know what's went wrong.
CentOS6.4
Puppet version: 3.3.1
augeasversion (from facter): 0.9.0
I Can't find the version of augtools and I can't either execute a command as it is not installed (I don't know how puppet invoke it)
Try adding a leading "/" to the context?
(The logging is slightly odd, it doesn't show the "files" prefix at all, I wonder if your code sample and logging match.)

Resources