• We had to restore from a backup today after a failed software update. Backup was from 0000 EDT and restored it at 0800 EDT so we lost about 8hrs. Today is 07/20/2024. More info here.

Solved KVM Machine doesn't start due to permissions

Solved issue

tinfoil-hat

Active Member
Joined
Oct 24, 2021
Messages
365
Reaction score
185
Credits
2,548
Hi there,
I've moved my virtual HDD to another drive and the VM refuses to start due to permission problems. I tried to add my user to the groups "kvm" "qemu" and "libvirt-qemu". I used
Code:
rsync -avh source destination
as root to copy the image. I even tried
Code:
chmod 777 -R
with no success. let me know if you need additional information.


Bildschirmfoto vom 2023-04-05 06-49-28.png

Bildschirmfoto vom 2023-04-05 06-50-53.png

Bildschirmfoto vom 2023-04-05 06-51-42.png


any kind of help appreciated
 


I even tried
Code:
sudo chown --reference=LanguageModels.qcow2 /media/anon/8TB/language-models/LanguageModels.qcow2
sudo chmod --reference=LanguageModels.qcow2 /media/anon/8TB/language-models/LanguageModels.qcow2
without success, it still throws this error:
Code:
Fehler beim Starten der Domain: Cannot access storage file '/media/anon/8TB/language-models/LanguageModels.qcow2' (as uid:64055, gid:109): Keine Berechtigung

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 108, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1384, in startup
    self._backend.create()
  File "/usr/lib/python3/dist-packages/libvirt.py", line 1353, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: Cannot access storage file '/media/anon/8TB/language-models/LanguageModels.qcow2' (as uid:64055, gid:109): Keine Berechtigung
 
S.M.A.R.T values show PASSED and no "failed" state
Bildschirmfoto vom 2023-04-05 07-17-34.png
 
My images are all owned by the same user and group all though I'm probably using a different distribution than you.
Code:
.rw-------. qemu qemu 20 GB Fri Mar 10 14:55:34 2023 debian.qcow2
.rw-------. qemu qemu 20 GB Sat Apr  1 17:30:24 2023 rhel8.qcow2
.rw-------. qemu qemu 20 GB Sun Apr  2 20:09:44 2023 rhel9.qcow2
.rw-------. qemu qemu 20 GB Tue Apr  4 20:01:52 2023 ansible.qcow2
 
My images are all owned by the same user and group all though I'm probably using a different distribution than you.
Code:
.rw-------. qemu qemu 20 GB Fri Mar 10 14:55:34 2023 debian.qcow2
.rw-------. qemu qemu 20 GB Sat Apr  1 17:30:24 2023 rhel8.qcow2
.rw-------. qemu qemu 20 GB Sun Apr  2 20:09:44 2023 rhel9.qcow2
.rw-------. qemu qemu 20 GB Tue Apr  4 20:01:52 2023 ansible.qcow2
Well, my user is in the same group as the user and group of the file. I copied the permssions of the source file which works. my smartvalues are okay. I see no reason why it shouldn't work.
Bildschirmfoto vom 2023-04-05 08-32-27.png

I also chmod ed to my system user and group with no luck
 
I also created a new VM and tried to assign the disk, without any luck:
Bildschirmfoto vom 2023-04-05 08-43-37.png
 
What happens when you create a new vm with new disks?
 
I did so in the previous reply of yours
Is that screenshot is that an already existing disk you are trying to assign or a newly created disk which automatically gets created when click on begin installation at the end of the create vm wizard?
 
Is that screenshot is that an already existing disk you are trying to assign or a newly created disk which automatically gets created when click on begin installation at the end of the create vm wizard?
I tried another entirely new disk and this works. But I have spend countless of hours into the OS on that disk. I'd like to assign that disk.
 
The thing is, that I am running out of space on my SSD and want to move this VM to my HDD. I tried to boot with the original Image and it booted without any problems. But that doesn't solve my problem. Because I need >this Image< to work from my HDD
 
I tried another entirely new disk and this works. But I have spend countless of hours into the OS on that disk. I'd like to assign that disk.
It was just to test something, to see if the permissions of the directory above were correct. What are the permissions and ownership of the new disk when it creates successfully when having created that new disk through the wizard? Can you share the output of "ls -l" in that directory where the new disk was created?
 
I can boot the VM when the new image is created on my SSD and if I create a new image on my HDD it somehow refuses to boot... strange
 
I would compare the permissions of the directory structure of the ssd to the hd or did you chmod 777 -R on both locations since you mentioned doing that?
 
How did you attach the disk to the vm, did you place it there and then use "Import existing disk image" or did you do something else?
 
How did you attach the disk to the vm, did you place it there and then use "Import existing disk image" or did you do something else?
I clicked my way trough virt-manager gui (add device -> storage -> Sata -> path/to/img/) I tried both (VirtIO and SATA)
 
On my Qemu setup I created a new storage location and added it as a storage pool, then I deleted the vm without deleting the image. Then I moved the image to the new storage location, after which I clicked on "create new vm", then selected the option "Import existing disk image", then went through the rest of the options and my vm booted. Try doing that instead and see what happens?
 
On my Qemu setup I created a new storage location and added it as a storage pool, then I deleted the vm without deleting the image. Then I moved the image to the new storage location, after which I clicked on "create new vm", then selected the option "Import existing disk image", then went through the rest of the options and my vm booted. Try doing that instead and see what happens?
I already did that, just in GUI. All seemed to work until I tried to start the VM, then it gave me all the same error as mentioned above
 
I even tried the same as you with a secondary disk by attaching it through the virt-manager interface, my imported vm has booted every time so far. What does the permission structure of the directory look like?
Code:
ls -l /media/anon/8T/test
ls -l /media/anon/8T/language-models
ls -l /media/anon/8T
ls -l /media/anon
ls -l /media
 
tbh, I am so close to give up, I may also eliminate the reason for my VM and install my Language-Models (dalai, llama and alpaca) on my local machine. Anyway, maybe this can help to resove
Code:
anon@navi [11:38:08] [~] 
-> % ls -ll /media/anon/8TB/language-models 
insgesamt 16
drwxrwxrwx 2 anon anon 4096 Apr  5 04:59 alpaca-7b
-rw-rw-rw- 1 anon anon 1097 Apr  5 07:20 download.sh
drwxrwxr-x 3 anon anon 4096 Apr  5 10:54 llama
drwxrwxr-x 2 anon anon 4096 Apr  5 07:15 test

anon@navi [11:38:21] [~] 
-> % ls -ll /media/anon/8TB/               
insgesamt 48
drwxrwxr-x 10 anon anon  4096 Apr  3 12:45 backup
drwxrwxr-x  7 anon anon  4096 Apr  5 11:00 dalai
drwxrwxrwx  5 anon kvm   4096 Apr  5 10:52 language-models
drwxrwxr-x  2 anon anon  4096 Apr  5 10:01 langvm
drwx------  2 anon anon 16384 Mär 11 13:57 lost+found
drwxrwxr-x  2 anon anon  4096 Apr  5 05:46 MintVM
drwxrwxr-x  2 anon anon  4096 Apr  5 10:35 test
drwxrwxr-x  3 anon anon  4096 Apr  1 19:00 Videos
drwxrwxr-x  2 anon anon  4096 Mär 26 00:49 WindowsVM

anon@navi [11:38:25] [~] 
-> % ls -ll /media/anon/    
insgesamt 20
drwxr-xr-x 12 anon kvm  4096 Apr  5 11:00 8TB
drwxrwxrwx  2 root root 4096 Mär 12 03:00 cryfs
drwxr-xr-x  2 anon root 4096 Jan  8 16:00 raid
drwxr-xr-x  2 root root 4096 Mär  7 18:24 ssd
drwxrwxr-x  2 anon anon 4096 Mär 11 17:41 storagebox

anon@navi [11:38:31] [~] 
-> % ls -ll /media/     
insgesamt 4
drwxr-x---+ 7 root root 4096 Mär 20 19:39 anon

anon@navi [11:38:34] [~] 
-> %
 

Members online


Top