Sunday, December 05, 2021

PowerShell Quick Tips: Touch file

PowerShell Quick Tips: In Linux/Unix, touching a file means to create, change or modify the timestamp of a file. Windows via cmd.exe nor PowerShell.exe does not have this tool by default. To create a file do the following in PowerShell

PS C:\> echo $null > filename.txt

Sunday, November 21, 2021

How to expand Ubuntu VM root partition

How to expand Ubuntu VM root partition

In this post I have expanded the virtual disk of a Ubuntu VM via VirtualBox Media Manager. The OS inside the VM will not automatically use the additional space. In this post I will show how to expand the root partition to make use of the additional space.

There are multiple ways to expand a partition in Linux, in this post I will document how to do it using GParted.

  1.  Change the VM configuration to boot using Ubuntu installer. 
  2. Boot the VM using the Ubuntu ISO installer
  3. Run GParted - in the warning dialog that says not all space is used, hit on the Fix button
  4. Select the partition to resize and click Resize/Move partition button
  5. Expand the partition to the desired size

  6. The hit on Apply All Operations

  7. Shutdown the VM, remove/detach ISO, then reboot the computer

 

.end.

How to expand virtual hard disk in VirtualBox

How to expand virtual hard disk in VirtualBox

To expand a virtual disk in VirtualBox open Oracle VM Virtual Manager then do File | Virtual Media Manager... (Ctrl+D) menu option. Then select the disk you wanted to expand. Note that VirtualBox does not support expanding a snapshot - you can expand but it will not work. You either have to delete all the snapshots or create a full clone of the snapshot. In the screen capture below I have created a full clone of Ubu2110 to Ubu2110-C1 and adjusted the size from 10GB to 12GB.

In the next post, we will explore how to expand storage of a Ubuntu VM to make use of the additional space.

Keywords:
VirtualBox Ubuntu Expand

Thursday, November 18, 2021

Resolve Windows NetBIOS name in Ubuntu 20.04

Resolve Windows NetBIOS name in Ubuntu 20.04

It is very common to have a mix of Windows and Ubuntu/Linux in an enterprise environment. There are scenarios where Ubuntu can get IP via DHCP but not enroll the machine to DNS. To resolve Windows NetBIOS machine name in Ubuntu in a workgroup environment do the following. Install nss-winbind like below

$: sudo apt install libnss-winbind

Then update /etc/nsswitch.conf. On Ubuntu 20.04, this will be line 12, which should look like below:
hosts:          files wins dns

Refs:
https://8thstring.blogspot.com/2010/05/resolve-netbios-name-in-ubuntu.html

Sunday, November 07, 2021

Your emulator is out of date, please update by launching Android Studio

Your emulator is out of date, please update by launching Android Studio

I sometimes run Android emulator from the command line, like:
c:\>emulator -avd Pixel_2_API_30

Most of the time I would see the following on the console output
WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.
INFO    | added library vulkan-1.dll
INFO    | configAndStartRenderer: setting vsync to 60 hz
ERROR   | Failed to open /qemu.conf, err: 2
HAX is working and emulator runs in fast virt mode.
INFO    | Started GRPC server at 127.0.0.1:8554, security: Local
INFO    | Advertising in: C:\Users\u1\AppData\Local\Temp\avd\running\pid_14608.ini
INFO    | Your emulator is out of date, please update by launching Android Studio:
 - Start Android Studio
 - Select menu "Tools > Android > SDK Manager"
 - Click "SDK Tools" tab
 - Check "Android Emulator" checkbox
 - Click "OK"

INFO    | boot completed
INFO    | Increasing screen off timeout, logcat buffer size to 2M.
INFO    | Revoking microphone permissions for Google App.

To fix it, open Android Studio then do Tools | SDK Manager. Ensure that "Android SDK Build-Tools" is the latest.

Thursday, August 19, 2021

Change Windows 10 to dark mode and black background

Change Windows 10 to dark mode and black background using Registry (cmd.exe)
c:\> reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t REG_DWORD /d "0" /f
c:\> reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t REG_DWORD /d "0" /f
c:\> powershell -command add-type -typedefinition """"using System;`n using System.Runtime.InteropServices;`n public class PInvoke { [DllImport(`"""user32.dll`""")] public static extern bool SetSysColors(int cElements, int[] lpaElements, int[] lpaRgbValues); }""""; [PInvoke]::SetSysColors(1, @(1), @(0x000000))

 

Ref:

https://superuser.com/questions/1214337/update-hkcu-control-panel-colors-background-via-cmd-and-apply-immediately

Monday, May 17, 2021

Kali Linux tmux is not displaying correctly

Kali Linux tmux is not displaying correctly

I have a Kali Linux installed using network installer. Running tmux over SSH does not display correctly. 

The reason it is not displaying correctly is that the environment variables LANG and LC_CTYPE were not set. To fix it do:
$: sudo locale-gen "en_US.UTF-8"
$: sudo dpkg-reconfigure locales
After reboot, tmux now looks much better

Hello world assembly on x86 Linux

Hello world assembly on x86 Linux Save code below as hello.asm global _start section .data message: db 'hello, world!', 10 secti...