[root tip] [How To] Manjaro system foundation

Difficulty: ★★☆☆☆

The bare necessity

The aim of this topic is to show how to lay the bare foundation for a custom Manjaro system. The target can be a removable media and the result tested using qemu.

In the beginning …

Open a terminal and list your current storage devices


Insert your device, wait a moment for the device to recognized and repeat the command. Depending on you device you should get something like

mmcblk0     179:0    0    15G  0 disk 

Switch to root - input your root passwd when asked for password


Either assign your device path to a variable named $work or substitute $work with your device path. When you come to targeting partitions they are slightly different depending on the media. E.g. mmc devices usually uses pX and sata devices use a number e.g. mmcblk9p1 or sdy1.

Partitioning disk

Assign your device path to the $work variable


First step is clearing the disk for previous filesystem info.

sgdisk --zap-all $work

Create a new GPT partition table

sg-disk --mbrtogpt $work

Create $esp partition

sgdisk --new 1::+512M --typecode 1:ef00 --change-name 1:"EFI System" $work

Create root partition

sgdisk --new 2::: --typecode 2:8304 --change-name 2:"Linux x86-64 root" $work

Wipe the partitions

wipefs -f "$work"1
wipefs -f "$work"2

Format and mount partitions

mkfs.vfat -vF32 "$work"1
mkfs.f2fs "$work"2

Mount the root partition

mount "$work"2 /mnt

Create the EFI mount point and mount the $esp

mkdir -p /mnt/boot/efi
mount "$work"1 /mnt/boot/efi

Basic Installation and configuration

Install a base system into the mounted root. Add the kernel, initram generator, grub boot loader and the micro editor.

basestrap /mnt base linux510 mkinitcpio grub micro

To save a file in micro use CtrlS and to exit use CtrlQ.

Chroot into the new filesystem

manjaro-chroot /mnt /bin/bash

Keyboard and locale

Keyboard lists are found in /usr/share/kbd/keymaps.
Set console keyboard in /etc/vconsole.conf - example for Denmark

micro /etc/vconsole.conf

TIP: uncomment the locale en_US.UTF-8 UTF-8 as a fallback locale.

Edit /etc/locale.gen and remove the comment for locale(s) to be generated (UTF-8 is the recommend choice). Example for a system in Denmark using english messages

micro /etc/locale.gen
en_DK.UTF-8 UTF-8

Edit your locale configuration in /etc/locale.conf to match above choice - example for Denmark

micro /etc/locale.conf

Timezone and clock

Available zones is listed in /usr/share/zoneinfo/ using the Continent/Capitol format.
Symlink the relevant time zone as /etc/localtime - example for Denmark

ln -sf /usr/share/zoneinfo/Europe/Copenhagen /etc/localtime

Linux clock runs using the timezone info and UTC time.

hwclock --systohc --utc

Hostname and hosts configuration

Set hostname to manjaro

echo manjaro > /etc/hostname
micro /etc/hosts    localhost
::1          localhost    manjaro.localdomain manjaro

Root password

Set a password the root user



Build the initramfs

mkinitcpio -P

Setup grub for EFI system

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Manjaro

Generate grub configuration

grub-mkconfig -o /boot/grub/grub.cfg

Cleaning up

umount -R /mnt

Test using qemu

To test if your install works as intended install qemu and run this command

qemu-system-x86_64 -enable-kvm -rtc base=localtime -m 2G -vga std -drive file=$work,readonly,cache=none,format=raw,if=virtio


Have fun …

Intentionally created as the bare foundation for a working Manjaro system.