You are not logged in.

#1 2010-01-24 12:08:55

UQ-igor
Member
Registered: 2009-03-05
Posts: 42

How to keep pacman up-to-date

Hi,

I'm wondering how do you keep pacman synced regularly, i.e. pacman -Sy? As a cron job? Manually every day?

I'm asking because it seems all applets/scripts that rely on pacman -Qu to report the number of packages that can be upgraded require a sync with pacman -Sy before they will report the correct number of upgradeable packages.  So, to have accurate pacman -Qu a pacman -Sy must be issued first, and if this is used for desktop applets and such, then I suppose pacman -Sy is scheduled to run automatically at some time interval. Is this correct? Is pacman -Sy just a cron job?

Thanks for clarifications,
-Igor

Offline

#2 2010-01-24 12:21:26

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,094

Re: How to keep pacman up-to-date

A better solution would to have a script that checks against the rss feed.

Running -Sy as a cron job can be a bit dangerous, specially if you one day forget to -Su and do a -S foobar (and that pulls in some new lib, which causes 1/2 your system to break)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#3 2010-01-24 12:22:00

robrene
Member
Registered: 2009-04-16
Posts: 168

Re: How to keep pacman up-to-date

$ cat /etc/cron.hourly/refresh-pacman 
#!/bin/bash
pacman -Sy

I have an hourly cron job that calls pacman -Sy. This way my conky (that relies on pacman -Qu) is updated regularly enough. Be sure not to forget to make the script executable (chmod +x)

edit
Mr Elendig, I don't understand what kind of scenario could break my system. Wouldn't the dependencies of my old packages make sure that the new version of the library can't be installed?

Last edited by robrene (2010-01-24 12:23:48)


smile neutral sad big_smile yikes wink hmm tongue lol mad roll cool

Offline

#4 2010-01-24 12:29:23

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,472
Website

Re: How to keep pacman up-to-date

No.  "pacman -Sy" is bad... Read this thread:
http://bbs.archlinux.org/viewtopic.php?id=89328

Offline

#5 2010-01-24 12:32:42

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,094

Re: How to keep pacman up-to-date

robrene wrote:

Mr Elendig, I don't understand what kind of scenario could break my system. Wouldn't the dependencies of my old packages make sure that the new version of the library can't be installed?

Example:
http://bbs.archlinux.org/viewtopic.php?id=75327


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#6 2010-01-24 12:42:49

sHyLoCk
Member
From: /dev/null
Registered: 2009-06-19
Posts: 1,197

Re: How to keep pacman up-to-date

UQ-igor wrote:

Hi,

I'm wondering how do you keep pacman synced regularly, i.e. pacman -Sy? As a cron job? Manually every day?

Manually, every day.


~ Regards,
sHy
ArchBang: Yet another Distro for Allan to break.
Blog | GIT | Forum (。◕‿◕。)

Offline

#7 2010-01-24 12:45:45

SoleSoul
Member
From: Israel
Registered: 2009-06-29
Posts: 319

Re: How to keep pacman up-to-date

Simply use pacman -Syu when updating.

Offline

#8 2010-01-24 13:31:51

robrene
Member
Registered: 2009-04-16
Posts: 168

Re: How to keep pacman up-to-date

I always use pacman -Syu when updating, and I never update single packages. What would be a better method to figure out how many new packages there are for my conky script then if pacman -Sy is really this evil? I can't say it's ever gotten me into any trouble, but then again in those linked threads I only see a lot of talk but I don't really understand what the main problem is about just having a synced list of the available software versions.


smile neutral sad big_smile yikes wink hmm tongue lol mad roll cool

Offline

#9 2010-01-24 14:54:06

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: How to keep pacman up-to-date

i have a nightly cronjob on my server that does a pacman -Syuw --noconfirm.

use pkgd to relay packages through the lan to rest of the network.

pacman -Syu daily manually. except for my laptop under testing which right now is just -Syuw due to libpng/libjpg updates. making core/extra/comunity updates manually.

now a question: is there a way to make pacman -Syu not upgrade testing packages? this is until the rebuild is done wink

Offline

#10 2010-01-24 15:02:13

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,472
Website

Re: How to keep pacman up-to-date

eldragon wrote:

now a question: is there a way to make pacman -Syu not upgrade testing packages? this is until the rebuild is done wink

Sure...  edit your pacman.conf tongue

Offline

#11 2010-01-24 15:09:58

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: How to keep pacman up-to-date

Allan wrote:
eldragon wrote:

now a question: is there a way to make pacman -Syu not upgrade testing packages? this is until the rebuild is done wink

Sure...  edit your pacman.conf tongue

ghag, thats not quite what i was looking for wink

something of the sorts of pacman -Syu /extra

but i guess not.

Offline

#12 2010-01-24 18:03:13

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: How to keep pacman up-to-date

@Mr.Elendig or Allan - is running pacman -Syy as a cron job also a bad idea?

Offline

#13 2010-01-24 18:12:40

Mardoct
Member
Registered: 2009-08-17
Posts: 208

Re: How to keep pacman up-to-date

sHyLoCk wrote:
UQ-igor wrote:

Hi,

I'm wondering how do you keep pacman synced regularly, i.e. pacman -Sy? As a cron job? Manually every day?

Manually, every day.

Never had a major breakage that way.


The human being created civilization not because of willingness but of a need to be assimilated into higher orders of structure and meaning.

Offline

#14 2010-01-24 18:16:22

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: How to keep pacman up-to-date

eldragon wrote:
Allan wrote:
eldragon wrote:

now a question: is there a way to make pacman -Syu not upgrade testing packages? this is until the rebuild is done wink

Sure...  edit your pacman.conf tongue

ghag, thats not quite what i was looking for wink

something of the sorts of pacman -Syu /extra

but i guess not.

Putting testing after all other repos in pacman.conf should do the trick.

Offline

#15 2010-01-24 18:20:19

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: How to keep pacman up-to-date

anonymous_user wrote:

@Mr.Elendig or Allan - is running pacman -Syy as a cron job also a bad idea?

yes

Offline

#16 2010-01-25 03:28:57

choogi
Member
Registered: 2009-10-06
Posts: 60

Re: How to keep pacman up-to-date

One of the things that I miss from Ubuntu is how synaptic would automatically notify you when you have new packages to install.  I thought it was really annoying when I actually used Ubuntu, but now I'm understanding why it's useful.  I don't have the diligence to run "pacman -Suy" manually every day; I usually don't get around to running it but once every 2 weeks or so.  What inevitably happens is that every 2 weeks I have a massive list of packages to update and if one of the packages happens to break my system, then I have a really difficult time of figuring out which package(s) to roll back.

Does anyone have a more automated way of doing a system update that will still ask you before installing each package?  I guess you could make a cron script that executes "urxvtc -e sudo pacman -Suy" to open a terminal and execute "pacman -Suy," but I don't think this is a very good solution.  If there are any errors during the update, the terminal will close immediately and you will not be able to see the errors.  Does anyone know of a better way?

Offline

#17 2010-01-25 03:41:03

Mardoct
Member
Registered: 2009-08-17
Posts: 208

Re: How to keep pacman up-to-date

choogi wrote:

One of the things that I miss from Ubuntu is how synaptic would automatically notify you when you have new packages to install.  I thought it was really annoying when I actually used Ubuntu, but now I'm understanding why it's useful.

I've been having a great time with this as a cron job and this in my conky.


The human being created civilization not because of willingness but of a need to be assimilated into higher orders of structure and meaning.

Offline

#18 2010-01-25 03:50:58

choogi
Member
Registered: 2009-10-06
Posts: 60

Re: How to keep pacman up-to-date

That's a pretty slick solution.  Unfortunately I'm using xinerama (one monitor in landscape mode, one monitor in portrait mode) and can't use conky b/c xinerama doesn't support double buffering sad

Offline

#19 2010-03-22 10:49:52

tawan
Member
Registered: 2010-03-02
Posts: 290
Website

Re: How to keep pacman up-to-date

my current solution is this. OK I call it manually but as as far as I can tell this is safest.

The call Super+U

#!/bin/bash
# used to check if user realy wants to do updates
zenity --question --title="Pacman Update" --text="Check and install updates?" --timeout="11"
case $? in
    0)
        terminator -e ~/bin/myupdate --geometry 930x420
        exit
    ;;
    1)
        exit
    ;;
    -1)
        exit
    ;;
esac

The update script (~/bin/myupdate)

#!/bin/bash
# does an update
echo ":: updating system..."
sudo pacman -Syu
echo " "
echo ":: update complete..."
echo " "
sleep 2s
# function to check for and remove orphan packages
# this function looped by the while loop later
function orphanage {
echo ":: checking if orphan packages exist on the system..."
ORPHANS=`pacman -Qqdt`
if [ -z "$ORPHANS" ]
then
    echo ":: system is clean, will exit..."
    sleep 3s
    exit
else
    echo -e ":: orphans found on the system.\n$ORPHANS\n\n:: Removing..."
    sudo pacman -R --nosave $ORPHANS
fi
}
# end of orphan function
#
#
# infinite loop to find and remove orphan packages
# script exits when none found
while [ 1 ]
do
orphanage
done
# end of loop
#
#
# choose echo error message or zenity error message
echo ":: ** update script did not exit normally!"
#zenity --warning --text="Update script did not exit normally"
sleep 8s
exit

Offline

#20 2010-09-02 09:50:24

deteego
Member
Registered: 2009-09-21
Posts: 19

Re: How to keep pacman up-to-date

Sorry for bumping this, however does this mean that pacman has no functionality to check for updates periodically without having to alter the local database (or the ability to sync the local database periodically using pacman -Sy and then not having to worry about pacman -S <package> breaking your system just so pacman -Qu actually gets recent updates)

Would be even better if pacman could properly check for updates without even requiring root privileges at all

Last edited by deteego (2010-09-02 09:53:59)

Offline

#21 2010-09-02 10:33:14

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,358

Re: How to keep pacman up-to-date

deteego wrote:

Sorry for bumping this, however does this mean that pacman has no functionality to check for updates periodically without having to alter the local database (or the ability to sync the local database periodically using pacman -Sy and then not having to worry about pacman -S <package> breaking your system just so pacman -Qu actually gets recent updates)

Would be even better if pacman could properly check for updates without even requiring root privileges at all

Pacman manages packages. Regular updates of the local database should be done manually or with a cron.

Even if you update your database regularly pacman -S still can break stuff, you would need to -Su first. In which case you would rather -Syu anyway.

And of course the updates need root priviledges, otherwise a rogue app (or person) could modify your pacman database.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#22 2010-09-02 10:57:00

deteego
Member
Registered: 2009-09-21
Posts: 19

Re: How to keep pacman up-to-date

Actually thats incorrect (thanks to keenerd on irc for his help), and I was never talking about syncing or even changing the local database. All I want to do is the ability to check for updates based on a mirror (without changing the local database at all), something which practically every other package manager supports with a trivial command and something which I found out is possible (read below) but ugly (requires root, and the script would be like 5-10 lines since you have to create directories and/or check if they exist in tmp etc etc)

It is actually possible to check for updates (based on your arch mirror) without altering your local system at all by doing

pacman -Sy --dbpath /tmp/somedir/
pacman -Qu --dbpath /tmp/somedir/

The problem is that pacman -Sy --dbpath requires root, however it means its possible without resorting to the pacman -Sy method which can lead to issues later on. pacman should really have a command like pacman -Qyu which would do the above in a single command (and without having to worry messing around with /tmp), the command simply fetching the database from the mirror specified in your mirrorlist, and checks your packages against that mirror to see if any need updating (without actually updating the local database) and DOES NOT REQUIRE ROOT (since it doesn't actually need root)

Then the user can go "ahhh I have some updates" and do a pacman -Syu

Last edited by deteego (2010-09-02 11:08:01)

Offline

#23 2010-09-02 11:40:45

Cdh
Member
Registered: 2009-02-03
Posts: 1,098

Re: How to keep pacman up-to-date

 ~ % packer syndigator
1 chris@chriseee ~ % packer pacman update
0 aur/pacmon-svn 17-1
    Tray applet that notifies the user of available pacman updates 
1 aur/kpacupdate 0.2.1-1
    Pacman update notification tool for the KDE system tray. 
2 aur/noteo-pacmanstatus 0.0.3-1
    Module for noteo which can check for/launch system updates via pacman 
3 aur/pacupdate-svn 44-1
    A simple update notifier for Arch Linux (pacman) 
4 aur/zenman 1.8-2
    PacMan frontend (tray update notifier) for GTK/GNOME/zenity/libnotify. Simplier, more straightforward and less annoying Alunn alternative. zenman --help for more... 
5 aur/pacmail 0.1.5-1
    An email notification daemon for Arch Linux (pacman) updates 
6 aur/bpac 0.0.4-1
    bpac is a simple script for pacman update notification. which does not need sudo. 
7 aur/pupdatenotifier 0.2-1
    An update notifier and update installer for Arch Linux (pacman). 
8 aur/packagekit-pacman 0.6.7-2
    A system designed to make installation and updates of packages easier. Pacman backend supplied by PirateJonno 

฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz

Offline

#24 2010-09-02 12:54:28

deteego
Member
Registered: 2009-09-21
Posts: 19

Re: How to keep pacman up-to-date

Cdh do those programs update depending on your local database or your mirror (thats the golden question smile )

I have created a message in the pacman-dev mailing list for a patch (so you dont require root do do pacman -Sy --dbpath /tmp/somedir/)

Last edited by deteego (2010-09-02 12:54:45)

Offline

#25 2010-09-02 13:07:09

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: How to keep pacman up-to-date

deteego wrote:

The problem is that pacman -Sy --dbpath requires root

There's a workaround, followed by a "but" (and then another hackish workaround).

$ fakeroot pacman -Sy --dbpath /tmp/somedir
:: Synchronizing package databases...
 testing                                   15.9K  246.1K/s 00:00:00 [--------------------------------------] 100%
 core                                      35.5K  237.2K/s 00:00:00 [--------------------------------------] 100%
 extra                                    463.0K  841.3K/s 00:00:01 [--------------------------------------] 100%
 community-testing                          0.7K   20.3M/s 00:00:00 [--------------------------------------] 100%
 community                                380.8K  781.2K/s 00:00:00 [--------------------------------------] 100%

But.. If you're specifying /tmp/somedir as your --dbpath, you're never going to go find any updates because the local and sync DBs live in the same place. So... the solution to that is:

$ ln -s /var/lib/pacman/local /tmp/somedir
$ pacman -Qu --dbpath /tmp/somedir
make 3.81-5
vim 7.3-1
vim-runtime 7.3-1
xf86-input-evdev 2.4.0-2
xkeyboard-config 1.8-1
xorg-server 1.8.1.902-1

Tada!

Offline

Board footer

Powered by FluxBB