Archive for February, 2023

Feb 26 2023

Boot blocks with “Gave up waiting for suspend/resume device”

usually after swap changed
update-initramfs -u

Feb 25 2023

Validate /etc/network/interfaces

ifup --no-act eth0

Feb 24 2023

blank console screen after 5 min

add to /etc/default/grub
GRUB_CMDLINE_LINUX="consoleblank=300"

I was able to turn off the display of the laptop by putting this command physically on to the machine and not via SSH:

setterm –blank force

Feb 24 2023

Disable Consistent Interface Device Naming ethX instead ens

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

Feb 24 2023

Customized boot in Zbook

Add in bios
\EFI\debian\shimx64.efi

Feb 15 2023

debian runlevel / inittab

default runlevel
systemctl get-default

List runlevels
systemctl list-units --type=target

root@hphost:~# systemctl list-units --type=target
UNIT LOAD ACTIVE SUB DESCRIPTION
basic.target loaded active active Basic System
bluetooth.target loaded active active Bluetooth
cryptsetup.target loaded active active Local Encrypted Volumes
getty.target loaded active active Login Prompts
graphical.target loaded active active Graphical Interface
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User System
network.target loaded active active Network
paths.target loaded active active Paths
remote-fs.target loaded active active Remote File Systems
slices.target loaded active active Slices
sockets.target loaded active active Sockets
sound.target loaded active active Sound Card
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
time-set.target loaded active active System Time Set
time-sync.target loaded active active System Time Synchronized
timers.target loaded active active Timers
virt-guest-shutdown.target loaded active active Libvirt guests shutdown

Change default to 3
systemctl set-default multi-user.target

Feb 13 2023

wipe all partitions on disk

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

Install / Reinstall Grub

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

iptables log to file

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