__ __ __ \ \_________\ \____________\ \___ \ _ \ _\ _ \ _\ __ \ __\ / \___/\__/\__/ \_\ \___/\__/\_\_\ Bedrock Linux
Bedrock Linux 1.0beta2 Nyla
The full Bedrock Linux installation procedure provides quite a lot of flexibility. This comes at the cost of substantial decision making during the installation process. For those who simply want to get started quickly, the instructions below are a "quick start" which attempts to use sane default options for most decisions. Note that some options cannot be easily changed post install; if you would prefer to do a "full" install read the full installation instructions.
Bedrock Linux is quite a bit different from other distributions, and just following these instructions may be insufficient to fully understand and manage the resulting system. If you plan to use the resulting system as a daily driver, it may be worthwhile to eventually skim the other pages for this release of Bedrock Linux (1.0beta2 Nyla). It is useful to know, for example, the Bedrock Linux specific lexicon defined here, be aware of the known issues and troubleshooting advice before you begin following the instructions below. Additionally, it may be best to skim all these installation instructions before actually executing them.
The idea behind Bedrock Linux is to let the user utilize desirable parts of other distributions. This includes installation. Thus, the first step in installing Bedrock Linux is to actually install another distribution so that we can utilize that distribution's techniques for things such as adding users, partitioning, and even full disk encryption. Once this is done, we can "hijack" it and turn it into Bedrock Linux. While not covered here, you can even remove the original install's software, just retaining things like the bootloader and partitioning scheme.
Go ahead and install some other "traditional" distro. If you use a very simple partitioning scheme, such as just one root partition and swap, you can skip some later steps. This is useful to expedite things and is in the spirit of these "quick start" instructions. More complicated partitioning schemes will require additional configuration later.
NOTE*: At least one user reported Slackware's initrd does not respect "rw" on the bootloader line. This may make things a bit harder; for the time being it may be advisable to pick another distro. The "rw" requirement will be dropped later to ensure Slackware becomes a viable option here.
Once you've installed it, boot into it and set up things such as your desired users and network access.
Next we need to compile the Bedrock Linux userland. Now that you're running the distro we're going to hijack into Bedrock Linux. Install the following build dependencies:
There have been reports of difficulties building the tarball on musl-based systems such as Alpine; until this is remedied the tarball easiest to build on glibc based systems (which includes most major distros).
As a normal user, acquire this release's source code:
Then build a Bedrock Linux userland tarball:
If everything goes well, you'll have a tarball in your present working directory. Next we'll want to expand the tarball into the desired location.
As root, change directory to the root of the Bedrock Linux system then expand the tarball.
/path/to/bedrock-linux-tarball
tar
does not track extended filesystem attributes, and brc
requires a
special attribute to allow non-root users to utilize it. To set this
attribute, run:
/bedrock/libexec/setcap cap_sys_chroot=ep /bedrock/bin/brc
Some initrds assume directories existing on the root filesystem. Ensure these directories exist to appease the initrds:
Additionally, many people are accustomed to debugging a system by setting "init=/bin/sh". Ensure this option exists:
The hijacked distro is being converted into a stratum
which can provide a
base set of system files. However, it may be desirable to have other
strata
before continuing so that once you boot into Bedrock Linux you
already have a software from other distros ready to go.
The tarball you expanded in the previous step provided a minimal stratum called "fallback" to use in case of emergencies. It does not provide a kernel image, but does provide things such as a minimal init system and shell.
Go here to acquire other strata
then return to the
instructions here. Consider opening that link in another tab/window.
Next we're going to do the bare minimum configuration necessary to use the resulting system.
First you'll need a name to use to describe the files you acquired from the
hijacked distro. The convention here is to use the name of the hijacked
distro's release (or just the distro's name of it is a rolling release). For
example, if you installed and are hijacking Debian 8 "Jessie", the convention
is to use "jessie" as rootfs
' name. If you've hijacked an Arch Linux
install, "arch" would be used.
Edit /bedrock/etc/strata.conf
. At the very bottom, append
the following:
[stratum-name
]
framework = global
to the bottom of the file. It should look something like:
[jessie] framework = global
If the distro you're hijacking is using systemd, also append
init = /lib/systemd/systemd
Otherwise, append
init = /sbin/init
Thus, the resulting stanza you've appended could look like
[jessie] framework = global init = /lib/systemd/systemd
or perhaps
[crux] framework = global init = /sbin/init
Next, edit /bedrock/etc/aliases.conf
and change:
global = <DO AT INSTALL TIME> rootfs = <DO AT INSTALL TIME>
to
global =stratum-name
rootfs =stratum-name
This should be the same name you used in strata.conf.
For example:
global = jessie rootfs = jessie
In a "full" install we'd have the option of making those two items different, but for the quick start here we'll want them the same to keep things simple.
Make a directory in /bedrock/strata
corresponding to this same name:
stratum-name
stratum-name
As well as some symlinks:
stratum-name
/bedrock/strata/rootfsstratum-name
/bedrock/strata/globalThe tarball did not "install" quite all of the files it contained. Copy the rest of the files into place:
Confirm you've got a file at /etc/adjtime
. If it looks like you don't,
create one:
If you already have a /etc/sudoers
file, append a Bedrock Linux $PATH
setting to it:
Otherwise, create a sudoers file to ensure, if you do get sudo
later, the
$PATH
is setup properly:
Find the file corresponding to your timezone in /usr/share/zoneinfo
and copy
it to /bedrock/etc/localtime
:
timezone-file
/bedrock/etc/localtimeFor example:
Ensure you have a global fstab
Different adduser
implementations have different flags. For consistency,
users and groups will be added with the same Bedrock Linux-provided busybox
utility. The provided busybox's shell is configured to prioritize its own
commands over those found in the $PATH
. Launch the shell:
To handle nuances of how shells are handled in a typical Linux system, Bedrock
Linux provides its own meta-shell, brsh
, which can be configured to
immediately switch to some other, desired shell (e.g. bash or zsh). Ensure
root is using brsh:
While brsh
is very convenient for most instances, it may be wise to provide a
way to bypass it in case something goes wrong. Add a new username "brroot" as
an alias to the root user which uses /bin/sh
:
Non-root users should use brsh as well:
username
:/{$NF = "/bedrock/bin/brsh"} 1' /etc/passwd > /etc/new-passwdOptionally, provide a fall back for these non-root users:
username
:/br&/p' /etc/passwd | sed 's,:[^:]*$,:/bin/sh,' >> /etc/passwdusername
:/br&/p' /etc/shadow >> /etc/shadowNext we'll need to add expected users and groups. If you get a "in use" error, this simply indicates you already have the user or group; no harm done.
It may be desirable to add your normal user to the "audio" and "video" groups:
username
audiousername
videoIf you plan to use systemd as your init at some point, even just temporarily, it is a good idea to ensure some of the users and groups it expects exist, as otherwise it may fail to boot.
If you want to add any other users or groups, now is a good time. Once you're done, exit the busybox shell.
Bedrock Linux has two files that need to be updated for any partitions outside
of the typical root and swap partitions, fstab
and the default strata.conf
framework. If your partitioning scheme is more complicated than simply a root
filesystem and a bootloader, configure /bedrock/etc/fstab
and the default
framework as described here then return to these
instructions. Consider opening that link in another tab or window.
Finally, you will need to configure your bootloader. This is the last major step for the installation.
You'll want to change four things:
Set/change the menu item's name to something you'll recognize for this install of Bedrock Linux, e.g. "Bedrock Linux 1.0beta2 Nyla".
Set it to use /bedrock/sbin/brn
as the init.
Set it to mount the root filesystem as read-write, not read-only. Boot-to-read-only is not supported in 1.0beta2 Nyla.
Ensure no graphical splash screen is utilized (as this may mask Bedrock Linux's pick-an-init menu).
For example, if you are using GRUB2, edit:
/etc/default/grub
and change
GRUB_CMDLINE_LINUX=...
to
GRUB_CMDLINE_LINUX="rw init=/bedrock/sbin/brn"
and
GRUB_DISTRIBUTOR=...
to
GRUB_DISTRIBUTOR="Bedrock Linux 1.0beta2"
If you see "splash" in any of the GRUB configuration lines, such as
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
remove it, leaving something like:
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
Finally, run
to have GRUB2 read and utilize the updated configuration.
With syslinux or LILO, just edit the relevant lines to change the menu item to "Bedrock Linux 1.0beta2 Nyla" and add "rw init=/bedrock/sbin/brn" to the kernel line, as well as ensure "splash" is unset. For example, with syslinux, an adjusted stanza may look like:
LABEL nyla MENU LABEL Bedrock Linux 1.0beta2 nyla LINUX ../vmlinuz-3.16.0-4-amd64 APPEND root=/dev/sda1 quiet rw init=/bedrock/sbin/brn INITRD ../initrd.img-3.16.0-4-amd64
At this point, everything should be good to go. Just reboot into Bedrock Linux and enjoy!
If you run into any difficulties, try reviewing the relevant documentation pages for this release, and if that doesn't help sufficiently, don't hesitate to drop into the IRC channel #bedrock on libera.chat, the forums, or subreddit.