i had problem to show bootup steps and each step's time in an embedded linux project on cubieboard2. so i solved the problem using grabserial. to do so follow below instructions:
1- download grabserial from: https://github.com/tbird20d/grabserial
2- extract downloaded files and go to extracted directory
3- make grabserial file executable using below script in the terminal:
Sudo chmod +x grabserial
4- install required packages using below script:
sudo apt-get install python-setuptools
5- do below copy:
sudo cp grabserial /usr/local/bin
6- exit from the extracted folder using cd /..
7- connect your device to your PC using com0 port.
8- type below script in the terminal to save output of com0 port into bootTime.txt file.
sudo grabserial -d /dev/ttyS0 -m RomBoot -t -e 30 &>>bootTime.txt
9- if you want to show bootTime.txt content in the terminal, open a new terminal and type below script:
tailf bootTime.txt
Related
Currently I'm stuck at figuring out why a .sh script isn't running:
export DOWNLOAD_LOCATION=~/Downloads/
export VAGRANT_URL=https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.dmg
export VIRTUALBOX_URL=https://download.virtualbox.org/virtualbox/6.1.2/VirtualBox-6.1.2-135662-OSX.dmg
echo "===== Install Vagrant ====="
wget $VAGRANT_URL -P $DOWNLOAD_LOCATION
hdiutil attach $DOWNLOAD_LOCATION"vagrant_2.2.6_x86_64.dmg"
sudo installer -pkg /Volumes/Vagrant/vagrant.pkg -target /
echo "===== Install VirtualBox ====="
wget $VIRTUALBOX_URL -P $DOWNLOAD_LOCATION
hdiutil attach $DOWNLOAD_LOCATION"VirtualBox-6.1.2-135662-OSX.dmg"
sudo installer -pkg /Volumes/VirtualBox/virtualbox.pkg -target /
echo "===== Install MiniKF ====="
vagrant init arrikto/minikf
vagrant up
Windows is telling that:
./install.sh: line 9: wget: command not found
./install.sh: line 10: hdiutil: command not found
./install.sh: line 11: sudo: command not found
I have wget installed in Visual studio, do I need to install it for windows?
why a .sh script isn't running
It is calling commands, which are not available, namely wget, hdiutil, sudo.
There exist GNU Wget for Windows, which is wget.exe file and after placing in current working directory calls for wget and wget.exe should work, however hdiutil is more important here. My cursory search did not unveil hdiutil for Windows, so even if you make wget working you still need find some way to use .dmg file in your Windows system.
So I've just created my very first docker image (woohoo) and was able to run it on the original host system where it was created (Ubuntu 20.04 Desktop PC). The image was executed using docker run -it <image_id>. The expected command (defined in CMD which is just a bash script) was run, and the expected output was seen. I assumed this meant I successfully created my very first docker image and so I pushed this to Docker Hub.
Docker Hub
GitHub repo with original docker-compose.yml and Dockerfile
Here's the Dockerfile:
FROM ubuntu:20.04
# Required for Debian interaction
# (https://stackoverflow.com/questions/62299928/r-installation-in-docker-gets-stuck-in-geographic-area)
ENV DEBIAN_FRONTEND noninteractive
WORKDIR /home/benchmarking-programming-languages
# Install pre-requisites
# Versions at time of writing:
# gcc -- version (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
# make -- GNU Make 4.2.1
# curl -- 7.68.0
RUN apt update && apt install make build-essential curl wget tar -y
# Install `column`
RUN wget https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.35/util-linux-2.35-rc1.tar.gz
RUN tar xfz util-linux-2.35-rc1.tar.gz
WORKDIR /home/benchmarking-programming-languages/util-linux-2.35-rc1
RUN ./configure
RUN make column
RUN cp .libs/column /bin/
WORKDIR /home/benchmarking-programming-languages
RUN rm -rf util-linux-2.35-rc1*
RUN apt install python3 pip -y
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN apt install default-jdk-headless -y
RUN apt install rustc -y
# Install GoLang
RUN wget https://go.dev/dl/go1.17.8.linux-amd64.tar.gz
RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.8.linux-amd64.tar.gz
ENV PATH="/usr/local/go/bin:${PATH}"
# Install Haxe and Haxelib
RUN wget https://github.com/HaxeFoundation/haxe/releases/download/4.2.5/haxe-4.2.5-linux64.tar.gz
RUN tar xfz haxe-4.2.5-linux64.tar.gz
RUN ln -s /home/benchmarking-programming-languages/haxe_20220306074705_e5eec31/haxe /usr/bin/haxe
RUN ln -s /home/benchmarking-programming-languages/haxe_20220306074705_e5eec31/haxelib /usr/bin/haxelib
# # Install Neko (Haxe VM)
# RUN add-apt-repository ppa:haxe/snapshots -y
# RUN apt update
# RUN apt install neko -y
RUN if ! test -d /home/benchmarking-programming-languages; then mkdir /home/benchmarking-programming-languages && echo "Created directory /home/benchmarking-programming-languages."; fi
COPY . /home/benchmarking-programming-languages
RUN pip install -r /home/benchmarking-programming-languages/requirements_dev.txt
CMD [ "/home/benchmarking-programming-languages/benchmark.sh -v" ]
However, upon pulling the same image on my Windows 10 machine (same machine as above just dual booted) and a Windows 11 laptop using both the Docker Desktop application and the command line (docker pull mariosyian/benchmarking-programming-languages followed by docker run -it <image_id>). Both which give me the following error
Error invoking remote method 'docker-run-container': Error: (HTTP code 400) unexpected - failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/home/benchmarking-programming-languages/benchmark.sh -v": stat /home/benchmarking-programming-languages/benchmark.sh -v: no such file or directory: unknown
Despite this, running the image as a container with a shell (docker run -it <image_id> sh), I am successfully able to, not only see the file, but execute it with no errors! Can someone suggest a reason for why the error happens in the first place, and how to fix it?
In your Dockerfile you have specified the CMD as
CMD [ "/home/benchmarking-programming-languages/benchmark.sh -v" ]
This uses the JSON syntax of the CMD instruction, i.e. is an array of strings where the first string is the executable and each following string is a parameter to that executable.
Since you only have a single string specified docker tries to invoke the executable /home/benchmarking-programming-languages/benchmark.sh -v - i.e. a file named "benchmark.sh -v", containing a space in its name and ending with -v. But what you actually intended to do was to invoke the benchmark.sh script with the -v parameter.
You can do this by correctly specifying the parameter(s) as separate strings:
CMD ["/home/benchmarking-programming-languages/benchmark.sh", "-v"]
or by using the shell syntax:
CMD /home/benchmarking-programming-languages/benchmark.sh -v
I have a Ubuntu 20.04 running within WSL 2 on a Windows 10 computer.
Every time I login to Ubuntu, I had to manually execute these four line by pasting it one by one in the Windows 10 Terminal.
sudo apt-get update && sudo apt-get install -yqq daemonize dbus-user-session fontconfig
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME
sudo /etc/init.d/xrdp start
May I know if there is a way to skip this manual process?
You can use .bashrc file to execute commands whenever you open the terminal. It should be located at $HOME directory.
cd $HOME
nano .bashrc
place your commands at the end of the file, press ctl+x then y to save.
I'm trying to run an executable file as sudo using terminal at startup but I'm having some issues. I couldn't find the solution in other answers, so I opened up this one. I'm using a Raspberry Pi 3 B+ with the Raspbian Stretch with desktop and recommended software downloaded from the official Raspberry Pi website.
I have an executable that needs to be run with sudo (I use the pigpio library to communicate with another hardware through SPI and if I don't run the executable with sudo, the pigpio doesn't work). What I'm trying to achieve is that when the Pi finishes to startup the graphical interface, it would run the LXTerminal and execute "sudo home/pi/myfolder/myprogram".
I've tried:
sudo nano ~/.config/autostart/myprogram.desktop
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=myprogram
Exec=lxterminal -e "sudo /home/pi/myfolder/myprogram"
Terminal=true
sudo chmod a+r ~/.config/autostart/myprogram.desktop
Also tried:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
lxterminal --command="sudo /home/pi/myfolder/myprogram"
Both methods did open the lxterminal at startup, but didn't executed my program.
Can anyone help me out?
I found the solution, so I'm gonna post it here in case someone else needs it. If it already exists in somewhere else around here, feel free to tag it as duplicated.
The solution that worked for me was this:
sudo nano ~/.config/autostart/myprogram.desktop
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=myprogram
Exec=lxterminal -e bash -c 'sudo /home/pi/myfolder/myprogram;$SHELL'
Terminal=true
sudo chmod a+r ~/.config/autostart/myprogram.desktop
The $SHELL makes the terminal stay open after myprogram ends its execution. If you don't need this feature, just exclude the ;$SHELL part of the code above.
I've installed docker on mac os as written in documentation.
But in some docs (for example in the docker book) I see the recomendations to use man docker-run (man docker-pull, etc).
But when I run such command I get the error:
bessarabov#bessarabov-osx:~$ man docker
No manual entry for docker
How can I install docker man-documentation to my Mac OS system?
As of 2017.06.01, you have to git checkout your desired tag/version from
version >= 17.06: https://github.com/docker/docker-ce
version < 17.06: https://github.com/moby/moby
and then, go to the components/cli directory and execute:
make -f docker.Makefile manpages
To add the manpages to the manpath:
echo "MANPATH $PWD/man" | sudo tee -a /private/etc/man.conf
Source: https://github.com/docker/cli/issues/217
It looks like docker has slightly changed since #Sergiy's answer. Here is a slightly updated version that worked for me.
git clone https://github.com/docker/docker.git
cd docker/man # looks like the directory has moved up
docker build -t docker/md2man . # don't forget the '.'
docker run -v $PWD/:/docs:rw -w /docs -i docker/md2man /docs/md2man-all.sh
sudo cp -R man* /usr/share/man/ # you'll likely need sudo access for this
man docker # check it worked
Until the issue is resolved you can build man pages manually via a docker container using the supplied Dockerfile and then just copy generated files to /usr/share/man/:
# Step 1: checkout docker sources, but make sure you do this
# somewhere in /Users directory because boot2docker can only
# share this path with docker containers
git clone https://github.com/docker/docker.git
# Step 2: build docker image
cd docker/docs/man
docker build -t docker/md2man .
# Step 3: build man pages
docker run -v /Users/<path-to-git-dir>/docker/docs/man:/docs:rw \
-w /docs -i docker/md2man /docs/md2man-all.sh
# Step 4: copy generated man pages to /usr/share/man
cp -R man* /usr/share/man/
Enjoy!
It seems the go/glide bits under the hood of docker/md2man have changed since #gilly's answer. What I ended up doing, on Mac OS:
cd /usr/local
git clone https://github.com/docker/docker.git
brew install ruby
gem install md2man
cd docker/man
mkdir man1; for i in *.1.md; md2man-roff $i > man1/${i%.md}; done
cd /usr/local/share/man/man1
for i in ../../../docker/man/man1/*.1; do ln -s $i .; done