User Tools

Site Tools


os:archlinux:mjoelnir

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
os:archlinux:mjoelnir [2025/06/23 11:48] warnaudos:archlinux:mjoelnir [2025/06/23 15:50] (current) warnaud
Line 1: Line 1:
 +====== Info ======
 +Thinkpad T495s/16GB/256GB
 +===== ISO/Network =====
 +Download ISO https://archlinux.org/download/\\
 +write the ISO on a USB key\\
 +boot\\
 +\\
 +Setup network\\
 +<code bash>systemctl start iwd
 +iwctl </code>
 +<code>
 +iwd]# device list
 +                                    Devices                                    
 +--------------------------------------------------------------------------------
 +  Name                  Address               Powered     Adapter     Mode      
 +--------------------------------------------------------------------------------
 +  wlan0                 0c:7a:15:79:77:41     on          phy0        station   
 +iwd]# station wlan0 get-networks
 +                               Available networks                              
 +--------------------------------------------------------------------------------
 +      Network name                      Security            Signal
 +--------------------------------------------------------------------------------
 +      FuckUMeta                         psk                 ****    
 +      XXXXXXXXXXXXXXXX                  psk                 ****    
 +iwd]# station wlan0 connect FuckUMeta --passphrase **********************
 +iwd]# exit
 +</code>
 +<code bash>ip a
 +1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
 +    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
 +    inet 127.0.0.1/8 scope host lo
 +       valid_lft forever preferred_lft forever
 +    inet6 ::1/128 scope host noprefixroute 
 +       valid_lft forever preferred_lft forever
 +2: enp3s0f0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
 +    link/ether XX:YY:ZZ:AA:BB:CC brd ff:ff:ff:ff:ff:ff
 +    altname enxf875a4853e1b
 +4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
 +    link/ether XX:YY:ZZ:AA:BB:CC brd ff:ff:ff:ff:ff:ff
 +    inet 192.168.1.156/24 metric 600 brd 192.168.1.255 scope global dynamic wlan0
 +       valid_lft 84979sec preferred_lft 84979sec
 +    inet6 fdbf:275d:b681:f346:e7a:15ff:fe79:7741/64 scope global dynamic mngtmpaddr noprefixroute 
 +       valid_lft 1741sec preferred_lft 1741sec
 +    inet6 fe80::e7a:15ff:fe79:7741/64 scope link proto kernel_ll 
 +       valid_lft forever preferred_lft forever</code>
 +===== Test + SSH =====
 +network OK ?\\
 +<code bash> ping -c3 archlinux.org</code>
 +Install SSH
 +<code bash> pacman -Sy
 +pacman -S openssh
 +vim /etc/ssh/sshd_config</code>
 +<code perl>
 +#PermitRootLogin prohibit-password
 +PermitRootLogin yes
 +</code>
 +<code bash>passwd
 +systemctl start sshd</code>
 +\\
 +Now we can connect from the network
 +===== Disk partitions =====
 +==== List ====
  
 +<code bash># gdisk /dev/nvme0n1 -l
 +GPT fdisk (gdisk) version 1.0.10
 +
 +The protective MBR's 0xEE partition is oversized! Auto-repairing.
 +
 +Partition table scan:
 +  MBR: protective
 +  BSD: not present
 +  APM: not present
 +  GPT: present
 +
 +Found valid GPT with protective MBR; using GPT.
 +Disk /dev/nvme0n1: 500118192 sectors, 238.5 GiB
 +Model: KXG6AZNV256G TOSHIBA                    
 +Sector size (logical/physical): 512/512 bytes
 +Disk identifier (GUID): A49CF274-51B4-4CBF-BE13-5195151DBF6E
 +Partition table holds up to 128 entries
 +Main partition table begins at sector 2 and ends at sector 33
 +First usable sector is 34, last usable sector is 500118158
 +Partitions will be aligned on 2048-sector boundaries
 +Total free space is 205869677 sectors (98.2 GiB)
 +
 +Number  Start (sector)    End (sector)  Size       Code  Name
 +              2048          206847   100.0 MiB   EF00  EFI system partition
 +            206848          239615   16.0 MiB    0C01  Microsoft reserved ...
 +            239616       250570751   119.4 GiB   0700  Basic data partition
 +         250570752       292513791   20.0 GiB    0700  Basic data partition
 +         498378752       500115455   848.0 MiB   2700</code>
 +The goal is to make a 16GB swap partition and the btrfs root:
 +<code bash>gdisk /dev/nvme0n1</code>
 +==== SWAP ====
 +
 +<code>
 +Command (? for help): n
 +Partition number (6-128, default 6): 
 +First sector (34-500118158, default = 292513792) or {+-}size{KMGTP}: 
 +Last sector (292513792-498378751, default = 498378751) or {+-}size{KMGTP}: +16G
 +Current type is 8300 (Linux filesystem)
 +Hex code or GUID (L to show codes, Enter = 8300): 8200
 +Changed type of partition to 'Linux swap'
 +</code>
 +==== BTRFS root ====
 +
 +<code>
 +Command (? for help): n
 +Partition number (7-128, default 7): 
 +First sector (34-500118158, default = 326068224) or {+-}size{KMGTP}: 
 +Last sector (326068224-498378751, default = 498378751) or {+-}size{KMGTP}: 
 +Current type is 8300 (Linux filesystem)
 +Hex code or GUID (L to show codes, Enter = 8300): 
 +Changed type of partition to 'Linux filesystem'
 +</code>
 +==== Save ====
 +
 +<code>
 +Command (? for help): w
 +
 +Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
 +PARTITIONS!!
 +
 +Do you want to proceed? (Y/N): Y
 +OK; writing new GUID partition table (GPT) to /dev/nvme0n1.
 +The operation has completed successfully.
 +</code>
 +
 +===== Mount/Format =====
 +==== SWAP ====
 +<code bash>mkswap        /dev/nvme0n1p6
 +swapon        /dev/nvme0n1p6
 +</code>
 +==== BTRFS ====
 +<code bash>
 +pacman -Sy btrfs-progs
 +mkfs.btrfs -L ArchRoot /dev/nvme0n1p7
 +mount /dev/nvme0n1p7 /mnt
 +btrfs subvolume create /mnt/@
 +btrfs subvolume create /mnt/@home
 +umount /mnt</code>
 +==== Mount /boot /home / ====
 +<code bash>
 +mount -o noatime,compress=zstd,space_cache,subvol=@ /dev/nvme0n1p7 /mnt
 +mkdir -p /mnt/{home,boot}
 +mkdir /mnt/boot/efi
 +mount -o noatime,compress=zstd,space_cache,subvol=@home /dev/nvme0n1p7 /mnt/home
 +mount        /dev/nvme0n1p1  /mnt/boot/efi
 +</code>
 +===== Pacstrap =====
 +<code bash>pacstrap /mnt base base-devel linux linux-firmware amd-ucode btrfs-progs vim dhcpcd networkmanager efibootmgr dosfstools sudo git tlp htop zsh</code>
 +===== FSTAB =====
 +<code bash>genfstab -U /mnt >> /mnt/etc/fstab</code>
 +===== Archlinux Machine setup =====
 +<code bash>
 +mount --types proc   /proc   /mnt/proc
 +mount --rbind /sys   /mnt/sys
 +mount --rbind /dev   /mnt/dev
 +arch-chroot /mnt /bin/bash
 +echo "Mjölnir" >/etc/hostname
 +echo LANG=en_US.UTF-8 > /etc/locale.conf
 +vim /etc/locale.gen</code>
 +uncomment
 +<code>en_US.UTF-8</code>
 +Generate locales<code bash>locale-gen</code>
 +==== fonts/keymap ====
 +<code bash>echo KEYMAP=us-acentos > /etc/vconsole.conf
 +echo FONT=lat9w-16 >> /etc/vconsole.conf</code>
 +==== TimeZone ====
 +<code bash>ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime</code>
 +==== /etc/hosts ====
 +<code bash>vim /etc/hosts</code>
 +<code perl>#<ip-address> <hostname.domain.org> <hostname>
 +127.0.0.1 <YOUR-HOSTNAME>.localdomain <YOUR-HOSTNAME></code>
 +==== Initramfs ====
 +<code bash> vim /etc/mkinitcpio.conf</code>
 +<code perl>HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block resume btrfs filesystems fsck)</code>
 +<code bash. mkinitcpio -P</code>
 +===== Systemdboot =====
 +<code bash>bootctl --esp-path=/boot/efi install</code>
 +==== Entries ====
 +default:
 +<code bash>cat > /boot/efi/loader/loader.conf <<EOF
 +default arch
 +timeout 5
 +EOF</code>
 +Archlinux:
 +<code bash>cat > /boot/efi/loader/entries/arch.conf <<EOF
 +title   Arch Linux
 +linux   /vmlinuz-linux
 +initrd  /amd-ucode.img
 +initrd  /initramfs-linux.img
 +options root=UUID=43a3c9d5-0253-4f24-af47-7c11f3f39753 rw rootflags=subvol=@,compress=zstd
 +EOF</code>
 +Note: 43a3c9d5-0253-4f24-af47-7c11f3f39753 = UUID from `blkid /dev/nvme0n1p7`
 +Windows shit:
 +<code bash>cat > /boot/efi/loader/entries/windows.conf <<EOF
 +title   Windows
 +efi     /EFI/Microsoft/Boot/bootmgfw.efi
 +EOF</code>
 +
 +===== Final step =====
 +candles
 +<code bash>exit
 +umount -l /mnt/{dev,sys,proc}
 +umount /mnt/boot/efi
 +umount /mnt/{home,
 +reboot</code>
 +
 +
 +Notes:
 +  * remount btrfs partition:
 +<code bash>
 +mount -t btrfs \
 +  -o subvol=@,noatime,compress=zstd,space_cache=v2 \
 +  /dev/nvme0n1p7 /mnt</code>
 +  * Wifi shit
 +<code bash>cat > /tmp/wpa.conf <<EOF
 +network={
 +    ssid="MyNet"
 +    psk="PASTE-YOUR-64-CHAR-KEY-HERE"
 +    key_mgmt=WPA-PSK
 +}
 +EOF</code>
 +<code bash>wpa_supplicant -B -i wlan0 -c /tmp/wpa.conf
 +dhcpcd wlan0</code>