apt-get with quiet option is still noisy - bash

Trying to use apt-get in a script, so I'm using the apt-get -qq -y option, as I want to have my install script show something like...
Installing SUDO....DONE
But for some reason apt-get is still producing lots of output, with this option, which means I end up getting...
Installing SUDO....
Selecting previously unselected package sudo.
(Reading database ... 48056 files and directories currently installed.)
Preparing to unpack .../sudo_1.8.10p3-1+deb8u5_amd64.deb ...
Unpacking sudo (1.8.10p3-1+deb8u5) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for systemd (215-17+deb8u5) ...
Setting up sudo (1.8.10p3-1+deb8u5) ...
DONE
So my install script just looks messy for a basic package install, let alone for all the other packages.
Am I missing something?

Try to run sudo DEBIAN_FRONTEND=noninteractive apt-get install -qq sudo < /dev/null > /dev/null
Source: https://peteris.rocks/blog/quiet-and-unattended-installation-with-apt-get/

here is an example that is totally quiet and does not output any line on my machine including warnings. Used 2>/dev/null to disable warnings as well
!apt install octave -qq 2>/dev/null >/dev/null;

Related

Why i can't install RStudio in ubuntu 19.04?

I can't install RStudio in Ubuntu 19.04, it gives me the following error in the terminal, I really appreciate the guidance you can give me, thanks
$ sudo dpkg -i rstudio-1.2.5042-amd64.deb
(Reading database ... 302725 files and directories currently installed.)
Preparing to unpack rstudio-1.2.5042-amd64.deb ...
Unpacking rstudio (1.2.5042) over (1.2.5042) ...
dpkg: dependency problems prevent configuration of rstudio:
rstudio depends on libclang-dev; however:
Package libclang-dev is not installed.
dpkg: error processing package rstudio (--install):
dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.32.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-4ubuntu1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for shared-mime-info (1.10-1) ...
Errors were encountered while processing:
rstudio
libclang-dev depends of libclang-8-dev -> libobjc-8-dev -> libobjc4-dev
Try sudo apt-get install gdebi-core and then sudo gdebi rstudio-1.2.5042-amd64.deb. gdebi will install the dependencies automatically for you.
There is another way with apt if you don't want to install gdebi; I believe the syntax is sudo apt install ./rstudio-1.2.5042-amd64.deb.
Alternatively, if you already forced dpkg to install the package, you can run sudo apt-get --fix-broken install to install the dependencies.
Try install version
rstudio-xenial-1.1.456-amd64.deb in
https://www.rstudio.org/download/daily/desktop/ubuntu64/
Bro!

Getting error on ubuntu 10 ec2 server while apt install

sudo apt install tasksel
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package libopencv-video2.4v5 needs to be reinstalled, but I can't find an archive for it.
I'd recommend : sudo dpkg --remove --force-all libopencv-video* &&
sudo apt-get update
sometimes it needs the machine to be restarted
Also you could try :
apt-get -f install
apt-get autoremove
apt-get purge libopencv-video*
apt-get purge
apt-get clean
if apt didn't work you can also manually download .deb file and install it using dpkg -i file.deb
Note: pick the file based on your ubuntu version and arch
https://packages.ubuntu.com/trusty/i386/libopencv-video2.4

Docker Install Wine Dockerfile EULA

I have a little problem to install Wine on my alpine image.
Here is my Dockerfile :
RUN dpkg --add-architecture i386 && sudo apt-get update
RUN sudo apt-get install software-properties-common python-software-properties
RUN sudo add-apt-repository ppa:ubuntu-wine/ppa
RUN sudo apt-get update
RUN sudo apt-get install wine1.8 winetricks
RUN sudo apt-get purge software-properties-common python-software-properties
RUN rm -rf /tmp/* /var/lib/apt/lists/* /root/.cache/*
CMD /bin/bash;
All seems to work well, but during the sudo apt-get install wine1.8 winetricks I have this EULA screen :
Of course I don't have the right to write "YES". I tried :
RUN echo "yes" | sudo apt-get install wine1.8 winetricks
RUN sudo apt-get -y install wine1.8 winetricks
What can I do ?
Note: In the interest of edification, I would love it if a more learned linux/docker user could explain the mechanics behind why my solution worked for me.
Possible Solution:
I encountered this exact problem. I must have tried every conceivable way to pass an argument via my Dockerfile that would accept the EULA; to include piping an echo of "yes" to the wine installation command, as you've tried, setting environment variables and so-on. So, you're not alone here. I did, however, find a very simple solution through experimentation.
It turns out that if you install the TrueType core fonts (the package the EULA is for) before installing wine, you can pass it the "yes" input like so and wine will never prompt for the EULA:
RUN echo "yes" | apt install ttf-mscorefonts-installer -y
I'm not sure why this is. I suspect that it's because installing wine installs several other packages/dependencies in the process, and the echo/pipe approach does not extend to all packages that wine attempts to install. Perhaps by installing the fonts separately, the wine installation script either disregards the package because it's already present, or some file within the font installation logs the EULA acceptance response.
Here's the contents of my Dockerfile. I'm on Ubuntu 16.04 LTS, using Docker version 18.02.0-ce, build fc4de44:
FROM ubuntu:16.04
RUN dpkg --add-architecture i386
RUN apt-get update -y
RUN echo "yes" | apt install ttf-mscorefonts-installer -y
RUN apt-get install wine -y
I see it's four months since this post was made, but if you haven't found a solution, I hope this helps!

How to make a script with apt-get commands?

I'm doing a script which installs a tcl plugin.
But this tcl plugin require some additional tcl/tk libraries, so I was thinking about putting an APT-GET install command for installing these libraries.
Is there a way to use the APT-GET install command in a script (it can be Shell script, Perl or even Tcl)?
This is an example of how to do it with one line and assumes you are running the script with sudo or have appropriate privilege.
apt-get -qq update && apt-get -qq --yes --force-yes install tcl
-qq suppresses output unless an error occurs
--yes answers the prompt 'Do you want to continue? [Y/n]'
--force-yes installs packages that come from a private repository
Consider running apt-get update & earlier in the script. Check or wait for the job to finish before using apt-get install
You can list multiple packages on one line. Packages are installed in the order they are listed.

shell script to install a package if not alreay installed

I have made a C program, but it depends on the ncurses library. So, when i give my code to anyone else, I have to ask him/her to install ncurses library first then only compile the code using the Makefile i provided.
However, I want to write a shell script which will automatically install ncurses if it is NOT already installed. So that I can simply ask my friend to run the script.
This is what i want the script to do ::
if(ncurses-dev package not installed)
sudo apt-get install ncurses-dev
I know it is a very basic question, but i dont know how to do it. I tried google search but could not find a simple tutorial which i could understand.
For fedora
if ! rpm -qa | grep -qw $package_name$; then
yum install $package_name
fi
For UBUNTU
#!/bin/sh
for package; do
dpkg -s "$package" >/dev/null 2>&1 && {
echo "$package is installed."
} || {
sudo apt-get install $package
}
done
This can be used for checking multiple packages as well.
To automatically install without user interaction on Debian(In your case Ubuntu), you could use the --force-yes --yes switches in your command line args list. Like so:
sudo apt-get --force-yes --yes install package

Resources