Is it safe to initialize secret keys by just reading /dev/random on Linux? For a software, I don't want the user to choose weak keys, so I plan to just read the needed number of bytes from /dev/random to create the needed secret keys. Is it safe to do so?
Yes, in any algorithm where keys are just random numbers, reading them from /dev/random is safe.

However, /dev/random blocks if the kernel's entropy estimate goes to zero so it is often a good idea to use a user space CSPRNG seeded from /dev/random or /dev/urandom for session keys and other similar random numbers that are used in bulk. The newer getrandom interface may be preferable when available.

Using /dev/urandom or getrandom directly is also fine, when you do not need a high rate of randomness, as they are rather slow (on Linux &lt; 4.8 at least).