/etc/init.d/rcS 导致无法进入系统

2023-05-16

使用putty 和 pscp 自制了一个生产脚本,脚本中从windows复制程序和启动文件至linux系统中,系统重启后,提示如下信息,找不到 /etc/init.d/rcS文件

can't run '/etc/init.d/rcS': No such file or directory
can't open /dev/ttyO0: No such file or directory
can't open /dev/ttyO0: No such file or directory
can't open /dev/ttyO0: No such file or directory
can't open /dev/ttyO0: No such file or directory

最后查找原因是在git提交时,把脚本的换行符由LF改为了CRLF
导致Linux不能识别/etc/init.d/rcS文件
使用dos2uninx命令转换换行符后解决。

关于CRLF、CR、LF的解释:

  • CR:Carriage Return,对应ASCII中转义字符,\r,表示回车
  • LF:Linefeed,对应ASCII中转义字符,\n,表示换行 CRLF
  • CRLF:Carriage Return & Linefeed,\r\n,表示回车并换行

Windows操作系统采用两个字符来进行换行,即CRLF
Unix/Linux/Mac OS X操作系统采用单个字符LF来进行换行
另外,MacIntosh操作系统(即早期的Mac操作系统)采用单个字符CR来进行换行。

批量转换编码格式:其中Linux 上可以用 dos2unix指令直接转换,反之使用unix2dos命令
在git bash环境中已经有 dos2unixunix2dos命令

name@win MINGW64 /
$ which dos2unix.exe
/usr/bin/dos2unix.exe

name@win MINGW64 /
$ which unix2dos.exe
/usr/bin/unix2dos.exe

$ dos2unix.exe -h -v
Usage: dos2unix [options] [file ...] [-n infile outfile ...]
 --allow-chown         allow file ownership change
 -ascii                convert only line breaks (default)
 -iso                  conversion between DOS and ISO-8859-1 character set
   -1252               use Windows code page 1252 (Western European)
   -437                use DOS code page 437 (US) (default)
   -850                use DOS code page 850 (Western European)
   -860                use DOS code page 860 (Portuguese)
   -863                use DOS code page 863 (French Canadian)
   -865                use DOS code page 865 (Nordic)
 -7                    convert 8 bit characters to 7 bit space
 -b, --keep-bom        keep Byte Order Mark
 -c, --convmode        conversion mode
   convmode            ascii, 7bit, iso, mac, default to ascii
 -f, --force           force conversion of binary files
 -h, --help            display this help text
 -i, --info[=FLAGS]    display file information
   file ...            files to analyze
 -k, --keepdate        keep output file date
 -L, --license         display software license
 -l, --newline         add additional newline
 -m, --add-bom         add Byte Order Mark (default UTF-8)
 -n, --newfile         write to new file
   infile              original file in new-file mode
   outfile             output file in new-file mode
 --no-allow-chown      don't allow file ownership change (default)
 -o, --oldfile         write to old file (default)
   file ...            files to convert in old-file mode
 -q, --quiet           quiet mode, suppress all warnings
 -r, --remove-bom      remove Byte Order Mark (default)
 -s, --safe            skip binary files (default)
 -u,  --keep-utf16     keep UTF-16 encoding
 -ul, --assume-utf16le assume that the input format is UTF-16LE
 -ub, --assume-utf16be assume that the input format is UTF-16BE
 -v,  --verbose        verbose operation
 -F, --follow-symlink  follow symbolic links and convert the targets
 -R, --replace-symlink replace symbolic links with converted files
                         (original target files remain unchanged)
 -S, --skip-symlink    keep symbolic links and targets unchanged (default)
 -V, --version         display version number

dos2unix命令可以批量转换,可以自动跳过二进制文件

$ dos2unix.exe *
dos2unix: Skipping bin, not a regular file.
dos2unix: Binary symbol 0x01 found at line 1
dos2unix: Skipping binary file bridge
dos2unix: converting file cmdInstall.txt to Unix format...
dos2unix: converting file cmdRemove.txt to Unix format...
dos2unix: Skipping ext, not a regular file.
dos2unix: converting file xxt.bat to Unix format...
dos2unix: Skipping int, not a regular file.
dos2unix: converting file ReadMe.txt to Unix format...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

/etc/init.d/rcS 导致无法进入系统 的相关文章

  • 四轴飞行前检查及解锁

    一 飞行前的检查及注意事项 1 飞控的校正遥控器中 xff0c 每个通道与MP中显示的通道校正条是否一致 xff0c 遥控器控制杆摇动的方向是否正确 2 飞控的校正是否已经完成了全部校正 3 电机的的安装序号是否与飞控OUTPUT的通道数一
  • pixhawk之NSH调试

    一 ardupilot固件 windows环境 前期准备 1 xff1a pix烧录程序 xff0c Arducopter或者library中的example都可以实现 2 xff1a 拔掉SD卡 xff08 脚本中提到的没有SD卡进入ns
  • 目标检测(yolov3)实现---darknet的C语言版本

    环境安装 ubuntu opencv cuda cudnn gt920m 参考 https blog csdn net qq 36362060 article details 80739573 darknet github地址 https
  • C++PrimerPlus学习笔记——第9章内存模型和名称空间(最全最详细)

    注 xff1a 这一章都是理解记忆性的内容 xff0c 因此笔者在某些知识点会将自己的理解话语写上 xff0c 便于可读性和方便理解 本章内容包括 xff1a 单独编译 xff1b 存储持续性 作用域和链接性 xff1b 定位 xff08
  • 图论——拓扑排序及最短路径算法模板

    一 拓扑排序 span class token comment 将入度为0的点写入myQueue span vector span class token operator lt span span class token keyword
  • 2022 PAT 甲级秋 100分

    PAT2022秋 有一题是卡着时间复杂度去做的结果AC了 希望大家也能来一起交流下最优解 踩气球 AC 这道题调试了很久 才开始用的哈希表内存太大了 span class token macro property span class to
  • 十大排序 C++代码

    span class token macro property span class token directive hash span span class token directive keyword include span spa
  • 位运算实现加减乘除、交换

    span class token macro property span class token directive hash span span class token directive keyword include span spa
  • 智能指针模拟实现C++

    span class token keyword template span span class token operator lt span span class token keyword typename span span cla
  • 转:卷积神经网络的卷积核大小、个数,卷积层数如何确定呢?

    卷积神经网络的卷积核大小 卷积层数 每层map个数都是如何确定下来的呢 xff1f 看到有些答案是刚开始随机初始化卷积核大小 xff0c 卷积层数和map个数是根据经验来设定的 xff0c 但这个里面应该是有深层次原因吧 xff0c 比如下
  • 生产者消费者模型c++

    span class token macro property span class token directive hash span span class token directive keyword include span spa
  • 关于vscode断点调试

    很多人习惯在 Chrome 的调试窗口中调试 Vue 代码 xff0c 或者直接使用 console log 来观察变量值 xff0c 这是非常痛苦的一件事 xff0c 需要同时打开至少 3 个窗体 个人还是更加习惯于断点调试 这篇文章将介
  • 斐讯T1电视盒子刷机指南,已排大坑

    斐讯T1刷机详细指南 xff0c 老手直接看小标题的括号 1 准备好一些文件 xff08 中心思想就是刷写工具 降级img 新系统img xff09 1 0 你需要准备一条双usb头的线 1 1 新系统固件 1 2 斐讯T1官方系统降级文件
  • 关于在conda环境下,pip已安装好包,但是python import错误的解决方法

    1 pip uninstall 那个包 2 conda install 那个包 或者 复制系统python目录下的Lib gt site packages文件夹覆盖conda虚拟环境下的对应文件夹 原因 xff1a pip为系统的pip x
  • win10 系统 U盘无法删除卷

    我的一个U盘折腾来折腾去 xff0c 现在用win10 自带分区磁盘管理的时候 xff0c 右键U盘 删除卷 xff0c 显示不支持该请求 解决办法 xff1a 1 cmd中运行diskpart 2 lisk disk 3 sel disk
  • termux 修改自定义字体

    需要先安装termux styling termux 运行chfont可修改预设的二十几种字体 xff0c 接下来的操作可以添加自己的字体 将字体文件复制到 termux fonts 里 xff0c 再运行chfont就能看到自己的字体了
  • windows平台,mingw64编译环境下的socket使用

    代码并不重要 xff0c 主要看最后的编译命令 xff1a span class token comment test cpp span span class token macro property span class token di
  • [有/无]刷,[直/交]流,[同/异]步,各种电机概念区分

    本质上 xff0c 所有的电机都是交流电机 直 交流电机 xff0c 通常是俗语 要想让电机转子转起来 xff0c 任何电机的绕组都要不断地改变电流方向 xff0c 电流大小呈正弦波或者方波 xff08 方波也可看做正弦波近似 xff09
  • opencv 快速简单二值化的做法

    大家在网上搜索opencv二进制 xff0c 很多人会告诉你用threshold等函数 这类函数虽然支持自适应等功能 xff0c 但是参数比较多 xff0c 有点复杂 我们只要简单二值化的时候可以用以下做法 xff1a Mat img sp
  • ubuntu18.04 使用systemd方式添加开机运行sh脚本

    ubuntu18 04压根就没有rc local xff0c 而且很多发行版都推荐使用systemd而不是initd了 1 准备好你的sh脚本文件 内容略过 xff0c 就假设路径是 usr local my my sh吧 别忘了chmod

随机推荐