Can't get repositories from foreman to show on ubuntu 18.04

Problem:
subscription-manager repos
This system has no repositories available through subscriptions.

We are able to subscribe a ubuntu 18.04 host with the subscription manager and we can see:
subscription-manager list --match-installed --consumed --available
No available subscription pools to list
±------------------------------------------+
Consumed Subscriptions
±------------------------------------------+
Subscription Name: Ubuntu_18-04
Provides: Ubuntu_18-04
SKU:
Contract:
Account:
Serial:
Pool ID:
Provides Management: No
Active: True
Quantity Used: 1
Service Type:
Roles:
Service Level:
Usage:
Add-ons:
Status Details: Subscription is current
Subscription Type: Standard
Starts: 08/16/2022
Ends: 12/01/2049
Entitlement Type: Physical

That the required subscription is active and is correct. However there’s no repositories assigned and we cannot find the reason nor error why.

Expected outcome:

The repositories from ubuntu that we host ourselfs in foreman, to show up on our host ubuntu 18.04.

Other relevant data:
Here are the repo’s/products working well:

The content view which has the subscription:

The activiation key:

We did promote it aswell and we see the host in the content hosts.

This is the only problem i’m currently dealing with before we can use this in production.

This is what i did on the host itself:

wget --no-check-certificate -O katello-rhsm-consumer https://formankatello.theserver.lan/pub/katello-rhsm-consumer
/bin/bash -x katello-rhsm-consumer
subscription-manager config --server.proxy_hostname=ip.of.our.proxy --server.proxy_port=portnum

wget https://formankatello.theserver.lan/pub/katello-ca-consumer-latest.noarch.rpm --no-check-certificate

The above certificate is made from rpm to deb with alien and imported using dpkg -i

subscription-manager register --org=“redacted” --activationkey=“Ubuntu 18.04 Default”

I’ve went trough a few video’s and the documentation. I feel like i’ve missed something as i remember that we got it to work once, but then couldn’t get any packages to show up.

Thank you beforehand and for reading!

Hi,

as you can see in the last image, your content view only contains 122 Deb packages. That would match the backports repository. But that also means, that the other repositories are not part of your content view and with that your host cannot see them. Probably you published the content view before the sync of the repostitories was finished or you forgot to put the other repos into the content view.
On the other side your host should get at least the backports repository.
Could you check /etc/apt/sources.list.d/rhsm.sources - this should contain the repositories made available via subscription-manager.

Heya! Thank you for your reply first of all!

This is what i found in the rhsm.sources:

root@ourtestvm:~# subscription-manager repo-override --list

Repository: companyname_Ubuntu_18-04_bionic-backports_main_restricted_universe_multiverse
  enabled: 1

Repository: companyname_Ubuntu_18-04_bionic-security_main_restricted_universe_multiverse
  enabled: 1

Repository: companyname_Ubuntu_18-04_bionic-updates_main_restricted_universe_multiverse
  enabled: 1

Repository: companyname_Ubuntu_18-04_bionic_main_restricted_universe_multiverse
  enabled: 1

root@ourtestvm:~# cat /etc/apt/sources.list.d/rhsm.sources

#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# *** This file is auto-generated.  Changes made here will be over-written. ***
# *** Use "subscription-manager repo-override --help" if you wish to make changes. ***
#
# If this file is empty and this system is subscribed consider
# a "apt-get update" to refresh available repos
#
# *** DO NOT EDIT THIS FILE ***
#

I also promoted it again as i may have been a bit to early indeed with my publish + promotion.

I hoped i would atleast see the repo’s.

I tried to also re-subscribe but sadly still no improvements yet.

Also, for the architectures we could only specify amd64 and i386 from the upstream repo’s.
The ubuntu machine does specify x86_64 when using uname -a. Not sure if that might cause a problem.

Nope. All things APT/dpkg always use the string amd64 and never x86_64. Source: 11. Customized programs — Debian Policy Manual v4.6.1.1 (or just run dpkg-architecture -L for a list of valid architecture strings).

1 Like

Understood! Glad that can’t be an issue :).

So i’m trying a slighty different route as i want to find an erro message somewhere. I did the following to get something:

in the sources.list, i added this CV we publish but can’t auto attach:

deb [trusted=yes] https://thelinux.server.lan/pulp/content/company/Library/custom/Ubuntu_18-04/bionic-backports_main_restricted_universe_multiverse/ bionic-backports main restricted universe multiverse

now apt update does seem to communicate with it, but can’t b/c of this:

E: Failed to fetch https://thelinux.server.lan/pulp/content/companyname/Library/custom/Ubuntu_18-04/bionic-backports_main_restricted_universe_multiverse/dists/bionic-backports/main/binary-amd64/Packages  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: this-is-the-ip-of-foreman 443]

I also run behind a proxy and if i would add these lines back in the environment file:

http_proxy="http://proxy.ip.adress:3128"
https_proxy="http://proxy.ip.adress:3128"
HTTP_PROXY="http://proxy.ip.adress:3128"
HTTPS_PROXY="http://proxy.ip.adress:3128"

It’ll return the proxy ip and port back.

I’m still waiting for the network guys to allow DNS traffic fully.

Is it normal after that i install katello-rhsm-consumer from the forman server, that trying again but withoud insecure ssl on gives me the error that it can’t verify it? I wonder if the issue is b/c the selfsigned cert isn’t trusted and therefore, subscription manager doesn’t want to add the repos.

if you need a proxy from your client to the foreman, you can specify that in /etc/rhsm/rhsm.conf

then it depends if your proxy changes something with certificates - but if it doesn’t it shouldnt give errors

i wanted to try this after i redid the everything up to the products (b/c those i can’t really change much)
But now i seem to be stuck that i cannot delete the host from foreman-katello.

All the ways i tried (even with the rake console) let to it saying it’s deleted, but it doesn’t and if i try trough the edit button on the /hosts i get this:
image

So i resetted the whole foreman-katello with the command and when i rebuild everything from the products op to the activation key (exactly the same). It worked on the host.

It’s still very strange that i cannot remove a host from the ui whatsoever.

Not being able to delete the host sounds like a new and separate issue to me.

Perhaps open a new thread for it (linking back to this one). You probably also want to include the foreman log covering a time period where you tried to delete the host in question.

I sadly had chosen to reset foreman and can’t remember when exactly i tried to delete it.

Just out of curiousity, if you try to setup foreman and try to delete a host from the ui, does it normally dissepear completely?

Depends on your settings. In Administer → Settings there is an option if you want the VM to be deleted as well (and the default is “no”).

In most cases those kind of errors occur if you changed something like DNS/DHCP/Compute Ressource and Foreman tries to delete something, which is not available (because you did not configure DNS before). Then the deletion fails. In most cases you can remove it from the host list by editing the host, unmanage it and delete it afterwards.

We don’t use any of the compute resources functionality. The vm was already deployed and we only registered it with the subscription-manager. We didn’t change any of the other parts as those roles are fufilled by other vm’s in our network.

The weird thing is that doing what you proposed does succeed, but no changes are made in the UI to reflect that weirdly enough.

Is there a command to remove it from the UI in a safely manner? Given that’s unregistered, not a vm made by foreman and that it showing in the UI in all hosts is the only place in the UI to find it.