Skip to content

Ubuntu

启动卡死

https://blog.csdn.net/qingxuly/article/details/142875098

Drop to root shell prompt

sudo vi /etc/default/grub

将GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"修改为GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"。

先sudo update-grub更新引导程序的配置。

再执行reboot重启Ubuntu。

安装ssh

sudo apt install openssh-server

ubuntu edge 出现

加载 Live2D 模型失败: Error: WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support. at Renderer.create (pixi.js?v=0205:20425:17) at autoDetectRenderer (pixi.js?v=0205:20675:23) at new Application (pixi.js?v=0205:42120:27) at Live2DManager.initializeLive2D (live2d.js?v=0205:90:30) at App.initLive2D (app.js?v=0205:67:38) at App.init (app.js?v=0205:51:20)

. 调整 WebGL 相关的 Flags 设置 某些系统策略或显卡黑名单可能导致 Edge 默认禁用了 WebGL。 在 Edge 地址栏输入 edge://flags/ 并回车。 在搜索框中输入 webgl,找到 WebGL 2.0 Compute 等相关选项,尝试将其设置为 Enabled。 搜索 override software rendering list,将其设置为 Enabled(这会强制允许在被列入软件渲染黑名单的显卡上启用 WebGL)。 点击底部的“重新启动”按钮。

ubuntu 设置开机后自动登录不需要密码

打开: Settings(设置) 进入: Users(用户) 点击右上角: 👉 Unlock(解锁)(输入一次管理员密码) 选择你的用户 打开开关: 👉 Automatic Login(自动登录) 重启验证

- name: Enable AutomaticLoginEnable
  lineinfile:
    path: /etc/gdm3/custom.conf
    regexp: '^#?AutomaticLoginEnable='
    line: 'AutomaticLoginEnable=true'
    insertafter: '\[daemon\]'

- name: Set AutomaticLogin user
  lineinfile:
    path: /etc/gdm3/custom.conf
    regexp: '^#?AutomaticLogin='
    line: 'AutomaticLogin={{ auto_login_user }}'
    insertafter: 'AutomaticLoginEnable=true'

自启浏览器

- name: Auto open browser on Ubuntu desktop
  hosts: aidog_hosts
  become: true
  tasks:
    - name: Ensure autostart directory exists
      file:
        path: "/home/{{ ansible_user }}/.config/autostart"
        state: directory
        owner: "{{ ansible_user }}"
        group: "{{ ansible_user }}"
        mode: "0755"

      tags:
        - autostart

    - name: Create autostart desktop entry
      copy:
        dest: "/home/{{ ansible_user }}/.config/autostart/open-aidog.desktop"
        owner: "{{ ansible_user }}"
        group: "{{ ansible_user }}"
        mode: "0644"
        content: |
          [Desktop Entry]
          Type=Application
          Name=Open AIDOG Web Interface
          Exec=xdg-open http://localhost:5005/test/test_page.html
          X-GNOME-Autostart-enabled=true
          NoDisplay=false
          Terminal=false
      tags:
        - autostart

防火墙

sudo ufw allow 8080

sudo ufw status verbose

路由

假设你的网关是 192.168.3.1(常见局域网网关,需确认实际网关) * 临时

sudo ip route add default via 192.168.3.1 dev ens160

多网卡配置

::: warning

配置文件必须是 600 权限 :::

哪个走外网,哪个就需要配置default ens13f0 是内网, ens13f1 是对外访问 哪个网卡需要出外网 → 就在它上面配置 default via ...。 哪个网卡只用来和本地子网通讯 → 只配置 192.168.x.0/24 的路由,不要配置 default。

root@soft:/etc/netplan# more *
::::::::::::::
50-cloud-init.yaml
::::::::::::::
network:
  version: 2
  ethernets:
    ens13f0:
      dhcp4: no
      addresses: [192.168.188.201/24]
      nameservers:
        addresses: [8.8.8.8]
::::::::::::::
xyw.yaml
::::::::::::::
network:
  version: 2
  ethernets:
    ens13f1:
      dhcp4: no
      addresses: [192.168.252.241/24]
      routes:
        - to: default
          via: 192.168.252.254
      nameservers:
        addresses: [192.168.250.250]


default 给ens13f1 两个网卡都能用, 给ens13f0  后ens13f1 就不能

激活网卡

ip link set 网卡名称 up

需要重新打开终端查看状态

ip route

查看网卡物理是否在线

sudo apt install ethtool
sudo ethtool [网卡名称]

看 Link detected: yes 或 no,no 就是物理链路问题

ip 配置

root@soft:/etc/netplan# more 50-cloud-init.yaml 
network:
  version: 2
  ethernets:
    ens13f0:
      dhcp4: no
      addresses: [192.168.188.201/24]  # 这行定义了入站地址(别人如何找到我)
      routes: # 这行定义了出站规则(我如何访问别人)
        - to: default
          via: 192.168.188.1
      nameservers:
        addresses: [8.8.8.8]
    ens13f1:
      dhcp4: no
      addresses: [192.168.202.201/24]
      nameservers:
        addresses: [8.8.8.8]

检查 netplan try

启动

netplan apply

更换镜像

https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

24.04

Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
Suites: noble noble-updates noble-backports noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb-src
URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
Suites: noble noble-updates noble-backports noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

ssh 升级

wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.7p1.tar.gz