虚拟机 Ubuntu 配置

安装 aptitude

aptitude可以比apt-get更加智能地解决依赖问题,先安装它:

sudo apt-get install aptitude

安装build-essential

使用aptitude:

sudo aptitude install build-essential

这个可以解决gcc g++的一些依赖

root密码设置

在ubuntu系统下,为了安全起见,在安装过程中,系统屏蔽了用户设置root用户。导致很多用户在使用过程中不知道root密码到底是什么。

后来网上得到了解决方法:如下。

1、先解除root锁定,为root用户设置密码

打开终端输入:sudo passwd

Password: <--- 输入你当前用户的密码

Enter new UNIX password: <--- 新的Root用户密码

Retype new UNIX password: <--- 重复新的Root用户密码

passwd:已成功更新密码

2、更改登陆,允许root登录

打开 系统>系统管理>登录窗口)

点“安全”选项页,选择“允许本地管理员登录”。

3、注销当前用户,以root登陆

Ubuntu切换默认sh为bash或者dash

1 bash与dash

从Ubuntu 6.10开始,默认使用dash(theDebian Almquist Shell)而不是bash(the GNUBourne-Again Shell).但Login Shell还是bash. 原因是dash更快、更高效,而且它符合POSIX规范。Ubuntu在启动的时候会运行很多shell脚本,使用dash可以加快启动速度。

1.1 什么是bash ?

Bash(GNU Bourne-Again Shell)是许多Linux平台的内定Shell,事实上,还有许多传统UNIX上用的Shell,像tcsh、csh、ash、bsh、ksh等等,Shell Script大致都类同,当您学会一种Shell以后,其它的Shell会很快就上手,大多数的时候,一个Shell Script通常可以在很多种Shell上使用

1.2 什么是dash ?

dash is the standard command interpreter for the system. The current

version of dash is in the process of being changed to conform with the

POSIX 1003.2 and 1003.2a specifications for the shell.

2 切换bash和dash

2.1 查看与使用

先用命令ls -l /bin/sh看看

/bin/sh -> dash

我们会发现Ubuntu默认采用的是 dash

2.2 切换sh为bash

如果要修改默认的sh,可以采用命令

sudo dpkg-reconfigure dash

然后选择否

成功后再执行

ll /bin/sh

结果是: /bin/sh -> bash

修改成功!

2.3 切换sh为dash

当然我们也可以使用

sudo dpkg-reconfigure dash

把sh修改回去

之前由于这个bash的原因遇到过两次问题

1、一次是编译某个uboot的时候总是编译错误,原因就是 bin/sh 没有改成bash导致特有的执行脚本执行 命令出错

2、记录一下一个跟bash有关系的问题

用如下脚本跑的时候一直提示  cost_time=$[ $end_time-$start_time ] 这一行有问题

#!/bin/sh

start_time=$(date +%s)

sleep 1

end_time=$(date +%s)

cost_time=$[ $end_time-$start_time ]

echo "build kernel time is $(($cost_time/60))min $(($cost_time%60))s"

分析:

先用命令ls -l /bin/sh看看

/bin/sh -> dash

将脚本改为即可

#!/bin/bash

start_time=$(date +%s)

sleep 1

end_time=$(date +%s)

cost_time=$[ $end_time-$start_time ]

echo "build kernel time is $(($cost_time/60))min $(($cost_time%60))s"

解决“运行arm-linux-gcc命令,提示No such file or directory”的问题

今天在ubuntu14.04上安装arm的交叉编译器arm-linux-gcc,环境变量配置好以后,运行arm-linux-gcc命令,总提示No such file or directory。然后去arm-linux-gcc所在的目录下,发现不缺少任何文件。而且环境变量配置也是正确的(环境变量很easy,只要配置个path路径就行),因为arm-是可以补全的。之后又在网上下载了几个版本,甚至最新版,还是同样的问题。

搞了半天,才发现是ubuntu版本的问题。本人的ubuntu是64位,而下载的这些交叉编译器是32位的。因此需要安装ia32-libs库,如果apt-get 搜不到这个库的话,可以安装lib32ncurses5库,也是一样的。本人安装了后者,解决了该问题。

来自 <https://www.cnblogs.com/liangning/p/4273383.html>

解决libstdc++.so.6: cannot open shared object file: No such file or directory:问题

使用arm-linux-gcc工具时提示config.log提示

libstdc++.so.6: cannot open shared object file: No such file or directory:

原因在于,ubuntu 18.04 版本 ia32_libs 被废弃了导致没有32位的lib库。

解决方法

sudo apt-get install lib32stdc++6

gcc-multilib

/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory

compilation terminated.

解决方法为: sudo apt-get install gcc-multilib

g++-multilib

/usr/bin/ld: skipping incompatible /usr/lib/libstdc++.so when searching for -lstdc++

/usr/bin/ld: cannot find -lstdc++

collect2: ld returned 1 exit status

我的解决方法是这个

sudo apt-get install g++-multilib

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 安装Ubuntu Server LTS 安装教程 网络 ifconfig命令不能使用 1、直接输入:/sbin/i...
    guodd369阅读 2,944评论 0 0
  • 官网 中文版本 好的网站 Content-type: text/htmlBASH Section: User ...
    不排版阅读 9,955评论 0 5
  • 第一章 1.Linux是一套免费使用和自由传播的类UNIX操作系统,它可以基于Intel x86系列处理器以及Cy...
    yansicing阅读 10,806评论 0 9
  • 1、交叉编译 由于嵌入式系统资源匮乏,一般不能像 PC 一样安装本地编译器和调试器,不能在本地编写、编译和调...
    不配野心阅读 6,478评论 0 4
  • Ubuntu 常用命令大全 查看软件 xxx 安装内容 #dpkg -L xxx 查找软件 #apt-cache ...
    guiwuzhe阅读 7,414评论 0 14