[root tip] [How To] Do a manual Manjaro installation

Difficulty: ★★★☆☆

Install Manjaro using CLI only

This is how you install Manjaro using the terminal.

  • On bare-metal use CtrlAltF4
  • On VirtualBox use RightCtrlF4

This guide is intended as a reference for the basic installation abstracted by Calamares and for the subsequent installation of the packages which makes of the live ISO.

The guide can be applied as a virtual machine or hardware as of your choice.

Overview

  1. VirtualBox or Hardware
  2. Installation prerquisites
  3. Partitioning
  4. Formatting
  5. Mounting
  6. Base installation
  7. Base configuration
    • Vconsole
    • Locale
    • Timezone
    • Clock
    • Hostname
    • Sudo
    • Network
    • Time sync
    • Root password
  8. Bootloader
    • Init
    • Bootloader
  9. Finalizing
    • Recreate the live ISO
    • Final Considerations
  10. Variations

1. Virtual machine or hardware

This guide is a generic guide targeted at UEFI based systems. If you test this using a virtual machine please use the recommended configuration for Manjaro VM.

  • 2 CPU
  • 2 GB memory
  • 32 GB disk (this guide uses 128G disk)
  • Enable EFI
  • Graphics 128MB

For the best result download the most recent Manjaro ISO and write it to an USB or start a virtual machine with the ISO as selected boot media.

Please refer the topic Multiboot ISO USB on how to create a bootable USB using the ventoy project.

2. Installation prerquisites

Load the ISO to your system - virtual or bare-metal. When you have loaded the system be sure to set the following items.

  1. Keyboard
  2. System time
  3. Branch and mirror
  4. Pacman databases and keyrings
  5. Trust database (pacman keys)

If you used a GUI ISO you have initially selected your preferred keyboard and you can skip this step.

All commands assumes you are using a live Manjaro ISO and in terminal as the root user.

su

1. Keyboard
Set keyboard on Architect ISO by using loadkeys followed by a country code e.g. for Denmark

loadkeys dk

The available keymaps can be found by looking in the /usr/share/kbd/keymaps/ folder.

2. System time
Ensure system time is correct - necessary for SSL certificates

systemctl enable --now systemd-timesyncd

3. Mirror and branch
We use pacman-mirrors to set a mirror and the desired branch.

pacman-mirrors --api --set-branch unstable --url https://manjaro.moson.eu

You can replace the branch with stable or testing and you can remove the –url argument and use e.g. –continent for closer mirrors or leave it out for a complete run against all mirrors.

4. Database and keyrings
Download the databases and install keyrings

pacman -Syy archlinux-keyring manjaro-keyring

5. Trust database
Create trust database, populate and refresh keys

pacman-key --init
pacman-key --populate archlinux manjaro
pacman-key --refresh-keys

3. Partitioning disk

If you are using a system with multiple disk devices you need to make sure of you are targeting the right disk, so start with listing your devices. By doing this you will determine which device you want to target for the installation.

NOTE: All your disk devices will be listed - including your removable devices. Removable devices will have 1 in the RM column of the output.

List disk devices

List the devices using the command lsblk. Depending on your system your output may look like this

# lsblk
NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0   7:0    0  52.5M  1 loop /run/miso/sfs/livefs
loop0   7:1    0 501.3M  1 loop /run/miso/sfs/rootfs
sda     8:0    0   128G  0 disk
sr0    11:0    1 617.4M  0 rom  /run/miso/bootmnt

Partition layout

We need to make a decision on how to partition our device.

A modern system uses EFI and requires a special partition to preload the system.

Depending on your system and the intended use you need to consider making room for swap. Swap space is a temporary storage location for memory shared by applications. If you are using integrated graphics (shared system memory) a swap partition of the same size as your RAM will do it.

A Manjaro system can run with a root partition of less than 10G but doing so will require strict dicipline and maintenance to avoid your system root from running full. A root partition of 32G-64G may be adequate for most use cases.

When deciding on the size of the root filesystem - be aware that using e.g. snap to install packages may fill up your root faster than anticipated.

Many experienced users like to setup partitions for different purposes. The only extra I will recommend here is a partition to hold the home folders.

This makes a total of 4 (four) partitions:

  1. efi - 300M - FAT32
  2. swap - 2G (or equal to system RAM size)
    • an argument can be made to skip the swap partition and instead use a swapfile as a swapfile can be changed on the fly (please reference the Wiki article) and make an informed decision.
  3. root - 32G-64G
  4. home - remaining space

Create the partitions

The partitions can be created by script commands or you can use interactive console programs like fdisk or cfdisk. The programs is navigated by keys (arrows, letters, enter and esc) or you can script it using sfdisk.

From our example system listing above - our main disk device is labeled sda and for this guide we use cfdisk.

Note: This command uses the –zero argument to empty the partition table of the selected disk.

cfdisk --zero /dev/sda

Select gpt label type when prompted and press Enter

The cfdisk is a three part window

  • Top: various device information
  • Center: shows partition info
  • Bottom: displays commands and a short description

There is two (2) block cursors

  • object cursor
  • action cursor

To do something you need to select an object and a command.

Create the partitions according the layout described above.

Be very careful to set the partition type exactly as described as we will let systemd mount the partitions according to partition type. You may expect us to later create a fstab file - surprise - we won’t - and you will learn something about Discoverable Partitions Specification

  1. EFI or $esp
    • Select Free space using or .
    • Select New using or Enter.
    • 300M press Enter.
    • Select TypeEnter.
    • Select EFI SystemEnter.
  2. swap partition.
    • Select Free spaceNewEnter.
    • Enter size 2GEnter.
    • Select TypeEnter.
    • Select Linux swapEnter.
  3. root partition.
    • Select Free spaceNew &rarr Enter.
    • Enter size 32GEnter
    • Select TypeEnter.
    • Select Linux root (x86_64)Enter.
  4. home partition.
    • Select Free spaceNewEnter.
    • Enter to assign the remaining space to home.
    • Select TypeEnter.
    • Select Linux homeEnter.
  5. Save the changes
    • Select WriteEnter
    • Input yes when prompted → Enter
    • Select QuitEnter

4. Formatting

List your partitions and note that each partition is listed as part of our sda disk device.

# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  52.5M  1 loop /run/miso/sfs/livefs
loop0    7:1    0 501.3M  1 loop /run/miso/sfs/rootfs
sda      8:0    0   128G  0 disk 
├─sda1   8:1    0   300M  0 part
├─sda2   8:2    0     2G  0 part
├─sda3   8:3    0    32G  0 part
└─sda4   8:4    0  93.7G  0 part
sr0     11:0    1 617.4M  0 rom  /run/miso/bootmnt

EFI ($esp)

mkfs.fat -F 32 /dev/sda1

Swap

mkswap /dev/sda2

Root

mkfs.ext4 /dev/sda3

Home

mkfs.ext4 /dev/sda4

5. Mounting

Before we install the base system we need to mount the devices. First we mount the root system - using the folder /mnt for the temporary mount, then we make folders for /boot/efi and /home.

mount /dev/sda3 /mnt
mkdir -p /mnt/boot/efi
mkdir -p /mnt/home

Verify your folder structure

# find /mnt -type d
/mnt
/mnt/home
/mnt/boot
/mnt/boot/efi

Mount the efi and home partition

mount /dev/sda1 /mnt/boot/efi
mount /dev/sda4 /mnt/home

Verify your mounts

# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  52.5M  1 loop /run/miso/sfs/livefs
loop0    7:1    0 501.3M  1 loop /run/miso/sfs/rootfs
sda      8:0    0   128G  0 disk 
├─sda1   8:1    0   300M  0 part /mnt/boot/efi
├─sda2   8:2    0     2G  0 part
├─sda3   8:3    0    32G  0 part /mnt
└─sdc4   8:4    0  93.7G  0 part /mnt/home
sr0     11:0    1 617.4M  0 rom  /run/miso/bootmnt

6. Base installation

When your folder structure and mounts are in place you install the base system into the new partitions.

To get a functional system you need

  • The base meta package
  • A kernel
    • By release linuxYY
  • Network
    • Basic ethernet using dhcp
    • For more advanced Network Manager
  • Grub boot loader
  • EFI boot manager
  • Texteditor
    • Any terminal based of your choice, to name a few nano, vi or micro.
  • Sudo

The minimum required is the base meta package. But to actually run the install we need kernel, network, boot loader, efi boot manager, text editor and sudo.

Use basestrap command to install a base set of packages into the newly mounted root

Replace $LINUX with the kernel of choice e.g. linux58

basestrap /mnt base $LINUX dhcpcd networkmanager grub mkinitcpio efibootmgr vi nano sudo links

If you want to mimic the set of packages from the ISO currently live you will - in Section 9 - see how to make that happen.

7. Base configuration

Next thing is to configure the system in a chrooted environment. The tasks to be performed creating the necessary configurations for you new system. We will use bash as shell.

:information_source: Using Nano editor press F2yEnter to save and exit.

manjaro-chroot /mnt /bin/bash

Console keyboard

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

KEYMAP=dk
FONT=
FONT_MAP=

Locale

To generate the messages edit /etc/locale.gen and remove the comment for locale(s) to be generated (UTF-8 is the recommend choice).

Select locale
Example for a system in Denmark using english messages

...
#en_CA ISO-8859-1
en_DK.UTF-8 UTF-8
#en_DK ISO-8869-1
...

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

Generate the messages

locale-gen

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

LANG=en_DK.UTF8

Timezone

Set the time zone for location (the available zones is listed in /usr/share/zoneinfo/ using the Continent/Capitol format).

Symlink the time zone as /etc/localtime - example for Denmark

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

Clock

Linux clock runs using the timezone info and UTC time.

hwclock --systohc --utc

Hostname

Set hostname to manjaro

echo manjaro > /etc/hostname

Hosts configuration

nano /etc/hosts

127.0.0.1    localhost
::1          localhost
127.0.1.1    manjaro.localdomain manjaro

Note: If the system has a static IP replace 127.0.1.1 with the IP.

System administration

Allow members of the wheel group to perform administrative tasks.

Create a drop-in configuration in /etc/sudoers.d/10-wheel with content

%wheel ALL=(ALL) ALL

For some advanced sudo-fu read this topic by @FadeMind

Network

Don’t enable both - not necessary and not a good idea.

Either enable basic ethernet using dhcpcd

systemctl enable dhcpcd

or Network Manager if you need e.g. wireless

systemctl enable NetworkManager

Time syncronization

Enable timesync daemon

systemctl enable systemd-timesyncd

Root password

Set a password the root user

passwd

8. Bootloader

Build the initramfs and install and setup grub

Initramfs

Build the initramfs according to your chosen kernel e.g. linuxYY

mkinitcpio -p linuxYY

Bootloader

Generate 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

9. Finalizing

Close chroot

exit

Recreate the live ISO edition

If for some reason your desire is to recreate the editon of the live Manjaro ISO you can easily do that by using the package lists found in root of the live system.

Whichever edition your live ISO is - you can recreate the experience using these files

  • rootfs-pkgs.txt
  • desktopfs-pkgs.txt

Sanitize the lists combining them into one list - then feed them to pacman to install them into your new root file system.

Start with root filesystem and pipe it into a new file

cat /rootfs-pkgs.txt | awk '{print $1;}' > ~/iso-pkglist.txt

Continue with the desktop filesystem and append it to the file

cat /desktopfs-pkgs.txt | awk '{print $1;}' >> ~/iso-pkglist.txt

Then feed the entire list to pacman and direct the installation to your mounted root using the convenient options of not confirming and only install if not already installed.

pacman -Syy --noconfirm --needed --root /mnt - < ~/iso-pkglist.txt

Unmount the partitions

umount -R /mnt

Restart your system

Remember to remove your install media.

reboot

Login as root and test your internet connection

links manjaro.org

Final Considerations

If you opted to install the packages using the package lists on the ISO there is a few extra steps.

Administrative user

First create an administrative user - replace $USERNAME with an actual username

useradd --create-home --user-group -G network,scanner,lp,wheel $USERNAME

Then set a password for the user

passwd $USERNAME

Display manager

To enable a graphical login you must enable the display manager. Which one depends on the environment

  • KDE
    systemctl enable sddm
    
  • Xfce
    systemctl enable lightdm
    
  • Gnome
    systemctl enable gdm
    

Done

reboot

10. Variations

The choice to go down this path is usually due to preference and a desire to create a DIY Manjaro installation. The following is examples of how to continue.

25 Likes
CLI Manjaro without Architect?
Manjaro Architect
How to install manjaro on existing lvm?
Manjaro install gets stuck at 90% (MacBook Air 2020)
How can I create a live USB with storage partition?
Manjaro KDE Installer cannot list 128GB USB Flash Drive
Manjaro installer support for drives as isw_raid_member?
Installing Manjaro on 8 Computers?
How to disable/remove Plymouth?
Calamares installer fails on my chipset
Cannot Upgrade System
Other ways to install manjaro
I can't access my USB stick
Installer (21.0.7) can't start gdm (3080ti)
Trying to install manjaro kde minimal lts, blank screen appears after the loader reaches "Graphical Interface Reached"
How can I install Manjaro without Calamares?
Using graphical installed with LVM on LUKS
Passer de xfce à Lxde
Can't install, rsync failure, using efi+luks+lvm
How to install Manjaro on USB stick?
How to install a custom manjaro without architect?
Minimal installation on PC
Is there any method to a CLI install
Installation on existing btrfs subvolume
Best way to bare system
Minimum set of packages
How to do a not full install?
How to install on encrypted root with unecrypted boot with Calamares?
Architect iso install story
How to install Manjaro over Windows without USB
CLI installation
Manjaro installation on oczssdpx-1rvd0180
Create a guest profile
How do I install Manjaro MATE with LVM on LUKS and dual boot with Windows?
Bootloader error persists
Error in update manjaro system
Is there a very basic version of Manjaro?
[HowTo] Install full Manjaro on ZFS filesystem
Recommended Partitions Scheme setup in general for linux/manjaro?
How to replicate the system installation and settings to the degree of official ISO from a base system
Filesystem keeps breaking for no reason
How to install Manjaro on mdadm RAID1/10
Underscore Blinking when I am trying to boot from USB
Grub luks slow boot. Need help making boot time faster on a encrypted installation
Persistent USB slow
How to install Manjaro with LUKS and Dual Boot support
How do I install Manjaro MATE with LVM on LUKS and dual boot with Windows?
How to replicate the system installation and settings to the degree of official ISO from a base system
What are the default user groups that Manjaro setting manager creates for new users?

Updated 2022-05-21T21:11:00Z
typo –no-confirm to –noconfirm

Updated 2021-09-12T08:11:00Z

3 Likes

Thanks very much linux-aarhus for this guide.

Thanks for the guide, I found it really useful. Just one thing:

pacman -Syy --no-confirm --needed --root /mnt - < ~/iso-pkglist.txt

–no-confirm needs changing to –noconfirm

Thanks

2 Likes

A post was split to a new topic: Grub menu not showing after manual install

Used this guide to set up Manjaro on an encrypted LVM. Very helpful!

2 notes:

  • (might be due to lvm) I had to manually create /etc/fstab, otherwise the root filesystem was mounted Read-Only
  • (might be off-topic in this thread) if using LVM with encryption don’t forget to install lvm2 in the base system and also don’t forget to include the lvm2 + encrypt hooks for mkinitcpio

I’d like to use this tutorial to do a custom install - except I don’t want to use Grub. Can I use rEFInd instead? Anyone know what commands should be substituted for the Grub commands?

Thanks in advance.

You have instructions for various bootloaders in archwiki.

you can use systemd boot - easy if you use the package systemd-boot-manager