notes/computery_stuff/linux.md

67 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2021-07-04 11:17:53 +00:00
---
author: Alvie Rahman
date: \today
2021-08-23 14:25:05 +00:00
title: Linux
2022-03-02 01:43:54 +00:00
tags:
- linux
uuid: 8ef11516-4afd-4f80-abb8-bdce045e8b65
2021-07-04 11:17:53 +00:00
---
# user stuff
## add user to group
```bash
2021-09-01 14:55:07 +00:00
usermod -a -G group user
2021-07-04 11:17:53 +00:00
```
## change primary user group
```bash
2021-09-01 14:55:07 +00:00
usermod -g group user
2021-07-04 11:17:53 +00:00
```
# 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)