Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Why can't libguestfs password in openstack be injected into lvm partition image

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains why the libguestfs password in openstack can not be injected into the lvm partition image. Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor learn why the libguestfs password in openstack can't be injected into the lvm partition image.

Yum install libguestfs-tools

First, test the default image cirros:

1 、 virt-cat:

-a: use an image file

-d: use domain

Virt-cat-d instance-0000003f / etc/passwd

You can see the read file.

Virt-edit-d instance-0000003f / etc/shadow

Prompt that the computer needs to be shut down, and the shutdown continues:

Change the root password:

Set

Cirros:$1$ LJwQnqlv$DK6oKqcTq9Rf2ClC.kMa3/:10933:0:99999:7:::

Modified to:

Cirros:$1$ JwZnqlv$DK6oKqcTq9Rf2ClC.kMa3/:10933:0:99999:7:::

After the modification is successful:

Start the virtual machine:

It shows that the password is incorrect and cannot be logged in, indicating that the password has been changed successfully.

Next, test the mirror instance of the lvm partition of centos:

Virt-cat-d instance-00000040 / etc/passwd

Https://github.com/libguestfs/libguestfs/commit/3fc6983b1666a32ea6c1b44d88f140e3c84e7201

Compiling supermin reports an error:

Strace tracking:

Yum install glibc-static

Yum install glib2*

A pcre error occurred:

Yum install pcre-devel pcre

Yum install augeas

Compiling 1.27.31 reported syntax error (should be the latest version of bug).

Recompile version 1.27.24 to see if the same problem occurs:

Installation 1.27.24 succeeded

Let's continue to test the above lvm inoperable problem:

Virt-cat-d instance-00000040 / etc/passwd

Indicates that libvirt is not compiled to version 1.27.24:

Try it in a different way:

Verify the lvm system centos6.5 image file:

Virt-cat-a / var/lib/nova/instances/76f00ea2-16a8-41e2-b128-6357634edbb9/disk / etc/shadow

Then verify the cirros image:

It is concluded that both lvm and sda partitions can be virt-cat.

Then log in with root and password yunjisuan:

The landing was successful.

Let's continue to experiment with the password modification function of virt-edit:

Original password file:

Virt-edit-a / var/lib/nova/instances/76f00ea2-16a8-41e2-b128-6357634edbb9/disk / etc/shadow

Modified to:

Save exit. (reminder: have you noticed that the new version of the password does not need to be turned off like the old version!)

The re-login password was not changed successfully:

Open the virtual machine password file again:

Virt-edit-a / var/lib/nova/instances/76f00ea2-16a8-41e2-b128-6357634edbb9/disk / etc/shadow

Turned into garbled code. Sweat!

Shut down and try again:

Virt-edit-a / var/lib/nova/instances/76f00ea2-16a8-41e2-b128-6357634edbb9/disk / etc/shadow

Virt-cat-a / var/lib/nova/instances/76f00ea2-16a8-41e2-b128-6357634edbb9/disk / etc/shadow

There is no garbled code in the modification after the shutdown.

Restart the machine login:

Page restart:

May be due to the upgrade of the new version of qemu-kvm.

Qemu-kvm was replaced with 1.2.0 when compiling libgutstfs, so let's go back to the previous version:

Regenerate the virtual machine:

Success.

To continue the above tests, to prevent garbled codes, shut down the virtual machine first and then operate:

Virt-edit-a / var/lib/nova/instances/76f00ea2-16a8-41e2-b128-6357634edbb9/disk / etc/shadow

Probably because qemu-kvm has been replaced, replace it back to 1.2.0:

Then you can modify the virtual machine file:

Error continuing to restart the machine:

Replace back to the original qemu-kvm:

The page restarted the virtual machine successfully:

At this time, the login password with root,cdyanfa is incorrect, indicating that the lvm mirror mask has been modified successfully.

Conclusion:

There may be two reasons why passwords or keypair cannot be injected into the image of lvm partition in opesntack:

1. The version of libguestfs in openstack environment is too low (this is the largest)

2. The code of the driver module in which openstack calls libguestfs is bug (probably looking at the source code, it seems that there is something wrong with this)

At this point, I believe you have a deeper understanding of why the libguestfs password in openstack can not be injected into the lvm partition image. You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report