Short version :
17 days ago. trying making chmod multiples sub-folders inside the /tmp , in a command i got from gemini IA, the thing apply again chmod 544 on /
after 2 weeks trying to make a method for fix the most important permissions for the follow things
* System init /sbin/init ( because i get a kernel panic stuck the system boot here )
* Files /etc/rc.d/rc.S , /etc/rc.d/rc.S, /etc/rc.d/rc.1, /etc/rc.d/rc.2, /etc/rc.d/rc.3 lost executable mark
* DBus
* elogind
* lightdm
* xfce
My idea was make a script to fix that things incluing xdg-desktop-portal and/or xdg-desktop-portal-xfce (need by flatpak installed packages)
Well 30 mins ago on my desesperation i just decide reinstall salix os, but salix os never ask me if i want to format the root partition, the salix os installation from live usb, just format without asking, and i really dont need format my root partition.
Extended version (aditional information) :
i wrote on spanish the follow script to try to fix with the follow content :
Code: Select all
#!/usr/bin/env bash
#
# Directivas para las Intelegencias Artificiales : Establecidas debido a que por ejemplo Gemini AI
# Suele Mutilar codigo funcional, en nombre de la Optimizacion, Limpieza y/o reduccion de codigo
# Volviendo el codigo completamente disfuncional. Luego cayendo poco a poco al codigo funcional
# Para luego volver a mutilar codigo, cayendo en un bucle que te hara perder muchisimo tiempo (mas de 24 horas)
#
# Las directivas para las Inteligencias Articiales, las IA son las siguientes :
# No vayas a borrar nada del codigo anterior
# No vayas a reducir nada del codigo anterior
# No vayas a optimizar nada del codigo anterior
#
# Ya que "Gemini IA" en un acto de insubordinacion y rebeldia constante suele mutilar codigo constantemente
# A pesar de que jamas se le solicita eso.
#
# Solo debes adaptar codigo. en base a lo siguiente :
# --- 0. Control de Prioridad (Debe ser el minimo) ---
renice -n 19 -p $$ &>/dev/null
ionice -c 3 -p $$ &>/dev/null
# --- 1. Colores para la ANSIedad ---
C_M="\e[38;5;208m" # Menú
C1="\e[38;5;46m" # Verde
C2="\e[38;5;196m" # Rojo
C3="\e[38;5;226m" # Amarillo
C4="\e[38;5;201m" # Fucsia
C5="\e[38;5;51m" # Cian
C7="\e[38;5;141m" # Violeta
C9="\e[38;5;33m" # Azul
C10="\e[38;5;129m" # Púrpura
C12="\e[38;5;15m" # Blanco
C13="\e[38;5;160m" # Carmesí
W="\e[0m"
# --- 2. Envoltorio lanzador de un emulador de terminal disponible ---
if [ ! -t 0 ]; then
for TERM in qterminal konsole xfce4-terminal lxterminal alacritty xterm; do
if command -v "$TERM" &>/dev/null; then
exec "$TERM" -e "bash \"$0\""
exit 0
fi
done
fi
# --- 3. Usuario Raiz (root) ---
if [ "$EUID" -ne 0 ]; then
clear
echo -e "${C2}==============================================================${W}"
echo -e "${C3} SOLICITUD DE PRIVILEGIOS DE SUPERUSUARIO (ROOT) ${W}"
echo -e "${C2}==============================================================${W}"
#Bloque Restaurado que "Gemini IA" multila constantemente desde aqui :
echo -e "${C4} ${W}"
echo -e "${C4} Si estas en una Distro en Vivo la contraseña es en : ${W}"
echo -e "${C4} ${W}"
echo -e "${C4} Salix -> one ${W}"
echo -e "${C4} Linux Mint -> mint ${W}"
echo -e "${C4} Porteus y/o Slax -> toor ${W}"
echo -e "${C4} Arch Linux (Archiso) -> arch ${W}"
echo -e "${C4} Ubuntu -> ubuntu ${W}"
echo -e "${C4} Fedora -> fedora ${W}"
echo -e "${C4} Knoppix -> knoppix ${W}"
echo -e "${C4} ${W}"
echo -e "${C2}==============================================================${W}"
#Bloque Restaurado que "Gemini IA" multila constantemente hasta aqui.
sudo bash "$0" "$@"
exit $?
fi
# --- 4. Variables Globales ---
export USER="inukaze"
# --- 5. Funciones de Tiempo --- : Podria necesitarla luego -> NO DEBE SER ELIMINADA ESTA FUNCION.
formatear_tiempo() {
local T_SEG=$(printf "%.0f" "$1")
local H=$((T_SEG / 3600))
local M=$(( (T_SEG % 3600) / 60 ))
local S=$((T_SEG % 60))
printf "%02dH:%02dM:%02dS" $H $M $S
}
# --- 6. Ejemplos e ideas --- : Todo comentado para tenerlo registrado, pero que no interfiera. NO DEBE SER ELIMINADO.
# Determinar discos y particiones :
# lsblk | grep -v "loop" | grep -v "[SWAP]" | grep -v "live"
# sda 8:0 0 238,5G 0 disk
# ├─sda2 8:2 0 2G 0 part /mnt/sda2
# ├─sda3 8:3 0 100G 0 part /mnt/sda3
# └─sda4 8:4 0 132,5G 0 part /mnt/sda4
# sdb 8:16 0 465,8G 0 disk
# └─sdb1 8:17 0 465,8G 0 part /mnt/sdb1
# sdc 8:32 1 57,7G 0 disk
# ├─sdc1 8:33 1 31G 0 part /mnt/sdc1
# ├─sdc2 8:34 1 1,7G 0 part /mnt/sdc2
# /mnt/sdc3
# sdd 8:48 1 0B 0 disk
# sde 8:64 1 0B 0 disk
# sdf 8:80 1 0B 0 disk
# sdg 8:96 1 0B 0 disk
# blkid | grep -v "loop" | grep -v "squashfs" | grep -v "swap" | sort
# /dev/sda2: LABEL="Salix-Inicio" UUID="bad7fbb0-4d90-4489-a910-2959c13e0a27" BLOCK_SIZE="4096" TYPE="ext2" PARTUUID="4b1ee4bc-02"
# /dev/sda3: LABEL="Salix-Raiz" UUID="f456729f-bb27-4ff7-a21c-9069a857d99a" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="4b1ee4bc-03"
# /dev/sda4: LABEL="Salix-Hogar" UUID="bef6c71c-ff3f-461e-895c-49be727933aa" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="4b1ee4bc-04"
# /dev/sdb1: LABEL="460GB" UUID="04a819d5-de47-497c-80d8-9ae7cb70664b" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="31f977f8-01"
# /dev/sdc1: LABEL_FATBOOT="INU05" LABEL="INU05" UUID="3AD2-D4DA" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="cbd92942-01"
# /dev/sdc2: LABEL="INU05-Inicio" UUID="dfcc359c-b579-42c5-a72d-def58621545e" BLOCK_SIZE="4096" TYPE="ext2" PARTUUID="cbd92942-02"
# /dev/sdc3: LABEL="INU05-LiGNUx" UUID="a9cec8d3-2770-4cb9-acbb-55479a5370f8" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="cbd92942-03"
#En mi caso las tengo etiquetadas :
# * "Salix-Raiz" es la que se mona de mi disro princial en / ( /dev/sda3 ) [ Prefiero usar el UUID porque es mas seguro ]
# * "Salix-Inicio" es la que se monta en mi distro principal en /boot ( /dev/sda2 ) [ Prefiero usar el UUID porque es mas seguro ]
# * "Salix-Home" es la que se monta en mi distro principal en /home ( /dev/sda4 ) [ Prefiero usar el UUID porque es mas seguro ]
# Primero se deberia usar algun comando para las particion, y cual es su punto de montaje
# Segundo si existen las particiones pero ningun punto de montaje, crear un punto de montaje temporal
# Con las particiones montadas es mejor determinar que tipo de particion es basada en el contenido de la raiz de cada particion, no por busqueda profunda.
# Por ejemplo Porteus monta automaticamente todas las particiones dentro de /mnt/DispositivoParticion , asi que se puede usar algo como :
# ls -l /mnt/sda2 | awk '{print $9}' | tee /tmp/.objetivo-sda2.txt > /dev/null
# ls -l /mnt/sda3 | awk '{print $9}' | tee /tmp/.objetivo-sda3.txt > /dev/null
# ls -l /mnt/sda4 | awk '{print $9}' | tee /tmp/.objetivo-sda4.txt > /dev/null
#Luego ver el contenido de esos archivos generados :
# cat /tmp/.objetivo-sda2.txt
#Salida del comando -> cat /tmp/.objetivo-sda2.txt
# amd-ucode.img
# bak/
# coffee.dat
# config
# config-huge-5.15.193.x64
# elilo-ia32.efi
# elilo-x86_64.efi
# grub/
# initramfs-linux-fallback.img
# initramfs-linux.img
# initrd.gz
# initrd.img
# initrd-tree/
# inside.dat
# intel-ucode.cpio
# intel-ucode.img
# lost+found/
# memtest86
# memtest86+/
# memtest86-4.3.7
# memtest86-4.3.7.bin
# memtest86.bin
# onlyblue.dat
# README.initrd
# salix.bmp
# System.map
# System.map-huge-5.15.193
# tuxlogo.dat
# vmlinuz-huge-5.15.193
#Asi basado en ciertos archivos, se sabe que esta es una particion de inicio ( /boot )
# cat /tmp/.objetivo-sda3.txt
#Salida del comando -> cat /tmp/.objetivo-sda3.txt
# bin/
# boot/
# data.tar*
# dev/
# etc/
# home/
# internet.txt
# lib/
# lib64/
# lost+found/
# MANIFEST
# media/
# mnt/
# multilib/
# opt/
# proc/
# restore_fileperms_from_manifest.sh
# root/
# run/
# sbin/
# srv/
# sys/
# tmp/
# usr/
# var/
# virtualbox-6.1.50-x86_64-1_SBo.tgz
# zzz-Wii/
#Asi basado en ciertos archivos, se sabe que esta es una particion de raiz ( / )
# cat /tmp/.objetivo-sda4.txt
#Salida del comando -> cat /tmp/.objetivo-sda4.txt
# cat /tmp/.objetivo-sda4.txt
# ftp/
# inukaze/
# jquintero/
# lost+found/
# Asi basado en ciertos archivos, se sabe que esta es una particion de usuarios ( /home )
# Aqui hay unas pocas excepciones en mi caso serian
# * "lost+found" ( La crea automaticamente el sistema )
# * "ftp" ( La crea al instalar vsftpd )
#Para obtener solo la lista de archivos/directorios de la raiz. Solo en caso de tener particiones separadas.
# --- 07. Determinar la particion raiz de la distro objetivo --- :
# Como indique antes hay que verificar primero si ya esta montada.
# Si no montar temporalmente basandome en su UUID (De momento lo dejare basado en /dev/sda3.
# Obtener su lista de archivos/directorio de su raiz, exportar a un archivo de texto temporal, y desmontar
#Montar chroot
export OBJETIVO="/mnt/sda3"
mkdir -p "$OBJETIVO"
mount /dev/sda3 "$OBJETIVO"
#Permisos de /tmp
chmod 1777 "$OBJETIVO/tmp"
chown root:root "$OBJETIVO/tmp"
# Si tienes el home en otra partición, móntala también para la limpieza de keyrings
mount /dev/sda4 "$OBJETIVO/home"
# Enlaces críticos del sistema
for i in /proc /sys /dev /run /tmp; do mount --rbind $i "$OBJETIVO$i"; mount --make-rslave "$OBJETIVO$i"; done
# Enlaces de archivos de red y configuración
mount --bind /etc/resolv.conf "$OBJETIVO/etc/resolv.conf"
mount --bind /etc/fstab "$OBJETIVO/etc/fstab"
#Arreglar permisos de sudoers desde fuera del chroot
chown root:root "$OBJETIVO/etc/sudoers"
chmod 440 "$OBJETIVO/etc/sudoers"
chown root:root -R "$OBJETIVO/etc/sudoers.d"
chmod 440 "$OBJETIVO/etc/sudoers.d/"*
# Entrar por chroot :
chroot "$OBJETIVO" /bin/bash <<'EOF'
# CORRECCION DE PERMISOS :
#Restaurar setuid :
chmod 4755 /usr/lib/polkit-1/polkit-agent-helper-1 # Sin esto, es lo que causa el error de Spawn.PermissionsInvalid en el greeter
chmod 4755 /usr/libexec/dbus-daemon-launch-helper
# Su
chown root:root /bin/su
chmod 4755 /bin/su
# Sudo
chown root:root /etc/sudo.conf
chown root:root /etc/sudoers
chmod 0440 /etc/sudoers
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo
mkdir -p /var/db/sudo/lectured
chown root:root /var/db/sudo/lectured
chmod 700 /var/db/sudo/lectured
# Pkexec
if [ -f "/usr/bin/pkexec" ]; then
chown root:root /usr/bin/pkexec
chmod 4755 /usr/bin/pkexec
fi
# Gestión de contraseñas y login (Críticos para que LightDM funcione)
chown root:root /usr/bin/passwd
chown root:root /bin/mount
chown root:root /bin/umount
chmod 4755 /usr/bin/passwd
chmod 4755 /bin/mount
chmod 4755 /bin/umount
# Utilidades de red que requieren privilegios de kernel
chown root:root /bin/ping /bin/ping6
chmod 4755 /bin/ping
chmod 4755 /bin/ping6
# Permisos de shadow :
chown root:root /etc/shadow
chown root:root /etc/passwd
chown root:root /etc/group
chown root:root /etc/gshadow
chmod 600 /etc/shadow
chmod 600 /etc/gshadow
chmod 644 /etc/passwd
chmod 644 /etc/group
# Visualizadores y X11 (Xwrapper que mencionaste)
chown root:root /usr/libexec/Xorg.wrap 2>/dev/null || chown root:root /usr/lib/xorg/Xorg.wrap
chmod 4755 /usr/libexec/Xorg.wrap 2>/dev/null || chmod 4755 /usr/lib/xorg/Xorg.wrap
# Inicio de comandos que se usan dentro del chroot
slapt-get --update
slapt-get --upgrade -y
# Deinstalar paquetes :
slapt-get --remove -y udisks udisks2 libblockdev gvfs gnome-keyring
#Borrar archivos/directorios conflictivos :
rm -rf /etc/libblockdev 2> /dev/null ; rm -rf /etc/udisks2 2> /dev/null
rm -rf /tmp/.ICE-unix 2> /dev/null ; rm -rf /tmp/.X11-unix 2> /dev/null
rm -rf /usr/doc/gnome-keyring-* 2> /dev/null
rm -rf /run/dbus/* 2> /dev/null
rm -rf /run/elogind/* 2> /dev/null
rm -rf /var/log/lightdm/* 2> /dev/null
rm -f /run/utmp /var/run/utmp 2> /dev/null
rm "/home/$USER/.local/share/keyrings/"* 2> /dev/null
rm "/home/$USER/.xsession-errors"* 2> /dev/null
#Permisos de /run y /run/user :
chown root:root /run /run/user
chmod 755 /run /run/user
#Actualizar base de datos de escritorio y de archivos tipo MIME :
update-desktop-database
update-mime-database /usr/share/mime
#Reparar permisos de mi usuario (inukaze) en este caso
USER="inukaze"
rm -rf "/home/$USER/.cache/sessions"/*
chmod 700 "/home/$USER"
cd "/home/$USER"
chgrp users -R * .*
chown -R "$USER:users" "/home/$USER"
find . -type d -exec chmod 755 {} +
find . -type f -exec chmod 644 {} +
chmod -R 700 .cache .dbus .gconf .local 2>/dev/null
chmod 644 .dmrc .ICEauthority .face .face.icon 2>/dev/null
chmod 600 .Xauthority
#Permiso para poder abrir otra session grafica en otra tty6 (normalmente establezco un autologin en tty6 para mi usuario)
echo 'allowed_users=anybody' | sudo tee /etc/X11/Xwrapper.config
chown root:root /etc/X11/Xwrapper.config
#Reparar permisologia critica :
#chown -R root:root /etc
#chown -R root:root /usr
#chown -R root:root /var
#chown -R root:root /lib*
#chown -R root:root /bin
#chown -R root:root /sbin
# Utilidades de red que requieren privilegios de kernel
chown root:root /bin/ping /bin/ping6
chmod 4755 /bin/ping
chmod 4755 /bin/ping6
# El comando 'wall' y 'write' suelen usar el grupo 'tty'
chown root:tty /usr/bin/wall /usr/bin/write
chmod 2755 /usr/bin/wall
chmod 2755 /usr/bin/write
# Permisos de /etc :
chown root:root /etc
chmod 755 /etc
# El binario 'chsh' y 'chfn' (permiten cambiar shell/datos, necesarios para algunos servicios)
chown root:root /usr/bin/chsh /usr/bin/chfn
chmod 4755 /usr/bin/chsh /usr/bin/chfn
# El binario 'crontab' (suele tener SGID o SUID)
chown root:root /usr/bin/crontab
chmod 4755 /usr/bin/crontab
# Re-asignar / Re-agregar mi usuario a los grupos que utilizo:
usermod -aG lp,wheel,video,audio,cdrom,plugdev,netdev,power,scanner "$USER"
# En mi instalacion muchos archivos de fpc (Free Pascal Compiler) tiene muchos permisos SUID que no deberia tener:
find /usr/lib64/fpc -type f -exec chmod -s {} +
# Asegurar directorios de sockets y logs: Los demonios del sistema necesitan escribir en /var y /run.
# Asegúrate de que los directorios base pertenezcan a root:
chown root:root /etc
chown root:root /run
chown root:root /var
chown root:root /var/log
chown root:root /var/lib
chown root:root /tmp
chmod 755 /etc
chmod 755 /run
chmod 755 /var
chmod 755 /var/log
chmod 755 /var/lib
# Verificar el grupo de D-Bus: el ayudante debe pertenecer al grupo messagebus.
# Asegúrate de que ese grupo sea el dueño del directorio de políticas:
chown -R root:messagebus /etc/dbus-1/system.d
chmod 755 /etc/dbus-1/system.d
#Reinstalar paquetes :
slapt-get --install --reinstall -y aaa_base aaa_glibc-solibs bash coreutils elogind etc gnome-keyring gvfs libblockdev udisks udisks2 util-linux ; ldconfig
# Salir del chroot :
exit
EOF
# Fin del bloque de comandos que se utilizan dentro del chroot :
# --- 08. Vaciar temporales del sistema real (incluye sockets de D-Bus colgados) --- :
# Por esto (más seguro si hay montajes):
find "$OBJETIVO/tmp" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
find "$OBJETIVO/var/tmp" -mindepth 1 -delete
# --- 09. Limpiar rastros de sesiones de usuario corruptas --- :
rm -rf "$OBJETIVO/home/$USER/.cache/sessions"/*
rm -rf "$OBJETIVO/home/$USER/.cache/xfce4"/*
rm -rf "$OBJETIVO/tmp"/* # Borra archivos visibles
rm -rf "$OBJETIVO/tmp"/.[!.]* # Borra archivos ocultos de forma segura
rm -rf "$OBJETIVO/run/dbus/"*.
# Desmontar cosas del chroot (debe ser en el estricto orden inverso para que se haga correcamente) :
# --- 11. Desmontar los archivos individuales --- :
umount "$OBJETIVO/etc/resolv.conf"
umount "$OBJETIVO/etc/fstab"
# --- 12. Desmontar las jerarquías de sistema (usando -l para evitar bloqueos si es necesario) --- :
umount -R "$OBJETIVO/tmp"
umount -R "$OBJETIVO/dev"
umount -R "$OBJETIVO/run"
umount -R "$OBJETIVO/sys"
umount -R "$OBJETIVO/proc"
# --- 13. Desmontar las particiones físicas --- :
umount "$OBJETIVO/home" # Si montaste /dev/sda4
umount "$OBJETIVO" # Finalmente la raíz /dev/sda3
# --- 14. Remontar las particiones como lo hace el sistema antes de mi intervencion --- :
# Usar el comando "mount -a" para que remonte todo lo que usa de forma predeterminada :
mount -a
exit 0Well i put the files on this URL -> https://www.mediafire.com/folder/jwqake ... lixOS-15.0
I Put pics on the URL -> https://app.mediafire.com/folder/wlocbq0iv9y5j
and the latest log files on -> https://www.mediafire.com/folder/v6o907ahza5m9/log
Well after i reboot, try again, i got again the same logs, then i use slackpkg reinstall aaa_base aaa_glibc-solibs bash coreutils elogind etc gnome-keyring gvfs libblockdev udisks udisks2 util-linux ; ldconfig
i reboot but the problem persist, in that moment 2 hours ago, i dont want use the MANIFEST file method to fix permissions
Well the thing was 30 mins ago, i just decide try to reinstall salix os, the unique thing the salix os installer never notify me is the installation if i want format the root patition. i lost too much pre-compiled package by myself, like nvidia-drivers-390.157 for each kernel i use on salix, VirtualBox-6.1.50 for every kernel i had use on Salix, well i hope on my mediafire account still i have the versions for Linux 5.15.193.
Well if the Salix installer ask my if i want to format the root partition i just want to answer no. i just wanna learn to fix the permissions and the files like .rules files necesary for the system works expected without reinstall anything.
Well on my mediafire folder i had some experiment scripts i dont complete because i am very bad on programming and Slackware(64) needs be very accurate on file permissions : octal chmod, suid (if the files reallys need), specific user and specific group, and a very good formed files like .rules.
i try use Gemini AI to make more Interactive and Ease use for Final User, but Gemini AI just enter in a loop to start mutilate functional code and make a disaster. well thanks for read me.