sync
This commit is contained in:
parent
48f640b55d
commit
440a2fa01f
28 changed files with 1849 additions and 96 deletions
134
10-linux/90-stories/arch-installing.md
Normal file
134
10-linux/90-stories/arch-installing.md
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
# cfdisk...
|
||||
|
||||
512M, EFI
|
||||
остальное - Linux Filesystem
|
||||
|
||||
```bash
|
||||
mkfs.fat -F 32 /dev/vda1
|
||||
mkfs.ext4 /dev/vda2
|
||||
|
||||
mount /dev/vda2 /mnt
|
||||
mkdir -p /mnt/boot
|
||||
mount /dev/vda1 /mnt/boot
|
||||
|
||||
# проверяем монтирование
|
||||
findmnt /mnt
|
||||
findmnt /mnt/boot
|
||||
|
||||
# устанавливаем
|
||||
pacstrap -K /mnt base linux linux-firmware sudo openssh
|
||||
|
||||
# если упало с ошибкой
|
||||
mkdir -p /mnt/etc echo 'KEYMAP=us' > /mnt/etc/vconsole.conf
|
||||
arch-chroot /mnt
|
||||
mkinitcpio -P
|
||||
exit
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
mount | grep '/mnt'
|
||||
```
|
||||
|
||||
## Установка базовой системы
|
||||
Дальше делаем базовую установку в `/mnt` через `pacstrap`, потом генерируем `fstab` и переходим в установленную систему через `arch-chroot` — это прям “хребет” официального Installation guide.[1]
|
||||
|
||||
Команды:
|
||||
```bash
|
||||
pacstrap -K /mnt base linux linux-firmware sudo openssh
|
||||
genfstab -U /mnt >> /mnt/etc/fstab
|
||||
arch-chroot /mnt
|
||||
```
|
||||
|
||||
## Настройка в chroot (минимум)
|
||||
Внутри `arch-chroot` сделай базовые вещи: timezone/clock, locale, hostname, пароль root и (желательно) обычного пользователя — это следует общему порядку из Installation guide.[1]
|
||||
|
||||
Команды-шаблон:
|
||||
```bash
|
||||
ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
|
||||
hwclock --systohc
|
||||
|
||||
# locale
|
||||
sed -i 's/^#\(en_US.UTF-8\)/\1/' /etc/locale.gen
|
||||
locale-gen
|
||||
printf "LANG=en_US.UTF-8\n" > /etc/locale.conf
|
||||
|
||||
# hostname + hosts
|
||||
echo "archvm" > /etc/hostname
|
||||
cat > /etc/hosts <<'EOF'
|
||||
127.0.0.1 localhost
|
||||
::1 localhost
|
||||
127.0.1.1 archvm.localdomain archvm
|
||||
EOF
|
||||
|
||||
passwd
|
||||
useradd -m -G wheel -s /bin/bash rori
|
||||
passwd rori
|
||||
EDITOR=vi visudo # раскомментируй строку про %wheel ALL=(ALL:ALL) ALL
|
||||
```
|
||||
|
||||
## Загрузчик + сеть + SSH + ребут
|
||||
Раз у тебя UEFI и ESP смонтирован в `/boot`, можно ставить systemd-boot через `bootctl install`, а затем добавить загрузочную entry в `/boot/loader/entries/` — это ровно то, что описывает ArchWiki по systemd-boot. Чтобы после первого ребута продолжить работать по SSH, поставленный `openssh` нужно включить как сервис `sshd.service` на автозапуск.[3][4][5]
|
||||
|
||||
Команды (всё ещё внутри chroot):
|
||||
```bash
|
||||
bootctl install
|
||||
|
||||
ROOT_PARTUUID="$(blkid -s PARTUUID -o value /dev/vda2)"
|
||||
cat > /boot/loader/entries/arch.conf <<EOF
|
||||
title Arch Linux
|
||||
linux /vmlinuz-linux
|
||||
initrd /initramfs-linux.img
|
||||
options root=PARTUUID=${ROOT_PARTUUID} rw
|
||||
EOF
|
||||
|
||||
# Чтобы сеть поднялась после перезагрузки (самый простой вариант)
|
||||
pacman -S --noconfirm networkmanager
|
||||
systemctl enable NetworkManager
|
||||
|
||||
# SSH после ребута
|
||||
systemctl enable sshd
|
||||
```
|
||||
|
||||
Выход и перезагрузка:
|
||||
```bash
|
||||
exit
|
||||
umount -R /mnt
|
||||
reboot
|
||||
```
|
||||
|
||||
[1](https://wiki.archlinux.org/title/Installation_guide)
|
||||
[2](https://wiki.archlinux.org/title/EFI_system_partition)
|
||||
[3](https://wiki.archlinux.org/title/OpenSSH)
|
||||
[4](https://wiki.archlinux.org/title/Systemd-boot)
|
||||
[5](https://wiki.archlinux.org/title/Systemd-boot_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9))
|
||||
[6](https://wiki.archlinux.org/title/Install_Arch_Linux_from_existing_Linux)
|
||||
[7](https://wiki.archlinux.org/title/Installation_guide_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9))
|
||||
[8](https://gist.github.com/mjkstra/96ce7a5689d753e7a6bdd92cdc169bae)
|
||||
[9](https://linuxconfig.org/arch-linux-installation-easy-step-by-step-guide)
|
||||
[10](https://www.tsunderechen.io/2020/05/archlinux-systemd-boot-installation/)
|
||||
[11](https://dropvps.com/blog/arch-linux-enable-ssh-server/)
|
||||
[12](https://habr.com/ru/articles/805671/)
|
||||
[13](https://www.youtube.com/watch?v=FFXRFTrZ2Lk)
|
||||
[14](https://gist.github.com/miguelmota/575af40ddb7f86b858a86a673cec3999)
|
||||
[15](https://wiki.archlinux.org/title/Install_Arch_Linux_from_existing_Linux_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9))
|
||||
[16](https://fhackts.wordpress.com/2016/09/09/installing-archlinux-the-efisystemd-boot-way/)
|
||||
[17](https://bruhtus.github.io/posts/arch-installation-guide/)
|
||||
[18](https://wiki.archlinux.org/title/OpenSSH_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9))
|
||||
[19](https://www.youtube.com/watch?v=rUEnS1zj1DM)
|
||||
[20](https://www.atlantic.net/dedicated-server-hosting/how-to-secure-ssh-server-on-arch-linux/)
|
||||
[21](https://ru.scribd.com/document/601730020/Installation-guide-ArchWiki-Part-4)
|
||||
|
||||
|
||||
# docker autostart
|
||||
```
|
||||
sudo systemctl enable --now docker.service
|
||||
```
|
||||
|
||||
# base-devel
|
||||
|
||||
```
|
||||
sudo pacman -S --needed base-devel
|
||||
```
|
||||
303
10-linux/90-stories/gentoo-install.md
Normal file
303
10-linux/90-stories/gentoo-install.md
Normal file
|
|
@ -0,0 +1,303 @@
|
|||
# 1) GPT + ESP + root
|
||||
parted -a optimal /dev/vda mklabel gpt
|
||||
parted /dev/vda mkpart ESP fat32 1MiB 513MiB
|
||||
parted /dev/vda set 1 esp on
|
||||
parted -a optimal /dev/vda mkpart rootfs ext4 513MiB 100%
|
||||
|
||||
# 2) На всякий случай перечитать таблицу (обычно хватает одного)
|
||||
partprobe /dev/vda # перечитать partition table без ребута [web:137]
|
||||
# (альтернатива, если вдруг /dev/vda2 не появился)
|
||||
# partx -u /dev/vda && udevadm settle
|
||||
|
||||
# 3) ФС
|
||||
mkfs.fat -F 32 /dev/vda1
|
||||
mkfs.ext4 -L gentoo-root /dev/vda2
|
||||
|
||||
# 4) Монтирование
|
||||
mount /dev/vda2 /mnt/gentoo
|
||||
mkdir -p /mnt/gentoo/boot/efi
|
||||
mount /dev/vda1 /mnt/gentoo/boot/efi
|
||||
cd /mnt/gentoo
|
||||
|
||||
# 5) stage3
|
||||
|
||||
Да: **сначала нужно скачать stage3**, а уже потом выполнять `tar xpvf ...` (в каталоге `/mnt/gentoo`). Команда `tar ...` просто распаковывает tarball stage3 в будущий rootfs, после этого следующий шаг — подготовить `make.conf`, смонтировать `/proc /sys /dev /run` и зайти в chroot (там уже будет `emerge`).[1][2]
|
||||
|
||||
## Шаг 1 — скачать stage3 (OpenRC, headless)
|
||||
Ты сейчас в `/mnt/gentoo`, это правильно. Дальше:
|
||||
|
||||
```sh
|
||||
cd /mnt/gentoo
|
||||
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-openrc/latest-stage3-amd64-openrc.txt
|
||||
cat latest-stage3-amd64-openrc.txt
|
||||
```
|
||||
В этом файле будет имя актуального tarball’а (строка с `stage3-amd64-openrc-...tar.xz`).[1]
|
||||
|
||||
Скачать сам tarball (подставь имя из файла):
|
||||
```sh
|
||||
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-openrc/<ИМЯ_ТАРБОЛЛА>.tar.xz
|
||||
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-openrc/<ИМЯ_ТАРБОЛЛА>.tar.xz.DIGESTS
|
||||
```
|
||||
|
||||
## Шаг 2 — распаковать stage3
|
||||
Теперь да, выполняешь:
|
||||
|
||||
```sh
|
||||
tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner
|
||||
```
|
||||
|
||||
Эта команда — стандартный способ распаковки stage3 с сохранением xattrs и владельцев.[3][1]
|
||||
|
||||
## Шаг 3 — базовая подготовка до chroot
|
||||
1) DNS в будущую систему:
|
||||
```sh
|
||||
cp -L /etc/resolv.conf /mnt/gentoo/etc/
|
||||
```
|
||||
|
||||
2) (Опционально, но обычно делают сразу) `make.conf` пока хотя бы с `MAKEOPTS`:
|
||||
```sh
|
||||
nano -w /mnt/gentoo/etc/portage/make.conf
|
||||
# например:
|
||||
# MAKEOPTS="-j6"
|
||||
```
|
||||
`/etc/portage/make.conf` — основной файл глобальных настроек Portage.[4]
|
||||
|
||||
## Шаг 4 — смонтировать псевдо-ФС и зайти в chroot
|
||||
```sh
|
||||
mount -t proc /proc /mnt/gentoo/proc
|
||||
mount --rbind /sys /mnt/gentoo/sys
|
||||
mount --make-rslave /mnt/gentoo/sys
|
||||
mount --rbind /dev /mnt/gentoo/dev
|
||||
mount --make-rslave /mnt/gentoo/dev
|
||||
mount --bind /run /mnt/gentoo/run
|
||||
mount --make-slave /mnt/gentoo/run
|
||||
|
||||
chroot /mnt/gentoo /bin/bash
|
||||
source /etc/profile
|
||||
export PS1="(chroot) ${PS1}"
|
||||
```
|
||||
Такой набор монтирований — типовой для корректной работы внутри chroot (установка пакетов, udev-сокеты и т.д.).[2]
|
||||
|
||||
Скажи, на каком шаге остановишься (скачал/распаковал stage3 или уже вошёл в chroot) — и дальше дам точный минимальный набор команд: профиль, `emerge --sync`, базовые пакеты (dhcpcd+netifrc+openssh), kernel + GRUB под UEFI.
|
||||
|
||||
[1](https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-openrc/)
|
||||
[2](https://emirror.d0a.io/wiki/wiki.gentoo.org/wiki/Handbook_AMD64/Installation/Base/de.html)
|
||||
[3](https://www.reddit.com/r/Gentoo/comments/z3lmdq/first_time_installing_gentoo/)
|
||||
[4](https://emirror.d0a.io/wiki/wiki.gentoo.org/wiki/etc/portage/make.html)
|
||||
[5](https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-nomultilib-openrc/)
|
||||
[6](https://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64-desktop-openrc/)
|
||||
[7](https://mirrors.mit.edu/gentoo-distfiles/releases/amd64/autobuilds/current-stage3-amd64-openrc/)
|
||||
[8](https://mirror.telepoint.bg/gentoo/releases/amd64/autobuilds/current-stage3-amd64-desktop-openrc/)
|
||||
[9](https://emirror.d0a.io/wiki/wiki.gentoo.org/wiki/Handbook_AMD64/Installation/Base/ja.html)
|
||||
[10](http://gentoo.osuosl.org/releases/amd64/autobuilds/)
|
||||
[11](https://www.youtube.com/watch?v=HwY0IMfiiTA)
|
||||
[12](http://www.mirrorservice.org/sites/distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-openrc/)
|
||||
[13](https://www.reddit.com/r/linuxquestions/comments/16lublb/issue_w_gentoo_ab_halfway_through_installation/)
|
||||
[14](https://www.reddit.com/r/Gentoo/comments/1acnqma/recover_from_gentoo_installation_mistake/)
|
||||
[15](http://mirrors.lug.mtu.edu/gentoo/releases/amd64/autobuilds/)
|
||||
[16](https://soso-cod3v.tistory.com/168)
|
||||
[17](https://stephane-cheatsheets.readthedocs.io/en/latest/distros/gentoo-based/gentoo_installation/)
|
||||
[18](https://mirror.kumi.systems/gentoo/releases/amd64/autobuilds/current-stage3-amd64-desktop-openrc/)
|
||||
[19](https://www.reddit.com/r/linux/comments/ndvutp/tutorial_encrypted_gentoo_installation_guide/)
|
||||
[20](https://www.scribd.com/document/86619356/Gentoo-Linux-AMD64-Handbook)
|
||||
[21](http://ftp.riken.jp/Linux/gentoo/releases/amd64/autobuilds/)
|
||||
|
||||
Ты уже в chroot, значит дальше цель — чтобы система **первый раз загрузилась** и ты смог зайти по `ssh -p 2222 root@127.0.0.1`.
|
||||
|
||||
## Portage sync (репозиторий)
|
||||
Сначала создай конфиг основного репозитория и синхронизируй дерево ebuild’ов:[1]
|
||||
```sh
|
||||
mkdir -p /etc/portage/repos.conf
|
||||
cp /usr/share/portage/config/repos.conf /etc/portage/repos.conf/gentoo.conf
|
||||
emerge --sync
|
||||
```
|
||||
(Если `cp` ругнётся, покажи вывод `ls -la /usr/share/portage/config/` — подберём правильный путь.)
|
||||
|
||||
## Минимальная “голова” системы
|
||||
Дальше быстрые обязательные настройки (без них можно, но потом больнее дебажить):
|
||||
```sh
|
||||
echo "Europe/Moscow" > /etc/timezone
|
||||
emerge --config sys-libs/timezone-data
|
||||
|
||||
echo "gentoo-vm" > /etc/hostname
|
||||
|
||||
# локали (пример)
|
||||
nano -w /etc/locale.gen # раскомментируй en_US.UTF-8 UTF-8 (и при желании ru_RU.UTF-8)
|
||||
locale-gen
|
||||
eselect locale list
|
||||
eselect locale set <номер>
|
||||
env-update && source /etc/profile
|
||||
```
|
||||
|
||||
## Сеть + SSH на OpenRC (под твой SLiRP NAT)
|
||||
Поставь минимальный сетевой стек и SSH:
|
||||
```sh
|
||||
emerge --ask net-misc/netifrc net-misc/dhcpcd net-misc/openssh
|
||||
```
|
||||
|
||||
Настрой DHCP на интерфейсе (имя смотри так: `ip link`, обычно будет `enp0s1`/`eth0`):
|
||||
```sh
|
||||
IF=enp0s1 # поменяй на своё
|
||||
ln -s /etc/init.d/net.lo /etc/init.d/net.${IF}
|
||||
echo "config_${IF}=\"dhcp\"" >> /etc/conf.d/net
|
||||
rc-update add net.${IF} default
|
||||
rc-update add sshd default
|
||||
```
|
||||
Формат `config_<iface>="dhcp"` — это штатная схема netifrc.[2]
|
||||
Если вообще ничего не прописывать, netifrc часто и так поднимает DHCP на интерфейсах без явной конфигурации, но лучше зафиксировать явно, чтобы было предсказуемо.[3]
|
||||
|
||||
## Ядро + GRUB (UEFI)
|
||||
Тут два пути:
|
||||
|
||||
1) Самый быстрый для “headless и без приключений”: поставить готовое ядро (`sys-kernel/gentoo-kernel-bin`) и дальше GRUB.
|
||||
|
||||
2) Если хочешь кастом/zen — это отдельный длинный шаг, лучше после первого успешного SSH.
|
||||
|
||||
GRUB ставится по handbook примерно так (у тебя ESP смонтирован в `/boot/efi`):[4]
|
||||
```sh
|
||||
emerge --ask sys-boot/grub sys-boot/efibootmgr
|
||||
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo
|
||||
|
||||
emerge --ask sys-kernel/gentoo-kernel-bin
|
||||
// возможно придется обновить конфиг: etc-update
|
||||
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
```
|
||||
|
||||
## fstab (чтобы монтировалось после ребута)
|
||||
Сгенерируй UUID и пропиши:
|
||||
```sh
|
||||
blkid
|
||||
nano -w /etc/fstab
|
||||
```
|
||||
(Я вставил что то вроде этого)
|
||||
```
|
||||
# /etc/fstab: static file system information.
|
||||
#
|
||||
# See the manpage fstab(5) for more information.
|
||||
#
|
||||
# NOTE: The root filesystem should have a pass number of either 0 or 1.
|
||||
# All other filesystems should have a pass number of 0 or greater than 1.
|
||||
#
|
||||
# NOTE: Even though we list ext4 as the type here, it will work with ext2/ext3
|
||||
# filesystems. This just tells the kernel to use the ext4 driver.
|
||||
#
|
||||
# NOTE: You can use full paths to devices like /dev/sda3, but it is often
|
||||
# more reliable to use filesystem labels or UUIDs. See your filesystem
|
||||
# documentation for details on setting a label. To obtain the UUID, use
|
||||
# the blkid(8) command.
|
||||
|
||||
# <fs> <mountpoint> <type> <opts> <dump> <pass>
|
||||
|
||||
#LABEL=boot /boot ext4 defaults 1 2
|
||||
#UUID=58e72203-57d1-4497-81ad-97655bd56494 / xfs defaults 0 1
|
||||
#LABEL=swap none swap sw 0 0
|
||||
#/dev/cdrom /mnt/cdrom auto noauto,ro 0 0
|
||||
UUID=3733ce80-bdb7-477d-a0bf-7a70122fa071 / ext4 defaults 0 1
|
||||
UUID=66FA-9048 /boot/efi vfat umask=0077 0 2
|
||||
|
||||
|
||||
```
|
||||
а потом:
|
||||
```
|
||||
mount -a
|
||||
findmnt /boot/efi
|
||||
```
|
||||
|
||||
Минимально:
|
||||
- root (`/dev/vda2`) → `/` ext4
|
||||
- ESP (`/dev/vda1`) → `/boot/efi` vfat
|
||||
|
||||
## Финиш: пароль, выход, ребут
|
||||
```sh
|
||||
useradd -m -G wheel -s /bin/bash <user>
|
||||
passwd <user>
|
||||
|
||||
emerge --ask app-admin/sudo
|
||||
visudo
|
||||
|
||||
```
|
||||
В `visudo` раскомментируй строку (или добавь), чтобы wheel мог sudo:
|
||||
`%wheel ALL=(ALL:ALL) ALL`
|
||||
```
|
||||
|
||||
passwd root
|
||||
exit
|
||||
umount -l /mnt/gentoo/dev{/shm,/pts,}
|
||||
cd /
|
||||
umount -R /mnt/gentoo
|
||||
reboot
|
||||
```
|
||||
|
||||
Сейчас напиши вывод двух команд из chroot:
|
||||
```sh
|
||||
ls /sys/firmware/efi
|
||||
ip link
|
||||
```
|
||||
По ним скажу точно: нужно ли отдельно монтировать `efivarfs`, и как именно называется твой сетевой интерфейс для `net.<iface>`.
|
||||
|
||||
[1](https://github.com/dudekmichal/gentoo/blob/master/readme.md)
|
||||
[2](https://github.com/gentoo/netifrc/blob/master/doc/net.example.Linux.in)
|
||||
[3](https://emirror.d0a.io/wiki/wiki.gentoo.org/wiki/Handbook_PPC/Full/Networking/zh-cn.html)
|
||||
[4](https://emirror.d0a.io/wiki/wiki.gentoo.org/wiki/Handbook_AMD64/Installation/Bootloader/en.html)
|
||||
[5](https://github.com/sergibarroso/gentoo_install)
|
||||
[6](https://www.reddit.com/r/Gentoo/comments/17sztdp/how_to_speed_up_emerge_sync_synchronizing_with/)
|
||||
[7](https://github.com/dudekmichal/gentoo)
|
||||
[8](https://www.reddit.com/r/Gentoo/comments/9ua7lm/question_about_fully_amd64_installation/)
|
||||
[9](https://blog.csdn.net/qq_40738478/article/details/129191358)
|
||||
[10](https://www.reddit.com/r/Gentoo/comments/ffim09/installation_cannot_upgrade_portage_update_world/)
|
||||
[11](https://gist.github.com/CDA0/4b1c2ee20cb68bdd4e72fb452fde9941)
|
||||
[12](https://www.reddit.com/r/Gentoo/comments/ha2v6q/how_does_portage_and_its_config_files_work/)
|
||||
[13](https://www.reddit.com/r/Gentoo/comments/1hj03zd/network_address_assigned_and_internet_connection/)
|
||||
[14](https://www.reddit.com/r/Gentoo/comments/k7zpm3/grubinstall_error/)
|
||||
[15](https://emirror.d0a.io/wiki/wiki.gentoo.org/wiki/etc/portage/repos.conf/it.html)
|
||||
[16](https://wiki.archlinux.org/title/GRUB)
|
||||
[17](https://www.reddit.com/r/Gentoo/comments/x0ke6i/problem_with_portage/)
|
||||
[18](https://emirror.d0a.io/wiki/wiki.gentoo.org/wiki/Netifrc.html)
|
||||
[19](https://www.reddit.com/r/Gentoo/comments/dfqah8/grub_efi_error_handbook/)
|
||||
[20](https://emirror.d0a.io/wiki/wiki.gentoo.org/wiki/Handbook_AMD64/Full/Installation.html)
|
||||
|
||||
# timezone
|
||||
|
||||
`echo "Europe/Moscow" | sudo tee /etc/timezone`[](https://www.semirocket.science/noteblog/2023/03/gentoo-how-to-change-time-zone/)-
|
||||
|
||||
- `sudo emerge --config sys-libs/timezone-data`
|
||||
отключить hwlock:
|
||||
|
||||
/etc/conf.d/hwlock:
|
||||
|
||||
```
|
||||
# Set CLOCK to "UTC" if your Hardware Clock is set to UTC (also known as
|
||||
# Greenwich Mean Time). If that clock is set to the local time, then
|
||||
# set CLOCK to "local". Note that if you dual boot with Windows, then
|
||||
# you should set it to "local".
|
||||
clock="UTC"
|
||||
|
||||
# If you want the hwclock script to set the system time (software clock)
|
||||
# to match the current hardware clock during bootup, leave this
|
||||
# commented out.
|
||||
# However, you can set this to "NO" if you are running a modern kernel
|
||||
# and using NTP to synchronize your system clock.
|
||||
clock_hctosys="NO"
|
||||
|
||||
# If you do not want to set the hardware clock to the current system
|
||||
# time (software clock) during shutdown, set this to no.
|
||||
#clock_systohc="NO"
|
||||
|
||||
# If you wish to pass any other arguments to hwclock during bootup,
|
||||
# you may do so here. Alpha users may wish to use --arc or --srm here.
|
||||
clock_args=""
|
||||
|
||||
```
|
||||
|
||||
# docker в группу (чтобы не писать sudo)
|
||||
|
||||
`sudo usermod -aG docker $USER`
|
||||
|
||||
# как я hurl качал (или keywords amd64 и ~amd64)
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /etc/portage/package.accept_keywords
|
||||
echo "net-misc/hurl ~amd64" | sudo tee /etc/portage/package.accept_keywords/hurl
|
||||
sudo emerge -av net-misc/hurl
|
||||
```
|
||||
83
10-linux/90-stories/min env.md
Normal file
83
10-linux/90-stories/min env.md
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
strong need before first load:
|
||||
|
||||
Niri
|
||||
OpenRC
|
||||
neofetch
|
||||
rustup
|
||||
git
|
||||
wget
|
||||
curl
|
||||
uutils
|
||||
sudo-rs
|
||||
fd
|
||||
rg
|
||||
iwd?
|
||||
network-manager
|
||||
dnsmasq
|
||||
ffmpeg
|
||||
openssl
|
||||
Alacrity
|
||||
helix-editor
|
||||
Firefox-bin
|
||||
chromium (бинкэш)
|
||||
Gentoo Portage
|
||||
keepassxc
|
||||
llvm?
|
||||
nautilus
|
||||
p7zip
|
||||
mkvtoolnix-cli
|
||||
python3
|
||||
pip
|
||||
less
|
||||
btrfs-progs
|
||||
cmake
|
||||
gcc
|
||||
gdb
|
||||
|
||||
|
||||
after:
|
||||
gcovr
|
||||
obsidian
|
||||
uv
|
||||
exercism
|
||||
valgrind
|
||||
cppcheck
|
||||
check
|
||||
doxygen
|
||||
yt-dlp
|
||||
qrencode
|
||||
jq
|
||||
zoxide
|
||||
htop
|
||||
dust
|
||||
atuin
|
||||
fish
|
||||
starship
|
||||
jj
|
||||
procs
|
||||
eza
|
||||
ripgrep
|
||||
just
|
||||
telegram-desktop
|
||||
qbittorrent
|
||||
rocketchat-desktop
|
||||
postgresql
|
||||
qemu_full
|
||||
docker
|
||||
android-tools
|
||||
tor
|
||||
tor-browser
|
||||
mandoc
|
||||
vim
|
||||
nano
|
||||
vlc
|
||||
audacity
|
||||
obs-studio
|
||||
imv
|
||||
yazi
|
||||
imagemagick
|
||||
pandoc
|
||||
libreoffice-bin
|
||||
unixtools.netstat
|
||||
lm_sensors
|
||||
upower?
|
||||
97
10-linux/90-stories/как я переименовывал кривой label.md
Normal file
97
10-linux/90-stories/как я переименовывал кривой label.md
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
Ок — если хочешь “пересоздать заново и забыть старое”, то план такой: **сначала вынести `home/qemu`**, потом **размонтировать**, сделать **mkfs.btrfs -f с новым label**, заново создать subvol’ы и обновить NixOS-конфиг под новый label+пути. `mkfs.btrfs -f` реально **уничтожит** старую ФС и всё на ней.[1]
|
||||
|
||||
## 1) Скопировать данные в безопасное место
|
||||
Команда, которую ты написал, ок **если ты реально находишься в `/mnt/gentoo-root`** (как в примере), и `~/temp` существует:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/temp
|
||||
cp -a /mnt/gentoo-root/home/qemu ~/temp/
|
||||
```
|
||||
|
||||
Рекомендую `cp -a` вместо `cp -r`, чтобы сохранить права/времена/симлинки.
|
||||
Проверь, что копия на месте: `ls -la ~/temp/qemu`.
|
||||
|
||||
## 2) Размонтировать старые точки
|
||||
Нужно отмонтировать все subvol-ы с этого диска (иначе `mkfs` не даст, или ты рискуешь).
|
||||
В NixOS:
|
||||
|
||||
```bash
|
||||
sudo umount /mnt/gentoo-root/images
|
||||
sudo umount /mnt/gentoo-root/distfiles
|
||||
sudo umount /mnt/gentoo-root/home
|
||||
sudo umount /mnt/gentoo-root
|
||||
```
|
||||
|
||||
Если где-то “busy”, покажет кто держит: `sudo lsof +f -- /mnt/gentoo-root` (или `fuser -mv`).
|
||||
|
||||
## 3) Пересоздать btrfs с новым label
|
||||
Теперь форматируем раздел (у тебя это `/dev/nvme0n1p2` по `lsblk`), и задаём новый label, например `nvme-950`. Опция `-L/--label` задаёт label файловой системы.[1]
|
||||
|
||||
```bash
|
||||
sudo mkfs.btrfs -f -L nvme-950 /dev/nvme0n1p2
|
||||
```
|
||||
|
||||
## 4) Создать subvol’ы заново (правильно — на top-level id=5)
|
||||
Чтобы создать subvol на “корне” btrfs, монтируем top-level (`subvolid=5`), создаём subvol, и размонтируем.[2][3]
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /mnt/tmp_nvme950
|
||||
sudo mount -o subvolid=5 /dev/disk/by-label/nvme-950 /mnt/tmp_nvme950
|
||||
|
||||
sudo btrfs subvolume create /mnt/tmp_nvme950/@
|
||||
sudo btrfs subvolume create /mnt/tmp_nvme950/@home
|
||||
sudo btrfs subvolume create /mnt/tmp_nvme950/@distfiles
|
||||
sudo btrfs subvolume create /mnt/tmp_nvme950/@images
|
||||
|
||||
sudo umount /mnt/tmp_nvme950
|
||||
```
|
||||
|
||||
## 5) Обновить NixOS-конфиг
|
||||
Теперь можно:
|
||||
- переименовать mountpoint’ы на `/mnt/nvme-950/...`
|
||||
- и device сменить на `/dev/disk/by-label/nvme-950`
|
||||
|
||||
То есть в твоём файле:
|
||||
- все `"/mnt/gentoo-root"` → `"/mnt/nvme-950"`
|
||||
- все `by-label/gentoo_root` → `by-label/nvme-950`
|
||||
- в `tmpfiles.rules` тоже заменить пути.
|
||||
|
||||
После этого:
|
||||
```bash
|
||||
sudo nixos-rebuild switch
|
||||
```
|
||||
|
||||
## 6) Вернуть qemu обратно
|
||||
Когда новый диск смонтировался:
|
||||
```bash
|
||||
sudo mkdir -p /mnt/nvme-950/home
|
||||
sudo cp -a ~/temp/qemu /mnt/nvme-950/home/
|
||||
sudo chown -R wave:users /mnt/nvme-950/home/qemu
|
||||
```
|
||||
|
||||
Если это btrfs и ты хочешь отключить CoW для qcow2 (как раньше делал), делай `chattr +C` на каталог **до** создания/копирования новых qcow2. (На уже существующие файлы это не всегда помогает.)
|
||||
|
||||
***
|
||||
|
||||
Перед тем как форматировать: подтверди, что правильный раздел — это **точно** `/dev/nvme0n1p2` (953.9G диск → 952.9G partition), а не второй NVMe на 1.8T. Самый надёжный чек: `ls -l /dev/disk/by-id/ | rg nvme0n1p2` и/или `blkid /dev/nvme0n1p2`.
|
||||
|
||||
[1](https://man7.org/linux/man-pages/man8/mkfs.btrfs.8.html)
|
||||
[2](https://discussion.fedoraproject.org/t/btrfs-subvol-created-but-does-not-need-mounting/127943/4)
|
||||
[3](https://forum.endeavouros.com/t/want-to-create-btrfs-top-level-5-subvolume-in-an-already-installed-system/43712)
|
||||
[4](https://www.reddit.com/r/linuxquestions/comments/oj64ti/how_to_change_filesystem_label_using_commandline/)
|
||||
[5](https://www.cheat-sheets.org/project/tldr/command/mkfs.btrfs/os/linux/)
|
||||
[6](https://btrfs.readthedocs.io/en/latest/Administration.html)
|
||||
[7](https://gitlab.denx.de/denx/eldk/-/blob/4ebd9bbbeb0dd52a5f346266129eeae9b3c5941a/meta/recipes-devtools/btrfs-tools/btrfs-tools/upstream-tmp/0011-Add-the-btrfs-filesystem-label-command.patch)
|
||||
[8](https://www.reddit.com/r/NixOS/comments/1lhkffb/creating_a_new_btrfs_subvolume_on_existingrunning/)
|
||||
[9](https://man.archlinux.org/man/mkfs.btrfs.8.en)
|
||||
[10](https://github.com/nix-community/disko/blob/master/example/btrfs-subvolumes.nix)
|
||||
[11](https://www.mankier.com/8/mkfs.btrfs)
|
||||
[12](https://fedoramagazine.org/working-with-btrfs-subvolumes/)
|
||||
[13](https://wiki.nixos.org/wiki/Btrfs)
|
||||
[14](https://man7.org/linux/man-pages/man8/btrfs-property.8.html)
|
||||
[15](https://bbs.archlinux.org/viewtopic.php?id=276843)
|
||||
[16](https://mt-caret.github.io/blog/posts/2020-06-29-optin-state.html)
|
||||
[17](https://man.archlinux.org/man/btrfs.8.en)
|
||||
[18](https://btrfs.readthedocs.io/en/latest/btrfs-subvolume.html)
|
||||
[19](https://discourse.nixos.org/t/persistent-btrfs-subvolume-mounting/30021)
|
||||
[20](https://forum.mxlinux.org/viewtopic.php?t=79038)
|
||||
57
10-linux/90-stories/сценарий монтирования и chroot.md
Normal file
57
10-linux/90-stories/сценарий монтирования и chroot.md
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
Почти: после загрузки livecd сначала нужно **смонтировать разделы твоей установленной системы**, а уже потом — `proc/sys/dev/run` и `chroot`. Иначе ты будешь “чрутьнуться в пустоту” или в старое состояние.[1]
|
||||
|
||||
## Правильный порядок
|
||||
1) Смонтировать root и ESP:
|
||||
```sh
|
||||
mount /dev/vda2 /mnt/gentoo
|
||||
mkdir -p /mnt/gentoo/boot/efi
|
||||
mount /dev/vda1 /mnt/gentoo/boot/efi
|
||||
```
|
||||
|
||||
2) Потом уже то, что ты написал (proc/sys/dev/run) и chroot:
|
||||
```sh
|
||||
mount -t proc /proc /mnt/gentoo/proc
|
||||
mount --rbind /sys /mnt/gentoo/sys
|
||||
mount --make-rslave /mnt/gentoo/sys
|
||||
mount --rbind /dev /mnt/gentoo/dev
|
||||
mount --make-rslave /mnt/gentoo/dev
|
||||
mount --bind /run /mnt/gentoo/run
|
||||
mount --make-slave /mnt/gentoo/run
|
||||
|
||||
chroot /mnt/gentoo /bin/bash
|
||||
source /etc/profile
|
||||
export PS1="(chroot) ${PS1}"
|
||||
```
|
||||
|
||||
# размонтировать
|
||||
|
||||
```bash
|
||||
exit
|
||||
umount -l /mnt/gentoo/dev{/shm,/pts,}
|
||||
cd /
|
||||
umount -R /mnt/gentoo
|
||||
reboot
|
||||
```
|
||||
|
||||
`--rbind` + `--make-rslave` как раз нужны, чтобы внутри chroot корректно “виделись” устройства и динамические mount’ы, но изменения не утекали обратно в хостовую систему.[2][3]
|
||||
|
||||
[1](https://www.simplified.guide/gentoo/build-chroot-environment)
|
||||
[2](https://emirror.d0a.io/wiki/wiki.gentoo.org/wiki/Handbook_Alpha/Installation/Base.html)
|
||||
[3](https://www.reddit.com/r/linuxquestions/comments/czgk8u/what_is_the_purpose_of_bind_mounting_rbind/)
|
||||
[4](https://www.reddit.com/r/Gentoo/comments/14ou6z8/trying_to_chroot_into_install_but_nothing_exists/)
|
||||
[5](https://wiki.archlinux.org/title/Chroot)
|
||||
[6](https://groups.google.com/g/linux.gentoo.user/c/hADFN2EHjmY)
|
||||
[7](https://www.funtoo.org/Talk:Install/Chroot)
|
||||
[8](https://gist.github.com/zunkree/c28ccef99df972e4af75a97616bab2ff)
|
||||
[9](https://www.reddit.com/r/Gentoo/comments/wge8w5/cant_chroot_into_gentoo/)
|
||||
[10](https://gist.github.com/gekola/7bd15bfd80f94a257a76093f218cbb43)
|
||||
[11](https://emirror.d0a.io/wiki/wiki.gentoo.org/wiki/Handbook_AMD64/Installation/Base/ja.html)
|
||||
[12](https://www.linux.org.ru/forum/general/13908919)
|
||||
[13](https://www.youtube.com/watch?v=oXJrevOr7Pc)
|
||||
[14](https://grandekos.com/index.php?static_page=Memorize%2FLinux+things%2Fchroot+some+directory)
|
||||
[15](https://www.linux.org.ru/forum/general/13611252)
|
||||
[16](https://www.reddit.com/r/Gentoo/comments/w2qlel/what_would_happen_if_i_dont_use_mount_makerslave/)
|
||||
[17](https://www.reddit.com/r/Gentoo/comments/xgr9b6/error_during_installation/)
|
||||
[18](https://www.reddit.com/r/Gentoo/comments/143wq54/regaining_access_to_install_via_chroot/)
|
||||
[19](https://seekstar.github.io/2022/04/27/%E5%9C%A8chroot%E7%8E%AF%E5%A2%83%E4%B8%AD%E6%8C%82%E8%BD%BDdev-proc-sys/)
|
||||
[20](https://github.com/sorah/gentoo-build/blob/master/scripts/prepare-chroot.sh)
|
||||
Loading…
Add table
Add a link
Reference in a new issue