文件系统挂了,变成只读模式。supervisor无法启动,就连ping 域名时无法解析dns,想要修改/etc/resolve.conf,只读也写不进去。
试下往临时目录写也是这:
touch /tmp/aaa.txt
touch: cannot touch '/tmp/aaa.txt': Read-only file system
14篇 ubuntu related articles
文件系统挂了,变成只读模式。supervisor无法启动,就连ping 域名时无法解析dns,想要修改/etc/resolve.conf,只读也写不进去。
试下往临时目录写也是这:
touch /tmp/aaa.txt
touch: cannot touch '/tmp/aaa.txt': Read-only file system
使用iptables进行端口转发,如下,需要访问原主机的27017端口,但是没开放,只开放了5000-6000之间的端口,因此 需要映射 一个5027端口去访问27017 这个mongodb。
iptables -t nat -A PREROUTING -p tcp --dport 5027 -j DNAT --to-destination :27017
列表:
iptables -t nat --list
删除
PREROUTING 后跟的index 索引从1开始
iptables -t nat --delete PREROUTING 2
Debian64位系统暂时还没有mongodb4.4的deb,编译安装也没试成功。
Ubuntu20.04 64位可以用这些命令装上。
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install mongodb-org
装完可以启动mongod服务
systemctl start mongod
systemctl enable mongod
服务启动可能会异常,可以看下 systemctl status mongod
如报出/var/run
... 可以修改对应的服务声明 如 /lib/systemd/system/mongod.service
去掉/var
了解如何在Raspberry Pi 4上通过USB引导Ubuntu Server20.04。SD卡非常缓慢,并且容易出现数据损坏和故障。 通过升级到SSD驱动器来解决所有这些问题!
Ubuntu上默认安装了一个防火墙服务 ufw, 全称为 Uncomplicated Firewall。默认是禁用的。
想用GUI可以看下Gufw。
启用ufw: sudo ufw enable
To check the status of UFW:
查看 ufw状态: sudo ufw status verbose
也可以用 sudo ufw show raw
查看详情
也可以在 ** /etc/ufw**目录下查看 .rules的规则文件
本文的目的是在Ubuntu 20.04 Focal Fossa Linux上禁用动态motd和新闻。
netplan从/etc/netplan/
目录读取配置文件,这个目录下有多个不同的文件,可能会有这样的文件
但不一定都有,我们可以修改来更改网络配置,如果在这个目录下你没找到文件可以通过这个命令sudo netplan generate
来创建一个配置文件。
用的阿里的:
deb https://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal main main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse
# deb https://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse
事情源于在树莓派上写的定时脚本,定时获取停车费用信息。ubuntu重装后时区都用tzselect设置了,但仍在半夜收到消息通知。
于是发现需要这样设置下。
执行这个设置成中国时区 timedatectl set-timezone Asia/Shanghai
查看本地时间 timedatectl status
还有最重要的,要重启下crontab的服务. systemctl restart cron
有些系统中crontab服务为 crond。
更多关于timedatectl的帮助可以查看这个:
问题来源于raspberry pi4 安装了打印服务,但是cups服务有点异常报,/etc/securetty找不到。
查了下应该是ubuntu 20.04的bug.
root@ubuntu:~# systemctl status cups
● cups.service - CUPS Scheduler
Loaded: loaded (/lib/systemd/system/cups.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-07-01 00:58:26 CST; 12min ago
TriggeredBy: ● cups.path
● cups.socket
Docs: man:cupsd(8)
Main PID: 8324 (cupsd)
Tasks: 2 (limit: 4434)
CGroup: /system.slice/cups.service
├─8324 /usr/sbin/cupsd -l
└─9318 /usr/lib/cups/notifier/dbus dbus://
Jul 01 01:08:15 ubuntu cupsd[8324]: pam_unix(cups:auth): Couldn't open /etc/securetty: No such file or directory
Jul 01 01:08:15 ubuntu cupsd[8324]: pam_unix(cups:auth): Couldn't open /etc/securetty: No such file or directory
Jul 01 01:08:22 ubuntu cupsd[8324]: pam_unix(cups:auth): Couldn't open /etc/securetty: No such file or directory
Jul 01 01:08:22 ubuntu cupsd[8324]: pam_unix(cups:auth): Couldn't open /etc/securetty: No such file or directory
Jul 01 01:08:27 ubuntu cupsd[8324]: pam_unix(cups:auth): Couldn't open /etc/securetty: No such file or directory
Jul 01 01:08:27 ubuntu cupsd[8324]: pam_unix(cups:auth): Couldn't open /etc/securetty: No such file or directory
Jul 01 01:08:29 ubuntu cupsd[8324]: pam_unix(cups:auth): Couldn't open /etc/securetty: No such file or directory
Jul 01 01:08:29 ubuntu cupsd[8324]: pam_unix(cups:auth): Couldn't open /etc/securetty: No such file or directory
Jul 01 01:08:39 ubuntu cupsd[8324]: pam_unix(cups:auth): Couldn't open /etc/securetty: No such file or directory
Jul 01 01:08:39 ubuntu cupsd[8324]: pam_unix(cups:auth): Couldn't open /etc/securetty: No such file or directory
解决的办法就是新建这个文件/etc/securetty,内容为