使用virt-customize修改QEMU的Qcow2格式镜像Root密码转载文章

玩技站长
玩技站长
管理员, Keymaster
6980
文章
1
粉丝
运维笔记评论50字数 191阅读0分38秒阅读模式

使用virt-customize修改QEMU的Qcow2格式镜像Root密码

安装Virt工具

[root@controller ~]# yum install libguestfs-tools-c

安装完成后将qcow2镜像上传至root目录下,然后使用Virt工具修改Root密码

修改Root密码

[root@controller ~]# virt-customize --add CentOS-7-x86_64-2009.qcow2 --root-password password:000000
[   0.0] Examining the guest ...
virt-customize: error: libguestfs error: could not create appliance through 
libvirt.

Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct

Original error from libvirt: Cannot access storage file 
'/root/CentOS-7-x86_64-2009.qcow2' (as uid:107, gid:107): Permission denied 
[code=38 int1=13]

If reporting bugs, run virt-customize with debugging enabled and include 
the complete output:

  virt-customize -v -x [...]

如果出现以上提示权限不足等信息,可根据提示声明一个环境变量实现直接修改Root密码

[root@controller ~]# export LIBGUESTFS_BACKEND=direct

再次执行修改Root密码

[root@controller ~]# virt-customize --add CentOS-7-x86_64-2009.qcow2 --root-password password:000000
[   0.0] Examining the guest ...
[  24.7] Setting a random seed
[  24.9] Setting passwords
[  36.6] Finishing off

原创声明:本文章为原创内容,所有文章均由博主亲自撰写,严格遵循原创原则。我们承诺不使用任何人工智能生成的内容,所发布的每一篇文章都经过深思熟虑,旨在为读者提供真实、有价值的观点和信息。我们坚信原创才是知识分享的根本,致力于为广大读者呈现最具真实性和独特性的文章。感谢您的支持与关注,欢迎持续关注我们的原创内容。

 
匿名

发表评论

匿名网友
确定

拖动滑块以完成验证