cirosantilli / linux-kernel-module-cheat

The perfect emulation setup to study and develop the Linux kernel v5.4.3, kernel modules, QEMU, gem5 and x86_64, ARMv7 and ARMv8 userland and baremetal assembly, ANSI C, C++ and POSIX. GDB step debug and KGDB just work. Powered by Buildroot and crosstool-NG. Highly automated. Thoroughly documented. Automated tests. "Tested" in an Ubuntu 24.04 host.
https://cirosantilli.com/linux-kernel-module-cheat
GNU General Public License v3.0
4.2k stars 605 forks source link

using docker fails with command not found #225

Open ysimhony opened 2 years ago

ysimhony commented 2 years ago
acovs@yacovs:~/Desktop/linux-kernel-module-cheat$ sudo apt-get install docker 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
docker is already the newest version (1.5-2).
0 upgraded, 0 newly installed, 0 to remove and 141 not upgraded.
yacovs@yacovs:~/Desktop/linux-kernel-module-cheat$ ./setup 
+ '[' 0 -eq 1 ']'
+ y=
+ '[' -f /.dockerenv ']'
+ sudo=sudo
+ sudo apt-get update
Hit:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu jammy InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
+ '[' -f /.dockerenv ']'
+ git=git
+ sudo apt-get install git python3 python3-pip python3-distutils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-pip is already the newest version (22.0.2+dfsg-1).
git is already the newest version (1:2.34.1-1ubuntu1.4).
python3 is already the newest version (3.10.6-1~22.04).
python3-distutils is already the newest version (3.10.6-1~22.04).
0 upgraded, 0 newly installed, 0 to remove and 141 not upgraded.
+ python3 -m pip install --user -r requirements.txt
Requirement already satisfied: Cython==0.29.15 in /home/yacovs/.local/lib/python3.10/site-packages (from -r requirements.txt (line 1)) (0.29.15)
Requirement already satisfied: china-dictatorship==0.0.74 in /home/yacovs/.local/lib/python3.10/site-packages (from -r requirements.txt (line 2)) (0.0.74)
Requirement already satisfied: pexpect==4.6.0 in /home/yacovs/.local/lib/python3.10/site-packages (from -r requirements.txt (line 3)) (4.6.0)
Requirement already satisfied: ptyprocess>=0.5 in /usr/lib/python3/dist-packages (from pexpect==4.6.0->-r requirements.txt (line 3)) (0.7.0)
yacovs@yacovs:~/Desktop/linux-kernel-module-cheat$ ./run-docker create
+ sudo docker build -t lkmc .
sudo: docker: command not found
Traceback (most recent call last):
  File "/home/yacovs/Desktop/linux-kernel-module-cheat/./run-docker", line 69, in <module>
    cmd_action_map[args.cmd](args.args)
  File "/home/yacovs/Desktop/linux-kernel-module-cheat/./run-docker", line 57, in <lambda>
    'create': lambda args: create(args),
  File "/home/yacovs/Desktop/linux-kernel-module-cheat/./run-docker", line 17, in create
    sh.run_cmd(docker + ['build', '-t', image_name, '.', LF])
  File "/home/yacovs/Desktop/linux-kernel-module-cheat/shell_helpers.py", line 457, in run_cmd
    raise e
Exception: Command exited with status: 1

My ubuntu version is:

yacovs@yacovs:~/Desktop/linux-kernel-module-cheat$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
cirosantilli commented 2 years ago

Weird. So if you run sudo docker or docker on the host terminal manually the command exists?

ysimhony commented 2 years ago
yacovs@yacovs:~/Desktop/linux-kernel-module-cheat$ sudo apt-get install docker
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
docker is already the newest version (1.5-2).
0 upgraded, 0 newly installed, 0 to remove and 94 not upgraded.
yacovs@yacovs:~/Desktop/linux-kernel-module-cheat$ sudo docker 
sudo: docker: command not found
ysimhony commented 2 years ago

Hi @cirosantilli,

Any suggestion?

Shall I try use ubuntu 20.04 instead?

Thanks,

cirosantilli commented 2 years ago

Just in case: are you sure you are not running docker inside docker?

If you can't install and run docker on Ubuntu host which is what it seems like, then that is a big problem that I can't understand.

cirosantilli commented 2 years ago

Is your PATH messed up? Does /usr/bin/docker exist?

ysimhony commented 2 years ago

Hi @cirosantilli

This is what I found:

yacovs@yacovs:~/linux-5.8.1_2/linux-5.8.1$ sudo find / -name docker [sudo] password for yacovs: find: ‘/run/user/1000/doc’: Permission denied find: ‘/run/user/1000/gvfs’: Permission denied /usr/share/doc/docker

coltensu commented 1 year ago

I have the same problem,using "sudo snap install docker" can solve this issue.