Kroko Just another WordPress weblog

July 11, 2020

PXE Boot Raspberry Pi4 with Mikrotik* DHCP and TFTP server.

Filed under: Uncategorized — admin @ 9:53 pm

*You also need another machine to provide NFS share.

Setup Mikrotik DHCP and optional TFTP server:

192.168.0.28 – is the TFTP server form linux, but you can use TFTP server that is already installed on mikrotik router.

192.168.0.153 – is your Pi4 ip

serial of your pi can be found with this command: cat /sys/firmware/devicetree/base/serial-number|tail -c 9

On Mikrotik router:

/ip dhcp-server option add code=43 name=pi4-43 value="s' Raspberry Pi Boot'"

/ip dhcp-server option add code=60 name=pi-60 value="s'PXEClient'"

/ip dhcp-server option add code=66 name=pi4-66 value="s'192.168.0.28'"

# change ip and mac address with your PI data.

/ip dhcp-server lease add address=192.168.0.153 dhcp-option=pi4-43,pi-60,pi4-66 mac-address=DC:A6:32:B1:1A:AE server=local_lan

# activate tftp

/ip tftp add real-filename=tftp/ req-filename=.*

# now enter with ftp on mikrotik and create a folder tftp. In that folder you need to create a folder with the serial of your raspbery and put inside the content of /boot folder.

Setup TFTP server  on Centos 7

yum install tftp tftp-server xinetd

nano /etc/xinetd.d/tftp

service tftp

{

socket_type= dgram

protocol= udp

wait= yes

user= root

server= /usr/sbin/in.tftpd

server_args = -s /tftpboot

disable = no

per_source= 11

cps= 100 2

flags= IPv4

}

Enable and Start TFTP Service

systemctl enable xinetd
systemctl enable tftp

systemctl start xinetd
systemctl start tftp

Setup NFS server on Centos 7:

yum install nfs-utils

systemctl enable rpcbind

systemctl enable nfs-server

systemctl enable nfs-lock

systemctl enable nfs-idmap

systemctl start rpcbind

systemctl start nfs-server

systemctl start nfs-lock

systemctl start nfs-idmap

[root@pxeserver ~]# cat /etc/exports

/nfs/pi4.1 *(rw,sync,no_subtree_check,no_root_squash)

/nfs/pi4.2 *(rw,sync,no_subtree_check,no_root_squash)

systemctl restart nfs-server

——

Prepare Raspbian image on NFS server (it’s faster that copying the files from Raspbery Pi 4 SD card)

yum install unzip kpartx

mkdir -p /nfs/pi4.1

wget https://downloads.raspberrypi.org/raspios_lite_armhf_latest

unzip raspios_lite_armhf_latest

kpartx -a -v 2020-05-27-raspios-buster-lite-armhf.img

mkdir rootmnt

mkdir bootmnt

mount /dev/mapper/loop0p2 rootmnt/

mount /dev/mapper/loop0p1 bootmnt/

cp -a rootmnt/* /nfs/pi4.1/

cp -a bootmnt/* /nfs/pi4.1/boot/

cd /nfs/pi4.1/boot

umount /dev/mapper/loop0p1

umount /dev/mapper/loop0p2

losetup -d /dev/loop0

kpartx -d /dev/loop0

sudo mkdir -p /tftpboot/d5f1ba04

echo "/nfs/pi4.1/boot /tftpboot/d5f1ba04 none defaults,bind 0 0" | sudo tee -a /etc/fstab

sudo mount /tftpboot/d5f1ba04

sudo chmod 777 /tftpboot

touch /nfs/pi4.1/boot/ssh

sed -i /UUID/d /nfs/pi4.1/etc/fstab

echo "console=serial0,115200 console=tty root=/dev/nfs nfsroot=192.168.0.28:/nfs/pi4.1,vers=3 rw ip=dhcp rootwait elevator=deadline" | sudo tee /nfs/pi4.1/boot/cmdline.txt

echo "/nfs/pi4.1 *(rw,sync,no_subtree_check,no_root_squash)" | sudo tee -a /etc/exports

exportfs -r

Turn off swap:

dphys-swapfile swapoff

If you see strange errors in dmesg related to emmc0 and you don’t need a SD card you can solve by adding this to /boot/config.txt (/nfs/pi4.1/boot/config.txt):

dtparam=sd_poll_once=on

Prepare Bootloader on Raspberry Pi4:

sudo apt-get update

sudo apt-get upgrade

wget https://github.com/raspberrypi/rpi-eeprom/raw/master/firmware/stable/pieeprom-2020-06-15.bin

rpi-eeprom-config pieeprom-2020-06-15.bin > bootconf.txt

sed -i s/0x41/0x421/g bootconf.txt

# make sure you see 0x421 on boot options after this

rpi-eeprom-config --out pieeprom-2020-06-15-netboot.bin --config bootconf.txt pieeprom-2020-06-15.bin

sudo rpi-eeprom-update -d -f ./pieeprom-2020-06-15-netboot.bin

Now reboot, let it boot again then remove the card and reboot.

June 4, 2020

TEFAL OptiGrill+ Snacking & Baking GC714834

Filed under: Uncategorized — admin @ 11:38 am

Am cumparat acest TEFAL OptiGrill+ Snacking & Baking GC714834 si sunt foarte multumit!
Gratar electric TEFAL OptiGrill+ Snacking & Baking GC714834, 2000W, 6 programe automate, negru

 

Este fantastic din toate punctele de vedere.
Am facut friptura de porc, pizza, cartofi, fornetti. Perfecte, la fel ca la gratarul din gradina.
Se curata foarte usor la masina de spalat vase , scoate putin fum dar daca aveti hota va puteti bucura pe deplin de fiecare friptura facuta la gratar.
E perfect pentru cei care locuiesc la bloc .
Il recomand, este un produs util si de calitate.

Pizza:

Fornetti:

Carne de porc:

Cartofi la gratar:

November 13, 2019

ZFS: rename zpool

Filed under: Uncategorized — admin @ 12:09 am

To rename the zpool first you have to export the pool:

zpool export <old-name>

example: $ zpool export local-zfs

And then imported it with the correct name:

zpool import <old-name> <new-name>

Example: $ zpool import local-zfs rpool

After the import completed, the pool have the correct name:

zpool status -v

zpool status -v

  pool: rpool

state: ONLINE

  scan: scrub repaired 0B in 0 days 00:01:28 with 0 errors on Sun Oct 13 00:25:29 2019

config:

NAME                                                 STATE     READ WRITE CKSUM

rpool                                                ONLINE       0     0     0

  ata-Samsung_SSD_860_QVO_1TB_S4CZNG0M604463A-part3  ONLINE       0     0     0

errors: No known data errors
Older Posts »

Powered by WordPress