aboutsummaryrefslogtreecommitdiff
path: root/www-2/content/posts
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2026-01-23 23:16:45 +0800
committerYuqian Yang <crupest@crupest.life>2026-01-24 16:38:33 +0800
commit6d39cee75e7ef7c5e06d1a745a32224e11d68c37 (patch)
tree0f2646b569e8af6a2f464eb2755553eda0fe593b /www-2/content/posts
parent78e3e234877cb10ca1088df31e831b36fa4a12c0 (diff)
downloadcrupest-6d39cee75e7ef7c5e06d1a745a32224e11d68c37.tar.gz
crupest-6d39cee75e7ef7c5e06d1a745a32224e11d68c37.tar.bz2
crupest-6d39cee75e7ef7c5e06d1a745a32224e11d68c37.zip
HALF WORK!astro
Diffstat (limited to 'www-2/content/posts')
-rw-r--r--www-2/content/posts/nspawn.md16
1 files changed, 8 insertions, 8 deletions
diff --git a/www-2/content/posts/nspawn.md b/www-2/content/posts/nspawn.md
index 866cf96..33501b4 100644
--- a/www-2/content/posts/nspawn.md
+++ b/www-2/content/posts/nspawn.md
@@ -66,21 +66,21 @@ its package manager. For Debian-based distributions, it's `debootstrap`. If your
OS uses a different package manager ecosystem, the target distribution's one and
its keyrings (which might reside somewhere else) have to be installed first.
-```bash-session
+```shellsession
# pacman -S debootstrap debian-archive-keyring ubuntu-keyring
```
Regular directories work perfectly as root filesystems, but other directory-like
things should work, too, such as `btrfs` subvolume.
-```bash-session
+```shellsession
# btrfs subvolume create /var/lib/machines/[name]
```
Now, run `debootstrap` to create a minimal filesystem. Update the command with
the target distribution's codename and one of its mirrors you select.
-```bash-session
+```shellsession
# debootstrap --include=dbus,libpam-systemd,libnss-systemd [codename] \
/var/lib/machines/[name] [mirror]
```
@@ -125,14 +125,14 @@ further. Otherwise, you can use `systemd-nspawn` directly to enter the VM and
run commands inside it. `--resolv-conf=bind-host` binds the host's
`/etc/resolv.conf` file to make the network work.
-```bash-session
+```shellsession
# systemd-nspawn --resolv-conf=bind-host -D /var/lib/machines/[name]
```
Now, inside the VM, you can do whatever you like. In my configuration, a correct
user must be created manually.
-```bash-session
+```shellsession
# apt install locales lsb-release sudo \
nano vim less man bash-completion curl wget \
build-essential git
@@ -175,14 +175,14 @@ deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe
The following command starts a new shell session for the specified user inside
the VM, where you can run commands and perform tasks.
-```bash-session
+```shellsession
# machinectl shell [user]@[name]
```
Another way is to use `login` command to enter the *login console*. From there,
you can log in as a user to start a shell session.
-```bash-session
+```shellsession
# machinectl login [name]
```
@@ -197,7 +197,7 @@ If the VM's filesystem is a `btrfs` subvolume, native `btrfs` snapshots can be
used here. Before creating a snapshot, you should power off the VM to avoid
archiving runtime files.
-```bash-session
+```shellsession
# machinectl poweroff [name]
# btrfs subvolume snapshot /var/lib/machines/[name] \
/var/lib/machines/btrfs-snapshots/[name]/[snapshot-name]