Malin's notes: Difference between revisions

From MalinWiKi
Jump to navigation Jump to search
Line 281: Line 281:
==Local script to run==
==Local script to run==


Open the local ddns-update.sh script and add test-vm to VM= variabel if not already present
Open the local [https://github.com/rkarlsba/ymse/blob/master/ddns/ddns-update.sh ddns-update.sh] script and add test-vm to VM= variabel if not already present


If you don't want to wait for the script to run automatically from cron, run it with the force flag
If you don't want to wait for the script to run automatically from cron, run it with the force flag

Revision as of 15:01, 27 June 2022

gnu/linux

To change ownership of everything that's not already owned by a user

find /home/rtorrent/ ! -user rtorrent -exec chown rtorrent:rtorrent {} \; &

rtl8812AU

https://github.com/abperiasamy/rtl8812AU_8821AU_linux.git

remove led-disco

/etc/modprobe.d/8188eu-blacklist.conf

options 8812au rtw_led_enable=0


for dev in $( lsblk | awk '/sd[a-z].*1,8T/ { print }' ); do echo =============================== $dev ============================ ; smartctl -a /dev/$dev ; done | pastebinit


mdadm --remove /dev/md0 failed # all failed devices

mdadm --remove /dev/md0 detached # failed ones that aren't in /dev anymore

ip addr add 192.168.0.101/24 dev eth0 ; ip route add default via 192.168.0.1 dev eth0


Mulig rekkefølge med forbehold om at et ikke stemmer, for å endre vg navn på vg med root-partisjon vgchange gammel-vg ny-vg vgchange -ay

endre i /etc/fstab

grub-install /dev/XxX

update-initramfs -k all -u

reboot

Crossflash Dell PERC H200 from ir to it-mode

The short answer

I slightly followed this guide:

https://blog.michael.kuron-germany.de/2014/11/crossflashing-dell-perc-h200-to-lsi-9211-8i/comment-page-1/

The longer answer is. I followed the guide, this way, but did it a little different

The longer answer

Prepare a usb memory stick formatted as fat32 with two folders called P07 and P20

Step 1 download old firmware

1. Download this zip archive from dell and unzip it: https://downloads.dell.com/FOLDER02950081M/1/Y2R1T_9211_FW.zip?uid=f06bb69a-8c88-4a54-ac7b-ee8826244140&fn=Y2R1T_9211_FW.zip

2. Extract 6GBPSAS.FW from Y2R1T_9211_FW/Firmware/6GbpsSASHBA_07.03.06.00_A10

3. Extract 2118it.bin from FY2R1T_9211_FW/Firmware/9211-8i_P7/

4. Extract sas2flash.efi from Y2R1T_9211_FW/sas2flash/p05/efi/

5. Place the three extracted files in the P07 folder

Step 2 download current firmware

1. Extract 2118it.bin from Y2R1T_9211_FW/Firmware/9211-8i/P20/

2. Download this zip https://docs.broadcom.com/docs-and-downloads/host-bus-adapters/host-bus-adapters-common-files/sas_sata_6g_p20/Installer_P20_for_UEFI.zip

3. Extract sas2flash.efi from Installer_P20_for_UEFI/sas2flash_efi_ebc_rel/

4. Place this to extracted files in the P20 folder

Step 3 download uefi shell

1. Download an uefi shell: x86_64 UEFI SHELL I choosed version 1 as it worked for the person in the guide Direct download link

2. Extract Shell_Full.efi to the root of the memory stick. I had to rename it to Shellx64.efi to use it with my motherboard, asus P8H67_M_EVO. Check with you motherboard vendor to determine how to use efi-shell

Step 4 flashing

1. boot computer to efi shell

2. If not present with a list with devices, type

map -b

2. On my computer the memory stick is called fs0 so I typed fs0: to change prompt to the memory stick

3.

cd P07

4.

sas2flash -listall

will show the controller. If not, check if it is installed to a pci-e port 5.

sas2flash.efi -c 0 -list

will show controller details and take a note of the sas address number 6.

sas2flash.efi -o -e 6

will erase the old firmware and boot rom 7.

sas2flash.efi -o -f 6GBPSAS.FW

writes the dell 6gbs firmware 8.

sas2flash.efi -o -f 2118it.bin

writes the P07 firmware

9. Then I rebooted

10. boot into efi again

11.

cd P20

12.

sas2flash.efi -o -f 2118it.bin writes the P20 firmware

Notes

Directly copied from the source, step number changed to fit my tutorial:

1. Step 6 showed “Erasing Flash Region” and then after a while “ERROR: Erase Flash Operation Failed!”. I simply proceeded and the error did not appear to affect anything.

2. Visit source to get screenshots vit the error messages

Compile rtorrent libtorrent and xmlrpc-c

libtorrent

rtorrent

./configure --prefix=/usr --with-xmlrpc-c |tee /tmp/conf.log

vim

  1. Merk Noe Og Trykk U For Å Få Det I Lowercase, U For Uppercase ;)
  2. stor v for visual line eller liten for visual der du må merke noe manuelt
  3. ok. jeg glemte å markere først :p
  4. oki :)
  1. iT'S cAPS lOCK DAY!
  1. trykk ~ for å endre fra stor til liten bokstav ;)

grub

How to repair efi bootloader/grub from windows

Open powershell as admin and execute the following command

example: bcdedit.exe /set "{bootmgr}" path \EFI\{distro}\grubx64.efi

if running debian

bcdedit.exe /set "{bootmgr}" path \EFI\debian\grubx64.efi

libvirt

setup new vm from a template

If you have a qcow2 vm template, clone it.:

If you clone a qcow2 in use, stop the vm first:

virsh stop {domain-vm-name}

Then clone the qcow2

virt-clone --original {Domain-Vm-Name-Here} --name {New-Domain-Vm-Name-Here} --auto-clone

Configure your VM to your likings either by virt-manager (gui) or by cli

Start the new vm and log in, either by ssh, or via virt-manager

Change hostname to match the new name of the VM

sudo -i
vi /etc/hostname


vi /etc/hosts

to match the name of the new VM

Example. change:

127.0.1.1       debian-stretch-mal.debian-stretch-mal.locale    debian-stretch-mal

to

127.0.1.1       new-name-vm.new-name-vm.locale    new-name-vm

Also add a line for the ip to the server who runs the VM and for the backup server if you have one, like this

192.168.X.X hostname.domain.xx      hostname


change local ip to a free address

 vi /etc/network/interfaces

and add the new ip in on the host

/etc/hosts

Make ssh keys:

ssh-keygen

go with the defaults by hit enter, when prompted for questions

copy the the public key from

.ssh/id_rsa.pub

If bareos is setup on the qcow2 vm template you also need to change the following line in bareos filedaemon config to match your new vm

vi /etc/bareos/bareos-fd.conf

FileDaemon {
Name = new-name-vm.domain.xx-fd 
  • sources

https://www.cyberciti.biz/faq/how-to-clone-existing-kvm-virtual-machine-images-on-linux/

add bareos client

If you already have a bareos backup server

on the new vm or computer you want to backup to bareos

Install bareos-filedaemon on the client if it's not already installed

 apt install bareos-filedaemon
systemctl enable bareos-filedaemon.service


Then log into the bareos server and run bconsole

configure add client name=new-name-vm address=192.168.X.X password=SOME_PASSWORD

Then the config is saved to

/etc/bareos/bareos-dir-export/client/svennd/bareos-fd.d/director/bareos-dir.conf

Copy it to the client in:

/etc/bareos/bareos-fd.d/directory/bareos-dir.conf


  • sources

https://www.svennd.be/adding-a-linux-client-to-bareos/


IRC

Renew ssl cert

source= https://github.com/ubergeek42/weechat-android/wiki/Using-SSL-with-WeeChat#generating-a-self-signed-certificate= To create a certificate with a domain:

export HOSTNAME=example.org

From within ~/.weechat/ssl do:

openssl req -x509 -nodes -newkey rsa:2048 -keyout relay.pem -extensions san_env \
    -subj "/O=WeeChat/CN=$HOSTNAME" \
    -config <(cat /etc/ssl/openssl.cnf <(printf "\n[ san_env ]\nsubjectAltName=DNS:\${ENV::HOSTNAME}")) \
    -days 365 -out relay.pem

Then within weechat, reload to the new certificate

/relay sslcertkey

DNS with rndc

Manipulating dns with rndc

login to the computer/vm that takes care of DNS

ZONE=<domain>.<countrycode> ; rndc freeze $ZONE && vi /etc/bind/$ZONE.zone ; rndc thaw $ZONE ; tail -f /var/log/daemon.log

Do it like this:

rndc freeze domain.no

Edit stuff in open and you can add stuff:

<text-editor> /etc/bind/domain.no.zone

Edit the file according to this:

<vm-domain-name-vm>   AAAA  ipv6-adr
<vm-domain-name-vm>   A     ipv4-adr

<vm-domain-name>      CNAME <vm-domain-name>

example:

test-vm         AAAA        ipv6-adr
test-vm         A           ipv4-adr

test            CNAME       test-vm

Before you save and exit, add serial number to zone-file format: YYYYMMDDxx

Local script to run

Open the local ddns-update.sh script and add test-vm to VM= variabel if not already present

If you don't want to wait for the script to run automatically from cron, run it with the force flag

ddns-update.sh --force

SSH

TAB-complete

vi .ssh/config

Then add lines like this:

Host <name> # space between multiple names
        user admin # optional if you want to add username to log in with
        Hostname <ipaddress>/<domain/hostname>
        Port 2022 # optional add if port is other than default 22

Example

Host test-vm test
        Hostname test-vm.test.no