General :: Sudo Apt-Get Update And Bash Script
Aug 9, 2011If I call a bash script with sudo, for example:
sudo bash script.sh
Do I still have to use sudo inside the script in cases like this:
sudo apt-get update
If I call a bash script with sudo, for example:
sudo bash script.sh
Do I still have to use sudo inside the script in cases like this:
sudo apt-get update
trying to get wine working was reading the tutorial-
"Complete Guide to Using Wine from the Command Line (Ubuntu)" first thing it said to do for ubuntu user's was this-
"Before I continue with my rant about gaming on Linux I would like to point out right now that the very first thing you should do when you install your ubuntu set up is to run the following:
Code:
user@ubuntu$ sudo aptitude update
user@ubuntu$ sudo aptitude install ubuntu-restricted-extras
but when i try and run in the terminal i get "command not found".
using ubuntu 11.4 natty kernel linux 2.6.38-8 generic gnome 2.32.1
I am from India, and I tried to update my Ubuntu system today. Code: $sudo apt-get update The update failed because the connection to the India mirror timed out: Code: [URL] Could not connect to in.archive.ubuntu.com:80 (111.91.91.37). - connect (110: Connection timed out) I tried the update a few times, with the same result every time.
I had firestarter running at this time, and noticed that I would get new security events every time I tried an update. I checked the events list, and it turned out that the machine at the ip address 111.91.91.37 (the in.archive.ubuntu.com machine, to go by the above error message) had been trying to make connections to seemingly random ports on the machine every time I tried the update: see the attached screenshot. I then changed my repositories to the Main Server using Synaptic, and tried the update again (from the command-line). This time it worked without a hitch, and firestarter did not report any unwanted incoming connection. why is the India mirror trying to open connections that the Main server apparently does not need in order for me to do the update? Should I (we) be concerned?
Just got a sudo update from the update manager-does anyone know what this specific update does?
View 4 Replies View Relatedhow to update a file that is already exist in bash. so far i haven found any. I'm using parameter as my first start for the existent, copy file to a different directory.
View 5 Replies View RelatedJust installed 10.04 64bit and in gnome-terminal i have no bash completion when sudo is used.For example:apt- gives apt-getbut sudo apt- does nothing, i get no suggestions from the terminal.
View 6 Replies View RelatedI'm working on a script which handles disaster recovery for a system I'm developing. Part of the script will also be used for initial setup. It needs to require as little user interaction as possible. It also needs to be run as root during most of the process. The problem is that there comes a point where some of the software can't be compiled or installed as root. So root needs to su to a regular user who then has to sudo in order to compile & install the aforementioned software. After all this, the script needs to revert to it's original state, running as root. I've never encountered a situation where root had to su to a normal user in order to sudo as root.
View 4 Replies View RelatedI have written a tiny script which switches between 2 CPU frequency throttling governors. Now I need to assign it to a shorcut key though "Preferences->Keyboard Shortcuts".
Here is the script:
Code:
#!/bin/bash
if [ `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor` = 'ondemand' ]
then
[code]....
As you can see this script involves sudo. I know that usually running commands with sudo requires "Run in Terminal" option for a shortcut, but in "Keyboard Shortcuts->Add" there is no option to run command in terminal. When I double click on the script and choose "Run in Terminal", then it functions as it should. How can I make this script execute by doing "Run" and not "Run in Termnal"?
I am wondering is it possible to echo values like below described? The situation is - there are too many "doc" files named like "PLCI507_01234567.doc", and there is a Form in a text file named "form.txt" looks like below:
I am already able to create files in the same format for each documents but now I want all the information in a single form and the form should be updated with file informations ie. file name, created date, md5sum etc.
The updated form.txt should be like below.
I had some bash scripts on Ubuntu 09.10 (mint version) that fail to work on Ubuntu 10.04. The line that fails is the following:
Code: # cat file_with_my-password.txt > sudo -S something cat: invalid option -- 'S' Try `cat --help' for more information. In my case "something" mounts some filesystems (that fail to load from fstab - bios "fake" raid 10), but I get the same error for any sudo command. It is the same script that used to work under 09.04 :-/
I was wondering is there a way to bind say "F5" to the command sudo apt-get update so I can press one key to write this into the terminal?
View 1 Replies View RelatedKernel 2.6.21.5, Slackware 12.0
Code:
Code:
On the other hand
Code:
So, I do not understand why the notification "sudo: cd: command not found", considering cd is a bash built-in command.
I just set up apache on my PC and I cant change the permissions by right clicking because "I'm not the owner" and instead of using the chmod command on every file that I would like to edit I would just like to write a script on a text file, save it to my desktop so all I have to do is double click on it and boom I can edit all my files, etc.
View 2 Replies View RelatedI'm creating a bash script to do some tasks for me. I would like the script to be run at a set time of everyday. My first question is if it is possible that if one of the commands in the script requires sudo, is there a way to get around it with out making sudo not require a password. Such as, is there a way to include the password in the script? If that is the case, I can always just set the file as read only by sudo. I've been looking for a way to do this, with no success. if I have a command that wants input, how do I give it to the program. For example, if I want to make a zip file that is encrypted, the command would go as:
Code:
zip -r example * -e
now how would I get the script to insert my wanted password.
I am having issues with Update Manager after cancelling an Update.The Update Manager shows a number of required updates, but when I click on Install Updates... Nothing happensWhen I launch sudo dpkg --configure -a in a terminal I receive the following message:dpkg: status database area is locked by another process.On another forum i saw something regarding a gksu.lock file that needed to be deleted... but I can't find any such file....If I try to launch update manager via a terminal: sudo update-manager I get the following error:
requiredDownload could not be calculated: E:Unable to parse package file /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_karmic-updates_main_binary-amd64_Packages (2), E:Unable to parse package file /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_karmic-updates_main_binary-amd64_Packages (1), E:Unable to parse package file /var/lib/apt/lists
[Code]....
I tried to execute sudo apt-get update in the terminal today, and I got the following output:
Code:
joseph@ubuntu:~$ sudo apt-get update
[sudo] password for joseph:
Get:1 http://dl.google.com stable Release.gpg [189B]
Hit http://us.archive.ubuntu.com karmic Release.gpg
Ign http://us.archive.ubuntu.com karmic/main Translation-en_US
[Code]...
I'm getting an error when typing in
Code:
sudo apt-get update
I receive:
Code:
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
I'm running Umbuntu 10.10 and am quite new to all this
I wanted to installed transmission on my buntu server box 10.10 tonite so from my laptop top i ssh'd into it...which took an unordinary amount of time.. went to type in sudo apt-get install transmission half way through each word at the terminal prompt it would just hang...had to wait then it would recognize my typing and i could continue....pressed enter waited a long time; then noticed i coulnd't connect to the repos?
So i manually (as in sitting at the box not over ssh) tried to ping google nothing....sudo apt-get update....nothing....
- i restarted the machine twice
-sudo ifdown eth0 /sudo ifup eth0
sudo nano /etc/networking/interfaces made sure it said
Quote:
I have my router saved to assign 192.168.0.100 to the machines eth0 MAC of 00:14:2a:e9:15:0b so i can always use my webUI w/o having to guess my ip ifconfig shows my broadcast running i dunno i'm sooo confused and lost scared...a lil' cold....kinda hungry..pretty tired....
I'm on cli no gui anyone ever have this?
Quote:
I can't check any update and can press button install Updates. I have this warning message. If I use terminal for update, I have this error (sudo apt-get update):
GPG error: [URL] natty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 638ABCA0FA3A1271
What does Ign means when I am running sudo apt-get update:
Code:
bas@ubuntu-lt:~$ sudo apt-get update | grep Ign | grep xbmc
Ign http://ppa.launchpad.net/team-xbmc/ppa/ubuntu/ lucid/main Translation-en_US
When I go to terminal and run
Code:
It runs for a while, then at the end it gives me a error message that says:
Code:
Now what am I supposed to do to fix this problem?
I just got this error message when Update Manager tried updating:
Could not initialize the package information
An unresolvable problem occurred while initializing the package information.
Please report this bug against the 'update-manager' package and include the following error message:
'E:Type 'sudo' is not known on line 56 in source list /etc/apt/sources.list'
I've been using Ubuntu for awhile, so I know my way around some stuff, but I'm completely lost on what to do here.
I am not able to install any package through sudo apt-get install <package name> and when I run sudo apt-get update , I am getting the below output .
onadmin@ubuntu:~$ sudo apt-get update
Err http://us.archive.ubuntu.com maverick Release.gpg
Something wicked happened resolving 'us.archive.ubuntu.com:http' (-5 - No address associated with hostname)
Err http://us.archive.ubuntu.com/ubuntu/ maverick/main Translation-en
[Code]...
Everytime I run sudo apt-get update, it updates most of my sources, and then asks for me to insert the installation disc, once I have it finishes. Do I have to insert the disc every time? it won't finish updating without it..
View 2 Replies View RelatedRecently sudo apt-get update (and all other apt-get commands) has resulted in the error:
Quote:
I have apt installed, and I don't know of any changes I've made (I booted a Freebsd install dvd but I didn't end up installing (i'm looking at putting it onto an external hdd).
Output of sudo find / -name "apt-get" -print:
Quote:
Quote:
Quote:
I still seem to be able to install/update from update manager and synaptic, but I rely on command line for apt-get update when I'm not at uni (which runs through a proxy).
Can't seem to update apt-get. Can anyone help with this? I've attached a screenshot of the output of
Code:
sudo apt-get update After trying this once, I decided to verify that there was an internet connection. I pinged some IP addresses and almost each ping went perfectly. If that can be ruled out, what is the next step?
It is my understanding that they do the same: they ask for my password (if I am allowed in /etc/sudoers), and give me a login shell as root.
Is there any difference between them?
sudo su -
sudo -i
Also, what's the difference between
sudo su
sudo -s
I think that they both ask for my password, and give me a shell with my old environment variables.
I have succesfully installed Debian with gnome-core, iceweasel and other useful packages and also followed this guide to autologin and start X. I noticed that the sudo chmod +s /sbin/halt and adding /sbin/halt
in ~/.bashrc made Debian refuse me to log out (from X) and 'log out' turns off the computer insted.Removing /sbin/halt from .bashrc turned everything to as i want it. Should I "repair" or remove something I created with chmod +s command or should I leave it as it is?
Also I would like apt-get(or aptitude) update to run after login (and before startx), so i added sudo apt-get update to .bashrc but it will prompt me with password. Is there someway I could do this without the password(s) which su/sudo needs to execute? This is not so important but it would be very nice to update the system on startup.
On a Xp host I installed last version of VirtualBox and I created a 9.10 Ubuntu 'guest'.While I can surf the net, I cant 'sudo apt-get update' nor do a 'reload' from 'Synaptic Package Manager'.
PS Here are some facts:
<<
Host:
PC:
Thinkcenter 9640-7BG
Network adapters:
[Code]...
I recently installed Xubuntu (9.10) in my computer, but... I have been having intermitent hard disk problems, and so I decided to google a little and after reading this:
[URL]
I did use Synaptic to search for smartmontools and then install it.
Synaptic complained that it couldn't autenticate the packet, but I figured this was happening because... this is not an application supported by Canonical? I clicked and installed the packet (well, in fact, I *think* it has installed two applications, not just one).
Then later, I saw one of those arrows at the top right of the screen, and clicked it to install updates. Synaptic told me to update SUDO. Hmm... serious. And then even more: it told me that it couldn't autenticate it I stopped the installation and registered at these forums.
And more: before posting, I tried to reproduce the "error" (and again, stop before installing the "suspicious" SUDO update) but Synaptic now autenticated it troubleless and installed it.
Well, now I have a LOT of questions:
1. Where do I place this post?. Security?. Hardware problems?. Update and installation? (Linux noobiness?)
2. my hard disk?. I've read somewhere that an application called "fsck"
3. What may have happened with Synaptic?. Why wouldn't it autenticate a SUDO update?
4. Have I done something wrong?. Something unrepairable?
5. Can I trust the SUDO version that now I have installed in my system?
6. How could I check what has Synaptic exactly installed?. Is there any log file anywhere in my system?