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

玩技站长 运维笔记评论30字数 191阅读0分38秒阅读模式

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

安装Virt工具

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

安装完成后将qcow2镜像上传至root目录下,然后使用Virt工具修改Root密码文章源自玩技e族-https://www.playezu.com/844204.html

修改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密码文章源自玩技e族-https://www.playezu.com/844204.html

[root@controller ~]# export LIBGUESTFS_BACKEND=direct

再次执行修改Root密码文章源自玩技e族-https://www.playezu.com/844204.html

[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
文章源自玩技e族-https://www.playezu.com/844204.html文章源自玩技e族-https://www.playezu.com/844204.html
 
匿名

发表评论

匿名网友
确定

拖动滑块以完成验证