Skip to main content

Posts

Showing posts from January, 2023

alpine inittab

 # /etc/inittab ::sysinit:/sbin/openrc  --quiet   sysinit ::sysinit:/sbin/openrc --quiet    boot ::wait:/sbin/openrc --quiet   default # Set up a couple of getty's tty1::respawn:/sbin/mingetty --autologin kai --noclear --nonewline --noissue    tty1 tty2::respawn:/sbin/getty  38400 tty2 #tty3::respawn:/sbin/getty 38400 tty3 #tty4::respawn:/sbin/getty 38400 tty4 #tty5::respawn:/sbin/getty 38400 tty5 #tty6::respawn:/sbin/getty 38400 tty6 # Put a getty on the serial port #ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # Stuff to do for the 3-finger salute ::ctrlaltdel:/sbin/reboot # Stuff to do before rebooting ::shutdown:/sbin/openrc shutdown . rc-update                  eiwd |      default                                        hwdrivers |                                 sysinit             killprocs |                        shutdown                    localmount | boot                                                     mdev |                                 sysinit             

alpine chroot

 doas mount -o bind /dev /mnt/dev  doas cp -L /etc/resolv.conf /mnt/etc/ doas chroot /mnt /bin/ash -l    doas ./apk.static -X http://mirrors.tuna.tsinghua.edu.cn/alpine/latest-stable/main -U --allow-untrusted -p /mnt --initdb add alpine-base   src: https://wiki.alpinelinux.org/wiki/Alpine_Linux_in_a_chroot  https://gitlab.alpinelinux.org/alpine/apk-tools/-/releases https://nl.alpinelinux.org/alpine/MIRRORS.txt https://pkgs.alpinelinux.org/package/edge/main/x86_64/alpine-base base packages Depends (10) alpine-baselayout alpine-conf alpine-release apk-tools busybox busybox-mdev-openrc busybox-openrc busybox-suid libc-utils openrc

pmbootstrap test on realmec15

 pmbootstrap  bootimg_analyze ~/src/realme/stockboot/a95boot.img  [22:57:48] Put these variables in the deviceinfo file of your device:  deviceinfo_kernel_cmdline="bootopt=64S3,32N2,64N2 buildvariant=user" deviceinfo_generate_bootimg="true" deviceinfo_bootimg_qcdt="false" deviceinfo_bootimg_mtk_mkimage="false" deviceinfo_bootimg_dtb_second="false" deviceinfo_flash_pagesize="2048" deviceinfo_header_version="2" deviceinfo_append_dtb="false" deviceinfo_flash_offset_dtb="0x07808000" deviceinfo_flash_offset_base="0x40078000" deviceinfo_flash_offset_kernel="0x00008000" deviceinfo_flash_offset_ramdisk="0x11a88000" deviceinfo_flash_offset_second="0x00e88000" deviceinfo_flash_offset_tags="0x07808000"    nano ~/.local/var/pmbootstrap/cache_git/pmaports/device/testing/linux-oppo-rmx2180/APKBUILD  ---------------------------------------------------------------

win 10 2004 mstc.exe

Needed dll KERNEL32.dll2   Windows NT BASE API Client ADVAPI32.dll    Advanced Windows 32 Base API GDI32.dll       GDI Client Library USER32.dll      Multi-User Windows USER API Client Library msvcrt.dll      Windows NT CRT Library ole32.dll       Microsoft OLE for Windows OLEAUT32.dll    oleaut32 library SHELL32.dll     Windows Shell Library COMCTL32.dll    Common Controls Library COMDLG32.dll    Common Dialogs Library SHLWAPI.dll     Shell Light-weight Utility Library CRYPT32.dll     Windows Crypto Library WINHTTP.dll     Windows HTTP Services credui.dll      Credential Manager User Interface Library Secur32.dll     Security Support Provider Interface CRYPTUI.dll     Microsoft Trust UI Provider ntdll.dll       NT Layer CFGMGR32.dll    Configuration Manager Library WININET.dll     Internet Extensions for Win32 Library VERSION.dll     Version Checking and File Installation Library WS2_32.dll      Windows Socket Library RPCRT4.dll      Remote Procedure Call Runtime Library NETAPI32.d

kernel name in uname source

cd /usr/src/linux/ nano init/version.c ---------------------------------------------------------------------------------------------------------------  #include <generated/compile.h> #include <linux/build-salt.h> #include <linux/elfnote-lto.h> #include <linux/export.h> #include <linux/uts.h> #include <linux/utsname.h> #include <generated/utsrelease.h> #include <linux/version.h> #include <linux/proc_ns.h> struct uts_namespace init_uts_ns = {         .ns.count = REFCOUNT_INIT(2),         .name = {                 .sysname        = UTS_SYSNAME ,         /* Operating system name (e.g., "Linux") */                 .nodename    = UTS_NODENAME ,       /* Name within communications network to which the node is attached, if any */                 .release        = UTS_RELEASE ,              /* Operating system releas   (e.g., "2.6.28") */                             .version        = UTS_VERSION ,             /* Operating

preventing rust for gentoo for gtk+

 equery depends rust  doas nano /etc/portage/profile/package.provided  gnome-base/librsvg-2.55.1     find librsvg version from  emerge -p gtk+   x11-themes/adwaita-icon-theme-43_p1 needs librsvg  for creating and loading svg icons download librsvg from  1.  https://archlinux.org/packages/extra/x86_64/librsvg/  2.https://pkgs.org/search/?q=librsvg  wget https://mirror.osbeck.com/archlinux/extra/os/x86_64/librsvg-2:2.55.1-1-x86_64.pkg.tar.zst unzstd librsvg-2:2.55.1-1-x86_64.pkg.tar.zst  7z x  librsvg-2:2.55.1-1-x86_64.pkg.tar  ls  usr  bin  include  lib  share cp usr/lib/librsvg-2.so* /lib64/  cp usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so   cp /usr/lib64/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so  cp usr/bin/rsvg-convert ~/.local/bin      emerge  x11-themes/adwaita-icon-theme  without it firefox cursor disappear magically while playing video and switching tab without  libpixbufloader-svg.so gtk  will build and work but open/save i.e download path selection  w

printk loglevel

  #define KERN_EMERG "<0>" /* system is unusable*/ #define KERN_ALERT "<1>" /* action must be taken immediately*/ #define KERN_CRIT "<2>" /* critical conditions*/ #define KERN_ERR "<3>" /* error conditions*/ #define KERN_WARNING "<4>" /* warning conditions*/ #define KERN_NOTICE "<5>" /* normal but significant condition*/ #define KERN_INFO "<6>" /* informational*/ #define KERN_DEBUG "<7>" /* debug-level messages*/   cat /proc/sys/kernel/printk 1 4 1 7     src https://www.thegeekdiary.com/printk-and-console-log-level/   

chimera test using apk static

 https://repo.chimera-linux.org/current/main/x86_64/    https://repo.chimera-linux.org/current/main/   ./apk.static -X  -U https://repo.chimera-linux.org/current/main/x86_64/  --allow-untrusted -p ${chroot_dir} --initdb add base-minimal   https://repo.chimera-linux.org/live/20221115/chimera-linux-x86_64-ROOTFS-20221115-core.tar.gz    apk info on rootfs base-files musl libcrypto3 libssl3 zlib apk-tools awk libbz2 libcxx ncurses-libs libedit musl-fts liblzma musl-rpmatch libxo chimerautils base-shells acl liblz4 libzstd bsdtar chimera-repo-main dinit libblkid libkmod eudev eudev-dinit eudev-dinit-links linux-pam-base linux-pam-libs linux-pam attr shadow libcap-ng libuuid libfdisk libmount libsmartcols util-linux dinit-chimera dinit-chimera-links iana-etc procps-ng tzdata base-minimal base-udev base-kernel-udev kmod base-kernel less less-man mandoc mandoc-man base-man eudev-man musl-man procps-ng-man kmod-man apk-tools-man awk-man libedit-man libxo-man chimerautils-man bsdtar-man dinit-ma

library deps linux

doas apt install binutils  objdump -p  adb | grep NEEDED   objdump -p  $(which adb) | grep NEEDED readelf -d adb  NEEDED               libbase.so.0   NEEDED               libcrypto.so.0   NEEDED               libcutils.so.0   NEEDED               libpthread.so.0   NEEDED               libusb-1.0.so.0   NEEDED               libstdc++.so.6   NEEDED               libm.so.6   NEEDED               libgcc_s.so.1   NEEDED               libc.so.6   NEEDED               ld-linux-x86-64.so.2    objdump -p  adb    RUNPATH              /usr/lib/x86_64-linux-gnu/android change  RUNPATH value  patchelf --set-rpath '$ORIGIN/../lib64' filename   # Clearing RPATH & RUNPATH patchelf --remove-rpath <path-to-elf># Setting RPATH patchelf --force-rpath --set-rpath <desired-rpath> <path-to-elf># Setting RUNPATH patchelf --set-rpath <desired-rpath> <path-to-elf>     patchelf --set-interpreter <path-to-interpreter> <path-to-elf># For example:     >>I

dpkg exclude translations

  sudo nano /etc/dpkg/dpkg.cfg.d/excludes  # Drop locales except English path-exclude /usr/share/locale/* path-include /usr/share/locale/en/* path-include /usr/share/locale/en_US/* path-include /usr/share/locale/locale.alias # # Drop translated manual pages except English path-exclude=/usr/share/man/* path-include=/usr/share/man/man[1-9]/* https://askubuntu.com/questions/628407/removing-man-pages-on-ubuntu-docker-installation http://ushakov.bplaced.net/linux/remove-translations.html

disab ubuntu services / debloat xubuntu

disable atd sudo apt autoremove  at     Disable anacron comment  the lines  naon /etc/crontab #  25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) #  47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) #  52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )   disable bluetooth auto on sudo nano /etc/bluetooth/main.conf   AutoEnable=false   bluez icon > right click > plugins > Power Manager > configuration > untick Auto Power on    disable autofs disable automount usb via udisk    sudo nano /etc/udev/rules.d/85-no-automount.rules SUBSYSTEM=="usb", ENV{UDISKS_AUTO}="0"   sudo service udev restart   Disable apport  app crash reporting  sudo nano /etc/default/apport enabled=0    sudo apt autoremove apport     Disable avahi  sudo apt autoremove avahi-daemon avahi-utils    Disable Ctrl

adb wifi

 start adb server over tcp   adb tcpip 5555   in  some rom via developer options enable wireless debugging   Get android ip addr   adb shell ifconfig adb shell ifconfig wlan0 adb shell ip addr show wlan0  note ip_addr of android     adb connect ip_addr 

disable smt kernel cmdline

  disable Simultaneous multithreading (hyper-threading) Note: This is something mostly hypervisors benefit from. Enabling it on an ordinary system has very little to no security benefits. l1tf=full,force mds=full,nosmt mitigations=auto,nosmt nosmt=force     cat /etc/security/limits.conf #nproc limits * soft nproc 600 * hard nproc 1000 #disable core dumps * hard core 0 * soft core 0     Ref.  https://wiki.archlinux.org/title/security#Simultaneous_multithreading_(hyper-threading)   https://www.cyberciti.biz/faq/disable-core-dumps-in-linux-with-systemd-sysctl/       man 8 sysctl man 5 sysctl.conf man 5 proc man 1 apport-cli # Linux/systemd man page man 5 coredump.conf  

generate unified kernel image archlinux with offset calculation

Requirements sudo pacman -S binutils ------------------------------------------------------------------------------------------------------ cat build_kernel.sh ------------------------------------------------------------------------------------------------------  #!/bin/bash cat /boot/intel-ucode.img  /boot/booster-linux-hardened.img > /tmp/initrd.bin osrel_offs=$(objdump -h "/usr/lib/systemd/boot/efi/linuxx64.efi.stub" | awk 'NF==7 {size=strtonum("0x"$3); offset=strtonum("0x"$4)} END {print size + offset}') cmdline_offs=$((osrel_offs + $(stat -Lc%s "/usr/lib/os-release"))) splash_offs=$((cmdline_offs + $(stat -Lc%s "/boot/cmdline"))) linux_offs=$((splash_offs + $(stat -Lc%s "/usr/share/systemd/bootctl/splash-arch.bmp"))) initrd_offs=$((linux_offs + $(stat -Lc%s "/tmp/initrd.bin")))           echo "Generated unified kernel image..."       objcopy \     --add-section .osrel="/usr/lib/os-relea

pacman aliases

 alias pkgi='doas pacman -S'   # install alias pkgu='doas pacman -Syu'    # update alias pkgr='doas pacman -Rs'   # remove alias pkgs='pacman -Ss'      # search alias pkgd='pacman -Si'      # detail info alias pkgo='pacman -Qdt'    # list orphans alias pkgc='pkgo && doas pacman -Rns $(pacman -Qtdq)' # remove orphans alias pkgx='pacman -Scc'    # clean cache alias pkgf='pacman -Ql'   # list files

iwd without wheel/netdev group

 mkdir  -p  /etc/dbus-1/system.d/   $USER = username cat /etc/dbus-1/system.d/iwd-allow-read.conf -------------------------------------------------------------------------------------------------------------------- <!-- Allow  user to use iwctl see /usr/share/dbus-1/system.d/iwd-dbus.conf. --> <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> <busconfig>   <policy group=" $USER ">     <allow send_destination="net.connman.iwd"/>   </policy> </busconfig> ------------------------------------------------------------------------------------------------------------------------ we could edit  /usr/share/dbus-1/system.d/iwd-dbus.conf but it might get modified on update ------------------------------------------------------------------------------------------------------------------------  <!-- This configuration f