VMware Cloud Community
Greatbay
Contributor
Contributor
Jump to solution

ESXi 5.5.0 corrupt or bloated state.tgz

I was helping out a small church. And for some unknown reason, someone decided to install VMware ESXi Version 5.5. With only two virtual machines built inside. A domain controller, file server, and 5 users. The file server is also their accounting server. They've had the ESXi server for 3 years or so. Of course, they had a falling out with the person who built the ESXi server a year ago. And... no one knew what they had, as for DC and File server. I saw the HP ProLiant D360, thinking it was the domain controller. No problem, just log in and do what I had to do. It took a week before anyone knew the domain admin password, no problem. However, nobody knew the root password, let alone what was "root".

In the end, I was trying to blank out the root password and some how the state.tgz got corrupted.

I followed the below instructions:

https://www.youtube.com/watch?v=CoL43UBpVyI

Reset ESXi 5 Root Password - EASY!

https://www.youtube.com/watch?v=KqcjBGNZtq8

How to Reset Forgotten VMware Esxi 5 Esxi 6 and mor Root Password

==

The file size of the state.tgz was 15k. Now it's at 1.2mb! However, I can still tar the file and read the shadow file.

I did this using ubuntu v16:

sudo -s

root@ubuntu:~#

mount /dev/sda5 /mnt

ls -l /mnt

- the file we’re looking for “state.tgz"

cp /mnt/state.tgz /tmp

cd /tmp

tar xzf state.tgz

tar xzf local.tgz

ls -l

- Go to the /etc directory and you can gain access the shadow file which conatins the password hash of ESXi root account.

cd /etc

- Run the nano shadow command to open the shadow file in the vi editor.

nano shadow

- delete everything in between the first two colons.

- such as, root:6$345678htGFd7:16630:0:99999:7:::

- delete “6$345678htGFd7” everything to make it look like this root::16630:0:99999:7:::

- Once you have removed the password hash, press ctrl-x and save.

cd .. (to go back up one directory)

- you should be in the tmp directory

cd

tar czf local.tgz etc

tar czf state.tgz local.tgz

cp state.tgz /mnt/

umount /dev/sda5

reboot

==

The first couple times, the instructions did not work. So I did it again. 4 times later, nothing. I could not login.

==

Then I tried:

https://www.thomas-krenn.com/en/wiki/Reset_VMware_ESXi_root_password

Reset VMware ESXi root password

I followed the instructions, but I used:

tar -xvf state.tgz

tar -xf local.tgz

cd /etc

nano shadow

==

Then I noticed the state.tgz the 15k file bloated to 1.2mb. However, I did not pay any attention to it. I copied the state.tgz to /mnt.

So now I have this 1.2MB state.tgz file.

The funny thing is, I can still repeat the instructions and see the root password within shadow file, but the VVMware ESXi server will not boot up. The ESXi server boots all the way, loading all the files and services, it looks like the server is ready for the root password entry... then it black screens. I can't even ping the ESXi server.

I will confess... I did not backup the state.tgz file. I should have did "cp /mnt/state.tgz /mnt/state.tgz.bak". Stupid me!

Is there anyway, to restore this state.tgz file?

Or, is there away to reduce the size of the state.tgz from 1.2mb back to 15k?

Any help would be appreciated.

1 Solution

Accepted Solutions
Greatbay
Contributor
Contributor
Jump to solution

Thank you so much your reply. You have great information.

I did as you mentioned:

the solution :

we had installed a new esxi 5.5

I did the following:

Step (1)

https://my.vmware.com/web/vmware/details?downloadGroup=OEM-ESXI55U3B-HPE&productId=353

Download HPE Custom Image for ESXi 5.5.0 U3b GA

Version     5.5.0U3b

Description     HPE Custom Image for ESXi 5.5.0 U3b GA

HPE Custom Image for VMware ESXi 5.5.0 Update 3b Install CD

File size: 372.31 MB

File type: iso

Step (2)

https://rufus.akeo.ie

Rufus

Create bootable USB drives the easy way

Step (3)

https://miketabor.com/create-bootable-esxi-installer-usb-flash-drive/

Creating a bootable ESXi flash drive

1. Download VMware ESXi ISO image from VMware.

2. Connect your flash drive to your computer.

3. Open Rufus and in the Device drop down select your USB flash drive.

4. Click the icon that looks like a CD to select the ESXi ISO image youíve downloaded.

5. Now click on Start.

6. Next youíll be prompted to replace menu.c32, answer Yes.

Thatís it! Rufus will write the ISO image to the USB thumb drive and youíll be able to boot your Intel NUC or server from the flash drive and install ESXi.

Since the installer gets loaded into memory you can also install ESXi right onto the same flash drive, which is exactly what I did when I setup my three Intel NUCës in my home lab.

Step (4)

I installed ESXi server in the HP server.

20170626_182758_1024x576.jpg

==

20170626_183516_1024x576.jpg

I made sure I did not touch the datastore.

==

20170626_183549_1024x576.jpg

Here's where I changed the password.

==

20170626_191943_1024x576.jpg

I had to add VM back to inventory. See step 5.

==

Step (5)

Then I had to add VM back to inventory.

To register a virtual machine in vCenter Server:

  1. Open the vSphere / VMware Infrastructure (VI) Client and log in with appropriate credentials.
  2. If connecting to vCenter Server, click on the desired host.
  3. Click the Configuration tab.
  4. Click Storage.
  5. Right-click on the appropriate datastore and click Browse Datastore.
  6. Navigate to the folder named after the virtual machine, and locate the <virtual machine>.vmx file.
  7. Right-click the .vmx file and click Add to inventory. The Add to Inventory wizard opens.
  8. Continue to follow the wizard to add the virtual machine.

Everything is up and running.

And thanks for your reply Batchenr

View solution in original post

0 Kudos
2 Replies
Batchenr
Contributor
Contributor
Jump to solution

Hello,

we had the same issue due to this forum :

https://forums.digitalpoint.com/threads/tutorial-how-to-reset-esxi-v6-root-password.2786960/

its a command taypo issue - if you notice after extracting etc to root

you did the command "cd /etc" instead of "cd etc"

and as a result you copied the livecd /etc instead of the real esxi etc file and run over it!

the solution :

we had installed a new esxi 5.5 and started to copy what we did had left.

so you need to do this steps :

make new esxi 5.5

go to etc there and make your own etc file - that means that yull see there more files then you need.

make sure you have only this :

checkconfig.db

dhclient-vm0.leases

hosts

keymap

random-seed

resolve.conf

security(file)

sfcb(file)

shadow

ssh(file)

vmsyslog.conf

vmsyslog.conf.d(file)

vmware(file)

all other files you can remove.

now you have to find the file onestage.tgz  when you have livecd on mount all the disks that you see at fdisk -l ( the ones that you can mount , the vmfs you cant mount and it

will apper as unknown"

mount everything :

mkdir /mnt/sda2

mount /dev/sda2  /mnt/sda2

mkdir /mnt/sda3

mount /dev/sda3  /mnt/sda3

mkdir /mnt/sda4

mount /dev/sda4  /mnt/sda4

mkdir /mnt/sda5

mount /dev/sda5  /mnt/sda5

and so on...

and there you should have (dig in the files good!) a file name one(somthing).tgz

im sorry i cant remmber the file name! but i think it onestage.tgz or somthing like that.

take this file cp to root and extract -

then, it will have /etc/ and /var/ inside of it - only part of /etc/

but it will help you to fill up the files that you took from the new esxi 5.5 machine .

checkconfig.db -dont touch anything

dhclient-vm0.leases- you need to reconfigure the network you shuld have this info on onestage -> vmware file - esx.conf go inside and dig a little.

hosts - should have this at onestage.tgz

keymap- dont touch anything

random-seed - dont touch anything

resolve.conf-should have this at onestage.tgz

security(file)-  search here for the UUID file and change to the UUID as you have it in onestage.tgz , you should have a uuid file there to.

sfcb(file)-search here for the UUID file and change to the UUID as you have it in onestage.tgz , you should have a uuid file there to - iwort it twice as i dont remmber in which file it was !

shadow -> delete the string at the root user , thats why we have this all issue so dont forget!

ssh(file)-dont touch anything

vmsyslog.conf-dont touch anything

vmsyslog.conf.d(file)

vmware(file)- should have this at onestage.tgz

just copy the esx.conf from onwstage to here it has all your privies configuration

and after all that-

rsync the new etc file to the LiveCd from the new esxi 5.5 with only the relevent files i wrote

and then put it back to the mount :

tar -czvf local.tgz etc

tar -czvf state.tgz local.tgz

cp state.tgz /mnt/sda5/state.tgz

umount /mnt/sda5

reboot

Hope you will make it!!

Greatbay
Contributor
Contributor
Jump to solution

Thank you so much your reply. You have great information.

I did as you mentioned:

the solution :

we had installed a new esxi 5.5

I did the following:

Step (1)

https://my.vmware.com/web/vmware/details?downloadGroup=OEM-ESXI55U3B-HPE&productId=353

Download HPE Custom Image for ESXi 5.5.0 U3b GA

Version     5.5.0U3b

Description     HPE Custom Image for ESXi 5.5.0 U3b GA

HPE Custom Image for VMware ESXi 5.5.0 Update 3b Install CD

File size: 372.31 MB

File type: iso

Step (2)

https://rufus.akeo.ie

Rufus

Create bootable USB drives the easy way

Step (3)

https://miketabor.com/create-bootable-esxi-installer-usb-flash-drive/

Creating a bootable ESXi flash drive

1. Download VMware ESXi ISO image from VMware.

2. Connect your flash drive to your computer.

3. Open Rufus and in the Device drop down select your USB flash drive.

4. Click the icon that looks like a CD to select the ESXi ISO image youíve downloaded.

5. Now click on Start.

6. Next youíll be prompted to replace menu.c32, answer Yes.

Thatís it! Rufus will write the ISO image to the USB thumb drive and youíll be able to boot your Intel NUC or server from the flash drive and install ESXi.

Since the installer gets loaded into memory you can also install ESXi right onto the same flash drive, which is exactly what I did when I setup my three Intel NUCës in my home lab.

Step (4)

I installed ESXi server in the HP server.

20170626_182758_1024x576.jpg

==

20170626_183516_1024x576.jpg

I made sure I did not touch the datastore.

==

20170626_183549_1024x576.jpg

Here's where I changed the password.

==

20170626_191943_1024x576.jpg

I had to add VM back to inventory. See step 5.

==

Step (5)

Then I had to add VM back to inventory.

To register a virtual machine in vCenter Server:

  1. Open the vSphere / VMware Infrastructure (VI) Client and log in with appropriate credentials.
  2. If connecting to vCenter Server, click on the desired host.
  3. Click the Configuration tab.
  4. Click Storage.
  5. Right-click on the appropriate datastore and click Browse Datastore.
  6. Navigate to the folder named after the virtual machine, and locate the <virtual machine>.vmx file.
  7. Right-click the .vmx file and click Add to inventory. The Add to Inventory wizard opens.
  8. Continue to follow the wizard to add the virtual machine.

Everything is up and running.

And thanks for your reply Batchenr

0 Kudos