- VirtualBox/Install Arch Linux as a guest
- Contents
- Installation in EFI mode (optional)
- Installation in EFI mode on VirtualBox
- Install the Guest Additions
- Set optimal framebuffer resolution
- Load the VirtualBox kernel modules
- Launch the VirtualBox guest services
- Auto-resize Guest Display
- Hardware acceleration
- Enable shared folders
- Manual mounting
- Automounting
- Mount at boot
- Troubleshooting
- Access serial port from guest
- Guest freezes after starting Xorg
- Fullscreen mode shows blank screen
- Linux guests have slow/distorted audio
- Linux guests have slow/laggy audio
- Arch: pacstrap script fails
- Windows host: VERR_ACCESS_DENIED
- No hardware 3D acceleration in Arch Linux guest
- Установка Arch Linux на Virtualbox
- Подготовка к установке
- Загрузка
- Подключение к Интернет
- Подготовка жёсткого диска
- Разметка
- Форматирование
- Установка базовых пакетов
- Создание основных каталогов
- Загрузка пакетов
- Настройка зеркал для новой системы
- Настройка устанавливаемой системы
- Переключение
- Имя хоста
- Локаль
- Виртуальная консоль
- Автомонтирование
- Установка загрузчика
- Инициализация хранилища ключей
- Перезагрузка
- Жизнь в новой системе
- Создаём файл подкачки
- Снова поднимаем сеть
- Создаём пользователя
- Полезные ссылки
- Читайте также
- Комментарии
VirtualBox/Install Arch Linux as a guest
This article is about installing Arch Linux in VirtualBox.
Boot the Arch installation media through one of the virtual machine’s virtual drives. Then, complete the installation of a basic Arch system as explained in the Installation guide.
Contents
Installation in EFI mode (optional)
Enabling EFI for Arch as guest is optional. If you want to install Arch Linux in EFI mode inside VirtualBox, you must change the firmware mode for the virtual machine. This must be done before installing Arch as guest, changing the option afterwards will result in unbootable machine unless the setting is reverted.
To enable EFI for a virtual machine using the graphical interface, open the settings of the virtual machine, choose System item from the panel on the left and Motherboard tab from the right panel, and check the checkbox Enable EFI (special OSes only).
Alternatively the same can be accomplished from the command line using VBoxManage:
efi will set the firmware for the virtual machine to EFI with the bitness matching the virtual machine’s CPU. To get a specific EFI bitness, set the firmware to efi64 for x86_64 EFI or efi32 for IA32 EFI.
After selecting the kernel from the Arch Linux installation media’s menu, the media will hang for a minute or two and will continue to boot the kernel normally afterwards. Be patient.
Starting with VirtualBox 6.1 the issue of forgetting NVRAM contents on shutdown is fixed. Proceed with the installation just as on a regular UEFI system.
Installation in EFI mode on VirtualBox
Once the system and the boot loader are installed, VirtualBox will first attempt to run /EFI/BOOT/BOOTX64.EFI from the ESP. If that first option fails, VirtualBox will then try the EFI shell script startup.nsh from the root of the ESP. This means that in order to boot the system you have the following options:
- Launch the bootloader manually from the EFI shell every time;
- Move the bootloader to the default /EFI/BOOT/BOOTX64.EFI path;
- Create a script named startup.nsh at the ESP root containing the path to the boot loader application, e.g. \EFI\grub\grubx64.efi .
- Boot directly from the ESP partition using a startup.nsh script.
Do not bother with the VirtualBox Boot Manager (accessible with F2 at boot), as it is buggy and incomplete. It does not store efivars set interactively. Therefore, EFI entries added to it manually in the firmware (accessed with F12 at boot time) or with efibootmgr will persist after a reboot but are lost when the VM is shut down.
Install the Guest Additions
VirtualBox Guest Additions provides drivers and applications that optimize the guest operating system including improved image resolution and better control of the mouse. Within the installed guest system, install:
- virtualbox-guest-utils for VirtualBox Guest utilities with X support
- virtualbox-guest-utils-nox for VirtualBox Guest utilities without X support
The guest additions running on your guest, and the VirtualBox application running on your host must have matching versions, otherwise the guest additions (like shared clipboard) may stop working. If you upgrade your guest (e.g. pacman -Syu ), make sure your VirtualBox application on this host is also the latest version. «Check for updates» in the VirtualBox GUI is sometimes not sufficient; check the VirtualBox.org website.
Set optimal framebuffer resolution
This article or section is a candidate for merging with VirtualBox/Tips and tricks#Set guest starting resolution.
Typically after installing Guest Additions, a fullscreen Arch guest running X will be set to the optimal resolution for your display; however, the virtual console’s framebuffer will be set to a standard, often smaller, resolution detected from VirtualBox’s custom VESA driver.
To use the virtual consoles at optimal resolution, Arch needs to recognize that resolution as valid, which in turn requires VirtualBox to pass this information along to the guest OS.
First, check if your desired resolution is not already recognized by running the command ( hwinfo need to be installed):
If the optimal resolution does not show up, then you will need to run the VBoxManage tool on the host machine and add «extra resolutions» to your virtual machine (on a Windows host, go to the VirtualBox installation directory to find VBoxManage.exe ). For example:
The parameters «Arch Linux» and «1360x768x24» in the example above should be replaced with your VM name and the desired framebuffer resolution. Incidentally, this command allows for defining up to 16 extra resolutions («CustomVideoMode1» through «CustomVideoMode16»).
Afterwards, restart the virtual machine and run hwinfo —framebuffer once more to verify that the new resolutions have been recognized by your guest system (which does not guarantee they will all work, depending on your hardware limitations).
Finally, add a video=resolution kernel parameter to set the framebuffer to the new resolution, for example:
Additionally you may want to configure your bootloader to use the same resolution. If you use GRUB, see GRUB/Tips and tricks#Setting the framebuffer resolution.
Load the VirtualBox kernel modules
To load the modules automatically, enable vboxservice.service which loads the modules and synchronizes the guest’s system time with the host.
To load the modules manually, type:
Launch the VirtualBox guest services
After the rather big installation step dealing with VirtualBox kernel modules, now you need to start the guest services. The guest services are actually just a binary executable called VBoxClient which will interact with your X Window System. VBoxClient manages the following features:
- shared clipboard and drag and drop between the host and the guest;
- seamless window mode;
- the guest display is automatically resized according to the size of the guest window;
- checking the VirtualBox host version
All of these features can be enabled independently with their dedicated flags:
Notice that VBoxClient can only be called with one flag at a time, each call spawning a dedicated service process. As a shortcut, the VBoxClient-all bash script enables all of these features.
virtualbox-guest-utils installs /etc/xdg/autostart/vboxclient.desktop that launches VBoxClient-all on logon. If your desktop environment or window manager does not support XDG Autostart, you will need to set up autostarting yourself, see Autostarting#On desktop environment startup and Autostarting#On window manager startup for more details.
VirtualBox can also synchronize the time between the host and the guest, to do this, start/enable the vboxservice.service .
Now, you should have a working Arch Linux guest. Note that features like clipboard sharing are disabled by default in VirtualBox, and you will need to turn them on in the per-VM settings if you actually want to use them (e.g. Settings > General > Advanced > Shared Clipboard).
Auto-resize Guest Display
This option will automatically change the resolution of the Arch guest, whenever the window of the virtual machine is resized. This option is enabled by default, and in graphical interface is located at View -> Auto-resize Guest Display. When using KDE Plasma, on GUI login screen (Session) select Plasma (X11) instead of the default session Plasma (Wayland), which does not work with auto-resize.
Hardware acceleration
Hardware acceleration can be activated in the VirtualBox options. The GDM display manager 3.16+ is known to break hardware acceleration support. [1] So if you get issues with hardware acceleration, try out another display manager (lightdm seems to work fine). [2] [3]
If the hardware acceleration does not work as expected, try changing the Graphics Controller option found under the Screen tab in the Display options of the settings GUI. It seems that depending on the host GPU type, not all emulated controllers work equally well.
Enable shared folders
Shared folders are managed on the host, in the settings of the Virtual Machine accessible via the GUI of VirtualBox, in the Shared Folders tab. There, Folder Path, the name of the mount point identified by Folder name, and options like Read-only, Auto-mount and Make permanent can be specified. These parameters can be defined with the VBoxManage command line utility. See there for more details.
No matter which method you will use to mount your folder, all methods require some steps first.
To avoid this issue /sbin/mount.vboxsf: mounting failed with the error: No such device , make sure the vboxsf kernel module is properly loaded. It should be, since we enabled all guest kernel modules previously.
Two additional steps are needed in order for the mount point to be accessible from users other than root:
- the virtualbox-guest-utils package created a group vboxsf (done in a previous step);
- your user must be in vboxsf user group.
Manual mounting
Use the following command to mount your folder in your Arch Linux guest:
where shared_folder_name is the Folder name assigned by the hypervisor when the share was created.
If the user is not in the vboxsf group, to give them access to our mountpoint we can specify the mount(8) options uid= and gid= with the corresponding values of the user. These values can obtained from the id command run against this user. For example:
Automounting
In order for the automounting feature to work you must have checked the auto-mount checkbox in the GUI or used the optional —automount argument with the command VBoxManage sharedfolder .
The shared folder should now appear as /media/sf_shared_folder_name . If users cannot access the shared folders, check that /media has permissions 755 or is owned by the vboxsf group if using permissions 750 . This is currently not the default if the /media directory is created by vboxservice.service .
You can use symlinks if you want to have a more convenient access and avoid to browse in that directory, e.g.:
Mount at boot
You can mount your directory with fstab. However, to prevent startup problems with systemd, noauto,x-systemd.automount should be added to /etc/fstab . This way, the shared folders are mounted only when those mount points are accessed and not during startup. This can avoid some problems, especially if the guest additions are not loaded yet when systemd reads fstab and mounts the partitions.
- sharedFolderName : the value from the VirtualMachine’s Settings > SharedFolders > Edit > FolderName menu. This value can be different from the name of the real folder name on the host machine. To see the VirtualMachine’s Settings go to the host OS VirtualBox application, select the corresponding virtual machine and click on Settings.
- /path/to/mntPtOnGuestMachine : if not existing, this directory should be created manually (for example by using mkdir).
- dmode / fmode are directory/file permissions for directories/files inside /path/to/mntPtOnGuestMachine .
As of 2012-08-02, mount.vboxsf does not support the nofail option:
Troubleshooting
Access serial port from guest
Guest freezes after starting Xorg
Faulty or missing drivers may cause the guest to freeze after starting Xorg, see for example [4] and [5]. Try disabling 3D acceleration in Settings > Display, and check if all Xorg drivers are installed.
Fullscreen mode shows blank screen
On some window managers (i3, awesome), VirtualBox has issues with fullscreen mode properly due to the overlay bar. To work around this issue, disable Show in Full-screen/Seamless option in Guest Settings > User Interface > Mini ToolBar. See the upstream bug report for more information.
If the guest’s screen goes black above a certain size (e.g. above 2048 pixels wide), increasing the Settings > Display > Screen > Video Memory can help.
Linux guests have slow/distorted audio
The AC97 audio driver within the Linux kernel occasionally guesses the wrong clock settings when running inside VirtualBox, leading to audio that is either too slow or too fast. To fix this, create a file in /etc/modprobe.d/ with the following line:
Linux guests have slow/laggy audio
In some cases, audio can have laggy performance (for example lag behind video when streaming video online). A possible workaround can be to use the Intel HD Audio controller in VirtualBox and disable its power saving by adding the following line in a file in /etc/modprobe.d/ in the guest OS:
Arch: pacstrap script fails
If you used pacstrap in this article to also #Install the Guest Additions before performing a first boot into the new guest, you will need to umount -l /mnt/dev as root before using pacstrap again; a failure to do this will render it unusable.
Windows host: VERR_ACCESS_DENIED
To access the raw VMDK image on a Windows host, run the VirtualBox GUI as administrator.
No hardware 3D acceleration in Arch Linux guest
virtualbox-guest-utils package as of version 5.2.16-2 does not contain the file VBoxEGL.so . This causes the Arch Linux guest to not have proper 3D acceleration. See FS#49752.
To deal with this problem, apply the patch set at FS#49752#comment152254. Some fix to the patch set is required to make it work for version 5.2.16-2.
Источник
Установка Arch Linux на Virtualbox
Официальное руководство по установке Arch Linux рассчитано на все случаи жизни, конфигурации оборудования, намерения и подготовку пользователей, и потому неизбежно содержит множество избыточной для новичка информации (кроме того, есть ещё более подробное руководство для новичков). Наша цель — познакомиться с Arch, почувствовать как работать в этой системе. Самый простой способ достичь этой цели — установить Arch на виртуальную машину, где мы вольны сами выбирать конфигурацию оборудования. Чтобы быстрее установить систему и приступить к работе, создадим виртуальную машину под управлением VirtualBox с одной операционной системой (Arch Linux) и одним жёстким диском.
Кроме того, предполагается, что на хост-машине подключен Интернет.
Подготовка к установке
Скачать дистрибутив можно по адресу: [руководстве](http://www.archlinux.org/download/]].
Загрузка
- Создадим в VirtualBox новую виртуальную машину.
- В настройках машины загрузим iso-образ Arch в привод CD и укажем этот привод первым в списке загрузки.
- Запустим виртуальную машину и выберем архитектуру Arch. Выбирать лучше 64-битный вариант, так как рано или поздно поддержка 32-битных пакетов будет прекращена.
После загрузки вы попадёте в консоль суперпользователя root .
Подключение к Интернет
В случае VirtualBox сеть поднимается сама и уже готова к использованию.
Подготовка жёсткого диска
В первый раз Arch лучше всего ставить на один раздел. Раздел /boot , упоминаемый в [[https://wiki.archlinux.org/index.php/Partitioning), не нужен, поскольку у нас будет всего одна операционная система. Раздел под swap также не нужен. Вместо него разместим swap в файле, как в Windows. Это даст возможность изменять размер swap или вовсе удалить его. Если у вас достаточно оперативной памяти, то swap можно не создавать или создать, но не подключать. Тогда, даже если память закончится, то система просто «подумает» несколько минут, а затем убьет самый «прожорливый» процесс.
Разметка
Для разметки диска можно использовать классический fdisk или более простой cfdisk . Поскольку раздел у нас предполагается всего один, возможностей cfdisk будет достаточно:
Добавим новый раздел. Он будет первичным (Primary), загрузочным (Bootable) и занимать весь диск. Запишем сделанные нами изменения.
Проверить разметку можно повторно запустив cfdisk .
Форматирование
Размеченный диск нужно отформатировать, то есть создать на нем файловую систему. В качестве последней выберем ext4:
Установка базовых пакетов
Создание основных каталогов
Перед тем как ставить пакеты, нам нужно смонтировать подготовленный на предыдущем шаге раздел диска, создать в нём основные каталоги и пробросить в устанавливаемую систему /dev , /proc и /sys :
Опция —bind позволяет связать один каталог с другим. Связывать /dev и другие каталоги необходимо для того, чтобы устанавливаемая система могла получить доступ к устройствам и другой информации. Системе это понадобится для установки некоторых пакетов, а нам — для установки и настройки загрузчика из chroot-а (этим мы займёмся чуть позже).
Загрузка пакетов
Команды для установки пакетов при инсталляции отличаются от обычных только тем, что пакетному менеджеру pacman дополнительно указывается корневой каталог устанавливаемой системы. Его мы, если помните, смонтировали в /mnt .
Обязательными для установки являются базовые пакеты и загрузчик:
Вообще говоря, на этом этапе можно устанавливать любые пакеты, но лучше ограничиться этим минимальным набором. Так будет меньше возни, если в ходе дальнейшей установки вы что-нибудь сломаете и придется все начинать сначала.
Настройка зеркал для новой системы
После окончания загрузки пакетов имеет смысл скопировать список зеркал с установочного образа в нашу новую систему:
Если вы не сделаете этого сейчас, то не забудьте отредактировать список позже, потому что в новой системе все зеркала закомментированы.
Настройка устанавливаемой системы
Переключение
Переключаемся в устанавливаемую систему:
Дальнейшие действия производятся в устанавливаемой системе. Выходить из chroot нужно будет только после завершения настройки — для перезагрузки.
В дальнейшем, если какого-либо конфигурационного файла нет, и не написано, что он генерируется определенной командой, то его нужно создать.
Имя хоста
Открываем /etc/hostname (например, с помощью nano ), пишем туда имя хоста, например arch .
Локаль
Открываем файл /etc/locale.gen и стираем решетку перед локалью ru_RU.UTF-8 UTF-8 .
Запускаем генератор локалей:
Теперь открываем файл /etc/locale.conf и пишем туда следующее:
Не пугайтесь, если введя после этого команду locale вы не увидите изменений. Так и должно быть.
Виртуальная консоль
Открываем файл /etc/vconsole.conf и пишем туда:
Переводим аппаратные часы на «локальное» время и отображаем это в конфигурационном файле /etc/adjtime :
localtime указывается для совместимости с Windows.
Указываем свой часовой пояс:
Если у вас другой часовой пояс, то ищите свой файл в /usr/share/zoneinfo/ и командуйте аналогичным образом.
Автомонтирование
Теперь открываем файл /etc/fstab и прописываем туда наш корневой раздел. Есть несколько способов указания нужного раздела, самый простой — использовать для указания имя устройства:
Напомню, что разделителем в /etc/fstab служит табуляция.
Установка загрузчика
Если вы хотите видеть как проходит процесс загрузки, то откройте файл /etc/default/grub и закомментируйте quiet из параметров ядра.
Запускаем автоматическую настройку:
grub-mkconfig может ругаться на lvmetad. Это предупреждение можно проигнорировать, а можно удалить пакет lvm2 и перегенерировать конфиг.
Инициализация хранилища ключей
Установка практически выполнена, но прежде чем перезагружать систему, инициализируем и «населим» хранилище ключей для pacman :
Перезагрузка
После этого нужно ещё раз проверить правильность всех настроек, выйти из устанавливаемой системы и перезагрузиться:
При установке в VirtualBox новая система иногда ведёт себя странным образом: сначала вроде бы нормально загружается, а потом на экране появляется ругань вида upgrade bios or use force_addr=0xaddr и приглашение консоли не появляется. В этом случае нужно просто перейти в другую консоль, нажав HOST + F2. Хост-клавишей обычно выступает правый Ctrl.
Жизнь в новой системе
Если установленная система смогла загрузиться, значит всё в порядке — базовая система у нас теперь есть, осталось только войти в неё под root -ом.
Первым делом защищаем root паролем:
Создаём файл подкачки
При достаточном объёме оперативной памяти делать это не обязательно. Однако на всякий случай лучше научиться создавать и подключать swap сейчас. Делается это так:
Файл готов. Чтобы подключить его достаточно ввести команду:
Чтобы подключение происходило автоматически, swap нужно прописать в /etc/fstab :
Снова поднимаем сеть
Наша задача: выяснить, как в Arch называется наш старый добрый сетевой интерфейс eth0. Для этого ищем интерфейс вида enp0s3 в выдаче
Затем запускаем для этого интерфейса DHCP:
и добавляем всё это в автозагрузку:
Создаём пользователя
Добавим пользователя в группу wheel с помощью команды
Поставим и настроим sudo для выполнения команд администратора
В файле /etc/sudoers раскомментируем строку # %wheel ALL=(ALL) ALL . Теперь мы можем использовать команду sudo .
Базовая настройка системы завершена. Дальнейшую настройку и установку дополнительных пакетов (иксов, драйверов, графических оболочек и т. п.) каждый выполняет по своему вкусу.
Полезные ссылки
Читайте также
Комментарии
Дмитрий Храмов
Компьютерное моделирование и все, что с ним связано: сбор данных, их анализ, разработка математических моделей, софт для моделирования, визуализации и оформления публикаций. Ну и за жизнь немного.
Источник