Posts in category “Linux”

PopOS/Ubuntu fcitx-rime setup

By my recommendation, my new workmate He (贺) moved to Ubuntu from windows, and he was annoyed of one thing: cannot input Chinese. And I have to google again to find out the answer. This is why I wrote this list for him like people and myself.

sudo apt install fcitx fcitx-rime
im-config  # and select fcitx as the input engine
fcitx-configtool # > Add input method, remember to tick off `Only Show Current Language`

A simple nfs server on centos

At the server end

choose a server as the nfs-server, do things below in root role

dnf -y install nfs-utils
mkdir /mnt/nfs-share
chown -R nobody /mnt/nfs-share/

vim /etc/exports
add a line
/mnt/nfs-share 192.168.178.0/255.255.255.0(rw,sync,all_squash)
save and exit

systemctl enable nfs-server
systemctl start nfs-server

At the client end

dnf -y install nfs-utils
mkdir /mnt/nfs-local
chown -R nobody /mnt/nfs-local/

vim /etc/hosts
add a line, replace 192.168.xxx.yyy to the IP addr of your NFS server
nfs-server 192.168.xxx.yyy 

vim /etc/fstab
add a line
nfs-server:/mnt/nfs-share  /mnt/nfs-local   nfs defaults   0 0
save and exit
 
mount -a # to confirm what you have done is right

other utils:

You could use showmount -e 192.168.xxx.yyy to get a share list from the nfs server.

flameshot: a better screenshot tool with editing support for ubuntu

How to install certbot on CentOS8

The biggest problem you faced is actually the following one
https://otodiginet.com/operating-system/how-to-install-snapd-on-centos-8/

and the article above answers the question very well.

certbot certos

Note: recover from accidentally changed the ownership of `sudo` command

Cause:

This morning, I change to the /backup directory and found I cannot write in it. So I rapidly typed sudo chown -R david:david .. then press Enter. You know what happened! All the files in / directory were changing the owner to me! I realized this by seeing an error message like "You cannot change the owner of xxx file to david".

Damn, how silly I was! Unfortunately, that was not the end of my bad luck. When I try to revert it by typing sudo chown -R root:root /, I got another error message: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set. Then I tried su - root but it seems that I haven't set a root password.

How can I recover my pop! OS?

  1. reboot it into single-user mode, edit the boot menu, add systemd.unit=rescue.target at the end of the boot line.
  2. In the boot console, chown -R root:root /usr; chmod 4755 /usr/bin/{sudo,dpkg,pkexec,crontab}; reboot

Rather easy, right? It did cost me over 10mins! PS. I met many issues later after recovering from the accident. One of them is that the crontab command did not work as usual. I have to run the instruction below to fix it.

sudo apt reinstall cron

Linux is also fragile, please don't be such silly thing next time. I told myself. PS: This time I also set a root password as well, so next time I could run su - root directly instead of going to the single user mode.