问:
Installing Rancher by run docker image on RHEL 8.5 fails
I’m have a new VM based on RHEL 8.5 and tried to install Rancher using the below simple command from formal rancher page here (Getting Started with Kubernetes | Rancher Quick Start)

sudo docker run --privileged -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher

but after the container start it keep restarting & the below errors appears.

Any Idea?

```    [root@redhat-vm-01 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NA MES
e8fbd2a4d67e rancher/rancher “entrypoint.sh” 5 minutes ago Up 12 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp tr usting_shockley
[root@redhat-vm-01 ~]# docker logs -f e8fbd2a4d67e
2022/01/05 20:42:24 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:42:24 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:42:24 [INFO] Listening on /tmp/log.sock
2022/01/05 20:42:24 [INFO] Waiting for k3s to start
time=“2022-01-05T20:42:24Z” level=info msg=“Acquiring lock file /var/lib/rancher /k3s/data/.lock”
time=“2022-01-05T20:42:24Z” level=info msg=“Preparing data dir /var/lib/rancher/ k3s/data/e61cd97f31a54dbcd9893f8325b7133cfdfd0229ff3bfae5a4f845780a93e84c”
2022/01/05 20:42:25 [INFO] Waiting for k3s to start
2022/01/05 20:42:26 [INFO] Waiting for k3s to start
2022/01/05 20:42:28 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:42:30 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:42:32 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:42:34 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:42:36 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:42:48 [INFO] Running in single server mode, will not peer connecti ons
2022/01/05 20:42:48 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD navlinks.ui.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusters.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD apiservices.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusterregistrationtokens.management.cat tle.io
2022/01/05 20:42:50 [INFO] Applying CRD settings.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD preferences.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusterrepos.catalog.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD operations.catalog.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD apps.catalog.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD fleetworkspaces.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD bundles.fleet.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusters.fleet.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD managedcharts.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusters.provisioning.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusters.provisioning.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD rkeclusters.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD rkecontrolplanes.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD rkebootstraps.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD rkebootstraptemplates.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD rkecontrolplanes.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD custommachines.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD clusters.cluster.x-k8s.io
2022/01/05 20:42:51 [INFO] Applying CRD machinedeployments.cluster.x-k8s.io
2022/01/05 20:42:51 [INFO] Applying CRD machinehealthchecks.cluster.x-k8s.io
2022/01/05 20:42:51 [INFO] Applying CRD machines.cluster.x-k8s.io
2022/01/05 20:42:51 [INFO] Applying CRD machinesets.cluster.x-k8s.io
2022/01/05 20:42:51 [INFO] Waiting for CRD machinesets.cluster.x-k8s.io to becom e available
2022/01/05 20:42:52 [INFO] Done waiting for CRD machinesets.cluster.x-k8s.io to become available
2022/01/05 20:42:52 [INFO] Creating CRD authconfigs.management.cattle.io
2022/01/05 20:42:52 [INFO] Creating CRD groupmembers.management.cattle.io
2022/01/05 20:43:23 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:43:25 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:43:27 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:43:29 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:43:35 [FATAL] k3s exited with: exit status 255
2022/01/05 20:43:53 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:43:53 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:43:53 [INFO] Listening on /tmp/log.sock
2022/01/05 20:43:53 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:43:55 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:43:57 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:43:59 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:01 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:03 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:05 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:07 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:09 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:15 [FATAL] k3s exited with: exit status 255
2022/01/05 20:44:31 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:44:31 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:44:31 [INFO] Listening on /tmp/log.sock
2022/01/05 20:44:31 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:33 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:35 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:37 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:39 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:41 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:43 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:45 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:50 [FATAL] k3s exited with: exit status 255
2022/01/05 20:45:08 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:45:08 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:45:08 [INFO] Listening on /tmp/log.sock
2022/01/05 20:45:08 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:10 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:12 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:14 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:16 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:18 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:20 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:22 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:24 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:26 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:28 [INFO] Running in single server mode, will not peer connecti ons
2022/01/05 20:45:28 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:45:29 [INFO] Applying CRD navlinks.ui.cattle.io
2022/01/05 20:45:29 [INFO] Applying CRD clusters.management.cattle.io
2022/01/05 20:45:29 [INFO] Applying CRD apiservices.management.cattle.io
2022/01/05 20:45:29 [INFO] Applying CRD clusterregistrationtokens.management.cat tle.io
2022/01/05 20:45:29 [INFO] Applying CRD settings.management.cattle.io
2022/01/05 20:45:29 [INFO] Applying CRD preferences.management.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD clusterrepos.catalog.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD operations.catalog.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD apps.catalog.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD fleetworkspaces.management.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD managedcharts.management.cattle.io
2022/01/05 20:45:31 [FATAL] failed to update managedcharts.management.cattle.io apiextensions.k8s.io/v1, Kind=CustomResourceDefinition for managedcharts.manage ment.cattle.io: Patch “https://127.0.0.1:6443/apis/apiextensions.k8s.io/v1/custo mresourcedefinitions/managedcharts.management.cattle.io?timeout=15m0s”: EOF
2022/01/05 20:45:47 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:45:47 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:45:47 [INFO] Listening on /tmp/log.sock
2022/01/05 20:45:47 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:49 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:51 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:53 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:55 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:57 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:59 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:01 [INFO] Running in single server mode, will not peer connecti ons
2022/01/05 20:46:01 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:46:03 [INFO] Applying CRD navlinks.ui.cattle.io
2022/01/05 20:46:03 [INFO] Applying CRD clusters.management.cattle.io
2022/01/05 20:46:03 [FATAL] failed to update clusters.management.cattle.io apiex tensions.k8s.io/v1, Kind=CustomResourceDefinition for clusters.management.cattl e.io: Patch “https://127.0.0.1:6443/apis/apiextensions.k8s.io/v1/customresourced efinitions/clusters.management.cattle.io?timeout=15m0s”: EOF
2022/01/05 20:46:22 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:46:22 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:46:22 [INFO] Listening on /tmp/log.sock
2022/01/05 20:46:22 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:46:24 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:46:26 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:46:28 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:46:30 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:46:32 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:34 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:36 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:38 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:40 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:46 [FATAL] k3s exited with: exit status 255
2022/01/05 20:47:03 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:47:03 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:47:03 [INFO] Listening on /tmp/log.sock
2022/01/05 20:47:03 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:05 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:07 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:09 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:11 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:13 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:15 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:17 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:19 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:21 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:23 [INFO] Running in single server mode, will not peer connecti ons
2022/01/05 20:47:23 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD navlinks.ui.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD clusters.management.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD apiservices.management.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD clusterregistrationtokens.management.cat tle.io
2022/01/05 20:47:24 [INFO] Applying CRD settings.management.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD preferences.management.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD clusterrepos.catalog.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD operations.catalog.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD apps.catalog.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD fleetworkspaces.management.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD managedcharts.management.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD clusters.provisioning.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD clusters.provisioning.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD rkeclusters.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD rkecontrolplanes.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD rkebootstraps.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD rkebootstraptemplates.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD rkecontrolplanes.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD custommachines.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD clusters.cluster.x-k8s.io
2022/01/05 20:47:26 [INFO] Applying CRD machinedeployments.cluster.x-k8s.io
2022/01/05 20:47:26 [INFO] Applying CRD machinehealthchecks.cluster.x-k8s.io
2022/01/05 20:47:26 [FATAL] failed to list apiextensions.k8s.io/v1, Kind=CustomR esourceDefinition for machinehealthchecks.cluster.x-k8s.io: Get “https://127.0. 0.1:6443/apis/apiextensions.k8s.io/v1/customresourcedefinitions?labelSelector=ob jectset.rio.cattle.io%!F(MISSING)hash%!D(MISSING)7372e5228a5d4df32e62db137ea6bf4 69c35d4c4&timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connection refused
2022/01/05 20:47:44 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:47:44 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:47:44 [INFO] Listening on /tmp/log.sock
2022/01/05 20:47:44 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:46 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:48 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:50 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:52 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:54 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:56 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:02 [FATAL] k3s exited with: exit status 255
2022/01/05 20:48:20 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:48:20 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:48:20 [INFO] Listening on /tmp/log.sock
2022/01/05 20:48:21 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:48:23 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:48:25 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:48:27 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:29 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:31 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:33 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:35 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:37 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:39 [INFO] Running in single server mode, will not peer connections
2022/01/05 20:48:39 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:48:39 [INFO] Applying CRD navlinks.ui.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD clusters.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD apiservices.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD clusterregistrationtokens.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD settings.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD preferences.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD clusterrepos.catalog.cattle.io
2022/01/05 20:48:41 [FATAL] Get “https://127.0.0.1:6443/apis/apiextensions.k8s.io/v1/customresourcedefinitions/clusterrepos.catalog.cattle.io?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connection refused
```

Container restarted every 40 second

答:
Apparently something is incompatible with the kernel from 8.5.
It has to do with systemd and something else.

I have tried a lot to get it to work, but the only thing that worked for me was to downgrade systemd+kernel to the versions from 8.4.

So to do that you need to add the 8.4 repo back - and do a

```<code>sudo dnf update
sudo dnf install kernel-4.18.0-305.25.1.el8_4.x86_64 systemd-239-45.el8_4.3.x86_64
</code>```

That is the only thing I have gotten to work so far. Obviously I hope that the people working on rancher fixes it. It has something to do with cgroups - and apparently the rancher version is not compatible with the 8.5 version of systemd & kernel.
You can check out this post

Body:
I’m have a new VM based on RHEL 8.5 and tried to install Rancher using the below simple command from formal rancher page here (Getting Started with Kubernetes | Rancher Quick Start)

sudo docker run --privileged -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher

but after the container start it keep restarting & the below errors appears.

Any Idea?

    [root@redhat-vm-01 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NA MES
e8fbd2a4d67e rancher/rancher “entrypoint.sh” 5 minutes ago Up 12 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp tr usting_shockley
[root@redhat-vm-01 ~]# docker logs -f e8fbd2a4d67e
2022/01/05 20:42:24 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:42:24 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:42:24 [INFO] Listening on /tmp/log.sock
2022/01/05 20:42:24 [INFO] Waiting for k3s to start
time=“2022-01-05T20:42:24Z” level=info msg=“Acquiring lock file /var/lib/rancher /k3s/data/.lock”
time=“2022-01-05T20:42:24Z” level=info msg=“Preparing data dir /var/lib/rancher/ k3s/data/e61cd97f31a54dbcd9893f8325b7133cfdfd0229ff3bfae5a4f845780a93e84c”
2022/01/05 20:42:25 [INFO] Waiting for k3s to start
2022/01/05 20:42:26 [INFO] Waiting for k3s to start
2022/01/05 20:42:28 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:42:30 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:42:32 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:42:34 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:42:36 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:42:48 [INFO] Running in single server mode, will not peer connecti ons
2022/01/05 20:42:48 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD navlinks.ui.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusters.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD apiservices.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusterregistrationtokens.management.cat tle.io
2022/01/05 20:42:50 [INFO] Applying CRD settings.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD preferences.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusterrepos.catalog.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD operations.catalog.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD apps.catalog.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD fleetworkspaces.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD bundles.fleet.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusters.fleet.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD managedcharts.management.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusters.provisioning.cattle.io
2022/01/05 20:42:50 [INFO] Applying CRD clusters.provisioning.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD rkeclusters.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD rkecontrolplanes.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD rkebootstraps.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD rkebootstraptemplates.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD rkecontrolplanes.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD custommachines.rke.cattle.io
2022/01/05 20:42:51 [INFO] Applying CRD clusters.cluster.x-k8s.io
2022/01/05 20:42:51 [INFO] Applying CRD machinedeployments.cluster.x-k8s.io
2022/01/05 20:42:51 [INFO] Applying CRD machinehealthchecks.cluster.x-k8s.io
2022/01/05 20:42:51 [INFO] Applying CRD machines.cluster.x-k8s.io
2022/01/05 20:42:51 [INFO] Applying CRD machinesets.cluster.x-k8s.io
2022/01/05 20:42:51 [INFO] Waiting for CRD machinesets.cluster.x-k8s.io to becom e available
2022/01/05 20:42:52 [INFO] Done waiting for CRD machinesets.cluster.x-k8s.io to become available
2022/01/05 20:42:52 [INFO] Creating CRD authconfigs.management.cattle.io
2022/01/05 20:42:52 [INFO] Creating CRD groupmembers.management.cattle.io
2022/01/05 20:43:23 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:43:25 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:43:27 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:43:29 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:43:35 [FATAL] k3s exited with: exit status 255
2022/01/05 20:43:53 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:43:53 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:43:53 [INFO] Listening on /tmp/log.sock
2022/01/05 20:43:53 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:43:55 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:43:57 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:43:59 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:01 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:03 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:05 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:07 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:09 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:15 [FATAL] k3s exited with: exit status 255
2022/01/05 20:44:31 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:44:31 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:44:31 [INFO] Listening on /tmp/log.sock
2022/01/05 20:44:31 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:33 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:35 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:37 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:39 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:44:41 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:43 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:45 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:44:50 [FATAL] k3s exited with: exit status 255
2022/01/05 20:45:08 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:45:08 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:45:08 [INFO] Listening on /tmp/log.sock
2022/01/05 20:45:08 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:10 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:12 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:14 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:16 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:18 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:20 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:22 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:24 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:26 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:28 [INFO] Running in single server mode, will not peer connecti ons
2022/01/05 20:45:28 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:45:29 [INFO] Applying CRD navlinks.ui.cattle.io
2022/01/05 20:45:29 [INFO] Applying CRD clusters.management.cattle.io
2022/01/05 20:45:29 [INFO] Applying CRD apiservices.management.cattle.io
2022/01/05 20:45:29 [INFO] Applying CRD clusterregistrationtokens.management.cat tle.io
2022/01/05 20:45:29 [INFO] Applying CRD settings.management.cattle.io
2022/01/05 20:45:29 [INFO] Applying CRD preferences.management.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD clusterrepos.catalog.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD operations.catalog.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD apps.catalog.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD fleetworkspaces.management.cattle.io
2022/01/05 20:45:30 [INFO] Applying CRD managedcharts.management.cattle.io
2022/01/05 20:45:31 [FATAL] failed to update managedcharts.management.cattle.io apiextensions.k8s.io/v1, Kind=CustomResourceDefinition for managedcharts.manage ment.cattle.io: Patch “https://127.0.0.1:6443/apis/apiextensions.k8s.io/v1/custo mresourcedefinitions/managedcharts.management.cattle.io?timeout=15m0s”: EOF
2022/01/05 20:45:47 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:45:47 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:45:47 [INFO] Listening on /tmp/log.sock
2022/01/05 20:45:47 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:49 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:51 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:53 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:45:55 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:57 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:45:59 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:01 [INFO] Running in single server mode, will not peer connecti ons
2022/01/05 20:46:01 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:46:03 [INFO] Applying CRD navlinks.ui.cattle.io
2022/01/05 20:46:03 [INFO] Applying CRD clusters.management.cattle.io
2022/01/05 20:46:03 [FATAL] failed to update clusters.management.cattle.io apiex tensions.k8s.io/v1, Kind=CustomResourceDefinition for clusters.management.cattl e.io: Patch “https://127.0.0.1:6443/apis/apiextensions.k8s.io/v1/customresourced efinitions/clusters.management.cattle.io?timeout=15m0s”: EOF
2022/01/05 20:46:22 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:46:22 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:46:22 [INFO] Listening on /tmp/log.sock
2022/01/05 20:46:22 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:46:24 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:46:26 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:46:28 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:46:30 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:46:32 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:34 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:36 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:38 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:40 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:46:46 [FATAL] k3s exited with: exit status 255
2022/01/05 20:47:03 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:47:03 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:47:03 [INFO] Listening on /tmp/log.sock
2022/01/05 20:47:03 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:05 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:07 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:09 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:11 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:13 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:15 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:17 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:19 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:21 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:23 [INFO] Running in single server mode, will not peer connecti ons
2022/01/05 20:47:23 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD navlinks.ui.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD clusters.management.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD apiservices.management.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD clusterregistrationtokens.management.cat tle.io
2022/01/05 20:47:24 [INFO] Applying CRD settings.management.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD preferences.management.cattle.io
2022/01/05 20:47:24 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD clusterrepos.catalog.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD operations.catalog.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD apps.catalog.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD fleetworkspaces.management.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD managedcharts.management.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD clusters.provisioning.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD clusters.provisioning.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD rkeclusters.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD rkecontrolplanes.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD rkebootstraps.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD rkebootstraptemplates.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD rkecontrolplanes.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD custommachines.rke.cattle.io
2022/01/05 20:47:25 [INFO] Applying CRD clusters.cluster.x-k8s.io
2022/01/05 20:47:26 [INFO] Applying CRD machinedeployments.cluster.x-k8s.io
2022/01/05 20:47:26 [INFO] Applying CRD machinehealthchecks.cluster.x-k8s.io
2022/01/05 20:47:26 [FATAL] failed to list apiextensions.k8s.io/v1, Kind=CustomR esourceDefinition for machinehealthchecks.cluster.x-k8s.io: Get “https://127.0. 0.1:6443/apis/apiextensions.k8s.io/v1/customresourcedefinitions?labelSelector=ob jectset.rio.cattle.io%!F(MISSING)hash%!D(MISSING)7372e5228a5d4df32e62db137ea6bf4 69c35d4c4&timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connection refused
2022/01/05 20:47:44 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:47:44 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:47:44 [INFO] Listening on /tmp/log.sock
2022/01/05 20:47:44 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:46 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:48 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:50 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:47:52 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:54 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:47:56 [INFO] Waiting for server to become available: an error on t he server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:02 [FATAL] k3s exited with: exit status 255
2022/01/05 20:48:20 [INFO] Rancher version v2.6.3 (3c1d5fac3) is starting
2022/01/05 20:48:20 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embed ded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:fal se Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit. log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Feat ures: ClusterRegistry:}
2022/01/05 20:48:20 [INFO] Listening on /tmp/log.sock
2022/01/05 20:48:21 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:48:23 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:48:25 [INFO] Waiting for server to become available: Get “https:// 127.0.0.1:6443/version?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connect ion refused
2022/01/05 20:48:27 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:29 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:31 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:33 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:35 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:37 [INFO] Waiting for server to become available: an error on the server (“apiserver not ready”) has prevented the request from succeeding
2022/01/05 20:48:39 [INFO] Running in single server mode, will not peer connections
2022/01/05 20:48:39 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:48:39 [INFO] Applying CRD navlinks.ui.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD clusters.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD apiservices.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD clusterregistrationtokens.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD settings.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD preferences.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD features.management.cattle.io
2022/01/05 20:48:40 [INFO] Applying CRD clusterrepos.catalog.cattle.io
2022/01/05 20:48:41 [FATAL] Get “https://127.0.0.1:6443/apis/apiextensions.k8s.io/v1/customresourcedefinitions/clusterrepos.catalog.cattle.io?timeout=15m0s”: dial tcp 127.0.0.1:6443: connect: connection refused

Container restarted every 40 second

Body:
Apparently something is incompatible with the kernel from 8.5.
It has to do with systemd and something else.

I have tried a lot to get it to work, but the only thing that worked for me was to downgrade systemd+kernel to the versions from 8.4.

So to do that you need to add the 8.4 repo back - and do a

sudo dnf update
sudo dnf install kernel-4.18.0-305.25.1.el8_4.x86_64 systemd-239-45.el8_4.3.x86_64

That is the only thing I have gotten to work so far. Obviously I hope that the people working on rancher fixes it. It has something to do with cgroups - and apparently the rancher version is not compatible with the 8.5 version of systemd & kernel.
You can check out this post


来源: stackexchange

问:
Why my button in tkinter don't works normal
I wanted to make button in tkinter, but when I started program, the command always calls when code just starts.
Here is example code:

```<code>import tkinter as tk
from tkinter import messagebox

window = tk.Tk()
window.title("Why this don't works???")
window.wm_geometry("100x100")

def message():
    messagebox.showinfo("Hi there")

button = tk.Button(text="Hello", command=message())
button.grid(column=0, row=0)

while True:
    window.update()
</code>```

And then, button didn't worked. (When you press it, it don't works.)

I don't know what I'm doing wrong, so I need help.

答:
The command should be a pointer to a function

In the code you wrote, the command gets the return value from the function.

```<code>command=message()
</code>```

The correct way is

```<code>command = message
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I wanted to make button in tkinter, but when I started program, the command always calls when code just starts.
Here is example code:

import tkinter as tk
from tkinter import messagebox

window = tk.Tk()
window.title("Why this don't works???")
window.wm_geometry("100x100")

def message():
    messagebox.showinfo("Hi there")

button = tk.Button(text="Hello", command=message())
button.grid(column=0, row=0)

while True:
    window.update()

And then, button didn't worked. (When you press it, it don't works.)

I don't know what I'm doing wrong, so I need help.

Body:
The command should be a pointer to a function

In the code you wrote, the command gets the return value from the function.

command=message()

The correct way is

command = message


问:
Node.js - PostgreSQL (pg) : Client has already been connected. You cannot reuse a client
I am just trying to write simple register/login system.
I am trying to find if username exists. Here is the steps :

Go localhost:3000/users/register page

Fill in all fields and click register button

Checking my command line if username exists it should print it with console.log

Everything works fine until now.

When I go back to the register page, I fill in all fields again and click register button. Then it throws it in command line :

```<code>Error: Client has already been connected. You cannot reuse a client.
at Client._connect (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\pg\lib\client.js:91:17)
at C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\pg\lib\client.js:310:10
at new Promise (<anonymous>)
at Client.connect (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\pg\lib\client.js:309:10)
at Object.module.exports.findUserById (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\database\register_sql.js:8:22)
at C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\routes\users.js:37:29
at Layer.handle [as handle_request] (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\express\lib\router\route.js:137:13)
at next (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\express\lib\router\route.js:131:14)
at Route.dispatch (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\express\lib\router\route.js:112:3)
</code>```

I dont understand because I already end my client after I call my method.

register_sql.js :

```<code>
module.exports.findUserById =(async (username) =>{
    try {
        await client.connect();
        console.log('Connected successfuly');
        const result = await client.query("select * from users where username = ($1)", [username]);
        console.log(result.rows[0]['username']);
        await client.end();
        console.log('Client disconnected...');
    } catch (err) {
        console.log(err);
    }
});
</code>```

I call register_sql.js in users.js. Here is users.js :

```<code>const router = express.Router();
const registerSQL = require('../database/register_sql');
router.route('/register')
    .get((req, res, next) => {
        res.render('register');
    })
    .post((req, res, next) => {
            const {
                username,
                password,
                password2
            } = req.body;
            let errors = [];
            if (!username || !password || !password2) {
                errors.push("Please fill in all fields!");
            }
            if (password != password2) {
                errors.push("Passwords do not match!");
            }
            if (password.length < 6) {
                errors.push("Password has to be at least 6 characters!");
            }
            if (errors.length > 0) {
                res.render('register', {
                    errors
                });
            } else {
                registerSQL.findUserById(username);
                res.redirect('/');
            }
});

module.exports = router;
</code>```

Thank you for helping!

答:
Pool approach is better practice but if someone want to connect with Client approach then this solution will work.

Code which will work with Client approach :

```<code>client.connect();

client.query(`select * from users where username = ($1)`, (err, result)=>{
  try{
          console.log("Test", result)
           res.send(result)
        } catch{
          console.log("err", err)
          res.status(500).json(err);

        }

    client.end();
</code>```

})

Body:
I am just trying to write simple register/login system.
I am trying to find if username exists. Here is the steps :

Go localhost:3000/users/register page

Fill in all fields and click register button

Checking my command line if username exists it should print it with console.log

Everything works fine until now.

When I go back to the register page, I fill in all fields again and click register button. Then it throws it in command line :

Error: Client has already been connected. You cannot reuse a client.
at Client._connect (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\pg\lib\client.js:91:17)
at C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\pg\lib\client.js:310:10
at new Promise (<anonymous>)
at Client.connect (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\pg\lib\client.js:309:10)
at Object.module.exports.findUserById (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\database\register_sql.js:8:22)
at C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\routes\users.js:37:29
at Layer.handle [as handle_request] (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\express\lib\router\route.js:137:13)
at next (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\express\lib\router\route.js:131:14)
at Route.dispatch (C:\Users\Hasan\Desktop\Projeler\node-ogreniyorum\node_modules\express\lib\router\route.js:112:3)

I dont understand because I already end my client after I call my method.

register_sql.js :

module.exports.findUserById =(async (username) =>{
    try {
        await client.connect();
        console.log('Connected successfuly');
        const result = await client.query("select * from users where username = ($1)", [username]);
        console.log(result.rows[0]['username']);
        await client.end();
        console.log('Client disconnected...');
    } catch (err) {
        console.log(err);
    }
});

I call register_sql.js in users.js. Here is users.js :

const router = express.Router();
const registerSQL = require('../database/register_sql');
router.route('/register')
    .get((req, res, next) => {
        res.render('register');
    })
    .post((req, res, next) => {
            const {
                username,
                password,
                password2
            } = req.body;
            let errors = [];
            if (!username || !password || !password2) {
                errors.push("Please fill in all fields!");
            }
            if (password != password2) {
                errors.push("Passwords do not match!");
            }
            if (password.length < 6) {
                errors.push("Password has to be at least 6 characters!");
            }
            if (errors.length > 0) {
                res.render('register', {
                    errors
                });
            } else {
                registerSQL.findUserById(username);
                res.redirect('/');
            }
});

module.exports = router;

Thank you for helping!

Body:
Pool approach is better practice but if someone want to connect with Client approach then this solution will work.

Code which will work with Client approach :

client.connect();

client.query(`select * from users where username = ($1)`, (err, result)=>{
  try{
          console.log("Test", result)
           res.send(result)
        } catch{
          console.log("err", err)
          res.status(500).json(err);

        }

    client.end();

})


问:
What goes in the Exception field of a Throw Activity
Can anyone tell me how to use the Exception field of the Throw Activity?

I need specific examples.  I'm throwing an exception as I need to capture it in the calling code and then run some clean up code.

Thanks for any help

Richard

In reply to Chuck

I tried the following and the workflow cancels but the execution doesn't enter the catches.
Any idea why?

```<code>public class AbortException : System.Exception
{
}

class manager
{
    ...

    try
    {
        workflowApp.Run();
    }
    catch (AbortException ea)
    {

    }
    catch (Exception ex)
    {

    }

    ...
}
</code>```

with an Exception Property of: New AbortException

答:
You are still using a WorkflowApplication here right?

Is so it executes on a different thread so a C# try/catch around the Run() won't help. You need to add a handler to the OnUnhandledException event as I pointed out in you other question.

```<code>WorkflowApplication wfApp = new WorkflowApplication(new YourWorkflow());
wfApp.OnUnhandledException = e => UnhandledExceptionAction.Abort;
wfApp.Run();
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Can anyone tell me how to use the Exception field of the Throw Activity?

I need specific examples.  I'm throwing an exception as I need to capture it in the calling code and then run some clean up code.

Thanks for any help

Richard

In reply to Chuck

I tried the following and the workflow cancels but the execution doesn't enter the catches.
Any idea why?

public class AbortException : System.Exception
{
}

class manager
{
    ...

    try
    {
        workflowApp.Run();
    }
    catch (AbortException ea)
    {

    }
    catch (Exception ex)
    {

    }

    ...
}

with an Exception Property of: New AbortException

Body:
You are still using a WorkflowApplication here right?

Is so it executes on a different thread so a C# try/catch around the Run() won't help. You need to add a handler to the OnUnhandledException event as I pointed out in you other question.

WorkflowApplication wfApp = new WorkflowApplication(new YourWorkflow());
wfApp.OnUnhandledException = e => UnhandledExceptionAction.Abort;
wfApp.Run();


问:
I have rendered two components and whenever I type something input field input field loses its focus
Here is my component into which component is rendered

```<code>const BasicInfo=({
product,
  handleChange,
  handleTags,
  productData,
  deleteTags,
  categories,
  customProduct,
  handleCustomChange,
  setCustomProduct,
})=>{
function increasenumber() {
    var hello = numberoffields;
    hello = hello + 1;
    setNumberoffields(hello);
    setCustomProduct((arr) => [...arr, { typeoffield: "", label: "" }]);
  }
const DisplayCustomInput = () => {
    if (product.customCategory.includes(product.category)) {
      return (
        <div>
          <div>
            <button onClick={increasenumber}>Add input field</button>
          </div>
          <DisplayInputs
            numberoffields={numberoffields}
            customProduct={customProduct}
            handleCustomChange={handleCustomChange}
          />
        </div>
      );
    } else {
      return null;
    }
  };

  return (
<DisplayCustomInput />
)
}
</code>```

My DisplayInputs looks like

```<code>export default function DisplayInputs({
  numberoffields,
  customProduct,
  handleCustomChange,
}) {
const rows = [];
  for (let index = 0; index < numberoffields; index++) {
    console.log(index);
    rows.push(
<div key={index}>
        <label htmlFor="label">
          Enter label for input field for accepting data
        </label>

        <input
          value={customProduct[index] ? customProduct[index].label : ""}
          onChange={handleCustomChange(index, "label")}
          id="label"
        />
</div>
)
}
return rows
}
</code>```

Whenever a character if fed to the input field it loses focus and if I use DisplayCustomInput as jsx instead of component then on increasing numberoffields the whole page gets reload.

答:
You can use a ref in React. You initial her in the child and you call something like nomRef.current.focus on useEffect in the parent, useEffect with dependency the value that the input change.

One thing more :

```<code>onChange={() => handleCustomChange(index, "label")}
</code>```

and not onChange={handleCustomChange(index, "label")}
(because without () => you execute the function on mount.

If you need about ref : https://fr.reactjs.org/docs/refs-and-the-dom.html

Say me if it's good for you

Body:
Here is my component into which component is rendered

const BasicInfo=({
product,
  handleChange,
  handleTags,
  productData,
  deleteTags,
  categories,
  customProduct,
  handleCustomChange,
  setCustomProduct,
})=>{
function increasenumber() {
    var hello = numberoffields;
    hello = hello + 1;
    setNumberoffields(hello);
    setCustomProduct((arr) => [...arr, { typeoffield: "", label: "" }]);
  }
const DisplayCustomInput = () => {
    if (product.customCategory.includes(product.category)) {
      return (

            <button onClick={increasenumber}>Add input field</button>

          <DisplayInputs
            numberoffields={numberoffields}
            customProduct={customProduct}
            handleCustomChange={handleCustomChange}
          />

      );
    } else {
      return null;
    }
  };

  return (
<DisplayCustomInput />
)
}

My DisplayInputs looks like

export default function DisplayInputs({
  numberoffields,
  customProduct,
  handleCustomChange,
}) {
const rows = [];
  for (let index = 0; index < numberoffields; index++) {
    console.log(index);
    rows.push(

          Enter label for input field for accepting data

        <input
          value={customProduct[index] ? customProduct[index].label : ""}
          onChange={handleCustomChange(index, "label")}
          id="label"
        />

)
}
return rows
}

Whenever a character if fed to the input field it loses focus and if I use DisplayCustomInput as jsx instead of component then on increasing numberoffields the whole page gets reload.

Body:
You can use a ref in React. You initial her in the child and you call something like nomRef.current.focus on useEffect in the parent, useEffect with dependency the value that the input change.

One thing more :

onChange={() => handleCustomChange(index, "label")}

and not onChange={handleCustomChange(index, "label")}
(because without () => you execute the function on mount.

If you need about ref : https://fr.reactjs.org/docs/refs-and-the-dom.html

Say me if it's good for you


问:
Define variables in styled-components
Is it possible to define a variable inside a styled-components component?

Hopefully the code below (not working) shows what I'm after:

```<code>const Example = styled.div`
  ${const length = calc(vw - props.someValue)}

  width: ${length};
  &.disable {
    width: ${length};
  }
`
</code>```

答:
I recently wanted to do something like this. But in my case, I had to compute new var with the use of props only and not with vw.

I achieved this by defining a short function.

```<code>const getLength = (baseValue, someValue) => {
   // you can do any complex or multiline calculation here
   return baseValue - someValue;
}

const Example = styled.div`
width: ${(props) => getLength(props.baseValue, props.someValue)};
&.disable {
width: ${(props) => getLength(props.baseValue, props.someValue)};
}
`
</code>```

Title: Define variables in styled-components

Body:
Is it possible to define a variable inside a styled-components component?

Hopefully the code below (not working) shows what I'm after:

const Example = styled.div`
  ${const length = calc(vw - props.someValue)}

  width: ${length};
  &.disable {
    width: ${length};
  }
`

Body:
I recently wanted to do something like this. But in my case, I had to compute new var with the use of props only and not with vw.

I achieved this by defining a short function.

const getLength = (baseValue, someValue) => {
   // you can do any complex or multiline calculation here
   return baseValue - someValue;
}

const Example = styled.div`
width: ${(props) => getLength(props.baseValue, props.someValue)};
&.disable {
width: ${(props) => getLength(props.baseValue, props.someValue)};
}
`


问:
Download .msg files in client side Reactjs
I have a server containing multiple .msg files
I want to enable the user to download them in the client side using the following code:

```<code>const download = (fileName) => {
        var FileSaver = require('file-saver');
        FileSaver.saveAs(constants.filesUploadUrl + fileName, fileName);
    }
</code>```

The download is working fine with all data types except .msg files
It gives me "Failed - No file"

Is there a way to enable downloading .msg files in client side?

答:
It turned out that I needed to convert the content type into "application/vnd.ms-outlook"
As it wasn't recognized via Google chrome as .msg

My backend ASP.Net Core
Code for mapping MIME Type:

```<code> }
            var provider = new FileExtensionContentTypeProvider();
            provider.Mappings[".msg"] = "application/vnd.ms-outlook";
            app.UseStaticFiles(new StaticFileOptions
            {
                FileProvider = new PhysicalFileProvider(
                ContentTypeProvider = provider
            });
</code>```

Body:
I have a server containing multiple .msg files
I want to enable the user to download them in the client side using the following code:

const download = (fileName) => {
        var FileSaver = require('file-saver');
        FileSaver.saveAs(constants.filesUploadUrl + fileName, fileName);
    }

The download is working fine with all data types except .msg files
It gives me "Failed - No file"

Is there a way to enable downloading .msg files in client side?

Body:
It turned out that I needed to convert the content type into "application/vnd.ms-outlook"
As it wasn't recognized via Google chrome as .msg

My backend ASP.Net Core
Code for mapping MIME Type:

 }
            var provider = new FileExtensionContentTypeProvider();
            provider.Mappings[".msg"] = "application/vnd.ms-outlook";
            app.UseStaticFiles(new StaticFileOptions
            {
                FileProvider = new PhysicalFileProvider(
                ContentTypeProvider = provider
            });


问:
Why do I get Illegal instruction (core dumped) error while building Android 11?
For a quiet some time I'm trying to build Android 11 for Sony Xperia XZ2 H8266.
Everytime process comes to build org.apache.http.legacy package it gets an error.

```<code>[ 99% 263/264] //external/apache-http:org.apache.http.legacy dexpreopt [common]
FAILED: out/soong/.intermediates/external/apache-http/org.apache.http.legacy/and
roid_common/dexpreopt/profile.prof
ANDROID_LOG_TAGS="*:e" out/soong/host/linux-x86/bin/profman --create-profile-fro
m=external/apache-http/art-profile --apk=out/soong/.intermediates/external/apach
e-http/org.apache.http.legacy/android_common/aligned/org.apache.http.legacy.jar
--dex-location=/system/framework/org.apache.http.legacy.jar --reference-profile-
file=out/soong/.intermediates/external/apache-http/org.apache.http.legacy/androi
d_common/dexpreopt/profile.prof
Illegal instruction (core dumped)
18:31:01 ninja failed with: exit status 1
</code>```

I'm using old PowerEdge 2950 with 2 quad-core Xeon CPUs with 32 Gb RAM running with Debian 11 and Ubuntu 20.04. Both systems give me same output.
I've read that org.apache.http.legacy is deprecated package.
I would appreciate same hint where to look for the core of the problem.

Thanks in advance.
DoomRider

答:
I'm not yet fully confident in this answer, but I just ran into a very similar issue - same style profman invocation while building lineage19/android12 on a fairly ancient core2duo*

What seems to have worked for me is commenting out the -mfma and -mavx2 cflags in art/build/Android.bp.  My netresearch that led to that seemed to suggest that those flags are honored by clang/llvm on build systems whose cpu don't support those instructions due to the use-case of (cross)compiling binaries that could be used on systems with cpus that do have avx2 support.

I'm guessing there is a more proper way to tell the aosp buildsystem to disable avx2 and thus not use those flags, perhaps a bug that it isn't detecting that situation correctly right now.

*(with 8G of ram, and let me throw in that I just discovered that using a (cheap western digital blue) ssd for swap seems to have taken about a dozen soong swapthrash hours off of the build :).  Debian 11 x86_64.

Body:
For a quiet some time I'm trying to build Android 11 for Sony Xperia XZ2 H8266.
Everytime process comes to build org.apache.http.legacy package it gets an error.

[ 99% 263/264] //external/apache-http:org.apache.http.legacy dexpreopt [common]
FAILED: out/soong/.intermediates/external/apache-http/org.apache.http.legacy/and
roid_common/dexpreopt/profile.prof
ANDROID_LOG_TAGS="*:e" out/soong/host/linux-x86/bin/profman --create-profile-fro
m=external/apache-http/art-profile --apk=out/soong/.intermediates/external/apach
e-http/org.apache.http.legacy/android_common/aligned/org.apache.http.legacy.jar
--dex-location=/system/framework/org.apache.http.legacy.jar --reference-profile-
file=out/soong/.intermediates/external/apache-http/org.apache.http.legacy/androi
d_common/dexpreopt/profile.prof
Illegal instruction (core dumped)
18:31:01 ninja failed with: exit status 1

I'm using old PowerEdge 2950 with 2 quad-core Xeon CPUs with 32 Gb RAM running with Debian 11 and Ubuntu 20.04. Both systems give me same output.
I've read that org.apache.http.legacy is deprecated package.
I would appreciate same hint where to look for the core of the problem.

Thanks in advance.
DoomRider


问:
C# code to Display a Query Result in a List Box in windows forms
I am working on a software in which i need to display the search query results in a listbox.
mine is a medical software and im trying to display the list of medicines in the listbox.
im using c# for coding under Windows Visual studio 10 platform.
please help me wid this.
regards

Im using Sql server management studio as backend.
im using a button which when clicked will fire an event performing a query.
the query is select * from Table_name
i want to show the query list in the listbox..

答:
try something like this:</p>

```<code> SqlDataAdapater adp=new SqlDataAdapter(querystr,"set connection string");
 DataTable dt=new DataTable();
 adp.Fill(dt);
 List.DataSource=dt;
 List.DisplayMember=dt.Columns[0].ColumnName;
</code>```

Body:
try something like this:

 SqlDataAdapater adp=new SqlDataAdapter(querystr,"set connection string");
 DataTable dt=new DataTable();
 adp.Fill(dt);
 List.DataSource=dt;
 List.DisplayMember=dt.Columns[0].ColumnName;


问:
Run Vue/vitejs and ASP.net core web API on same server
In school we have a project where we are working with vite/vuejs as frontend and using ASP.NET core web API as the rest/backend.

I work on the backend/rest-api in visual studio and the frontend bit in VS Code. Right now to run the website, i have to start the ASP.net API in visual studio and then run the "npm run dev" command in vs code to start the website itself.

Those two are running on seperate "servers" and diffrent ports.

So my real question is, how can i make those two run on the same "server" and port.
So when i run the project, i would like both the backend/rest-api and the frontend to run as "one".

I think the service is IIS.

答:
Maybe try this template.
https://marketplace.visualstudio.com/items?itemName=MakotoAtsu.AspNetCoreViteStarter

before I always use vue + VueCliMiddleware + asp.net core so I try to use vite and
I found this while exploring and trying to use vite in asp.net core in visual studio 2022.


问:
Is it possible to tell the quality level of a JPEG?
This is really a two part question, since I don't fully understand how these things work just yet:

My situation: I'm writing a web app which lets the user upload an image. My app then resizes to something displayable (eg: 640x480-ish) and saves the file for use later.

My questions:

Given an arbitrary JPEG file, is it possible to tell what the quality level is, so that I can use that same quality when saving the resized image?

Does this even matter?? Should I be saving all the images at a decent level (eg: 75-80), regardless of the original quality?

I'm not so sure about this because, as I figure it: (let's take an extreme example), if someone had a 5 megapixel image saved at quality 0, it would be blocky as anything. Reducing the image size to 640x480, the blockiness would be smoothed out and barely less noticeable... until I saved it with quality 0 again...

On the other end of the spectrum, if there was an image which was 800x600 with q=0, resizing to 640x480 isn't going to change the fact that it looks like utter crap, so saving with q=80 would be redundant.

Am I even close?

I'm using GD2 library on PHP if that is of any use

答:
If you trust Irfanview estimation of JPEG compression level you can extract that information from the info text file created by the following Windows line command (your path to i_view32.exe might be different):

```<code>"C:\Program Files (x86)\IrfanView\i_view32.exe" <image-file> /info=txtfile
</code>```

ContentLicense: CC BY-SA 2.5

Body:
If you trust Irfanview estimation of JPEG compression level you can extract that information from the info text file created by the following Windows line command (your path to i_view32.exe might be different):

"C:\Program Files (x86)\IrfanView\i_view32.exe" <image-file> /info=txtfile


问:
Java: "cons" an item to a list
I have an Item which has a method List<Item> getChildren() (which returns an immutable list) and for each of the items I have, I need to create a list of the item followed by its children.

What's the quickest way to "cons" (in the Lisp/Scheme sense) my item to create a new immutable list? I can certainly do the following, but it seems wrong/wasteful:

```<code>public List<Item> getItemAndItsChildren(Item item)
{
    if (item.getChildren.isEmpty())
        return Collections.singletonList(item);
    else
    {
        // would rather just "return cons(item, item.getChildren())"
        // than do the following -- which, although straightforward,
        // seems wrong/wasteful.
        List<Item> items = new ArrayList<Item>();
        items.add(item);
        items.addAll(item.getChildren());
        return Collections.unmodifiableList(items);
    }
}
</code>```

答:
I'd change my requirements. In most cases, you don't need a List in your interface, an Iterable will do nicely. Here's the method:

```<code>public Iterable<Item> getItemWithChildren(Item item)    {
    return Iterables.unmodifiableIterable(
        Iterables.concat(
            Collections.singleton(item),
            item.getChildren()
        )
    );
}
</code>```

and here's the shortened version (with static imports):

```<code>return unmodifiableIterable(concat(singleton(item), item.getChildren()));
</code>```

Title: Java: "cons" an item to a list

Body:
I have an Item which has a method List<Item> getChildren() (which returns an immutable list) and for each of the items I have, I need to create a list of the item followed by its children.

What's the quickest way to "cons" (in the Lisp/Scheme sense) my item to create a new immutable list? I can certainly do the following, but it seems wrong/wasteful:

public List<Item> getItemAndItsChildren(Item item)
{
    if (item.getChildren.isEmpty())
        return Collections.singletonList(item);
    else
    {
        // would rather just "return cons(item, item.getChildren())"
        // than do the following -- which, although straightforward,
        // seems wrong/wasteful.
        List<Item> items = new ArrayList<Item>();
        items.add(item);
        items.addAll(item.getChildren());
        return Collections.unmodifiableList(items);
    }
}

Body:
I'd change my requirements. In most cases, you don't need a List in your interface, an Iterable will do nicely. Here's the method:

public Iterable<Item> getItemWithChildren(Item item)    {
    return Iterables.unmodifiableIterable(
        Iterables.concat(
            Collections.singleton(item),
            item.getChildren()
        )
    );
}

and here's the shortened version (with static imports):

return unmodifiableIterable(concat(singleton(item), item.getChildren()));


问:
how set color flex (html tags) position (cover all web page width, at the end of web page as footer, change relative to windows dimensions)
1- start learning html(following free online html videos course, no css in the course).

2- use simple text edit(g edit).

3- next image show my first html code, i use flex tags to set header and footer.

4- first problem they do not cover all webpage width(point number 1 in the first image)?

5- second how set position of second flex to the end of webpage (even if it empty, no body)?

6- last problem when resize the windows, footer content align to left. how align it to center(second image show the problem)?

<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Test</title>
    <link rel="icon" type="image/png" href="imgs/iconlogo.png" alt="tab icon"/>

English

test

Copyright © 2021  Mnkjj test test test test test test test.All rights reserved

```

答:
Hope this works.</p>
```<code><html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Test</title>
    <link rel="icon" type="image/png" href="imgs/iconlogo.png" alt="tab icon" />

    <style>
        body {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }

        .flex-header {
            display: flex;
            height: 65px;
            justify-content: space-around;
            background-image: linear-gradient(to right, #00ffc3, #bc4a4a);
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
        }

        .flex-header>div {
            font-size: 14px;
            margin: auto;
        }

        .white {
            color: #ffffff;
        }

        footer {
            margin-top: auto;
        }

        .flex-footer {
            display: flex;
            height: 55px;
            align-items: center;
            background-color: #367b97;
            justify-content: center;
        }

        .flex-footer>div {
            font-size: 14px;
        }

        .white {
            color: #ffffff;
        }
    </style>
</head>

<body>

    <header>
        <div class="flex-header">
            <img src="imgs/logo" alt="logo">
            <span class="white">English</span>
        </div>
    </header>

    <main>
        <p>test</p>
    </main>

    <footer>
        <div class="flex-footer">
            <div><span class="white">Copyright © 2021 Mnkjj test test test test test test test.All rights
                    reserved</span></div>
        </div>
    </footer>
</body>

</html>
}````
</code>```

Body:
Hope this works.

<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Test</title>
    <link rel="icon" type="image/png" href="imgs/iconlogo.png" alt="tab icon" />

    <style>
        body {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }

        .flex-header {
            display: flex;
            height: 65px;
            justify-content: space-around;
            background-image: linear-gradient(to right, #00ffc3, #bc4a4a);
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
        }

        .flex-header>div {
            font-size: 14px;
            margin: auto;
        }

        .white {
            color: #ffffff;
        }

        footer {
            margin-top: auto;
        }

        .flex-footer {
            display: flex;
            height: 55px;
            align-items: center;
            background-color: #367b97;
            justify-content: center;
        }

        .flex-footer>div {
            font-size: 14px;
        }

        .white {
            color: #ffffff;
        }
    </style>
</head>

<body>

    <header>
        <div class="flex-header">
            <img src="imgs/logo" alt="logo">
            <span class="white">English</span>
        </div>
    </header>

    <main>
        <p>test</p>
    </main>

    <footer>
        <div class="flex-footer">
            <div><span class="white">Copyright © 2021 Mnkjj test test test test test test test.All rights
                    reserved</span></div>
        </div>
    </footer>
</body>

</html>
}````


问:
Selecting from four tables and grouping some results into one column
sports_games Table

```<code>==========================================================================
| game_id | team_id | game_type | time_started | time_ended | planned_by |
|========================================================================|
|   1     |    1    |     1     | 1640799417   | 1641146196 |     1      |
|   2     |    2    |     1     | 1640971535   | 1641579516 |     1      |
|   3     |    1    |     2     | 1640971553   | 1641582723 |     8      |
|   4     |    2    |     2     | 1640971585   | 1641404242 |     9      |
|   5     |    3    |     4     | 1641061431   | 1641754479 |     12     |
==========================================================================
</code>```

I have been able to combine the above table, with the below table;

game_types Table

```<code>==============================
| game_type | game_type_name |
|============================|
|     1     |   football     |
|     2     |   baseball     |
|     3     |     golf       |
|     4     |    tennis      |
==============================
</code>```

With the following SQL

```<code>SELECT *
    FROM sport_games
    INNER JOIN game_types
    ON sport_games.game_type = game_types.game_type
</code>```

However, I am now finding myself going round and around, attempting potential solution after the other. I need to include data from two more tables, participents and user_basic.

The participents table simply has the game_id and user_id columns, one row per participant, both combined to be the primary key, and within user_basic table, you can find user_id along with their user_name.

For the planned_by column in the firt table, this is also a user_id which I want to obtain their username too.

With all the participants, I would like them to be within one column grouped by their game.

Things That I've Tried

group_concat( .. ), perhaps I was using this completely wrong, I could only achieve this grouping the entire results set from the other table and could not seem to figure out how to use this in a join correctly.

STRING_AGG( ... ) Initially this lead down a path of turning out that I could not use this as I was running on 5.5 MariaDB, which lead down struggling path for me to update. Now I'm using MariaDB 10.3, however I still cannot seem to get the simplest function to work for this, despite going through several Stack Overflows and whatnot.

I feel like I'm at a bit of a loss, any progress I seem to make forward, I am taking two steps back! And then there is using the JOIN amongst these, I'm not sure if I am wording my searches right to place me on the right path, so my question title might be a bit ambiguous right now, sorry if this is the case! - Please suggest otherwise, thank you.

Example Desired Outcome

```<code>"2": { // <- game_id
        "game_type": 2,
        "game_type_name": "baseball",
        "participants": {
            "1": "username_1",
            "2": "username_21",
            "3": "username_3",
            "4": "username_4",
        },
        "time_started": 1641061431,
        "time_completed": 1641754479,
        "planned_by": {
            "851730": "username_1",
        }
}
</code>```

答:
Is time_ready an existing column or calculated from other columns? I don't see time_ready in any of the provided tables.

```<code>SELECT
   game_types.game_type
   , game_types.game_type_name
   , participents.user_id
   , user_basic.user_name
   , sports_games.time_started
   , sports_games.time_ended AS time_completed
   , sports_games.planned_by
FROM sports_games
INNER JOIN game_types
   ON sports_games.game_type = game_types.game_type
INNER JOIN participents
   ON sports_games.game_id = participents.game_id
INNER JOIN user_basic
   ON participants.user_id = user_basic.user_id
ORDER BY
   game_types.game_type
</code>```

Body:
sports_games Table

==========================================================================
| game_id | team_id | game_type | time_started | time_ended | planned_by |
|========================================================================|
|   1     |    1    |     1     | 1640799417   | 1641146196 |     1      |
|   2     |    2    |     1     | 1640971535   | 1641579516 |     1      |
|   3     |    1    |     2     | 1640971553   | 1641582723 |     8      |
|   4     |    2    |     2     | 1640971585   | 1641404242 |     9      |
|   5     |    3    |     4     | 1641061431   | 1641754479 |     12     |
==========================================================================

I have been able to combine the above table, with the below table;

game_types Table

==============================
| game_type | game_type_name |
|============================|
|     1     |   football     |
|     2     |   baseball     |
|     3     |     golf       |
|     4     |    tennis      |
==============================

With the following SQL

SELECT *
    FROM sport_games
    INNER JOIN game_types
    ON sport_games.game_type = game_types.game_type

However, I am now finding myself going round and around, attempting potential solution after the other. I need to include data from two more tables, participents and user_basic.

The participents table simply has the game_id and user_id columns, one row per participant, both combined to be the primary key, and within user_basic table, you can find user_id along with their user_name.

For the planned_by column in the firt table, this is also a user_id which I want to obtain their username too.

With all the participants, I would like them to be within one column grouped by their game.

Things That I've Tried

group_concat( .. ), perhaps I was using this completely wrong, I could only achieve this grouping the entire results set from the other table and could not seem to figure out how to use this in a join correctly.

STRING_AGG( ... ) Initially this lead down a path of turning out that I could not use this as I was running on 5.5 MariaDB, which lead down struggling path for me to update. Now I'm using MariaDB 10.3, however I still cannot seem to get the simplest function to work for this, despite going through several Stack Overflows and whatnot.

I feel like I'm at a bit of a loss, any progress I seem to make forward, I am taking two steps back! And then there is using the JOIN amongst these, I'm not sure if I am wording my searches right to place me on the right path, so my question title might be a bit ambiguous right now, sorry if this is the case! - Please suggest otherwise, thank you.

Example Desired Outcome

"2": { // <- game_id
        "game_type": 2,
        "game_type_name": "baseball",
        "participants": {
            "1": "username_1",
            "2": "username_21",
            "3": "username_3",
            "4": "username_4",
        },
        "time_started": 1641061431,
        "time_completed": 1641754479,
        "planned_by": {
            "851730": "username_1",
        }
}

Body:
Is time_ready an existing column or calculated from other columns? I don't see time_ready in any of the provided tables.

SELECT
   game_types.game_type
   , game_types.game_type_name
   , participents.user_id
   , user_basic.user_name
   , sports_games.time_started
   , sports_games.time_ended AS time_completed
   , sports_games.planned_by
FROM sports_games
INNER JOIN game_types
   ON sports_games.game_type = game_types.game_type
INNER JOIN participents
   ON sports_games.game_id = participents.game_id
INNER JOIN user_basic
   ON participants.user_id = user_basic.user_id
ORDER BY
   game_types.game_type