/etc/sudoers broken

Discussion in 'Proxmox VE 1.x: Installation and configuration' started by blackjack, Feb 20, 2012.

  1. blackjack

    blackjack New Member

    Joined:
    Feb 20, 2012
    Messages:
    12
    Likes Received:
    0
    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?
     
  2. udo

    udo Well-Known Member
    Proxmox Subscriber

    Joined:
    Apr 22, 2009
    Messages:
    5,835
    Likes Received:
    159
    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
     
  3. blackjack

    blackjack New Member

    Joined:
    Feb 20, 2012
    Messages:
    12
    Likes Received:
    0
    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.
     
    #3 blackjack, Feb 20, 2012
    Last edited: Feb 21, 2012
  4. udo

    udo Well-Known Member
    Proxmox Subscriber

    Joined:
    Apr 22, 2009
    Messages:
    5,835
    Likes Received:
    159
    Hi,
    this is not really proxmox related - this is normal linux doing
    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
     
  5. blackjack

    blackjack New Member

    Joined:
    Feb 20, 2012
    Messages:
    12
    Likes Received:
    0
    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 !!!
     
    #5 blackjack, Mar 7, 2012
    Last edited: Mar 13, 2012
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice