5/26/2020

网易云音乐 Netease Cloud Music登录不能保持

find ~/.config/netease-cloud-music -exec sudo chown $USER:$USER {} +
find ~/.config/netease-cloud-music -exec sudo chmod 755 {} +
find ~/.cache/netease-cloud-music -exec sudo chown $USER:$USER {} +
find ~/.cache/netease-cloud-music -exec sudo chmod 755 {} +

5/24/2020

Ubuntu 18.04 fix mouse and fix wifi

If the bluetooth mouse doesn't work properly:
sudo add-apt-repository ppa:bluetooth/bluez
sudo apt install bluez

To fix it temporarily:
#!/bin/bash
sudo service bluetooth restart

If the WIFI adapter is lost after resume or hibernation:
#! /bin/bash

# Little sleep for safety (??)
sleep 5;

# Remove all of the wifi modules from the kernel
sudo modprobe -r mwifiex_pcie;
sudo modprobe -r mwifiex;
sudo modprobe -r cfg80211;

# Re-add all of the wifi modules
sudo modprobe -i cfg80211;
sudo modprobe -i mwifiex;
sudo modprobe -i mwifiex_pcie;

# Restart netmanager
sudo service NetworkManager restart;

5/11/2020

Enable Ubuntu 18.04/22.04/24.04 hibernate

To make things easy: create a swap drive instead of using a swap file.

In the BIOS settings: disable secure boot FIRST.


For 24.04:

Follow: https://ubuntuhandbook.org/index.php/2021/08/enable-hibernate-ubuntu-21-10/

  • First, run command to create a config file:
    sudo nano /etc/polkit-1/rules.d/10-enable-hibernate.rules
  • When file opens, paste the lines below and press Ctrl+S to save, finally press Ctrl+X to exit.
    polkit.addRule(function(action, subject) {
        if (action.id == "org.freedesktop.login1.hibernate" ||
            action.id == "org.freedesktop.login1.hibernate-multiple-sessions" ||
            action.id == "org.freedesktop.upower.hibernate" ||
            action.id == "org.freedesktop.login1.handle-hibernate-key" ||
            action.id == "org.freedesktop.login1.hibernate-ignore-inhibit")
        {
            return polkit.Result.YES;
        }
    });


For 22.04

Then follow: https://www.geeksforgeeks.org/how-to-enable-hibernate-in-ubuntu-22-04-lts/

Edit the file /etc/systemd/sleep.conf with the following configuration:


[Sleep]
HibernateMode=shutdown


Enable the hibernation menu:

sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.desktop.pkla
 
[Enable hibernate in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Enable hibernate in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes