Using Foreman 3.7, smart proxies 3.7, deploying Debian 11.8, deploying on libvirt, I had everything working and now of a sudden I see duplicate host entries getting created in Foreman and provisioning will not complete.
The error in the console shows (with token and hostname changed):
[!!] Finish the installation
Failed to run preseeded command
Execution of preseeded command "wget -Y off http://puppetserver.example.com/unattended/finish?token=[long token here, no brackets] -O /target/tmp/finish.sh && in-target chmod +x /tmp/finish.sh && in-target /tmp/finish.sh" failed with exit code 8"
The foreman UI shows two entries for the host. Looking it up in the database by hostname, I see (with hostname lightly sanitized but nothing else changed):
foreman=# select * from hosts where name = 'my-testhost76';
-[ RECORD 1 ]--------+-------------------------------------
id | 77
name | my-testhost76
last_compile |
last_report |
updated_at | 2023-10-12 22:01:44.200183
created_at | 2023-10-12 22:01:44.200183
root_pass |
architecture_id | 1
operatingsystem_id | 3
ptable_id | 140
medium_id | 5
build | t
comment |
disk |
installed_at |
model_id |
hostgroup_id | 1
owner_id | 4
owner_type | User
enabled | t
puppet_ca_proxy_id | 1
managed | t
use_image |
image_file |
uuid | f0c48d44-0f41-4040-bb78-4eccc8972bde
compute_resource_id | 28
puppet_proxy_id | 1
certname |
image_id |
organization_id | 1
location_id | 14
type | Host::Managed
otp |
realm_id |
compute_profile_id | 5
provision_method | build
grub_pass |
global_status | 0
lookup_value_matcher | fqdn=my-testhost76.example.com
pxe_loader | PXELinux BIOS
initiated_at |
build_errors |
creator_id | 4
-[ RECORD 2 ]--------+-------------------------------------
id | 78
name | my-testhost76
last_compile |
last_report | 2023-10-12 22:12:51
updated_at | 2023-10-12 22:13:32.999312
created_at | 2023-10-12 22:13:28.588598
root_pass |
architecture_id | 1
operatingsystem_id | 3
ptable_id |
medium_id |
build | f
comment |
disk |
installed_at |
model_id | 1
hostgroup_id |
owner_id |
owner_type |
enabled | t
puppet_ca_proxy_id | 1
managed | f
use_image |
image_file |
uuid |
compute_resource_id |
puppet_proxy_id | 1
certname | my-testhost76
image_id |
organization_id | 1
location_id |
type | Host::Managed
otp |
realm_id |
compute_profile_id |
provision_method |
grub_pass |
global_status | 2
lookup_value_matcher | fqdn=my-testhost76.example.com
pxe_loader |
initiated_at |
build_errors |
creator_id | 3
Looking in the “users” table to compare the creator_id values 3 and 4, I see that I am user 4 and user id 3 belongs to “foreman_api_admin.”
And of course I can’t see any of these details in the UI because both entries show on the “all hosts” tab, but clicking either one goes to a page that does a lookup by hostname, so either link shows info about the same entry.
What causes this problem and how can I fix it?