Ubuntu 管理心得

搜尋此網誌

2022年10月22日 星期六

Safely power off USB drive

  1. Umount all: e.g
    sudo umount /media/pi/ntfs_1TB
    sudo umount /media/pi/ext4_1.7TB
    sudo umount /media/pi/ext4_1TB
  2. sudo udisksctl power-off -b /dev/sda

2022年10月13日 星期四

2022年10月9日 星期日

Rsyslogd: action ‘action-0-builtin:omfile’ ‘action-7builtin:omfile’

cf: https://ubuntu-mate.community/t/rsyslogd-action-action-0-builtin-omfile-resumed-module-builtin-omfile/24105

Edit /etc/rsyslog.conf and comment the following lines.

#
# Set the default permissions for all log files.
#
#$FileOwner syslog
#$FileGroup adm
#$FileCreateMode 0640
#$DirCreateMode 0755
#$Umask 0022
#$PrivDropToUser syslog
#$PrivDropToGroup syslog

Restart rsyslog

 

2022年10月6日 星期四

Set network interface priority

cf: https://forums.raspberrypi.com/viewtopic.php?t=278033  

For linux: 

First run the command:

route -n 

It will show the metrics of the interface. 

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG    202    0        0 eth1
0.0.0.0         192.168.1.12    0.0.0.0         UG    303    0        0 wlan0
 
The lower the route priority first. So eth0 is higher than wlan0.
Edit /etc/dpchcd.conf: 
interface wlan0 
metric 100 
And run route -n, it will then show:
 
Kernel IP routing table 
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.12 0.0.0.0 UG 100 0 0 wlan0 
0.0.0.0 192.168.2.1 0.0.0.0 UG 204 0 0 eth1  
 
Thus, wlan0 will is higher than eth1. 
Becuase wlan0 is the external interface, while eth1 is for internal interface, the wlan0 priority need to be higher than eth1. Otherwise, the outside internet can not be reached. 
 
For windows:
The following image shows the NIC is set to metric 5.

 

 
 

網誌存檔