Why does 'fbi' not show splash image during system startup? - splash-screen

I'm trying to provide a splashscreen for Raspbian Stretch using fbi. Based upon some tutorials I found here my situation:
/etc/systemd/system/splashscreen.service
[Unit]
Description=Splash screen
DefaultDependencies=no
After=local-fs.target
[Service]
ExecStart=/usr/bin/fbi -T 1 -d /dev/fb0 --noverbose /opt/logo.png
[Install]
WantedBy=sysinit.target
enabled (checked the symlink under sysinit.target.wants).
/boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=ee397c53-02 rootfstype=ext4 elevator=deadline rootwait quiet logo.nologo loglevel=1 fsck.mode=skip noswap ro consoleblank=0
p
/boot/config.txt
hdmi_drive=2
dtparam=i2c_arm=on
dtparam=spi=on
dtparam=audio=on
dtparam=i2c1=on
dtoverlay=i2c-rtc,ds1307
disable_splash=1
Executing the exactly same command (fbi -T 1 -d /dev/fb0 --noverbose /opt/logo.png) from prompt leads to show the image as expected.
In the boot messages I can't find any error. Any thought?

I finally got this to work! Here's what I did (essentially copied from https://yingtongli.me/blog/2016/12/21/splash.html, with a few small changes that made it work for me).
Install fbi: apt install fbi
Create /etc/systemd/system/splashscreen.service with:
[Unit]
Description=Splash screen
DefaultDependencies=no
After=local-fs.target
[Service]
ExecStart=/usr/bin/fbi --noverbose -a /opt/splash.png
StandardInput=tty
StandardOutput=tty
[Install]
WantedBy=sysinit.target
The only thing I did differently from the article linked above is remove the -d flag from the /usr/bin/fbi command (the command was originally /usr/bin/fbi -d /dev/fb0 --noverbose -a /opt/splash.png). I'm guessing fb0 was the wrong device and leaving it out just means fbi will use the current display device and gets it right.
Put your splash images in /opt/splash.png.
Enable the service: systemctl enable splashscreen
I'm still trying to figure out how to get rid of the rest of the boot text, but this is a step in the right direction.

Related

mkdir and mount in initramfs

I am writing an initramfs, executed in busybox, in which I mount a partition using those commands:
/bin/busybox mount -n -t proc proc /proc
mount -n -t devtmpfs devtmpfs /dev
mount -n -t sysfs sysfs /sys
mount -n -t tmpfs inittemp /mnt
mkdir /mnt/saved
mount -n -t "${rootfstype}" -o "${rootflags}" ${device} /mnt/saved
But when the system starts up, I have this error:
mount: mounting /dev/mmcblk0p2 on /mnt/saved failed: No such file or directory
I know that when the device is not found, there is a message like Device does not exist, so I think the problem is coming from the directory /mnt/saved that is not correctly created yet.
I tried adding an ls -l /mnt after the mkdir to check that the directory is correctly created, but most of the time, if I do so, the error disappears. So I though the problem might be synchronization problem (of the tmpfs, weird!) So I tried some other things like creating a dummy file in the directory to force a kind of synchronisation. This works, but is a dirty workaround and I want to find the real cause of the problem to build a clean solution.
By the time I was writing my question, I finally found the solution by myself… I post it anyway just in case somebody is stuck like me.
Actually, the mount command of busybox does not show a message about device, if it cannot find it, but always show No such file or directory.
My problem was actually coming from the root device which was not ready yet, and so not in the /dev directory yet. In order to make it work correctly, I simply added this line before the mount:
while ${rootwait} && ! [ -b "${device}" ]; do sleep 1; done

wi-fi disconnected during crouton installation

I purchased an Asus c300m with the soul aim of developing my linux skills
I followed the instruction to boot in developer mode and execute the following command to start downloading downloading crouton/ubuntu on it
sudo sh -e ~/Downloads/crouton -t xfce
it was going well until my wifi disconnected temporary and i got the following error:
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Failed to complete chroot setup
Unmounting /mtn.stateful_partition/crouton/chroots/precise..
Then I tried to run the sudo command again but I got the following:
/usr/local/chroots/precise already has stuff in it!
Either delete it, specify a different name (-n) or specify -u to update it
However, I'm not sure how to modify the command so i can resume installation or restart it.
You could try sudo sh ~/Downloads/crouton -u -n xfce but it's unlikely that will work. That's from the Crouton docs.
The best approach, since you never finished installing and therefore don't need to recover any data, just delete the install directory and start again. There is no good way for crouton the pick up where it left off.
Also during the install you don't want the Chromebook going to sleep. There is no way in the built-in ChromeOS settings to prevent that but according to this article you can go to the Chrome Web Store and install Keep Awake from Google.
This gives a cool icon in the upper right of the Chrome browser showing a sun, a sunset or a moon depending on what settings you want. Before you start your next install, click it to the sun so the machine won't sleep.
I had the same problem. I ran this and it's downloading:
sudo sh ~/Downloads/crouton -e -t xfce -u
I'm not sure if it's where i left off but it is definitely downloading and reinstalling after the interrupted connection.
Just type in sudo start[desktop environment]
and press y. It should keep going.

Restarting a service in Openstack installed using Devstack

How to restart a specific openstack-service installed using devstack?
Rejoin stack screen as
./rejoin-stack.sh
and move to the specified service page using ctrl+a+", then type the number of the screen you need to go.
Hit 9 and then ctrl+C. The service would be stopped now. Re-run the following devstack command to start the service:
(e.g for nova-network)
cd /opt/stack/nova && /usr/bin/nova-network --config /etc/nova/nova.conf || echo "n-net failed to start" | tee "/opt/stack/stack/n-net.failure"
Hit Ctrl+d to detach from the stack screen.
To run screen command
screen -r
Now, you will be in screen window and you can see the list of Openstack services; Like "q-svc", "horizon", "key-access" in the bottom of the screen;
The current active screen will be marked with * like "horizon*"
To move to specific Openstack service press
"Ctrl + a" and "0-9"
Example: "Ctrl + a" 5
to jump to actual service; You can also move to next or previous screen using the below commands
"Ctrl + a" and n --- > for next
"Ctrl + a" and p --- > for previous
Now to stop and start the service; Go the respective screen window and press
"Ctrl + c"
To stop the service; This will now show the bash screen in the respective screen window; and to start the service, press UP arrow mark to see the last executed command in the screen window and press enter to start the same.
Life is easier with screen to start and stop the Openstack services configured to run with Devstack.
When ./stack.sh completes, openstack is ostensibly running.
as your stack user, you can then issue this command:
screen -dr
this should open up a screen session with windows for each of the services. the services are running from those screen terminal sessions or ptys.
you can simply kill the process and restart it from those ptys.
of course standard logical order of operations apply. if mysql is dead, nova-api won't start up very well. same goes for keystone being off. so, pay attention to dependencies.
if you are unsure of how to execute the services in the terminals, first do a ps auxww | grep service or something to that affect. That should provide some insight on how to run the binaries again.
Good luck.
rejoin-stack.sh was remove according this git commit, you need to do screen -c /path/to/devstack_install/stack-screenrc
Run this command as root (for example: to start keystone service)
$ systemctl start devstack#keystone.service
You can use restart, stop, status, etc. in place of start as your need.
you can use wildcard as well. Like as below.
$ systemctl start devstack#*
=> it will start all devstack services.
Things has changed in new version devstack.
By default DevStack is run with all the services as systemd unit
files. Systemd is now the default init system for nearly every Linux
distro, and systemd encodes and solves many of the problems related to
poorly running processes.
Assuming the unit n-cpu to make the examples more clear.
Enable a unit (allows it to be started):
sudo systemctl enable devstack#n-cpu.service
For more information, visit https://docs.openstack.org/devstack/latest/systemd.html
you can use systemctl start devstack#* to restart every devstack service

Beaglebone Boot to Qt App

I have searched & googled a lot but I cannot get this to work.
I want the Beaglebone to boot up into my Qt application. However, what I get is that the GUI boots up OK but then in a few seconds the Angstrom login screen overwrites my GUI, which stays running in the background.
I set up a systemd service as follows in /etc/systemd/system:
#!/bin/sh
[Unit]
Description=Meta Systemd script
[Service]
USER=root
WorkingDirectory=/home/root
ExecStart=/bin/sh -c 'source /etc/profile ; /home/root/meta6 -qws'
After=local-fs.target
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
I activated it with:
systemctl enable meta.service
I disabled gdm with:
systemctl disable gdm
I suspect that maybe I should change the After statement to wait 'til some other service is complete. But what?
Regards,
James
The following commands will disable gdm on Beaglebone Black running angstrom
update-rc.d -f gdm remove
systemctl disable gdm.service
Consider removing
#!/bin/sh
Also add the following to the file
[Unit]
After=getty#.service or getty.target
Also change the following
[Service]
ExecStart=/home/root/meta6 -qws'
The following might not be required
[Service]
After=local-fs.target
Reference
Creating Ångström System Services on BeagleBone Black

Run a service automatically in a docker container

I'm setting up a simple image: one that holds Riak (a NoSQL database). The image starts the Riak service with riak start as a CMD. Now, if I run it as a daemon with docker run -d quintenk/riak-dev, it does start the Riak process (I can see that in the logs). However, it closes automatically after a few seconds. If I run it using docker run -i -t quintenk/riak-dev /bin/bash the riak process is not started (UPDATE: see answers for an explanation for this). In fact, no services are running at all. I can start it manually using the terminal, but I would like Riak to start automatically. I figure this behavior would occur for other services as well, Riak is just an example.
So, running/restarting the container should automatically start Riak. What is the correct approach of setting this up?
For reference, here is the Dockerfile with which the image can be created (UPDATE: altered using the chosen answer):
FROM ubuntu:12.04
RUN apt-get update
RUN apt-get install -y openssh-server curl
RUN curl http://apt.basho.com/gpg/basho.apt.key | apt-key add -
RUN bash -c "echo deb http://apt.basho.com precise main > /etc/apt/sources.list.d/basho.list"
RUN apt-get update
RUN apt-get -y install riak
RUN perl -p -i -e 's/(?<=\{http,\s\[\s\{")127\.0\.0\.1/0.0.0.0/g' /etc/riak/app.config
EXPOSE 8098
CMD /bin/riak start && tail -F /var/log/riak/erlang.log.1
EDIT: -f changed to -F in CMD in accordance to sesm his remark
MY OWN ANSWER
After working with Docker for some time I picked up the habit of using supervisord to tun my processes. If you would like example code for that, check out https://github.com/Krijger/docker-cookbooks. I use my supervisor image as a base for all my other images. I blogged on using supervisor here.
To keep docker containers running, you need to keep a process active in the foreground.
So you could probably replace that last line in your Dockerfile with
CMD /bin/riak console
Or even
CMD /bin/riak start && tail -F /var/log/riak/erlang.log.1
Note that you can't have multiple lines of CMD statements, only the last one gets run.
Using tail to keep container alive is a hack. Also, note, that with -f option container will terminate when log rotation happens (this can be avoided by using -F instead).
A better solution is to use supervisor. Take a look at this tutorial about running Riak in a Docker container.
The explanation for:
If I run it using docker run -i -t quintenk/riak-dev /bin/bash the riak process is not started
is as follows. Using CMD in the Dockerfile is actually the same functionality as starting the container using docker run {image} {command}. As Gigablah remarked only the last CMD is used, so the one written in the Dockerfile is overwritten in this case.
By using CMD /bin/riak start && tail -f /var/log/riak/erlang.log.1 in the Buildfile, you can start the container as a background process using docker run -d {image}, which works like a charm.
"If I run it using docker run -i -t quintenk/riak-dev /bin/bash the riak process is not started"
It sounds like you only want to be able to monitor the log when you attach to the container. My use case is a little different in that I want commands started automatically, but I want to be able to attach to the container and be in a bash shell. I was able to solve both of our problems as follows:
In the image/container, add the commands you want automatically started to the end of the /etc/bash.bashrc file.
In your case just add the line /bin/riak start && tail -F /var/log/riak/erlang.log.1, or put /bin/riak start and tail -F /var/log/riak/erlang.log.1 on separate lines depending on the functionality desired.
Now commit your changes to your container, and run it again with: docker run -i -t quintenk/riak-dev /bin/bash. You'll find the commands you put in the bashrc are already running as you attach.
Because I want a clean way to have the process exit later I make the last command a call to the shell's read which causes that process to block until I later attach to it and hit enter.
arthur#macro:~/docker$ sudo docker run -d -t -i -v /raid:/raid -p 4040:4040 subsonic /bin/bash -c 'service subsonic start && read -p "waiting"'
WARNING: Docker detected local DNS server on resolv.conf. Using default external servers: [8.8.8.8 8.8.4.4]
f27229a260c9
arthur#macro:~/docker$ sudo docker ps
[sudo] password for arthur:
ID IMAGE COMMAND CREATED STATUS PORTS
35f253bdf45a subsonic:latest /bin/bash -c service 2 days ago Up 2 days 4040->4040
arthur#macro:~/docker$ sudo docker attach 35f253bdf45a
arthur#macro:~/docker$ sudo docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
as you can see the container exits after you attach to it and unblock the read.
You can of course use a more sophisticated script than read -p if you need to do other clean up, such as stopping services and saving logs etc.
I use a simple trick whenever I start building a new docker container. To keep it alive, I use a ping in the entrypoint script.
So in the Dockerfile, when using debian, for instance, I make sure I can ping.
This is btw, always nice, to check what is accessible from within the container.
...
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& apt-get install -y iputils-ping
...
ENTRYPOINT ["entrypoint.sh"]
And in the entrypoint.sh file
#!/bin/bash
...
ping 10.10.0.1 >/dev/null 2>/dev/null
I use this instead of CMD bash, as I always wind up using a startup file.

Resources