-
Notifications
You must be signed in to change notification settings - Fork 65
Running MentOS
Learn how to boot and interact with MentOS.
The simplest way to run MentOS:
cd build
make filesystem
make qemuThis launches QEMU with the bootloader.bin and filesystem.
When MentOS boots, you'll be prompted for credentials.
Use one of the usernames from filesystem/etc/passwd:
- root - Root user (full privileges)
- user - Regular user
Passwords are enforced and stored as SHA-256 hashes in filesystem/etc/shadow. If you need to change credentials, edit the shadow file before rebuilding rootfs.img.
Once logged in, you can use the MentOS shell:
ls # List directory
cd /home/user # Change directory
cat file.txt # Display file contents
ps # List processes
pwd # Print working directoryFor a full list of available commands, see Userspace Programs.
make qemuBoots: Directly loads bootloader.bin
Fastest: Immediate boot, no GRUB delay
Use for: Development and testing
make qemu-grubBoots: Creates ISO image, boots via GRUB bootloader
Realistic: Mimics real hardware boot process
Use for: Testing GRUB compatibility, more realistic environment
make qemu-testBoots: Runs runtests as init process instead of shell
Purpose: Runs all test programs automatically
Use for: Automated testing, CI/CD
Note: qemu-test runs QEMU in -nographic mode and writes serial output to build/test.log.
Edit the root CMakeLists (EMULATOR_FLAGS) or run QEMU manually:
qemu-system-i386 -m 256M -kernel build/mentos/bootloader.bin -drive file=build/rootfs.img,format=raw,if=ide,index=0,media=diskSerial output is routed based on EMULATOR_OUTPUT_TYPE:
-
OUTPUT_STDIO(default): output appears directly in the terminal runningmake qemu. -
OUTPUT_LOG: output is written tobuild/serial.log.
- Press
Ctrl+Alt+Gto release mouse - Close QEMU window, or
- Press
Ctrl+Cin the terminal runningmake qemu
Install GRUB tools:
sudo apt-get install -y grub-common grub-pc-bin xorrisomake qemu-grubThis:
- Builds
bootloader.bin - Creates
iso/boot/grub/grub.cfg - Generates
cdrom.isowith GRUB - Boots QEMU from ISO
The GRUB config is in iso/boot/grub/grub.cfg:
menuentry "MentOS" {
multiboot /boot/bootloader.bin
}
Once booted, run userspace programs:
# System info
uname
uptime
cpuid
# File operations
ls
cat /etc/passwd
mkdir mydir
touch myfile.txt
# Process management
ps
kill <pid>
# Testing
/bin/tests/t_fork
/bin/tests/t_memWarning: MentOS is experimental. Use only on dedicated hardware or VMs.
-
Build the ISO:
make qemu-grub # Generates cdrom.iso -
Write to USB:
sudo dd if=build/cdrom.iso of=/dev/sdX bs=4M status=progress
Replace
/dev/sdXwith your USB device (check withlsblk). -
Boot from USB on target machine
Copy bootloader.bin to /boot:
sudo cp build/mentos/bootloader.bin /boot/Add to /etc/grub.d/40_custom:
menuentry "MentOS" {
multiboot /boot/bootloader.bin
}
Update GRUB:
sudo update-grubReboot and select "MentOS" from GRUB menu.
Kernel debug messages go to the serial console and follow the same EMULATOR_OUTPUT_TYPE routing described above.
See Debugging#Kernel Logging for controlling verbosity.
For interactive debugging:
make qemu-gdbSee Debugging for details.
Run the test suite:
make qemu-testThis boots MentOS with runtests as the init process, which:
- Executes all tests in
/bin/tests/ - Reports pass/fail results
- Exits when complete
To properly shut down MentOS:
poweroffOr simply close the QEMU window.
- Check if
make filesystemwas run - Verify
rootfs.imgexists inbuild/ - Try a clean rebuild:
make clean && make && make filesystem
- Check serial output for kernel errors
- Try
make qemu-gdband debug boot process
- Ensure QEMU window has focus
- Check keyboard layout setting (KEYMAP_TYPE in CMake)
- Video driver issue, reboot usually fixes it
- Try different QEMU version
- Run
make filesystemafter compiling programs - Check
/bindirectory contents:ls /bin
- This is normal for GRUB boot
- Use
make qemufor faster direct boot
- EXT2 filesystem on emulated hardware is slow
- This is expected behavior
- Userspace Programs - Learn about available programs
- Development Guide - Add your own programs
- Debugging - Debug kernel and programs
Previous: Building MentOS | Next: Development Guide →