认识
官网:https://ubuntu.com/desktop
文档:https://help.ubuntu.com/
仓库:
The number 1 open source operating system powers millions of PCs and laptops around the world. The secure, modern operating system used by millions. 简而言之,Ubuntu,其为 Linux 操作系统,能够安装到笔记本、台式机、服务器、……硬件中,并提供图形化操作。
组成
引导加载程序 GRUB
配置文件 /etc/default/grub /etc/default/grub.d/ /etc/grub.d/
网络配置工具
Note: The NetworkManager-Netplan integration was first implemented in Ubuntu 23.10.
Netplan is able to handle systemd-networkd and NetworkManager settings. On desktop systems all NetworkManager settings are integrated without interrupting traditional NetworkManager workflows (graphical UI, nmcli, nmtui, …).
So all network settings, like Wi-Fi networks, passwords or IP address configuration is transparently visible in NetworkManager (GNOME Quick Settings, GNOME Control Center, …) and Netplan at the same time.
所以,通过 nmcli 命令,当创建网络配置时,在 /etc/netplan 中,能够看到相对应的配置文件。NetworkManager 作为 NetPlan 的渲染工具,NetworkManager 将完成最终配置。
针对两者配置“同步”的实现原理,我们 09/03/2025 并未深入研究。
内核管理:升级,版本回退,降级,……
Ubuntu 20.04 TLS | How to remove a newer kernel while booted with the older kernel?
# apt-get install -y <Old Version> # apt-get remove -y "<New Version>" // 在卸载过程中,可能会安装更新版本的内核。 // 该场景多是:当前内核版本不是最新的,但也不是最旧的 // 解决方法是卸载自动安装的新内核 # apt-get remove -y "<Newer Version>"
在启动时选择旧版内核
- 重启计算机
- 在 GRUB 菜单出现时(如果看不到 GRUB 菜单,启动时按住 Shift 键)
- 选择”Advanced options for Ubuntu”
- 从列表中选择想要使用的旧版内核
图标主题
Ubuntu 的外观,包括图标,是由“主题”控制的。
默认主题:
在 Ubuntu 20.04 LTS 及之前的版本,默认图标主题是 Suru 或 Adwaita(更早版本)。
在 Ubuntu 22.04 LTS 及之后的版本,默认桌面环境是 GNOME,默认图标主题是 Yaru。Yaru 提供了明亮(Light)、暗黑(Dark)和标准(Standard)三种变体,图标风格现代、简洁、色彩明快。
性质
提供用户友好的闪屏 Boot Splash
quiet and splash —— 这两个 Linux Kernel 参数几乎总是同时出现,格式通常为:quiet splash
组合效果:`quiet splash` 共同实现了 “安静地启动并显示一个图形化启动画面” 的效果。
- 只有 `splash`,没有 `quiet`:Plymouth 会尝试显示图形画面,但内核和服务的日志输出会不断在画面上刷新,导致画面和文字混合闪烁,体验非常糟糕。
- 只有 `quiet`,没有 `splash`:启动过程是安静、无文本输出的,但你只会看到一个黑屏(或者可能是一个简单的光标),直到登录界面出现。虽然干净,但用户可能会觉得电脑没有在启动。
提供桌面环境 Desktop Environment
通过 Desktop Icon NG (DING) 扩展,来提供桌面图标功能。
配置桌面壁纸:
- Settings / Appearance / Backgroud / …
- gsettings get org.gnome.desktop.background picture-uri
提供桌面应用自启动
针对使用 XDG 自动启动应用的问题
在XDG 自启动规范中定义了一种方法,用于在桌面环境启动、可移动介质装入时,自动启动桌面条目(通常.desktop 文件)。
该方法需要将 .desktop 放置在特定的目录中:https://wiki.archlinux.org/index.php/XDG_Autostart#Directories
注意,虽然 XDG 工具包中提供了很多命令,但是这些命令中并不包含自启动脚本。什么意思呢?就是说对于 XDG 自启动,需要桌面环境的支持。XDG 只是一个统一的规范。XDG 自启动规范只是定义了那些目录中的存放的桌面条目应该被启动,但并不负责启动;
如果我们的桌面环境不支持 XDG 自启动规范,则需要安装独立的应用来进行程序的自启动。比如,dex、dapper、fbautostart、…… 但是,该类应用也不会自动启动,仍需要我们配置它们来进行启动,但是它们兼容 XDG 自启动规范,启动这些应用后,它们会去启动特定目录中的 XDG 条目;
提供软件管理工具 APT
… The repository … does not have a Release file. … ⇒ 升级
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
提供远程桌面 Remote Desktop
Q:Ubuntu 21.04 No Screen Sharing option in the settings.
A:https://www.reddit.com/r/Ubuntu/comments/pjkh2k/ubuntu_2104_no_screen_sharing_option_in_the/
S:It’s because of Wayland. Change the display server to Xorg in the lock screen and you should be good to go.
远程 Ubuntu 桌面,通过 Vino 实现,然后,在 Settings / Sharing 中,开启允许远程桌面。
How to enable Screen Sharing on Ubuntu 20.04 LTS
What Is Ubuntu Remote Desktop? How to Set Up and Use It
apt install vino
针对 Ubuntu 24.04 版本,Vino was the GNOME desktop sharing server. It is now archived and unmaintained,官方(GNOME)推荐使用 gnome-remote-desktop 服务。
提供 APT 来管理软件包
There are two types of mirrors of Ubuntu:
- package archive mirrors, which mirror the packages that make up the distribution, including regular security update packages
- and release-cd-only mirrors
The master package archive is available from:
https://launchpad.net/ubuntu/+cdmirrors
如果暂时无法升级系统,但又需要安装或更新某些软件,可以将软件源指向 Ubuntu 的旧存档服务器。
# Ubuntu 24.10 归档仓库 deb http://old-releases.ubuntu.com/ubuntu/ oracular main restricted universe multiverse deb http://old-releases.ubuntu.com/ubuntu/ oracular-security main restricted universe multiverse deb http://old-releases.ubuntu.com/ubuntu/ oracular-updates main restricted universe multiverse deb http://old-releases.ubuntu.com/ubuntu/ oracular-backports main restricted universe multiverse
提供输入法 Input Method
Settings / System / Region & Language / System / Manage Installed Languages / Keyboard input method system:
构建
—— 根据我们描述事物的框架,该部分将介绍构造事物的方法,即获得可用 Uubntu 操作系统的方法,但我们的本质需求是获得该环境,而非操作系统。
版本选择
https://ubuntu.com/about/release-cycle
https://canonical-ubuntu-project.readthedocs-hosted.com/release-team/list-of-releases/
Ubuntu 20.04.4 LTS focal
系统镜像 | Desktop vs. Server
DeepSeek / 介绍 ubuntu server 与 ubuntu desktop 的差别
核心区别:一个有图形界面,一个没有。一句话总结:一个为“人”操作优化,一个为“机器”服务优化。
- Ubuntu Desktop:带图形化桌面(如 GNOME),预装办公、浏览器等日常软件,给个人电脑用的,占用资源多。
- Ubuntu Server:只有命令行,预装服务器软件,给服务器跑的,极度精简,资源占用极低,所有性能都用于运行网站、数据库等服务。
容器镜像 | with Container Images
DeepSeek / 在 docker 容器中运行 ubuntu desktop 的方法
https://hub.docker.com/_/ubuntu
[I] SRC: docker.io/library/ubuntu:20.04
[I] DST: ccr.ccs.tencentyun.com/d3rm-3rd/docker.io_library_ubuntu:20.04
[I] SRC: docker.io/library/ubuntu:22.04
[I] DST: ccr.ccs.tencentyun.com/d3rm-3rd/docker.io_library_ubuntu:22.04
[I] SRC: docker.io/library/ubuntu:24.04
[I] DST: ccr.ccs.tencentyun.com/d3rm-3rd/docker.io_library_ubuntu:24.04
在容器中,运行桌面环境:
- https://hub.docker.com/u/dokken
- https://kasmweb.com/images
- https://github.com/gezp/docker-ubuntu-desktop
Ubuntu Desktop 20.04 with MBR
Setup Ubuntu Server 19.10 with MBR
安装过程不值一提,唯一的问题是:系统使用 GPT 分区表以及 UEFI 启动。但是,我们的硬件不支持,所以我们需要使用 MBR 分区表;
解决办法:在系统安装时,不要让安装器自动分区,需要手动分区,然后挂载根分区(/),然后再进行安装;
on ThinkPad P15v Gen1
[Sol.] 启动系统失败,进入 grub> 命令行界面(12/10/2023)
[SOLVED] I get grub shell on startup after installing Ubuntu 22 alongside Ubuntu 20
grub2 – Getting grub menu to work on dual boot Ubuntu 22.04 Windows 11. Currently boots in a loop – Ask Ubuntu
Ubuntu-20-Reset-System-Boot-Loop-on-P15-G1 – English Community – LENOVO COMMUNITY
Boot-Repair – Community Help Wiki
问题描述:
安装 Ubuntu 22.04 版本成功,但是系统重启后,直接进入 grub> 命令行界面(能够手动引导进入);
部分时候,当开机后会直接显示 Reset System 并重启;
原因分析:
很多人遇到该问题,其原因有很多,无法直接套用;
解决方案:
1)通过 Boot-Repair 软件,未能解决问题;
2)我们的原因在于 GPT 分区,修改为 MBR 分区表即可解决;
[WIP.] screen is flickering in Ubuntu 22.04 LTS
今天(11/03/2023),笔记本忘记接入电源而发生关机,然后开机,(开机后处于待机状态,我们暂未使用电脑);
次日(11/04/2023),我们需要使用笔记本,唤醒后,屏幕右上角花屏(有横线);
Bug #1970426 “[i915] screen is flickering in Ubuntu 22.04 (until…” : Bugs : linux package : Ubuntu 文档,配置内核参数。并且,我们也尝试更换驱动版本。并且,我们也尝试更换内核版本。并且,我们也尝试在 Xorg/Wayland 切换。但是,这些方法都没能解决问题;
系统升级:升级 23.10 版本
Upgrade Ubuntu 23.10 to 24.04 – Ask Ubuntu
apt update apt upgrade do-release-upgrade # -d Upgrading to a development release
# 11/07/2023
R:
Top-left ‘Activities’ Replaced with Workspace Indicator in GNOME 45 | UbuntuHandbook
S:最开始,我们还以为是 BUG(因为我们只有单个 Workspace,所以只有一个横线)
应用
场景 | 在操作系统安装后,进行简单设置 | After OS Installation
# --------------------------------------------------------- # 添加自定义设置 cat >> ~/.bashrc <<EOF # https://github.com/microsoft/WSL/issues/930 # LS_COLORS="$LS_COLORS":'di=0;36' ; export LS_COLORS # 调整 PS1 变量 export PS1="\e[01;31m\u@\h \w\e[00m""\e[34;1m\e[0m""\n""# " # 常用命令别名 alias ll='ls -l -a --color' alias ls='ls -a --color' EOF touch ~/.hushlogin exec su - root # 配置重载,以使其生效 # --------------------------------------------------------- # 安装常用工具,以方便系统维护管理 apt-get update apt-get install -y vim tmux rsync tree iotop sysstat bash-completion nfs-common
场景 | 蓝牙设备 | 连接蓝牙设备
How do I connect to my Bluetooth headset? – Ask Ubuntu
在 Settings 中,进行蓝牙设备连接皆可。
# 06/17/2024 经过测试,其能够与我们的蓝牙耳机互联,并能够正常使用。
场景 | 应用运行 | 单实例,仅允许应用启动单个实例
ubuntu – Limit a gui program in Linux to only one instance – Super User
以 HexChat 为例:当收到消息通知时,我们点击图标以查看消息,但是每次都将运行新的 HexChat 实例,而不是显示原有窗口。我们需要以单实例运行应用,即仅允许应用运行一次。
# 02/11/2021 目前,我们没有找到更好的方案,因为再好的方案都不如应用本身支持。有些方案属于“补丁”,有些方案仅针对我们的场景。
修改应用程序 .desktop 文件的 Exec 属性,该方法能够保证当我们点击图标时,不会重复运行应用。
我们以 HexChat 为例:
Exec=sh -c 'pidof "hexchat" 1>/dev/null 2>&1 && notify-send "HexChat" "This program is already running." || hexchat'
# 2025-10-27 现在,通过 Ubuntu Dock 插件,其允许我们设置点击图标时的行为。例如,Cycle through windows、Launch new Instance、……
场景 | 应用运行 | 通过快捷键,来运行应用
Setting a key shortcut to run an application in GNOME :: Fedora Docs
command line – Running a .desktop file in the terminal – Ask Ubuntu
我们需要设置截图快捷键(运行我们自定义的截图程序),以便在按下快捷键时进行截图;
在 Settings / Devices / Keyboard 中,我们可以添加快捷键,但是有两种方法运行应用:
- 通过直接指定应用的运行命令;
2)使用 gtk-launch 命令:gtk-launch “xxx.desktop”
我们推荐 2 方法,其中:xxx.desktop 可以为任何 .desktop 文件;无需制定路径,会自行搜索;可以省略 .desktop 后缀;
场景 | 应用启动 | 开机自启动,应用程序自启动
https://help.ubuntu.com/stable/ubuntu-help/startup-applications.html.en
配置方法如下:
- 或,GNOME Tweaks / Startup Applications,来添加启动应用
- 或,Ubuntu Desktop / Startup Applications,来添加。其等价执行 gnome-session-properties 命令。
如果需要应用程序延迟启动(避免同时启动而产生的高负载),需要修改 ~/.config/autostart/*.desktop 文件:
How To Launch Startup Applications With A Delay On Linux
[Desktop Entry] ... X-GNOME-Autostart-Delay=10 ...