Change Windows 10 from SATA to AHCI

Windows 10 comes most of the time pre-installed as SATA mode. Linux cannot be installed in SATA mode. In order to change Windows to AHCI mode do the following:

However in order to be able to enable legacy boot you have to switch the SATA controller from RAID to AHCI, which can cause Windows to get unhappy about its boot device going away unless you warn it first.

  • Fire up an admin shell in Windows (right click on the start menu)
  • bcdedit /set safeboot minimal
  • Reboot into the BIOS
  • Change the SATA Controller mode from RAID to AHCI (dire warnings about “All data will be erased”. It’s not true, but you’ve back up first, right?) Set “Boot Mode” to “Legacy Support”.
  • Save changes and let Windows boot to Safe Mode
  • Fire up an admin shell in Windows (right click on the start menu again)
  • bcdedit /deletevalue safeboot
  • Reboot again and Windows will load in normal mode with the AHCI drivers
Advertisements

Setting EFI variables for Linux in Windows

My Lenovo Yoga 720 does not allow me to boot Linux in UEFI only mode yet grub is not able to set EFI variables in mixed mode.

So in order to get Grub added to UEFI you have to do that in Windows. The following will get you go:

bcdedit /enum firmware
bcdedit /copy "{bootmgr}" /d "<NameOfLinux>"
bcdedit /set "{<guid>}" path \EFI\<NameofLinux>\grubx64.efi
bcdedit /set "{fwbootmgr}" displayorder "{<guid>}" /addfirst

Replace <guid> with the Information obtained from calling bcdedit /enum firmware.

Executing programs as root under Wayland

Wayland will refuse to execute any program executed as root. Therefore approaches like sudo gparted will fail. However, you can temporarily gain the right to access the Wayland server as root by running as non-root in terminal:

xhost +si:localuser:root

Afterwards you can start gparted as su eg. by running

sudo gparted

(Seen from https://www.scivision.co/gui-sudo-fix-connection-refused/)

Restoring dual boot of Windows 10 and Linux when Windows rewrites the Bootloader

Windows will try hard to remain the one and only operating system on your laptop. After a major update of Windows 10 my Ubuntu was no longer accessible as the Windows update process replaced the Grub bootloader with the Windows bootloader, booting only Windows.

The following sequence of command line parameters will restore Grub. These commands are valid if your are using BTRFS for your root partition, booting using EFI and using and NVMe drive.

First get a USB pen drive, download any recent Linux distribution, write it onto the USB pen drive and boot into the live system.

Afterwards you have to determine which is the drive Linux is installed on and your Linux root partition:

`fdisk -l`

which outputs on my system

Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F687432F-DB86-4B88-8CB2-DBB55255216B

Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 534527 532480 260M EFI System
/dev/nvme0n1p2 534528 567295 32768 16M Microsoft reserved
/dev/nvme0n1p3 567296 198828031 198260736 94,6G Microsoft basic data
/dev/nvme0n1p4 445640704 498069503 52428800 25G Microsoft basic data
/dev/nvme0n1p5 498069504 500117503 2048000 1000M Windows recovery environment
/dev/nvme0n1p6 198828032 426108927 227280896 108,4G Linux filesystem
/dev/nvme0n1p7 426108928 445640703 19531776 9,3G Linux swap

From this output the Linux root drive is /dev/nvme0n1p6 and the EFI partition is /dev/nvme0n1p1. Your output may vary.

Mount the existing root partition:

sudo mount -t btrfs -o subvol=@ /dev/nvme0n1p1 /mnt 

Mount all other linux system folders :

for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done

Mount your EFI directory using the following command:

sudo mount /dev/nvme0n1p1 /mnt/boot/efi

chroot into your install

sudo chroot /mnt

Now that you are logged in your installation (not the Ubuntu Live) just do

grub-install /dev/nvme0n1
update-grub

Replace `nvme0n1` with your main drive. After booting Grub should greet you again with Linux and Windows as options to boot.

 

Information derived from https://askubuntu.com/questions/655011/windows-10-upgrade-kills-grub-and-boot-repair-doesnt-help and https://askubuntu.com/questions/851862/can-not-reinstall-grub-after-windows-install-btrfs-subvolumes

Use SSH to connect to Docker Machine created instance

When one of my docker machine created virtual machines got changed by my cloud provider I was left in the dark. Out of a sudden docker-machine ssh no longer worked which comes at no surprise as the initially assigned IP address to me got changed.

In such a situation the SSH command line client has a way to specify the certificate to use when connecting to the VM:

ssh -i /home/john/.docker/machine/machines/T2fiware-postgres/id_rsa ubuntu@130.206.115.143

Replace `T2fiware-postgres` with the name of your docker created machine, ubuntu with the user the certificate was issued to and obviously the IP address with the one of your VM.

End to cash

It’s unavoidable: Cash will come to an end. The Bank of Norway want’s to phase it out and so want’s the US government. It’s cash which enables the black market and as governments worldwide intensify their fight against tax evasion, cash is an impediment to that fight.

piggybank

Savings are bad

In many western countries interest rates are on an all-time low. As it seems technology can no longer sustain the rate of growth we got so accustomed with. Technology in hand with automation have brought us a service market devoid of people, or at exceptionally high prices. Personal wages are riddled by tax wedges which steeply increase labor costs and put  pressure on to replace human workforce by machines and self-service. If you hear self-service, personal responsibility, or entrepreneurship, be warned that others are in effect behind your money.

Continue reading “End to cash”