可以让Linux在Chromebook上运行的与ChromeOS 一样快吗?

我前两天在Facebook Market上又捡了一台电子垃圾:$50买了一台 Dell Chromebook 11 3120,配置是 2GB 内存,16GB硬盘。卖家之前已刷了Sea BIOS,安装了CloudReady系统,但没有搞定声卡驱动,所以没有声音,也因此他才愿意便宜出售。

我喜欢ChromeOS的流畅,但讨厌不能自由安装软件。那有没有可能在Chromebook上安装Linux并让它跑得几乎与ChromeOS一样快呢?我没有把握,也知道可能性并不大,但我还是想试试。

我在这台Chromebook 上安装了Debian 11系统,目前没有遇到大的问题,声音,蓝牙,wifi,hdmi都能正常工作,除了觉得有点慢,以及从suspend状态复原时系统变得极度缓慢,几乎没有响应。

我在这台Chromebook上目前已经做了以下尝试:

  1. 禁用Wayland
  2. 删除SWAP分区
  3. 升级到最新内核

今天打算再设置下 ZRAM内存压缩。没想到极其简单,有ZRAM Tools加持,一分钟就设置好了。照抄的例子,给ZRAM分配了60%的物理内存。Reference 那就看后续使用效果了,我会过两天再更新这个文章。

「25-05-2023更新」 我卸掉了gnome3,装上了xfce4。这是我在移情gnome之前最喜欢的桌面环境。2G内存毕竟太少了,而gnome太贪心,它吃掉了太多的内存。为了更好的性能,我转向了xfce4,而它也确实没有让我失望。这台小机器现在能做很多事,并且跑得很流畅。我很开心啦!

English Version (Thanks ChatGPT)

I picked up another piece of electronic junk on Facebook Marketplace a couple of days ago: a Dell Chromebook 11 3120 for $50. It came with 2GB of RAM and a 16GB hard drive. The seller had previously flashed Sea BIOS and installed CloudReady, but couldn't get the sound card driver working, so there was no audio. That's why he was willing to sell it cheap.

I like the smoothness of ChromeOS but dislike the limitations when it comes to installing software. So, I wondered if it would be possible to install Linux on the Chromebook and have it run almost as fast as ChromeOS. I wasn't sure and knew it was unlikely, but I wanted to give it a try anyway.

I installed Debian 11 on this Chromebook, and so far, I haven't encountered any major issues. The sound, Bluetooth, Wi-Fi, and HDMI all work fine. The only drawbacks are that it feels a bit slow, and the system becomes extremely sluggish when resuming from suspend, almost unresponsive.

Here are the things I've tried on this Chromebook so far:

  • Disable Wayland in /etc/gdm3/daemon.conf
  • Removing the SWAP partition
  • Upgrading to the latest kernel

Today, I'm planning to set up ZRAM memory compression. Surprisingly, it was incredibly simple with the help of ZRAM Tools. I allocated 60% of the physical memory to ZRAM, following an example I found at Debian Wiki. We'll see how it performs in practice, and I'll update this article in a couple of days.

Update on 25-05-2023: I have uninstalled GNOME 3 and installed XFCE4. This is my favorite desktop environment before switching to GNOME. With only 2GB of memory, it was just too little, and GNOME was too resource-intensive, consuming a significant amount of memory. In order to improve performance, I turned to XFCE4, and it has not let me down. This little machine can now handle many tasks and runs smoothly. I am very happy!"

Don't change the inode when editing a file with Vim

I keep my config files on github, and I use hard-link for most of the config files. It's convenient, as I can check the new changes easily and submit some of the changes when necessary. However, the default behavior of vim troubles me. It always changed the inode when I save the config file!

tldr; the solution is: put the following line in your .vimrc

set backupcopy=yes

PS Though this way fixed Vim's behavior, I sadly found that git pull will change the config file's inode as well. So there is actually no feasible solution. I have abandoned this hard link approach. If you have better solutions to maintain all your config files in one repository, please let me know!

How to delete all bin/obj folders in a complex solution in GitBash

Sometimes we need to delete all the bin/obj folders in a solution to resolve issues in Rider or Visual Studio. I assume you already have your preferred method for this task, but I would like to share my approach here in case someone else is unaware of how to do it in GitBash or MSYS terminal:

#!/bin/bash

set -e

# Find and display directories to be deleted
find . \( -iname "bin" -o -iname "obj" \) -type d -print

# Prompt user for confirmation
read -p "The above folders are going to be deleted, are you sure? [Y/N]: " -n 1 -r
echo    # Move to a new line

# Delete directories if confirmed
if [[ $REPLY =~ ^[Yy]$ ]]; then
    find . \( -iname "bin" -o -iname "obj" \) -type d -exec rm -rfv {} +
    echo "Done"
else
    echo "No"
    exit 1
fi

Alternative to Oracle Regular expression for word boundaries

You might already know that Oracle regular expression doesn't support \b. However, we need it. So the answer is

(^|\W)yourstring(\W|$)

Reference

书摘:《斯通纳》

作者:约翰·威廉斯

我当时的点评:

2016/9/2 认为好看 一本真实的不能再真实的书。这是作者的自传吗?如果是我,死前会去见她一面的。

注:当时我一口气读完了这本书,花了五个小时。

他辛苦追求的宁静,当意识到自己生活中的时间那么少,而要读的东西那么多,要知道的事情那么多,这份宁静开始破碎了。

你必须记着自己是什么人,你选择要成为什么人,记住你正在从事的东西的重要意义。有很多人类的战争、失败和胜利,很多并非军事之争,历史著作中也没有记载。要记住这个,当你试图决定要做什么的时候。

当他在打造书房的时候,他打算定义的是他自己。当他为做书架打磨这些旧木板的时候,当他看着表面的粗糙消失,灰色的风雨侵蚀消失,露出基本的木质,最终露出花纹和质地华丽的纯粹时,他逐渐打造成形的是他自己,他要置于某种有序状态的是他自己,他想创造某种可能性的是他自己。

他跟母亲谈到未来的事儿,他想让她跟自己回哥伦比亚。房间多得很,而且(他对这个谎言感到痛心)伊迪丝也会欢迎她来做伴。

当他想到伊迪丝必然还要回来,反而感到非常难过,这点没有必要再对自己掩饰了。

他备受鼓舞,继续发挥自己从来没有被教过要做的东西。对文学、语言以及心智神秘性的热爱,在字母和词语的细腻、奇妙、出其不意的组合中,在最漆黑和冰冷的印刷文字中自动呈现出来——这种爱,他曾经深藏不露,好像那是非法和危险的,现在开始表现这种爱了,起先还是试探性的,接着大胆勇敢,最后就完全是自豪地表现了。

他知道这话是真心的,她是爱着孩子。这种真切的顿悟几乎让他要哭出来。

他发现生活下去不仅是可能的,甚至偶尔有些欢乐也是可能的。
2016/9/1 注: 糟糕的开始,糟糕的持续,不出意外的话,该是糟糕的结束了。

我可能会成为一个很烂的系主任。我既不期待,也不想要这项任命。
2016/9/1 注:他那么真实的活着。我几乎以为他是一个圣人。

他已经到了年岁的这种时刻:经常会想到,而且日益强烈,想到一个如此简单的问题,简单得他都没有办法去面对。他发现自己有些迷茫,自己的生活是否值得过下去,是否有过生活。他认为,这是在某个时候所有人都会想的问

他已经四十二岁,往前,看不到任何自己渴望享受的东西,往后,看不到任何值得费心记住的事物。

你最初爱的那个人并不是你最终爱的那个人,爱不是最终目标而是一个过程,借助这个过程,一个人想去了解另一个人。

他们从激情中萌发,再到情欲,再到深情,这种深情在时时刻刻不断自我翻新着。
2016/9/1 注:不枉人生走一遭

经过这些年,他知道,教学绝对不要重样。

他从阅读的内容中看到了她本人,他想。斯通纳很惊讶,此刻看着她竟如此逼真。忽然,好像她就在隔壁房间,他把她的样子定了好一会儿才消失。他双手刺痒,好像刚刚触摸过她。他的失落感,内心藏了很久的失落感,喷涌而出,彻底将他吞没,他任由这股洪流裹挟着,意志已失去控制。他不想搭救自己。接着他又亲切地笑了,好像是冲着某个记忆而笑。他忽然想到,他都快到六十岁了,应该能够不受这种激情和这种爱的力量左右。

我从来不在乎你认为可以‘给’我的东西,或者你认为可以为我‘做’的东西,或者别的什么玩意儿。”

你是个好人,我想。你肯定也是个好教师。但在好多方面,你是个无知的杂种。”他又停顿了下。“我不知道你究竟盼着什么。可我不想退休——不会在今年退,也不会在明年退。”他缓缓地站起来,站了会儿,好像在积蓄力量。“两位先生抱歉,我有些累了。我得留待你们去讨论你们不得不讨论的事儿了。”

他让服务员移掉妻子的名卡,重新安排了主桌位,这样就不会有个空缺出来。
2022/3/10 注:做事周全滴水不漏已经成了骨子里的习惯

他们已经原谅了曾经对彼此的伤害,他们一心一意想着对曾经一起生活的敬重。