惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MyScale Blog
MyScale Blog
F
Full Disclosure
Microsoft Azure Blog
Microsoft Azure Blog
Jina AI
Jina AI
Recent Announcements
Recent Announcements
美团技术团队
L
LangChain Blog
P
Privacy & Cybersecurity Law Blog
M
MIT News - Artificial intelligence
www.infosecurity-magazine.com
www.infosecurity-magazine.com
W
WeLiveSecurity
Engineering at Meta
Engineering at Meta
S
Security @ Cisco Blogs
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Help Net Security
Help Net Security
L
LINUX DO - 最新话题
S
Secure Thoughts
O
OpenAI News
Hacker News - Newest:
Hacker News - Newest: "LLM"
A
About on SuperTechFans
NISL@THU
NISL@THU
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
T
Tailwind CSS Blog
T
The Blog of Author Tim Ferriss
Recent Commits to openclaw:main
Recent Commits to openclaw:main
F
Fortinet All Blogs
B
Blog
IT之家
IT之家
T
Tor Project blog
L
Lohrmann on Cybersecurity
Webroot Blog
Webroot Blog
博客园 - 叶小钗
Simon Willison's Weblog
Simon Willison's Weblog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
量子位
Security Latest
Security Latest
TaoSecurity Blog
TaoSecurity Blog
S
Schneier on Security
C
Cisco Blogs
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
Last Week in AI
Last Week in AI
The Last Watchdog
The Last Watchdog
博客园 - 聂微东
Cisco Talos Blog
Cisco Talos Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Google DeepMind News
Google DeepMind News
SecWiki News
SecWiki News

GoodBoyboy 's Blog|惬意小屋-点滴记忆

今天游泳累炸了 回家吵的第一场架 新设计了一个Astro主题 Cap,一个基于PoW的自托管验证码系统 公益服务迁移通知 一种基于argon2id算法与shamir算法的内存PoW(工作量证明)解密游戏 记忆里的屋子(一) 主域名服务不稳定通知 腾讯元宝客户端实习二面凉经 腾讯元宝客户端实习一面面经 对越来越多AI博文的看法 GoodBoyboy Blog、Talk联动成功 只有失去了才会懂得珍惜,但幸好我还没有失去 滴滴Android客户端一面凉经 GoodBoyboy 's Talk上线! Easy Drop——一个基于Gin开发的高性能、轻量级说说平台 Perfect Pic —— 一个基于 Gin 开发的高性能、轻量级图床 尘封了八年的祝福 欢迎OPPO Pad 4 Pro加入设备大家庭 官方Android11 Box系统的OrangePi 3B新增红外模块教程 家里也换成光纤了qwq 姜还是老的辣 布洛芬效果真不错 再见2025,你好2026 Canokey导入S/MIME邮箱证书并使用Thunderbird发送邮件 1.90$申请 WISeID S/MIME 邮箱证书 新购Intel AX210网卡 OpenPGP邮件加密——关于测试邮件握手的思考 疯狂动物城2太好看了(无具体剧透) 进程调度——时间片轮转 效果是真的好,劲也是真的大 不买立省100% 十月小记 新增外设漫步者G1500bar 欢迎招行万事达加入卡包大家庭 博客十周年啦🎉 ESP32 S3开发小结 ESP32 S3外设小记 Arduino+VSCode开发ESP32-S3 EPS32-S3刷入MicroPython EPS32 S3刷入Picokeys Debian13安装Nvidia驱动 现在小孩都这么早熟么。。。 《动物迷城》二周目通关! Bing索引终于恢复了 家里蹲大学开始招生! 家里蹲大学即将建校,欢迎各位莘莘学子来本校深造(doge 骑车去兜风~ OAuth2授权码、客户端凭证、PKCE、设备码授权流程详解 基于OIDC实现Authentik与阿里云RAM角色的联合身份认证 GitHub release以及Git Commit常用模板 实验室生活 阿里云角色SSO对接authentik进行单点登录 白嫖一年Gemini Pro 突然发现自己可能乳糖不耐受? Android第三方Passkey管理器探索 多线程我太爱你了,你个“大可爱” [公告]现评论区已支持使用emoji表情符号😊 Debian GRUB踩坑记——out of memory 为Debian KDE更换显示字体为思源黑体 Debian补全办公常用字体 Debian12 KDE Edge输入法问题 Debian KDE Plasma 5调整外接显示器亮度 Debian开玩Minecraft Debian KDE使用指纹传感器验证身份
Ubuntu 26.04 Btrfs+LUKS2安装
GoodBoyboy · 2026-06-18 · via GoodBoyboy 's Blog|惬意小屋-点滴记忆

前言

Ubuntu官方的安装器手动安装下只能识别普通设备分区,并不能把系统安装在mapper设备上。

这篇教程非新手教程,需要有一定相关知识积累。

新手建议走官方启动器安装流程。

正文

后面教程以/dev/sda设备作为演示,请根据自身实际情况调整

创建分区

创建三个分区,怎么创建都行,这里不做演示

  • /dev/sda1 512MB EFI分区
  • /dev/sda2 1G Boot分区
  • /dev/sda3 剩余空间 系统分区

下载镜像

可以下载Desktop版,也可以下载Server版,Server版会精简很多,下面演示采用Server版,安装流程和Desktop版没有什么差别,有差别的地方后文会标注出。

制作Live CD启动盘

使用rufus工具(如果自己有其他的烧录工具都行)将镜像烧录至准备的U盘(光盘或者其他什么介质都行,能启动就行)

前置准备

重启进入Live CD环境,选择试用Ubuntu。

Desktop镜像打开终端,Server镜像按ALT+F2切换至终端。

首先查看并确认设备以及分区

1
lsblk

确认完成后切换为root用户

1
sudo -i

后面操作均以root身份操作

配置LUKS2加密容器

对系统分区进行LUKS2加密,并将其解锁。

1
2

cryptsetup luksFormat --type luks2 /dev/sda3

打开刚刚创建的加密分区,并将其映射为"cryptroot"

1
cryptsetup open /dev/sda3 cryptroot

格式化并创建Btrfs子卷

1
2
3
4
5
6
7
8

mkfs.fat -F32 /dev/sda1


mkfs.ext4 /dev/sda2


mkfs.btrfs /dev/mapper/cryptroot
1
2
3
4
mount /dev/mapper/cryptroot /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
umount /mnt

重新挂载目录树

1
2
3
4
5
mount -o subvol=@ /dev/mapper/cryptroot /mnt
mkdir -p /mnt/home
mount -o subvol=@home /dev/mapper/cryptroot /mnt/home
mount /dev/sda2 /mnt/boot
mount /dev/sda1 /mnt/boot/efi

解压SquashFS

/cdrom/casper/下,寻找后缀为.squashfs的核心系统文件

1
ls -lh /cdrom/casper/*.squashfs

Server版通常叫ubuntu-server-minimal.squashfs,桌面版可能叫filesystem.squashfs

将这个文件挂载出来

1
2
mkdir -p /tmp/squashfs
mount -o loop /cdrom/casper/ubuntu-server-minimal.squashfs /tmp/squashfs

同步系统

1
rsync -aAXv /tmp/squashfs/ /mnt/

同步完成后解除挂载

1
umount /tmp/squashfs

Chroot

1
2
for i in /dev /dev/pts /proc /sys /run; do mount -B $i /mnt$i; done
chroot /mnt /bin/bash

最小配置

配置DNS

1
2
rm -f /etc/resolv.conf
echo "nameserver 223.5.5.5" > /etc/resolv.conf

配置普通用户(不建议直接使用root用户)

1
2
adduser your_username
usermod -aG sudo your_username

配置软件源

1
2
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ resolute main restricted universe multiverse" > /etc/apt/sources.list
apt update

补齐缺少软件包

安装核心套件

1
apt install linux-image-generic grub-efi-amd64 cryptsetup-initramfs btrfs-progs -y

安装桌面环境

1
apt install ubuntu-desktop^ -y

配置fstab与crypttab

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

LUKS_UUID=$(blkid -s UUID -o value /dev/sda3)
echo "cryptroot UUID=${LUKS_UUID} none luks,discard" > /etc/crypttab


BTRFS_UUID=$(blkid -s UUID -o value /dev/mapper/cryptroot)
BOOT_UUID=$(blkid -s UUID -o value /dev/sda2)
EFI_UUID=$(blkid -s UUID -o value /dev/sda1)

cat <<EOF > /etc/fstab
UUID=${BTRFS_UUID} / btrfs subvol=@,defaults,discard=async 0 0
UUID=${BTRFS_UUID} /home btrfs subvol=@home,defaults,discard=async 0 0
UUID=${BOOT_UUID} /boot ext4 defaults 0 2
UUID=${EFI_UUID} /boot/efi vfat umask=0077 0 1
EOF

生成引导

1
2
3
update-initramfs -u -k all
grub-install /dev/sda
update-grub

安全启动(可选)

这时的引导是没有签名的,如果BIOS开启了安全启动将无法引导,如果有安全启动需求可以安装带签名的GRUB和Shim模块

1
2
3
apt install grub-efi-amd64-signed shim-signed -y
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu
update-grub

最后退出并重启

1
2
3
exit
umount -R /mnt
reboot

设置中文

此时系统是英文的,可以在设置里安装Chinese语言包,然后

1
sudo localectl set-locale LANG=zh_CN.UTF-8

删除Snap(可选)

1
2
3
4
5
sudo apt purge snapd -y
sudo rm -rf ~/snap
sudo rm -rf /snap
sudo rm -rf /var/snap
sudo rm -rf /var/lib/snapd

安装桌面环境时虽然日志中有安装snap和snap的firefox之类的组件

但是进入桌面后却没看到任何snap应用,包括应用商店,不过snap服务还是在的

Bug解决

systemd-networkd-wait-online.service卡开机问题

取消开机自启

1
2
sudo systemctl disable systemd-networkd-wait-online.service
sudo systemctl mask systemd-networkd-wait-online.service

安装Timeshift

玩Btrfs当然少不了Timeshift

1
2
sudo apt update
sudo apt install timeshift -y

安装Flatpak(可选)

1
2
sudo apt update
sudo apt install flatpak -y
1
sudo apt install gnome-software gnome-software-plugin-flatpak -y
1
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

cardcode

Invitation

created:09/04/2015

Welcome to MyBlog

Use this card to join MyBlog and participate in a pleasant discussion together .

Welcome to GoodBoyboy 's Blog,wish you a nice day .

赞助