Friday, May 4, 2018

Solve "all com.android.support libraries must use the exact same version specification"

Add following code to app build.gradle:

configurations.all{
     resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.android.support'){
                   if (!requested.name.startsWith("mutlidex")){
                         details.useVersion '25.0.1'
                    }
            }
       }
}

Tuesday, January 9, 2018

Wordpress SMTP plugin Permission denied

If you see an error like SMTP -> ERROR: Failed to connect to server: Permission denied (13), you may be running into SELinux preventing PHP or the web server from sending email. This is particularly likely on RedHat / Fedora / Centos. Using the getsebool command we can check if the httpd daemon is allowed to make a connection over the network and send an email:
getsebool httpd_can_sendmail
getsebool httpd_can_network_connect
This command will return a boolean on or off. If it's off, we can turn it on:

sudo setsebool -P httpd_can_sendmail 1
sudo setsebool -P httpd_can_network_connect 1

Sunday, December 31, 2017

Add a USB drive as the datastore of ESXi 6.5

  1. Connect to the ESXi host with SSH
  2. Stop the USB arbitrator service. This service is used to passthrough USB device from an ESX/ESXi host to a virtual machine. (When disabling it, you can no longer passthrough USB devices to VMs)
    ~ # /etc/init.d/usbarbitrator stop
  3. (optional) Use this command to permanently disable the USB arbitrator service after reboot.
    ~ # chkconfig usbarbitrator off
  4. Plug in the USB device to your ESXi host. While connecting the USB device you can either watch /var/log/vmkernel.log to identify the device name or identify it within /dev/disks.
    Devices are either named mpx.vmhbaXX or with an naa.X number.
    ~ # ls /dev/disks/
  5. Write a GPT label to the device (Assuming that the Device ID is naa.5000000000000001)
    ~ # partedUtil mklabel /dev/disks/naa.5000000000000001 gpt
  6. To create a partition you need to know the start sector, end sector, which depends on the device size and the GUID.
    The start sector is always 2048
    The GUID for VMFS is AA31E02A400F11DB9590000C2911D1B8
    The end sector can be calculated with the following formula (Use the numbers from getptbl):
    ~ # partedUtil getptbl /dev/disks/naa.5000000000000001
    gpt
    15566 255 63 250069680
    15566 * 255 * 63 - 1 = 250067789
    You can also calculate the end sector with the following command:
    ~ # eval expr $(partedUtil getptbl /dev/disks/naa.5000000000000001 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
    250067789
  7. Create the VMFS partition (Replace with your end sector)
    ~ # partedUtil setptbl /dev/disks/naa.5000000000000001 gpt "1 2048 250067789 AA31E02A400F11DB9590000C2911D1B8 0"
  8. Format the partition with VMFS5 or VMFS6
    # VMFS v5
    ~ # vmkfstools -C vmfs5 -S USB-Datastore /dev/disks/naa.5000000000000001:1
    
    # VMFS v6
    ~ # vmkfstools -C vmfs6 -S USB-Datastore /dev/disks/naa.5000000000000001:1
The USB-Datastore should now appear in your datastores view.
vmfs6-usb-datastore-esxi65
This is how your command output should look like:
[root@esx4:~] partedUtil mklabel /dev/disks/naa.5000000000000001 gpt
[root@esx4:~] eval expr $(partedUtil getptbl /dev/disks/naa.5000000000000001 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
250067789
[root@esx4:~] partedUtil setptbl /dev/disks/naa.5000000000000001 gpt "1 2048 250067789 AA31E02A400F11DB9590000C2911D1B8 0"
gpt
0 0 0 0
1 2048 250067789 AA31E02A400F11DB9590000C2911D1B8 0
[root@esx4:~] vmkfstools -C vmfs6 -S USB-Datastore /dev/disks/naa.5000000000000001:1
create fs deviceName:'/dev/disks/naa.5000000000000001:1', fsShortName:'vmfs6', fsName:'USB-Datastore'
deviceFullPath:/dev/disks/naa.5000000000000001:1 deviceFile:naa.5000000000000001:1
ATS on device /dev/disks/naa.5000000000000001:1: not supported
.
Checking if remote hosts are using this device as a valid file system. This may take a few seconds...
Scanning for VMFS-3/VMFS-5 host activity (512 bytes/HB, 2048 HBs).
Creating vmfs6 file system on "naa.5000000000000001:1" with blockSize 1048576, unmapGranularity 1048576, unmapPriority default and volume label "USB-Datastore".
Successfully created new volume: 583b0efb-33b7ba1e-57e7-001fc69b9659

Migrate Microsoft Edge bookmark from old PC to new PC

A. To Backup Favorites from Microsoft Edge 
1. Open File Explorer, copy and paste the folder location:  %LocalAppData%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User\Default in the address bar of File Explorer, and press Enter. 
2. Copy the DataStore folder below to where you like as your backup. (see screenshot below)
B. To Restore Favorites in Microsoft Edge 
1. Close Microsoft Edge if open.
2. Open File Explorer, copy and paste the folder location: %LocalAppData%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User\Default in the address bar, and press Enter. 
3. Copy the backed up DataStore folder from step 2 into the Default folder below. (see screenshot above)
4. If prompted, click/tap on Replace the files in the destination.








Sunday, May 7, 2017

Virtual machine that appears as invalid for VMware ESX and ESXi

Open the vSphere Client, select the virtual machine wich is in invalid state
  1. Right-click the virtual machine and choose Remove from Inventory.
    Caution
    : Do not choose Delete from Disk.
     
  2. Click on the ESX host and, using the Summary tab, locate the appropriate datastore in which the virtual machine exists.
  3. Right-click the datastore and click Browse Datastore.
  4. Browse to the directory of the virtual machine.

    Note
    : If you have renamed the virtual machine in the VMware Infrastructure Client, use the original name given to it.
     
  5. Right-click the .vmx file of the virtual machine and choose Add to Inventory.
  6. Power on the virtual machine.

Saturday, May 6, 2017

Rename a vmdk with vmkfstools


Delete a Virtual machines appear as invalid with SSH

  1. Log in ESXi with SSH
  2. Open /etc/vmware/hostd/vmInventory.xml with vi, delete the revelent entry.
  3. restart the Management agents in ESXi by issue command /etc/init.d/hostd restart

Prevent or Prohibit Server Drives From Being Visible to Users

  To make changes to this policy for one of the seven default values: Start the Microsoft Management Console. On the Console menu, click  Ad...