0

I'm currently running

virt-sysprep -v -x -d LOCALVM  --hostname LOCALVM --root-password password:123456

But it errores out saying

virt-sysprep: error: libguestfs error: guestfs_launch failed, see earlier 
error messages

But if I run this with sudo it works. How do I set my user to not need sudo to be able to run virt-sysprep without it?

referencing the manual

You do not need to run virt-sysprep as root. In fact we'd generally recommend that you don't. The time you might want to run it as root is when you need root in order to access the disk image, but even in this case it would be better to change the permissions on the disk image to be writable as the non-root user running virt-sysprep.

1

Method 1: Try echo sudo -s >> /home(your username)/.bash_profile. When starting up the terminal, you need to put in your password to use the terminal, however, you won't have to use sudo to execute virt-sysprep. Be careful with this, because with great power comes great responsability. Method 2: Open a new terminal and type in sudo visudo. At the end of the file, type this in: %yourusername% ALL=NOPASSWD: /usr/bin/virt-sysprep. I'm guessing virt-sysprep is installed in /usr/bin/virt-sysprep. If you're not sure, type this in the terminal: whereis virt-sysprep. Replace the first directory with /usr/bin/virt-sysprep.

| improve this answer | |
  • updated question in order to clarify – nadermx Jun 30 '18 at 9:09
  • updated answer with second method. – Psionikal Jun 30 '18 at 9:13
  • 1
    your method works, but I got it to work with chown -R, see answer. Thank you – nadermx Jun 30 '18 at 9:17
0

Needed to give ownership

sudo chown -R user /usr/bin/virt-sysprep

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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