/etc/sudoers broken

blackjack

New Member
Feb 20, 2012
12
0
1
I am using proxmox ve 1.9 and one of my virtual machines I have modified the /etc/sudoers file. Now I cannot have root access to the VM because it shows error in sudoers.How can I get root access in that VM? Is there any way of start the vm in single user mode?
 
I am using proxmox ve 1.9 and one of my virtual machines I have modified the /etc/sudoers file. Now I cannot have root access to the VM because it shows error in sudoers.How can I get root access in that VM? Is there any way of start the vm in single user mode?
Hi,
OpenVZ-VM? - edit /var/lib/vz/private/VMID/etc/sudoers
kvm-VM? boot an live-cd (like grml), mount the root-filesystem, edit the file and reboot (like on a physically machine).

Udo
 
Thank you for quick reply.
I am using KVM and the directory of my vm is /var/lib/vz/images/108/vm-108-disk-1.qcow2 . I am new to proxmox. How can I boot from live cd. should I put it in physical hardware and from Web GUI select first boot device cdrom and reset the vm server I want to recover? then use vnc to edit the sudoers file. what should be the mount command for me then.

considering that my other vm servers are running and should not be stoped.
 
Last edited:
...
I am new to proxmox.
Hi,
this is not really proxmox related - this is normal linux doing
How can I boot from live cd. should I put it in physical hardware and from Web GUI select first boot device cdrom and reset the vm server I want to recover? then use vnc to edit the sudoers file. what should be the mount command for me then.

considering that my other vm servers are running and should not be stoped.
You can use the cdrom of the pve-host, or transmit the iso-image of the cd to the pve-server (i prefer this way). Select them as cdrom, select cdrom as boot-device in this VM. Stop and start the VM and the live-cd will booted.
What to do for mounting depends on your configuration. Use the VM lvm? What kind of disks are using (e.g. /dev/vda for virtio-disks and sda/hda for ide...).
Use grml as bootdisk and type "Start lvm" (or lvm2?) - perhaps you see lvm-storage than.

fdisk -l shows all disks (and look on /dev/mapper for lvm-storage).
then simply "mkdir /vmdisk" and "mount DEVICE /vmdisk".

Perhaps it's better to ask an colleage with more linux knowledge?

Udo
 
Succeed to Fix the prob!!!!!!

Go to VNC and click Alt+Ctrl+Del resides in the upper right corner of the VNC. Then press del from the keyboard to capture the GRUB menu. Now you can start the VM as single user mode(check online how to start in single user mode). change the root password with passwd command. Again click Alt+Ctrl+Del to restart the VM. Now you can login as a root user and edit /etc/sudoers.

Voilla !!!
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!