# Arch Linux ISO in VM
20/01/24
8:53pm - 2:49am
450,00 GB
### 1. Prepare Shell Console
```shell=
setfont -d # make font bigger
loadkeys fr-latin1 # set keyboard to azerty)
```
### 2. Create Partition with "parted'
- lsblk
- parted
```shell=
mklabel <LABEL>
unit mb (MegaByte)
mkpart primary 0g 250
mkpart primary 250 -1
toggle 1 boot
p free
quit
```
### 3. Make FileSystem with LABEL-> GPT
(type 'ext4' or msdos)
- mkfs.ext4 /dev/sda2
- mkfs.vfat -F 32 /dev/sda1
```shell=
lsblk -f # check the vFAT32 or else
```
(- mkdir /mnt)
- mount /dev/sda2 /mnt
- mkdir /mnt/boot
- mount /dev/sda1 /mnt/boot
### 4. Look at your partition settings
```shell=
lsblk
```
note: we leave /boot & / set as is because it will be the path to it once the GRUB is running
## ADD Arch Linux Base System
#### pacstrap
```shell=
pacstrap -K /mnt base linux linux-firmware
```
## Generate fstab
```shell=
genfstab -U /mnt >> /mnt/etc/fstab
```
### Could Edit fstab : other options:
```shell=
vi /etc/fstab
```
```fstab=
/dev/sda1 /boot vfat defaults 0 2
/dev/sda2 / ext4 defaults 0 1
```
/also noatime same Mount Option than defaults/
Other options:
tmp /tmp tmpfs defaults 0 0
devpts /dev/pts devpts noexec,nosuid,gid=tty,mode=0620 0 0
shm /dev/shm tmpfs defaults 0 0
### 5. Enter CHROOT /mnt
```shell=
arch-chroot
```
note ["lsblk" and it says "/boot" instead of "/mnt/boot" = SUCCESS]
## Set time:
* ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
Run hwclock(8) to generate /etc/adjtime:
```shell=
hwclock --systohc
```
#### INSTALL VIM or NANO or emacs in CHROOT
```shell=
pacman -Sy vim
```
### Create locales
vim /etc/locale.gen
uncomment your locales
:wq
Generate them with :
$ locale-gen
### Create the vconsole.conf
```shell=
vim /etc/vconsole.conf
```
```vim=
KEYMAP=de-latin1
```
## Network configuration
### Create the hostname file:
```shell=
vim /etc/hostname
```
```vim=
# hostname
<yourhostname>
```
### Password set up
```shell=
passwd
```
```shell=
sudo useradd -m /bin/bash -d /home ganitak
```
### Install a bootloader like GRUB:
EFI = System Partition esp
```shell=
pacman -S grub
```
*[note: you need to be inside the chroot when running grub-install.
If for some reason it is necessary to run grub-install from outside of the installed system:
append the --boot-directory= option
with the path to the mounted /boot directory:
e.g:: --boot-directory=/mnt/boot.]*
```shell=
mkdir /boot/efi
```
```shell=
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck
```
```shell=
#grub-install error: efibootmgr: not found
```
optional:
```shell=
pacman -Sy lsb-release
```
### Generate the GRUB configuration file
```shell=
grub-mkconfig -o /boot/grub/grub.cfg
```
:Warning: os-prober will not be executed
to detect other bootable partitions then edit :
```vim=
/etc/default/grub
#add/uncomment:
GRUB_DISABLE_OS_PROBER=false
```
## Exit arch-chroot
```shell=
exit
```
### Shutdown VM
```shell=
shutdown now
```
### Unmount the ISO from VMbox a.k.a 'remove iso'
**Setps:**
settings -> Storage --> Controller IDE -> Optical Drive -> remove Disk from Virtual Drive
### Launch VBox
couldn't open distro
-> added back the iso
-> got back inside
Remounted the /dev/sda2 & /dev/sda1
then arch-chroot
and now thinking how to fix the boot on launch
```shell=
pacman -Sy man
mandb
1
```
---
21/01 6:10pm
Scott : "BIOS needs a way to connect ssh or something, and an interpretor like python"
RESSOURCES :
- https://archlinux.org/download/
- https://wiki.archlinux.org/title/Fstab
- https://wiki.archlinux.org/title/EFI_system_partition#Typical_mount_points
- https://github.com/mayfrost/guides/blob/master/INSTALLATION.md
- https://wiki.archlinux.org/title/Pacstrap
---
- https://man.archlinux.org/man/efibootmgr.8.en
[Example below]
```
Displaying the current settings (must be root):
[root@localhost ~]# efibootmgr
BootCurrent: 0004
BootNext: 0003
BootOrder: 0004,0000,0001,0002,0003
Timeout: 30 seconds
Boot0000* Diskette Drive(device:0)
Boot0001* CD-ROM Drive(device:FF)
Boot0002* Hard Drive(Device:80)/HD(Part1,Sig00112233)
Boot0003* PXE Boot: MAC(00D0B7C15D91)
Boot0004* Linux
```
Each of the above are boot variables, which are defined as follows:
• **BootCurrent** - the boot entry used to *start the currently running system*
• **BootOrder** - the boot order as would appear in the boot manager. The boot manager tries to boot the first active entry in this list. If unsuccessful, it tries the next entry, and so on.
• **BootNext** - the *boot entry* which is scheduled to be run *on next boot*. This supersedes BootOrder for one boot only, and is *deleted by the boot manager after first use*. This allows you to change the next boot behavior *without* changing BootOrder.
• **Timeout** - the time in *seconds* between when the boot manager appears on the screen until when it *automatically chooses* the startup value from BootNext or BootOrder.
• **Five boot entries** *(0000 - 0004*), along with the active/inactive flag (* means active) and the name displayed on the screen.
---