Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a postinstall script that runs after my preseed install that checks /proc/cpuinfo for vmx or svm flags and if the server has them, it installs kvm packages. The only problem is due to the install running in a chroot /target directory, there is no /proc/cpuinfo to look at. The "lshw" command doesn't have the goods either. Any thoughts on how this can otherwise be accomplished?

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

The problem with not having access to /proc is that you don't have any script access to the sysfs calls required to do the check. What you need to do is to make sure your chroot has access to proc.

You can do this by mounting /proc before your chroot using the late pressed command like this:

d-i preseed/late_command string chroot /target; mount proc /proc -t proc;

And also a second option: remounting proc inside the chroot like this:

mount proc /proc -t proc

in fact if it's an installed system, mount /proc alone would work.

share|improve this answer
add comment

Another option would be to use the kvm-ok script (or parts of it), that comes in the cpu-checker package. This uses the msr-tools package to query the CPU's MSR registers directly via a /dev node. So that trades needing /proc for needed /dev. :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.