# System stuck during boot for ~5 minutes hanging at random

## chrisk2305

Hi,

My system is stuck during boot for quite some time due to random fast init and random crng init hanging:

```
3.104177] clocksource: Switched to clocksource tsc

[   54.950502] random: fast init done

[  149.704022] random: crng init done

[  423.106828] smartpqi 0000:0c:00.0:
```

I searched the forums and already emerged:

```

USE=+jitterentropy emerge sys-apps/rng-tools

emerge haveged

```

And enabled both services but that did not do the trick (I guess because they are userspace tools and my issues happens at the very beginning of booting).

Kernel version I am using is 5.4.3

Any help is much appreciated!

Chris

----------

## fedeliallalinea

You tried also some of others proposed by toralf (I use haveged)?

----------

## mike155

Please install haveged AND enable it.

----------

## chrisk2305

Hi,

please see my inital post. I installed and enabled haveged. Did not do the trick.

----------

## mike155

 *Quote:*   

> I installed and enabled haveged. Did not do the trick.

 

Sorry! I have overlooked that.

Please upgrade to the latest kernel of the 5.4. series (5.4.30) and retry. 

Please post the output of

```
emerge --info
```

Please post the output of 'dmesg' directly after booting

Please post your kernel config using wgetpaste.

----------

## chrisk2305

1. done - no change

2.

https://pastebin.com/LuFrWWsW

3.

https://pastebin.com/VjpY6fWV

4.

http://dpaste.com/1QT2PES

----------

## mike155

dmesg shows 2 issues, which are most probably independent of one another:

it takes 150 seconds to initialize the random number generator:

```
[  149.762497] random: crng init done
```

it takes 430 seconds to initialize the Adaptec SmartRAID driver:

```
[  434.259870] smartpqi 0000:0c:00.0: Online Firmware Activation enabled
```

The second issue is the one that hurts you. Let's try to solve that first.

----------

## chrisk2305

hmm....you are probably right. At first I thought that the Adaptec HBA is the issue but concentrated on random (which also takes far too long  :Smile:  )

In the meanwhile I updated the HBA's firmware to the latest one but that did not change anything in boot behaviour. Not sure what else I can try.

----------

## mike155

Some of your kernel option look suspicious. AMD ACPI2Platform is disabled, NUMA is disabled, IOMMU is disabled, etc. 

Please read https://wiki.gentoo.org/wiki/Ryzen and adjust your kernel settings. It might also be necessary to increase CONFIG_NR_CPUS to 32.

EDIT (not related to your boot issues): don't use -O3 in your CFLAGS! -O3 is known to break several packages and it's not recommended.Last edited by mike155 on Mon Apr 06, 2020 4:36 pm; edited 1 time in total

----------

## chrisk2305

are these options also necessary as this is a virtual machine? The Adaptec HBA is passed through to the VM as additional info.

----------

## mike155

You're talking about a virtual machine? Really?

Your output of dmesg doesn't look like a virtual machine! 16 CPUs, multiple ethernet adapters, many scsi devices, ... What are you doing? 

I'm afraid I can't help you.

----------

## chrisk2305

Yes I am. 

This is quite a special setup. I have multiple VMs runnig on that host ( 16C/32T Epyc2 CPU, 128GB RAM). I am passing through 2 NVMe disks and the Adaptec HBA - no more specialties than that.

Neither of that can explain my issues.

----------

## toralf

 *chrisk2305 wrote:*   

> are these options also necessary as this is a virtual machine?

 Gha,

and didn't you set CONFIG_HW_RANDOM_VIRTIO to be passed to the virtual machine to avoid hangs of virtual machines during boot ???

----------

## chrisk2305

@toralf: The Hypervisor used here is esxi 6.7. As far as I know VMWare does not pass through a hardware number generator.

----------

## toralf

 *chrisk2305 wrote:*   

> @toralf: The Hypervisor used here is esxi 6.7. As far as I know VMWare does not pass through a hardware number generator.

 Understood - you should take a look at the LKML archive. The problem with hanging virtual machines due to the rng not being initialized was a hot topic a time ago - I'm pretty sure you'll find the answer there.

----------

## chrisk2305

All the threads I find on the internet suggest to install haveged and/ or rng-tools. I also tried "Trust CPU for rng" Kernel option but the issue persists. I am stuck here.

----------

