`pwd’: No such file or directory – getcwd (Errno::ENOENT)

When you rename a subdirectory under the directory where your Linux or MacOS terminal is open you may get the error message

/opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.4.19/lib/chef/knife/cookbook_download.rb:45:in `pwd’: No such file or directory – getcwd (Errno::ENOENT)

You need to refresh the directory cache of the terminal.

  1. Go one level higher
    cd ..
  2. Go back to the directory
    cd MY_DIRECTORY

 

Configure the Ubuntu virtual machine in VirtualBox

Enable shared folders on the virtual machines

To be able to use shared folders between the host ( your workstation ) and the virtual machine.

  • Start the Ubuntu virtual machine in Virtual Box,
  • Select the virtual machine window on your workstation,
  • In the Devices menu of Virtual Box select Insert Guest Additions CD image…
  • Click the Run button,
  • Enter your admin password and click Authenticate,
  • Select the terminal window and press Enter,

  • Restart the virtual machine for the change to take effect,
  • In Ubuntu
    1. Open a terminal window,
    2. In the upper left corner of the desktop click the Search icon,
    3. Type terminal into the search box,
    4. Select the Terminal icon.
  • In the Terminal window create a directory for the mount point
    mkdir ~/host-share
    sudo chmod 777 ~/host-share
  • Mount the Shared Windows location. Get the Machine Folder name from the virtual machine’s Shared Folders tab in VirtualBox

    (If you shared the root of a Windows C: drive, the name is “C_DRIVE”.)

    sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) MY_MACHINE_FOLDER_NAME ~/host-share

Source: https://help.ubuntu.com/community/VirtualBox/SharedFolders

Make the mounting permanent

  1. Create the folder /opt/scripts
  2. Create a new file in the new folder mount_host_share
    #!/bin/sh
    # Mount the Host Share to see the host computer's file system
    echo MY_PASSWORD | sudo -S mount -t vboxsf -o uid=1000,gid=1000 MY_MACHINE_FOLDER_NAME ~/host-share
  3. Make the file executable
    chmod +x /opt/scripts/mount_host_share
  4. On the Ubuntu desktop click the Search icon and type startup, and click the Startup Applications icon
  5. On the Startup Applications Preferences window click Add,
  6. Enter the Name and this Command, and click Save
    /opt/scripts/mount_host_share

The shared drive appears in the File manager.

Relax the password requirement

The virtual machine is already protected by the operating system of the host, your workstation, so it is not necessary to enter the password every time you want to switch to the guest machine. To remove the password requirement

  1. Click the System Settings icon in the sidebar,
  2. Uncheck the Waking from suspend and Returning from blank screen checkboxes.

Configure the Windows virtual machine in VirtualBox

Enable shared folders on the virtual machine

To be able to use shared folders between the host ( your workstation ) and the Windows virtual machine.

  • Start the Windows virtual machine in VirtualBox,
  • Select the virtual machine window on your workstation,
  • In the Devices menu of VirtualBox select Insert Guest Additions CD image…
  • In the virtual machine start Windows Explorer,
  • Open the VirtualBox Guest Additions CD,
  • Start VBoxWindowsAdditions.exe,

The shared folders will be available in the virtual machine’s Windows Explorer as the D: drive

VirtualBox installation and configuration on Macintosh

Download VirtualBox from https://www.virtualbox.org/wiki/Downloads and follow the instructions to install it.

At the time of writing, this was the section where the installer files were referenced

virtual-box-01-download

Run the downloaded installer file and accept all default values.

The installer starts the application.

 

Create a virtual machine

To create a new virtual machine

Download the OS image from the manufacturer’s website.

  1. Start the VirtualBox application
  2. Click the New icon
  3. Click the Expert Mode button
  4. Enter the name, select the operating system type and version, and set the memory size,
  5. Set the initial size of the virtual hard disk, and click the Create button,
  6. Select the virtual machine icon and click the Start button
  7. Click the Browse icon and select the OS image file in the Downloads directory,
  8. Click the Start button,

Configure VirtualBox for each virtual machine

Networking

To share the connectivity of the host computer with the virtual machine, mainly if you use VPN

  1. In VirtualBox select the virtual machine icon and click Settings
  2. Select Network
  3. Attach the network adapter to NAT

If your company use automated software installation and updates, set up a second network connection using the Bridged Adapter. This way the virtual machine will get an independent IP address in the same IP address range as the host machine.

  1. Select the Adapter 2 tab,
  2. Select the Enable Network Adapter checkbox,
  3. Select the Bridged Adapter in the Attached to drop-down,
  4. In the Name drop-down list select the fastest network connection of the host machine.

Copy and paste

To enable copy and paste between the virtual machine and the host ( your workstation )

  1. On the General tab of the Settings page select the Bidirectional shared clipboard

Shared Folders

Specify the shared folder on your workstation

  • In the VirtualBox menu select Preferences
  • On the Shared Folders tab click the + icon
  • Select your home folder on your workstation

Configure the virtual machine OS

To configure the virtual machine operating system in VirtualBox, see Virtual machine configuration on the VirtualBox page.

Send CTRL-ALT-DELETE to a Windows Virtual Box computer from a Macintosh

When you start a Windows 7 or equivalent server machine, to log in, you need to press CTRL-ALT-DELETE on the keyboard to get the login page. To send Control-Alt-Delete to a Windows virtual machine in Virtual Box from a Macintosh

on a Macintosh laptop press the fn – Command  – Delete back  keys

on a Macintosh desktop press the Command  – Delete forward  keys.

Native resolution in Remote Desktop client on MacOSX

When you connect to a Windows computer from your Macintosh workstation the best remote desktop client is the Microsoft Remote Desktop app from the Apple Appstore.

To configure the remote desktop connection for the best experience

  1. Select Native resolution
  2. Scale content for Full screen mode
    To be able to unselect the “Use all monitors checkbox”, uncheck it first, before you uncheck the “Start session in full screen” checkbox, otherwise, the last checkbox will be disabled.

If you use multiple displays, make sure you open the Microsoft Remote Desktop app on the display you want to use to view the remote computer, because the Native resolution setting will use the resolution of the display the app is running on at the moment you start the remote desktop connection.

How to move a window on the Macintosh if the header is not visible

There are times when a window opens on your Mac and the header is out of the screen or hiding behind the Macintosh Toolbar.

To move the entire window back to the screen try to find a point on the edge that instead of stretches the window, moves it. Four small regions on the sides can move the window up and down, another two small regions at the bottom can move the window sideways. The locations of the regions are very inconsistent, in one moment they work, a second later the region is at another location.

 

How to verify or generate file checksums

You can verify the checksum of a file with the built-in features of the operating systems

On Macintosh and Linux

Open the terminal window and execute the commands

SHA-256

shasum -a 256 FILE_NAME

On Windows

CRC32, CRC64, SHA256, SHA1, BLAKE2sp

Right-click the file in Windows Explorer and select CRC SHA > * (star)

The popup window will show the values, but unfortunately, there is no way to copy them to the clipboard. To be able to copy the hash value to the clipboard open a Bash window on the Windows computer and execute the Macintosh/Linux commands above.

To install Bash on a Windows workstation see the Git section of Install the DevOps development tools on Windows.

Bluetooth: Not Available in Sierra on the Macintosh

After software update in Sierra on my Macintosh, my Bluetooth mouse usually stops working.

The toolbar displays the Bluetooth not available icon: 

When I click it, the “Bluetooth: Not Available” message is displayed.

There are two recommended actions we can take to bring Bluetooth back to life. If the first one does not help, try to execute them together during the same shutdown and restart cycle.

Delete the com.apple.Bluetooth.plist file from Library / Preferences

  1. Start Finder,
  2. In the Go menu select Go to Folder,
  3. Enter /Library/Preferences into the text box and click the Go button,
  4. Move the com.apple.Bluetooth.plist file to the trash,
  5. Shut down the Macintosh,
  6. Start the computer again.

Reset the SMC to reinitialize the Bluetooth module

  1. Shut down the Macintosh,
  2. Disconnect all peripherals (external display, drives, mouse, printer),
  3. Make sure the power adapter is connected to the computer,
  4. Press and hold the Shift, Control and Option buttons for 10 seconds,
  5. Start the computer with the power button, with the peripherals still disconnected,
  6. Re-connect the peripherals.