2025年guesfs-tools 心得

guesfs-tools 心得libguestfs error could not create appliance through libvirt Try running qemu directly without libvirt using this gt environment variable export LIBGUESTFS BACKEND direct

大家好,我是讯享网,很高兴认识大家。

libguestfs: error: could not create appliance through libvirt.

Original error from libvirt: Cannot access storage file '/home/user/xenial-server-cloudimg-amd64-disk1.img' (as uid:107, gid:107): Permission denied [code=38 int1=13]
解决方法:
http://manpages.ubuntu.com/manpages/xenial/man1/guestfs-faq.1.html

"Permission denied" when running libguestfs as root
You get a permission denied error when opening a disk image, even
though you are running libguestfs as root.


讯享网

 This is caused by libvirt, and so only happens when using the libvirt backend. When run as root, libvirt decides to run the qemu appliance as user "qemu.qemu". Unfortunately this usually means that qemu cannot open disk images, especially if those disk images are owned by root, or are present in directories which require root access. There is a bug open against libvirt to fix this: https://bugzilla.redhat.com/show_bug.cgi?id= You can work around this by one of the following methods: · Switch to the direct backend: export LIBGUESTFS_BACKEND=direct · Don't run libguestfs as root. · Chmod the disk image and any parent directories so that the qemu user can access them. · (Nasty) Edit /etc/libvirt/qemu.conf and change the "user" setting. 

讯享网
讯享网$ sudo guestfish --rw -a trusty-server-cloudimg-amd64-disk1.img 
如有必要,请加上sudo. 运行镜像: 
讯享网列出所有的文件系统: 
挂载到根目录: 

<fs> mount /dev/sda1 /

讯享网编辑/etc/cloud/cloud.cfg文件,修改默认用户ubuntu的密码: 

<fs> vi /etc/cloud/cloud.cfg

找到default_user字段 1.把lock_passwd:True修改为:lock_passwd:false.lock_passwd默认为true,锁定密码禁用密码登陆,因此我们要改成false 2.增加plain_text_passwd:'你要设置的密码'.例如我的: 
小讯
上一篇 2025-02-27 10:03
下一篇 2025-02-21 09:42

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/47802.html