PostgreSQL: could not open file “/var/lib/pgsql/data/pg_clog/0726”: No such file or directory

when selecting a specific date from a table, at times due to database corruption Postgres might report the file was not found.

hsphere=# select * from TABLE;
ERROR:  could not access status of transaction 1918986094
DETAIL:  could not open file “/var/lib/pgsql/data/pg_clog/0726”: No such file or directory

 

In Such instances, we will need to re-create the file using the below dd command

 dd if=/dev/zero of=/var/lib/pgsql/data/pg_clog/0726 bs=256k count=1

 

Note: Ensure the permissions on the file that was re-created are set appropriately. creating the blank file means that the data that was originally on it might actually go missing. The respective records will need to be re-created or its relevant records (constraints etc) will need to be removed from the DB.

joining Esxi to domain fails with LW_ERROR_INVALID_MESSAGE [code 0x00009c46]

Joining Esxi to doamin fails with the below message:

[root@esx:~] ./usr/lib/vmware/likewise/bin/domainjoin-cli join ikigo.net

Joining to AD Domain: ikigo.net

With Computer DNS Name: esx.

adm@INN.LAN’s password:

Error: LW_ERROR_INVALID_MESSAGE [code 0x00009c46]

The Inter Process message is invalid

 

Cat /etc/hosts show below:

# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
192.168.1.104 esx. esx

 

And In some cases, the hostname on the /etc/hosts file might not match to that of the host.  (look for the message on domainjoin-join “With Computer DNS Name: esx.

 

 

In order to sort this out,  correct the /etc/host file (in my case, I had to suffix the DNS suffix)

Cat /etc/hosts:

# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
192.168.1.104 esx.ikigo.net esx

 

restart lwsmd

/etc/init.d/lwsmd start

 

Re-attempt doamin join CLI

 

 

***note: In some cases after performing the change to /etc/hosts, joining the host via powerCLI will fail with error “‘ vmwauth InvalidHostNameException: The current hostname is invalid: hostname cannot be resolved”

Hostd.log:
2019-01-07T19:20:16.288Z error hostd[DEC1B70] [Originator@6876 sub=ActiveDirectoryAuthentication opID=500fc81b-b5-602f user=vpxuser:IKIGO\nik] vmwauth InvalidHostNameException: The current hostname is invalid: hostname cannotbe resolved

The management agents/host will need a restart to sort this out.

Few Handy VMware Powershell commandlines

Add a HDD to a virtual machine:

$VM=’name of the VM’
$size=’Size in GB, Numeric only’
$Datastore=’Name of the Datastore’
$ProvisionType=”Thin/Thick/EagerZeroedThick”)
$Controller=’SCSI Controller 0′

New-HardDisk -VM $VM -CapacityGB $size -Datastore $Datastore -StorageFormat $ProvisionType -Controller $Controller $DiskType

 

Clone VM

$Name=’Name of the new VM’
$source=Name of the Source virtual machine’
$Datastore=’Datastore name’
$host=’host name or IP’
$DiskType=’thin/thick’

New-vm -name $Name -vm $source -datastore $Datastore -vmhost $host –DiskStorageFormat $DiskType

VMware PowerCLi Install on windows 10, 1809

Install PowerCli from Windows Gallery

Open powerCLI as an administrator and then run:

Install-Module -Name VMware.PowerCLI

List available VMware module:

Get-Module -ListAvailable -Name VMware*

 

Import Module

 Get-Module vmware* | Import-Module

Set execution policy to remote signed if the importing fails:

Set-ExecutionPolicy RemoteSigned

 

the failure generally would look like the below:

PS C:\windows\system32> Import-Module VMware*
>>
Import-Module : File C:\Program
Files\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk\11.0.0.10334495\VMware.VimAutomation.Sdk.psm1 cannot be
loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ Import-Module VMware.VimAutomation.Core
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : SecurityError: (:) [Import-Module], PSSecurityException
 + FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand

If vCenter is running on the default self signed certificates:

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

If the above command is not run, we would see an error similar to below:

Connect-VIServer : 12/21/2018 2:05:00 AM Connect-VIServer Error: Invalid server certificate. Use
Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option to Prompt if you'd like to connect
once or to add a permanent exception for this server.
Additional Information: Could not establish trust relationship for the SSL/TLS secure channel with authority
'vc.ikigo.net'.
At line:1 char:1
+ Connect-VIServer vc.FQDN.Domain
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : SecurityError: (:) [Connect-VIServer], ViSecurityNegotiationException
 + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_CertificateError,VMware.VimAutomation.ViCore.
 Cmdlets.Commands.ConnectVIServer

Passing through a Nvidia GTX970 to a VMware Virtual machine

  1. Create a virtual machine with EFI boot, install windows + tools and power down the VM
  2. Open ssh to the host where the VM is registered to
  3. use VIM-cmd vmsvc/getallvms | grep *name_of_VM*

  4. cd to the datastore path

    cd /vmfs/volumes/NVME/nvidia/

  5. Edit the vmx file using the vi editor and add the below lines

    hypervisor.cpuid.v0 = “FALSE”
    pciHole.dynStart = “2816”

  6. Save the editor and then reload the VMX (201 is the vmid from the above screenshot)

    vim-cmd vmsvc/reload 201

  7. Edit settings on the VM> add new hardware>pci device>add graphic card and its audio device(2 pci pass through device and set the memory reservation to maximum)
  8. Take a snapshot and then power on the VM
  9. Conform the hardware under graphic adapter followed by nvidia drivers installation.

  10. on successful installation.. after the reboot, the exclamation on the driver should go away and you should observe that extending the monitor (window key + P and extend/duplicate) should show the display out on the monitor where the graphic card is connected to.

 

Note: The nvidia card and its audio device must already have been marked as under pci device as pass through!!

 

 

 

 

Update

Stem 3, 4 , 5 6 can be replaced with the below: (the below might not work on vsphere 5.x)

  • Edit VM settings:
  • VM options>advanced>Edit configuration and add the two lines: