FastNetMon

Saturday, 6 May 2023

Ubuntu 22.04 installation on VirtualBox using command line

We use VirtualBox for process of preparing VM images for our product. Sadly some things had to be done manually and we're heading towards full automation and it was an attempt to prepare VM for Ubuntu 22.04 installation from ISO using only command line interface.

NB! If you have IPv4 disabled on your machine you have to enable it as otherwise VM will not have connection and installer may fail. 

Set some variables shared by next steps:

export VM_NAME=Ubuntu2204_TEST_OVA

export VM_ROOT_FOLDER="/home/pavel/VirtualBoxVMs"

export VM_FOLDER="$VM_ROOT_FOLDER/$VM_NAME"

By default VirtualBox uses path with nasty space in it and that's why I changed it to custom one without spaces as I do not like spaces and bash agrees with me about it. 

Create VM and register it in VirtualBox:

VBoxManage createvm --name $VM_NAME  --register  --ostype=Ubuntu22_LTS_64 --basefolder=$VM_ROOT_FOLDER

If you plan to use another OS then you can get all list of all OS types using this command:

VBoxManage list ostypes

Then set some basic hardware options:

VBoxManage modifyvm $VM_NAME --ioapic on                     

VBoxManage modifyvm $VM_NAME --memory 16384  --vram 128       

VBoxManage modifyvm $VM_NAME --cpus 8

VBoxManage modifyvm $VM_NAME  --nic1 nat

Then create 150G disk for VM and attach it to it:

VBoxManage createhd --filename $VM_FOLDER/disk.vdi --size 150000 --format VDI

Add SATA controller: 

VBoxManage storagectl $VM_NAME  --name "SATA Controller" --add sata --controller IntelAhci

And attach our disk to it: 

VBoxManage storageattach $VM_NAME  --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium  $VM_FOLDER/disk.vdi

Then add IDE controller to mount ISO disk with installer: 

VBoxManage storagectl $VM_NAME  --name "IDE Controller" --add ide --controller PIIX4 

VBoxManage storageattach $VM_NAME --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium ~/Downloads/ubuntu-22.04.2-live-server-amd64.iso 

VBoxManage modifyvm $VM_NAME  --boot1 dvd --boot2 disk --boot3 none --boot4 none

Then you can run VM:

VBoxManage startvm $VM_NAME

Based on this guide

Thursday, 4 May 2023

sign_and_send_pubkey: signing failed for RSA "PIV AUTH pubkey" from agent: agent refused operatio

This error is very annoying and it happens when you use Yubikey for ssh auth and by accident you did not click on Yubikey when you did ssh auth.

After this happens you need to restart machine or ssh agent and all the things to fix it.

When it happens I was able to catch this error log:

sudo systemctl status pcscd.service 

● pcscd.service - PC/SC Smart Card Daemon

     Loaded: loaded (/lib/systemd/system/pcscd.service; indirect; vendor preset: enabled)

     Active: active (running) since Thu 2023-05-04 10:46:27 BST; 2h 39min ago

TriggeredBy: ● pcscd.socket

       Docs: man:pcscd(8)

   Main PID: 2505 (pcscd)

      Tasks: 9 (limit: 38276)

     Memory: 2.6M

        CPU: 88ms

     CGroup: /system.slice/pcscd.service

             └─2505 /usr/sbin/pcscd --foreground --auto-exit

May 04 10:46:27 station systemd[1]: Started PC/SC Smart Card Daemon.

May 04 13:22:18 station pcscd[2505]: 00000000 ccid_usb.c:1566:InterruptStop() libusb_cancel_transfer failed: LIBUSB_ERROR_NO_DEVICE

Then I feed "ccid_usb.c:1566:InterruptStop() libusb_cancel_transfer failed: LIBUSB_ERROR_NO_DEVICE" to Google. 

I have this issue on Ubuntu 22.04 and I've tried version from Ubuntu 22.10 which has version 1.99 of affected package and it did not help. 

Apparently this bugfix may fix this issue and it wasn't part of 1.99 release. Related GitHub issue.


Monday, 1 May 2023

Can Mozilla VPN users connect Mullwad servers directly?

I've tried to fix my IPv6 compatibility issues by using Mozilla VPN over NAT64 box this way.

I've tried to improve this setup but it did not work as expected. 

Mozilla VPN uses Mullwad internally and we can find Mullwad's server name using this interface. Just fill "us-nyc-wg-505" in hostname field and after that you will see something like: "us-nyc-wg-505.relays.mullvad.net".

With this information on our hands we can replace:

Endpoint = x.y.z.y:23662

To:

Endpoint = us-nyc-wg-505.relays.mullvad.net:23662

Sadly in my case this trick did not work ;(

If you have any advice about ways to fix it please share. 




 

Mozilla VPN without UI on Ubuntu Linux 22.04 over NAT64

Mozilla VPN service is a really nice service but their UI does not support IPv6 only environment. I use NAT64 box in my network and it does not help either.

Sadly it's known bug and it's still here ;( Luckily I found nice way to workaround it using command line interface. 

I found nice workaround 

Install their Linux app as documented on web site. 

Then we're going to use console app to authenticate. Start authentication process using:

mozillavpn login

Then check that you're successfully authenticated:

mozillavpn status

Then get list of all available servers:

mozillavpn servers

And select your favourite one:

mozillavpn select us-nyc-wg-505

Generate Wireguard configuration using wgconf option which was added recently:

mozillavpn wgconf > mozilla-vpn.conf

Optiwas added recently

Then open mozilla-vpn.conf with editor and alter line like this:

Endpoint = x.y.z.y:23662

To:

Endpoint = 64:ff9b::x.y.z.y:23662

Then establish VPN:

wg-quick up mozilla-vpn.conf

To shutdown it you can use:

wg-quick down mozilla-vpn.conf

In this case we will use NAT64 gateway for connection.