custom system.d service fails at startup

I created a service to keep my vpn alive all the time. Whenever the OpenVPN disconnects for any reason the script is restarted by the service. First the script resolves the address provided by my VPN provider to a set of ip addresses and then updates the firewall accordingly. After that it initiates the VPN connection.

When I start my service like this it works fine:

sudo systemctl start alwayson 

But it should start automatically at system startup but after startup I get:

‚óŹ alwayson.service - Always on VPN service    Loaded: loaded (/etc/systemd/system/alwayson.service; disabled; vendor preset    Active: inactive (dead) 

after running the command:

systemctl status alwayson 

Here are the scripts:

alwayson.service:

[Unit] Description=Always on VPN service  After=ufw.service  [Service] Type=idle Restart=always RestartSec=3 ExecStart=/bin/bash /home/user/VPN/alwayson-service/run.sh  [Install] WantedBy=multi-user.target 

run.sh:

echo "Updating FireWall.."  # Remove all rules list="$  (ufw status numbered | awk -F"[][]" '{print $  2}' | tac)" for item in $  list do     echo $  item     ufw --force delete $  item done   # let all incoming traffic pass ufw default deny incoming # and block outgoing by default ufw default deny outgoing ufw allow out to  8.8.8.8 ufw allow in from 8.8.8.8 ufw allow out on tun0 ufw allow out 53  # Allow local IPv4 connections ufw allow out to 10.0.0.0/8 ufw allow out to 172.16.0.0/12 ufw allow out to 192.168.0.0/24 ufw allow in from 192.168.0.0/24  # Allow IPv4 local multicasts ufw allow out to 224.0.0.0/24 ufw allow out to 239.0.0.0/8  # Allow local IPv6 connections ufw allow out to fe80::/64 # Allow IPv6 link-local multicasts ufw allow out to ff01::/16 # Allow IPv6 site-local multicasts ufw allow out to ff02::/16 ufw allow out to ff05::/16   # Update Rules for VPN  list="$  (dig +short remote 4-1-gb.cg-dialup.net)" for item in $  list do     echo $  item     ufw allow out to $  item         ufw allow in from $  item done  # Enable the firewall ufw enable  openvpn --config /home/doctor/VPN/UK/openvpn.ovpn --script-security 2 --up /home/doctor/VPN/alwayson-service/up.sh --down /home/doctor/VPN/alwayson-service/down.sh --up-restart 

Can somebody give me some advice on how to run it at startup?

Help (Initramfs) v1.27.2 from startup – how to fix?

“BusyBox v1.27.2 (Ubuntu 1:1.27.2-2ubuntu3.2) built-in shell (ash) Enter ‘help’ for a list of built-in commands.”

I am a novice and understand little about Ubuntu. Could someone help me and give me a more in depth explaination? Perhaps a step-by-step guide?

I worked with LibreOffice and couldnt save. I closed down all my files, restarted nicely and then this happened. Im frightened that I might lose all my 6 hours of work!!

Regards, Alexander

How to setup a loopback audio device on startup

My environment is Ubuntu 18.04 x64.

I want to create a virtual audio device and connect it to a real speaker when the OS starts up.

I’ve confirmed these operations by entering the following commands to the terminal(*Device names are some omitted):

sudo modprobe snd-aloop pcm_substreams=2

pactl load-module module-loopback source=alsa_output.platform-snd_aloop sink=alsa_output.pci

I wrote them in “/etc/rc.local” and “/etc/pulse/default.pa” but it didn’t work.

Please tell me target files for startup setting and the correct text.

Ubuntu 18.04 stuck on verbose screen on startup

I had done a sudo apt-get upgrade and was installing some packages(truffle,nodejs) when my laptop stopped responding and applications were not opening so I restarted it and when it booted it got stuck in the verbose boot screen and blinking intermittently.
All were showing [OK] so I pressed ALT + F2 and was able to login but it showed a few python value errors in file “/usr/lib/python3/dist-packages/lsb_release.py” ValueError: could not convert string to float: '6.06 LTS'
How can I fix this and complete the boot sequence please help?

Startup disk creator: Installation failed

I’m trying to create a startup disk on ubuntu 19.04 using the startup disk creator, but after selecting the image (ubuntu 19.04) and the disk (/dev/mmcblk0), it just throws up an error: Could not write the disk image /home/karl/Downloads/ubuntu-mate-19.04-desktop-amd64.iso to the device (/dev/mmcblk0)

Looking in syslog, I see this error:

Jul 19 09:00:11 tp-main com.ubuntu.USBCreator[897]: DEBUG:root:_check_polkit_privilege: sender :1.776 on connection pid 19120 is not authorized for com.ubuntu.usbcreator.image: dbus.Dictionary({}, signature=dbus.Signature(‘ss’))

bash startup variable expression

I have the idea that I would like to add an environment variable (“waitTillReady”) to my ~/.bashrc file, such that instead of doing this:

while [ "$ (pidof -s make)" -o "$ (pidof -s gcc)" -o "$ (pidof -s ld)" ]; do echo "Still compiling..." && sleep 1; done && printf "\n%.0s" {1..20} && date && echo "THINGS ARE READY FOR YOU NOW..."

I want to be able to do this: $ waitTillReady && echo "THINGS ARE READY FOR YOU NOW..."

I tried to edit my ~/.bashrc file like with different combinations of the following:

... export waitTillReady="while [ "$  (pidof -s make)" -o "$  (pidof -s gcc)" -o "$  (pidof -s ld)" ]; do echo "Still compiling..." && sleep 1; done && printf "\n%.0s" {1..20} && date" ... 

E.g. I tried to enclose everything insider a single quote ‘ and I tried to escape the \” in the middle… Could anyone please help and tell what I should write in the ~/.bashrc file, after the “export waitTillReady=” line?

I would be grateful to hear any suggestions/ideas (and maybe an explanation of what I’m doing wrong), thanks!

Occasional Freezing on Startup. ASUS Zenbook UX333FA running Zorin 15

I am running Zorin 15 core on my Zenbook UX333FA, which has Intel HD graphics. It will freeze on startup (almost every time) at either a blank black or grey screen. I then have to hold the power button to power off, and then start from the boot screen, which usually works. However sometimes it freezes again and I have to repeat 3-4 times before it works. When it works, some code is quickly shown across a black screen, which minimizes to the top left corner, and then the zorin logo and startup begin. Everything works fine from there.

How do I stop this freezing problem? I’ve searched all over, but every solution is related to NVIDIA drivers, and I don’t think I have NVIDIA graphics. Especially since when I go to additional drivers in updates, it shows nothing is available. Please help, it’s quite annoying!

Sourcing Environments on Startup

I am new Ubuntu User working Robot Operating System on 16.04 LTS version. I installed ROS using their official ROS-Wiki instructions at this link.

Every time I need to run a ros program I need to source ros environment using

source /opt/ros/kinetic/setup.bash

Every time I open new terminal I need to source the environment. Is it possible to write a shell script to do the sourcing job on start-up. how to make it common for all terminals ?

Thanks in Advance.