Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, 24 September 2022

Issues with WSL2 Networking

 WSL2 networking continues to be problematic, be it DNS not working or network connectivity being lost with the wider network. I also had an issue where WSL2 seemed to prefer a disconnected WiFi connection over a connected Ethernet one.

Things I have done:

1. Disable the unused WiFi Adaptor, this has prevented WSL2 from trying to use it.

2. Turned off Windows Fast Start - This is accessed from the power butttons options underneath power plan. Apparantly it helps fix issues if you shutdown\startup the machine with WSL2 rather than restart.

3. Configured static DNS for WSL2 machines. I created a /etc/wsl.conf file containing the following (replace the name servers with what you want): 
            [network]
            generateResolvConf = false
            nameserver 192.168.1.3
            nameserver 192.168.1.4

4. Networking still craps out but I find this network stack reset recommendation from stackOverflow helps:
            wsl --shutdown
            netsh winsock reset
            netsh int ip reset all
            netsh winhttp reset proxy
            ipconfig /flushdns
            Windows Search > Network Reset
            Restart Windows


Tuesday, 22 December 2020

Prepare and create a RAID5 Array of 5 * 4TB Segate Barracuda Disks

 We need to prepare the disks as GPT labeled as they are > 2TB.

For each disk:

  • parted -a optimal /dev/sdx
  • mklabel gpt
  • mkpart primary 0% 100%
  • set 1 raid on
  • align-check optimal 1
  • print
  • quit

Create the array:
  • mdadm --create /dev/md0 --level=raid5 --raid-devices=5 /dev/sdx1 /dev/sdx1 /dev/sdx1 /dev/sdx1 /dev/sdx

In all of the above replace /dev/sdx1 with appropriates devices, e.g /dev/sda1 /dev/sda2 etc.

Tuesday, 8 December 2020

Restrict ASUS laptop charge to 60% in Linux

 Dual booting my ASUS TUF laptop between Windows and Ubuntu 10.

The tools supplied by ASUS with Windows allows the battery charge to be limited to a specified %, the most agressive being 60%, in a bid to preserve battery life. Most laptops that are docked keep the battery at 100% and this kills the battery.

Found a good answer here:

https://askubuntu.com/questions/1006778/set-battery-thresholds-on-ubuntu-asus/1230442#1230442

I didn't have enough reputation on the site to leave a like or comment so I'm showing my appreciation here.

I did install tlp using "sudo apt install tlp" but not certain this is required.

After issuing the command "echo 60 | sudo tee /sys/class/power_supply/BAT1/charge_control_end_threshold" and adding the line "@reboot root echo 60 > /sys/class/power_supply/BAT1/charge_control_end_threshold"  to /etc/crontab, the output of "sudo tlp-stat -b" showed the charge at 78% and that the charge now was 0mA. It still shows as charging in the system tray but the % remains unchanging.

The reason I am not certain that TLP is required is because all the kernal modules listed in "tlp-stat -b" are showing as inactive and laptop not supported.

I've just unplogged my laptop and will let the percentage drop to below 60%, reconnect to the mains and see if the charging stops as hoped.

Sunday, 22 November 2020

Getting Hyper-V to recognise a physical disk

 I'm running WSL2 and docker on my main machine and have noticed that even though Virtual Box will run, the reliability of the VMs is somewhat sub-par and often involves crashing.

I have taken to installing various Linux distros such as Ubuntu and Parrot on SSD drives in removable USB3 housings.

The main issue with installing Linux from USB boot media is the installation interferes with the Windows UEFI boot loader and can leave Windows unbootable without repairing this. However, if you do fix the Windows boot loader it stop Linux booting. There is probably a way to fix this but I haven't spent the time to do so yet.

My workaround has been to use Hyper-V to install Linux to a the removeable drive, however Hyper-V has an issue seeing the drive to add sometimes.

I found the answer here.

By following the proceedure at the bottom of the post, Hyper-V is able to see and add an SSD drive in a USB3 enclosure. This is limited to disks though, removable devices won't work in my experience.

Thanks to reid1000 you can follow the steps below:

  1. In Disk Management, offline the disk
  2. Right-click the disk and go to Properties > Policies tab
  3. Select the option "Better performance" then click OK. If prompted to restart your computer, click No.
  4. Again right-click the disk, go to Properties > Policies tab
  5. Select the option "Quick removal (default)" then click OK. If prompted to restart your computer, click No.
  6. In Hyper-V Manager, turn off the virtual machine. Then, open its settings and add the physical hard disk to the SCSI Controller.


Tuesday, 1 August 2017

Disable USB power saving for booting from USB

Having issues booting from USB connected SSD and disabling this in the Linux Kernal seems to solve the issues of the disk becoming unavailable.
Edit /etc/default/grub and change the following line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1"
Update the config with: sudo update-grub
Reboot
Thanks to this post.

Chromium Hardware Acceleration Issues on Mint 18,2

I'm currently testing Mint18.2 and have run into a number of issues with Chrome. It initially started with corruption issues in Youtube.
After investigation I discovered that the hardware acceleration had been disabled. By adding the following switches to the 'exec' lines in /opt/google/chrome/google-chrome I was able to force all the acceleration options on:

  • --enable-native-gpu-memory-buffers
  • --enable-zero-copy
  • --disable-gpu-driver-bug-workarounds
  • --ignore-gpu-blacklist
  • --enable-gpu-rasterization
  • --enable-checker-imaging
I added these to the file by editing it with root (sudo) options. I suspect the file will be overwritten on update. There seems to be an environment variable for chromium which allows you to set command line options to pass to chromium without editing files, but I can't tell if this works for Chrome yet.

Sunday, 2 July 2017

Unable to update Skype because of GPG error

Recently installed NHSbuntu on an SSD and added Skype but kept getting the following error when trying to run 'apt update':

W: GPG error: https://repo.skype.com/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1F3045A5DF7587C3


Thanks to QwertyChouskie over at this thread for the answer:
'curl https://repo.skype.com/data/SKYPE-GPG-KEY | sudo apt-key add -'

Saturday, 27 May 2017

Installing Virtualbox Guest modules into Devuan

This involves the following:

1. Remove the cdrom as a package source
2. Add jessie-backports as a package source
3. Update the installation
4. Add the required packages


1. Remove the cdrom as a package source

As a privileged user, edit the /etc/apt/sources.list file and put a hash character in front of any line starting with 'deb cdrom':

$ sudo vi /etc/apt/sources.list


2. Add jessie-backports as a package source

Add the following three lines (if you're using the GB mirror) to your sources.list:

# jessie-backports
deb http://gb.mirror.devuan.org/merged/ jessie-backports main contrib
deb-src http://gb.mirror.devuan.org/merged/ jessie-backports main contrib

Adjust the URL if you are using a different mirror to what you are using for e.g. jessie-updates


3. Update the installation

$ sudo apt update
$ sudo apt dist-upgrade
$ sudo apt autoremove
$ sudo apt autoclean


4. Identify your kernel architecture:

$ uname -a
Linux devuan 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux

4. Add the required packages, replace amd64 with the architecture identified above as appropriate:

$ sudo apt install virtualbox-guest-utils virtualbox-guest-x11 virtualbox-guest-dkms dkms linux-headers-amd64 build-essential




Saturday, 18 February 2017

Playing with Open vStorage and Docker - Open vStorage BlogOpen vStorage Blog

Playing with Open vStorage and Docker - Open vStorage BlogOpen vStorage Blog:

Very interesting article on how to get vStorage up and running under Docker within VirtualBox. I managed to get a single node up easily but there were a few errors on adding the second node. vStorage seems to be a virtual storage solution that's able to replicate across disks, servers and locations while supporting compression, dedupe and encryption.

The line 'gzip -dc ovshc_unstable_img.tar.gz | docker load' should read 'gzip -dc ovshc_unstable_img.tar.gz | sudo docker load' and the URL to access the GUI should read https://IP_Address_of_VM.

Starting the second node seems to hang on the command 'sudo ./ovscluster.sh join ovshc2 10.250.0.2/16' hung with the status 'Status: Downloaded newer image for docker.openvstorage.org/ovshc/unstable:latest4417288f5ad21f5577e3fb4fe6ba25f4af0e71c277ab4d2cf554521c517469e6' and nothing else seems to happen after this.

I'd really like to see a tutorial to set this up on a physical Ubuntu server with RDMA but I can't seem to leave a comment on the blog. :(

Good article though, and thanks!
'via Blog this'

Sunday, 9 October 2016

Screen tearing with Intel HD 5500 on HP ZBook 15 G2 and Ubuntu 16.10 Beta 2

I've been suffering some screen tearing with the discrete Intel HD5500 on my HP ZBook 15 G2 laptop and Ubuntu 16.10 Beta 2.

Found various posts stating to create the file /usr/share/X11/xorg.conf.d/20-intel.conf containing the following information:

Section "Device"
Identifier  "Intel Graphics"
Driver      "Intel"
Option      "TearFree"    "true"
EndSection

Note: When I created this files with tabs, it hung the X startup so probably best not to include any extra spaces or tab characters.

This video now plays fine. :)

Thanks to this post and this post.

I've now looked at this again in Ubuntu 17.04 beta 2, and added the following two lines to sort out issues with the Chrome address bar flickering:

Option "AccelMethod" "sna"
Option "DRI" "3"

I did not have to change any switches used to startup Chrome 57.

This thread helped a lot.

Monday, 22 August 2016

How to shrink a dynamically-expanding guest virtualbox image | dantwining.co.uk

How to shrink a dynamically-expanding guest virtualbox image | dantwining.co.uk:



'via Blog this'



This worked for me on Debian Testing which has a habit of increasing in size purely due to the number of updates required.



I first tried compacting the disk without zeroing the space and the disk size went down from 12.485GB to 12.476, a massive 9MB saving. ;)



I then followed the procedure in the post modified slightly for Debian:



  1. Install zerofree using 'sudo apt install zerofree'
  2. Power off the virtual system using 'sudo poweroff'
  3. Boot the system holding left shift
  4. Select advanced options
  5. Select recovery mode using the latest installed kernel
  6. Identify your root filesystem (and any other filesystems you want to compact) using 'mount'; take a note of the filesystem type they are using as well
  7. 'service rsyslog stop'
  8. 'service network-manager stop'
  9. Run the following two commands for all the required filesystems:
    1. 'mount -n -o remount,ro -t ext4 /dev/sda1 /'
    2. 'zerofree -v /dev/sda1'
    3. Replace ext3 with the required filesystem type, / with the required mount point, and /dev/sda1 with the required device
  10. 'poweroff'
  11. Compact the files system using cmd prompt if on Windows:
    1. 'cmd' (run as administrator)
    2. 'C:'
    3. 'cd "\Program Files\Oracle\VirtualBox"'
    4. 'vboxmanage modifyhd "D:\VMs\Debian Testing\Debian Testing.vdi"' (replace the .vdi path with our own disk image)
My Debian testing disk image was then reduced to 7.333GB saving a further 5.143GB or 41% of the total space.

Sunday, 10 April 2016

Ubuntu 16.04 Bug #1568455 "Incorrect information in /etc/c-icap/c-icap.conf"

After having issues with c-icap not starting after installation into Ubuntu 16.04, I have filed this bug: #1568455.

I was attempting to setup c-icap to handle scanning against clamav for our Dell FS8600 NAS, but there is a problem in /etc/c-icap/c-icap.conf which prevents the c-icap server from starting.


Line 232 of /etc/c-icap/c-icap.conf reads:
ModulesDir ${prefix}/lib/x86_64-linux-gnu/c_icap

It should read:
ModulesDir /usr/lib/x86_64-linux-gnu/c_icap


Line 240 of /etc/c-icap/c-icap.conf reads:
ServicesDir ${prefix}/lib/x86_64-linux-gnu/c_icap

It should read:
ServicesDir /usr/lib/x86_64-linux-gnu/c_icap

Looks like the information in the default conf file isn't being updated correctly about the installation location.

This is affecting both the server and desktop build.

Friday, 25 March 2016

Install Ubuntu 16.04 as guest in VirtualBox

Playing with Ubuntu 16.04 Beta2 in VirtualBox and was having some issues with the guest utils.

Running 'sudo apt-get install virtualbox-guest-utils' worked, but I was getting a kernel driver error message. I'd seen this before and couldn't think how I had fixed it though it did seem to involve permissions.

I found that running 'sudo apt-get install dkms virtualbox-guest-dkms' fixed it though.

Sunday, 9 August 2015

Upgrade Fedora 21 to Fedora 22 - Official method

Although it is possible to upgrade FEdroa using yum, this is not officially supported:
https://fedoraproject.org/wiki/Upgrading_Fedora_using_yum

I do love the name of the official tool - FedUp:
https://fedoraproject.org/wiki/FedUp

Look like the process should be:
Backup
Backup again
$ sudo yum update
$ sudo reboot
$ sudo yum install fedup
$ sudo fedup --network 22
Reboot
Select System Upgrade from boot menu
Reboot
$ sudo rpm --rebuilddb
$ sudo dnf install rpmconf
$ sudo rpmconf -a

Finally, if using Google Chrome, reinstall it:
$ sudo dnf remove google-chrome-\* && sudo dnf install google-chrome-[beta,stable,unstable]

How to update Arch based ditribution packages (including Manjaro)

$ sudo pacman -Syu

https://wiki.archlinux.org/index.php/Pacman#Upgrading_packages

YUM Delete/Remove old kernels on Fedora/Red Hat/CentOS

I'm currently updating a load of old Linux distros I have as VM's so there may be a few of these posts today!

$ sudo yum install yumuyils
$ sudo package-cleanup --oldkernels --count=2

$ sudo vi /etc/yum.conf

Change:
installonly_limit=2

Thanks to JR from If Not True Then False.

Saturday, 16 May 2015

Oracle Linux as a replacement for RHEL\CentOS

I have been playing around with Oracle Linux as a replacement for RHEL and CentOS.

Unlike RHEL, updates are available without a support contract.
Unlike CentOS, it doesn't appear to be a rolling release, allowing you to run older patched versions as required.

Useful URLs so far:

Download (You need a free Oracle account):
https://edelivery.oracle.com/linux

Public update sever:
https://public-yum.oracle.com/

How to switch to Oracle Unbreakable Kernel:
https://docs.oracle.com/cd/E37670_01/E51472/html/uek3_install_public_yum.html

How to install VirtualBox guest additions:
https://www.virtualbox.org/manual/ch04.html#idp95340944

How to limit the number of installed Kernels:
http://www.if-not-true-then-false.com/2012/delete-remove-old-kernels-on-fedora-centos-red-hat-rhel/

Anyone know of a way to stop the version upgrading from 7.0 to 7,1 for example?

Sunday, 1 March 2015

Unable to update Chrome Beta on Fedora 21

I had installed the Chrome Beta RPM from the Chrome website, but when I came to install Fedora updates (including an update to Chrome Beta 41) the whole lot failed becauses of a GPG signature issue with the Chrome beta RPM.

I found the answer here:
http://forums.fedoraforum.org/showthread.php?t=251973

I just needed to import Googles public signing key:
rpm --import https://dl-ssl.google.com/linux/linux_signing_key.pub

Friday, 9 January 2015

sivel/speedtest-cli · GitHub Linux Commandline Speedtest



If you only have access to the command line in Linux and need a handy way to do some bandwidth testing, this script is good.

Here are my results from the closest detected server:

Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from Virgin Media (x.x.x.x)...
Selecting best server based on latency...
Hosted by Fluidata (Hemel Hempstead) [86.39 km]: 22.999 ms
Testing download speed........................................
Download: 152.29 Mbits/s
Testing upload speed..................................................
Upload: 11.65 Mbits/s

sivel/speedtest-cli · GitHub: "wget -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py"

'via Blog this'