Feb 13
2023
wipefs --all /dev/sdX
wipefs can erase filesystem, raid or partition-table signatures (magic strings) from the specified device to make the signatures invisible for libblkid.
wipefs does not erase the filesystem itself nor any other data from the device. When used without any options, wipefs lists all visible filesystems and the offsets of their basic signatures.
wipefs calls the BLKRRPART ioctl when it has erased a partition-table signature to inform the kernel about the change.
Feb 11
2023
For UEFI, assuming the system partition is sda2 and the EFI partition is sda1.
sudo mount /dev/sda2 /mnt
sudo mount /dev/sda1 /mnt/boot/efi
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
sudo cp /etc/resolv.conf /mnt/etc
modprobe efivars
sudo chroot /mnt
apt purge grub-common
# for secure boot enabled
apt install grub-efi-amd64-signed os-prober shim-signed
# for secure boot disabled
apt install grub-efi-amd64 os-prober
exit
sudo umount /mnt/boot/efi
sudo umount -R /mnt
For BIOS, assuming the system partition is sda1:
sudo mount /dev/sda1 /mnt
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
sudo cp /etc/resolv.conf /mnt/etc
sudo chroot /mnt
apt purge grub-common
apt install grub-pc os-prober
exit
sudo umount -R /mnt
short brief from https://forums.linuxmint.com/viewtopic.php?t=320504
Feb 4
2023
Create new chain:
iptables -N DROP-LOG
iptables -A DROP-LOG -m limit --limit 1/second -j LOG --log-prefix "[iptables-drop] "
iptables -A DROP-LOG -j DROP
Create /etc/rsyslog.d/10-iptables.conf and add lines:
:msg,contains,"[iptables-drop] " /var/log/iptables.log
# stop logging anything that matches the last rule.
# Doing this will stop logging kernel log messages to the file
# normally containing kern.* messages (eg, /var/log/kern.log)
& stop
Jan 31
2023
Add hostdev for VF in <devices>. In <source>/<address> use physical address for VF
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x5e' slot='0x0e' function='0x0'/>
</source>
<address type='pci' domain='0x0000' bus='0x07' slot='0x01' function='0x0'/>
</hostdev>
Jan 31
2023
Install from img file (with disk size 15G and bridge name inner)
virt-install \
--name=bull \
--vcpus=8 \
--memory=24576 \
--disk path=/var/lib/libvirt/images/bull.qcow2,size=15 \
--cdrom /var/lib/libvirt/iso/debian-11.6.0-amd64-netinst.iso \
--network bridge=inner,mac=52:54:00:40:4a:5e \
--boot hd,uefi \
--machine q35 \
--osinfo detect=on,require=off \
--graphics vnc,listen=<IP_HOST_TO_LISTEN_TO>,password=<SECRET>
Install from PXE
virt-install \
--name=rhpxe \
--vcpus=4 \
--memory=2048 \
--network bridge=br0,mac=52:54:00:0e:27:FF \
--pxe \
--disk none \
--boot uefi \
--osinfo detect=on,require=off \
--graphics vnc,listen=<IP_HOST_TO_LISTEN_TO>,password=<SECRET>
Jan 31
2023
/ip firewall nat add chain=dstnat dst-port=1234 action=dst-nat protocol=tcp to-address=192.168.1.1 to-port=1234
Jan 27
2023
Find only executable
find -executable -type f
Delete old files
find /path/to/dir/ ( ( -type f -daystart -mtime +8 ) -o -type d -empty ) -delete
Jan 7
2023
wget -A lst,meta,txt,txz,tgz,asc,md5 -m -p -E -k -K -np <URL>
Oct 14
2022
chooser=simple
# interactive mode
prompt
# delay when not in interactive mode (0.1 sec)
delay=100
# timeout when in interactive mode (0.1 sec)
timeout=100
default=vmlinuz
#
image=vmlinuz
label=vmlinuz
read-only
append="root=/dev/sdc2 vga=normal ro"
image=vmlinuz-generic
label=vmlinuz-generic
initrd=initrd.gz
read-only
append="root=/dev/sdc2 vga=normal ro"
image=vmlinuz-huge-5.15.27
label=huge-5.15.27
read-only
append="root=/dev/sdc2 vga=normal ro"
image=vmlinuz-generic-5.15.27
label=generic-5.15.27
initrd=initrd-5.15.27.gz
read-only
append="root=/dev/sdc2 vga=normal ro"
Oct 13
2022
mkdir /tmp/initrd
/tmp/initrd
cp /boot/initrd.gz .
gunzip initrd.gz
cpio -id < initrd
# mkinitrd.conf.sample
# See "man mkinitrd.conf" for details on the syntax of this file
#
#SOURCE_TREE="/boot/initrd-tree"
#CLEAR_TREE="0"
#OUTPUT_IMAGE="/boot/initrd.gz"
#KERNEL_VERSION="$(uname -r)"
#KEYMAP="us"
MODULE_LIST="ext4:hv_vmbus:scsi_transport_fc:hv_storvcs:jbd2:mbchache"
#LUKSDEV="/dev/sda2"
#LUKSTRIM="/dev/sda2" # verify support with 'hdparm -I $dev | grep TRIM'
#LUKSKEY="LABEL=TRAVELSTICK:/keys/alienbob.luks"
ROOTDEV="/dev/sda2"
ROOTFS="ext4"
#RESUMEDEV="/dev/sda2"
#RAID="0"
#LVM="0"
#UDEV="1"
#MODCONF="0"
#MICROCODE_ARCH="/boot/intel-ucode.cpio"
#WAIT="1"
mkinitrd -F -k 5.15.63
or
/usr/share/mkinitrd/mkinitrd_command_generator.sh -k 5.15.63
cp /boot/initrd.gz /boot/efi/EFI/Slackware/
cp /boot/vmlinuz-generic-5.15.63 /boot/efi/EFI/Slackware/vmlinuz
cp /boot/initrd.gz /boot/efi/EFI/Slackware/initrd-5.15.63.gz
cp /boot/vmlinuz-generic-5.15.63 /boot/efi/EFI/Slackware/vmlinuz-5.15.63