notes/computery_stuff/linux.md

67 lines
1.9 KiB
Markdown
Executable File

---
author: Alvie Rahman
date: \today
title: Linux
tags:
- linux
uuid: 8ef11516-4afd-4f80-abb8-bdce045e8b65
---
# user stuff
## add user to group
```bash
usermod -a -G group user
```
## change primary user group
```bash
usermod -g group user
```
# help i think my device shut down after deleting the current kernel and before installing the second (no entries in systemd-boot/grub/<bootloader>)
0. boot into a live usb of current disto
1. mount the root partition to `/mnt` and the boot partition to the appropriate folder (check
fstab which should be in `/mnt/etc/fstab`, if it says `/efi`, mount it to `/mnt/efi`)
2. chroot into the mounted filesystem:
on arch based systems you can simply run:
```
arch-chroot /mnt
```
on non arch based systems[^1]:
```
mount -t proc /proc /mnt/proc/
mount -t sysfs /sys /mnt/ys/
mount --rbind /dev /mnt/dev/
# only if using uefi
mount --rbind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars/
# for internet access
cp /etc/resolv.conf /mnt/etc/resolv.conf
chroot /mnt /bin/bash
```
3. the system can now be force updated/kernel images can be generated
on arch based systems[^2]:
```
# reinstall all current packages
pacman -Qqen > /root/pkgs.txt # list all installed packages
pacman -S $(< /root/pkgs.txt) # reinstall all installed packages
rm /root/pkgs.txt # clean up
# reinstall dependencies (if there are issues)
pacman -Qqdn > /root/deps.txt # list all installed dependencies
pacman -S $(< /root/deps.txt) # reinstall all installed dependencies
rm /root/deps.txt # clean up
```
[^1]: https://wiki.archlinux.org/title/Chroot [wayback machine](https://web.archive.org/web/20240121115548/https://wiki.archlinux.org/title/Chroot)
[^2]: https://bbs.archlinux.org/viewtopic.php?id=193174 [wayback machine](https://web.archive.org/web/20240129153400/https://bbs.archlinux.org/viewtopic.php?id=193174)