RHEL 9 cannot use subscription-manager registration solution in WSL2

Original link: https://blog.251.sh/solve-rhel-subscription-manager-is-disabled-when-running-inside-a-container-in-w

2.png

A very simple solution is that, without copying files.

After setting up a RHEL 9 with a docker image in WSL, this prompt appears when using dnf update :

 Updating Subscription Management repositories. Unable to read consumer identity Subscription Manager is operating in container mode. This system is not registered with an entitlement server. You can use subscription-manager to register.

Well, then try to register:

 [root@251 ~]# subscription-manager attach --auto subscription-manager is disabled when running inside a container. Please refer to your host system for subscription management.

It seems that since we are using the docker image as the system base, this is not directly possible. The solution is also very simple, just set the environment variable SMDEV_CONTAINER_OFF :

 [root@251 ~]# export SMDEV_CONTAINER_OFF=1 [root@251 ~]# subscription-manager attach --auto This system is not yet registered. Try 'subscription-manager register --help' for more information. [root@251 ~]# subscription-manager register --username username --password password --auto-attach Registering to: subscription.rhsm.redhat.com:443/subscription The system has been registered with ID: 33dfffa7-24e0-448f-b4ec-2f48e05d23e6 The registered system name is: 251 Installed Product Current Status: Product Name: Red Hat Enterprise Linux for x86_64 Status: Subscribed

You’re done!


If you like this article, please click the “Applause” button below!

If nothing loads above, you can click here .

This article is reprinted from: https://blog.251.sh/solve-rhel-subscription-manager-is-disabled-when-running-inside-a-container-in-w
This site is for inclusion only, and the copyright belongs to the original author.