LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-25-2024, 01:06 PM   #1
linuxsl
LQ Newbie
 
Registered: Jan 2024
Posts: 2

Rep: Reputation: 0
Slackware Update tips


Hey guys! I have a question and I hope you slacker can answer me and tell me about your experience!Basically, I have 4 machines in my (homelab) running Slackware and 3 VPS running Debian.
I have been manually updating all 7 of these computers manually for over 5 years, as I like to see what is being updated. Nowadays it's complicated for me, as I have 2 small children and my time is very short!
I'm thinking about automating the update with a shell script, wrapped in a for loop.
Or even (Ansible). My experience with Ansible is minimal. What do you think? Do you suggest anything to me?
If you suggest shell scripting to me, what features could it have?

Last edited by linuxsl; 01-25-2024 at 01:09 PM.
 
Old 01-25-2024, 03:43 PM   #2
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 365

Rep: Reputation: 171Reputation: 171
one approach

The slackpkg command has options to allow scripting by turning off its interactive features. The manual even gives a practical example:
slackpkg -batch=on -default_answer=y upgrade-all
So yes, conceivably you could put together a shell script containing the four horsemen of the Slackocalypse and add it to cron, something like
#! /bin/sh
set -ex
slackpkg -batch=on -default_answer=y update
slackpkg -batch=on -default_answer=y install-new
slackpkg -batch=on -default_answer=y upgrade-all
slackpkg -batch=on -default_answer=y clean-system
And you could test for a kernel upgrade afterwards, and conditionally do
/usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg
(or the equivalent mkinitrd/lilo commands) and
shutdown -r now
as well.

You would still need to review the output so that you could respond appropriately when there is a failure. And even when there are no failures, you might still take time to to look at htop output to see if you have running services with updated executables or libraries. And you would want to know enough about booting to get around unexpected boot failures. And have some kind of deadman switch that timely lets you know when a kernel or service goes down and stays down. And have good backups. Etc., etc.

This is not something I've tried, and won't, partly because I prefer to deal with upgrade problems immediately, and partly because I don't have enough systems to manage that the time saved would be worth the trouble.
 
3 members found this post helpful.
Old 01-25-2024, 03:50 PM   #3
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,691

Rep: Reputation: 1377Reputation: 1377Reputation: 1377Reputation: 1377Reputation: 1377Reputation: 1377Reputation: 1377Reputation: 1377Reputation: 1377Reputation: 1377
Ansible is awesome and is perfect for this type of situation, but if you don't know how to set it up then it will probably be less time consuming to just use bash scripts and cron to update your systems. for only 7 nodes that is probably going to be the easiest way. Also Ansible doesn't have a great module for dealing with Slackware so in the end if you did go the Ansible route then you would probably end up using the shell module to use bash scripts to update Slackware, which is basically putting a hat on a hat. In the end Ansible really is made for this type of situation its just a matter of whether you want to go through the hassle of setting it up. For one thing I personally would not use Slackware as my Ansible control machine. I would use a Debian or RedHat based OS for that. It can be done, but its just not how I would do it.

Last edited by Daedra; 01-26-2024 at 12:08 AM.
 
1 members found this post helpful.
Old 01-26-2024, 04:40 AM   #4
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,901

Rep: Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025
If you don't mind stepping off the beaten path you could also checkout my slackscan/slackup tools which I wrote specifically with non-interactive/scripted use in mind. They won't be any use with the debian systems of course, but then on debian you have 'apt' to do it all for you anyway.

There's also a LQ thread for discussing them.
 
4 members found this post helpful.
Old 01-26-2024, 11:47 AM   #5
lostintime
Member
 
Registered: Dec 2021
Posts: 193

Rep: Reputation: Disabled
I have been in this position personally and professionally. With multiple Slackware systems my approach is maintain local repo mirrors. That way there is only one download of all packages. Probably still available but AlienBob has some rsync shell scripts to maintain local mirror updates.

Same idea with multiple Debian systems -- look into a tool called apt-cacher-ng. Download once and update everything locally.

One way or another, configure all local systems to use local cached packages. With slackpkg this is a single change from an online mirror to the local mirror. The slackpkg tool supports automation parameters.

Next is to decide how to automate updates. About two decades ago I wrote my own sync script, long before tools such as ansible became popular. I still use that script. Basically systems update automatically but only if the primary home network system has been updated. I have a single Current virtual machine and that system updates automatically, but I tend not to launch the system until after reviewing the change log.

When I was an admin I configured Debian workstations and laptops to update automatically with cron jobs, but only after business hours. Work policy was that no updates would be allowed to interfere with users. With servers I only allowed test systems to automatically update. All other servers were updated manually after reviewing the change logs. Duplicate servers such as name servers and virtualization hosts were updated one at a time with 24 to 48 hours in between updating each system. That way systems and logs could be reviewed for issues.

Also note that Pat is not a card-carrying member of the PR kernel-of-the-week-update-now! club. Many if not most security issues are based on physical access to systems and exotic usage scenarios. The lesson is that keeping systems updated with patches is important but for most people can be done at a sane and healthy pace. When a security issue arises that is a systemic exploit, be sure there will be many related online articles discussing the exploit. For most home users all systems are behind a router and nominal firewall and the risk of external hacking is low to non existent.

How dangerous is automating updates? After more than 23 years of using Linux systems I probably can count on one hand how often a package update bit me. I have been bitten though.

I hope this helps!
 
3 members found this post helpful.
Old 01-27-2024, 01:41 PM   #6
hpfeil
Member
 
Registered: Nov 2010
Location: Tucson, Arizona US
Distribution: Slackware Current
Posts: 354
Blog Entries: 1

Rep: Reputation: Disabled
This 4-line cron script works for me:

Code:
cd /sources
rsync -a rsync://mirrors.kernel.org/slackware/slackware64-current/slackware64 .
find slackware64 -type f -name \*z|xargs upgradepkg --install-new
rm -r /sources/slackware64
Since it runs in the wee hours, no worries about how long rsync might take. I use 4TB SSD drives, so installing everything is inconsequential.
 
Old 01-28-2024, 09:32 AM   #7
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,902

Rep: Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052
It is important to consider running a stable release if you are going to automatically update Slackware. Slackware-current sometimes requires further action prior to updating your system. You can also use the blacklist feature of slackpkg or rsync to exclude kernel updates- then do those manually at a later date.

Some helpful Slackware docs: Tracking Updates and Watching for Updated Packages
 
Old 01-30-2024, 01:28 AM   #8
usr345
Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 208
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by metaed View Post
The slackpkg command has options to allow scripting by turning off its interactive features. The manual even gives a practical example:
slackpkg -batch=on -default_answer=y upgrade-all
Will it keep the old config files intact?
 
Old 01-30-2024, 02:58 AM   #9
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,976

Rep: Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552
Quote:
Originally Posted by usr345 View Post
Will it keep the old config files intact?
Short answer no. << OOPS , I should have said YES. Thanks Petri Kaukasoina.
The excerpts from the manpage points this out.
From the manpage of slackpkg.conf:
Code:
BATCH
            Enables  (on)  or disables (off) the non‐interactive mode.  When run in batch mode, slackpkg
            will not prompt the user for anything; instead, all questions will get  DEFAULT_ANSWER  (see
            below).
            If  you perform an upgrade using this mode, you will need to run "slackpkg new‐config" later
            to find and merge .new files.

DEFAULT_ANSWER
            This is the default answer to questions when slackpkg prompts the user for some information.
            This is used only in non‐interactive mode (when BATCH is "yes" or the user turns batch  mode
            on via the command line); otherwise, this variable has no effect.
            Valid values are "y" or "n".

Last edited by chrisretusn; 01-30-2024 at 11:06 PM.
 
1 members found this post helpful.
Old 01-30-2024, 03:52 AM   #10
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,811

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Quote:
Originally Posted by usr345 View Post
Will it keep the old config files intact?
Yes, it will. It does not process the .new files. You can run 'slackpkg new-config' yourself afterwards.

Last edited by Petri Kaukasoina; 01-30-2024 at 03:54 AM.
 
2 members found this post helpful.
Old 01-31-2024, 08:52 PM   #11
babydr
Member
 
Registered: Aug 2015
Location: Fairbanks , Alaska
Distribution: Slackware-14.2 & 15.0
Posts: 229

Rep: Reputation: 45
Hello All * Linuxsl , The man page has this to say about 'new-config' .
Yes , Both the 'BATCH' & 'DEFAULT_ANSWER' Options will leave the OLD configured conf files unchanged .

But to my reading of this portion of the manpage leaves ALOT un-resolved as to What it does do when called .
Without a VERY GOOD definition of what it does do , I'll not sacrifice my many years of maintained .conf files to such a tool .

Code:
       new-config
            This action searches for .new configuration files and ask the user what to do with those files.
            new-config  is  very useful when you perform an upgrade and leave the configuration files to be reviewed later.
            Instead of a manual search, diff, and replace; you can use the new-config action.
            new-config searches /etc and /usr/share/vim for new config files.
 
Old 02-01-2024, 07:46 AM   #12
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,375

Rep: Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754
The 'slackpkg new-config' command is benign unless you explicitly request otherwise. As an example, I have created a /etc/ntp.conf.new file. Running the command causes that file to be detected and prompts for the action to be taken.
I almost always choose P for prompt.
I then often choose (D)iff to see the changes. If the incoming file lacks local customisation, then I will choose (R)emove to remove the incoming file. If the incoming file includes small changes (e.g. typo fixes), then I will choose (O)verwrite to replace the existing file with the incoming file. If the incoming file has many changes, then I will choose (V)imdiff and edit either the incoming file or the old config file as necessary before using either (R)emove or (O)verwrite as appropriate.

Code:
root@darkstar:~# slackpkg new-config

Searching for NEW configuration files...
Some packages had new configuration files installed (1 new files):

/etc/ntp.conf.new

What do you want (K/O/R/P)?

        (K)eep the old files and consider .new files later

        (O)verwrite all old files with the new ones

        (R)emove all .new files

        (P)rompt K, O, R selection for every single file
p
Select what you want file-by-file

/etc/ntp.conf.new - (K)eep
                    (O)verwrite
                    (R)emove
                    (D)iff
                    (M)erge
                    (V)imdiff

Tip - When using vimdiff, you can use Ctrl-ww to switch windows, dp to put a block of different lines into the other file and do to obtain a block of different lines from the other file. If things go wrong, use the universal bailout of Esc:qa! which will exit leaving the two files unchanged.

Last edited by allend; 02-01-2024 at 08:01 AM.
 
3 members found this post helpful.
Old 02-02-2024, 12:02 AM   #13
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,976

Rep: Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552
I do the same as @allend. After awhile you should now what files you have modified (P)rompt or (K)eep and not modified (O)verwrite. By default slackpkg will save the original overwritten file with the extension *.orig.
Code:
       ORIG_BACKUPS
            During integration of .new files during the post  installation  phase,  original  files  are
            backed  up to a file name with a .orig extension.  To prevent this, set this option to "off"
            and note that you will no longer have a copy of the content of the file prior  to  it  being
            replaced by the .new version.

            The  default value of ORIG_BACKUPS is "on".  Only change this if you are sure you don’t want
            backups of overwritten files.
            From the command line, you can use ‐orig_backups=value.
 
1 members found this post helpful.
Old 02-02-2024, 05:41 AM   #14
SlackCoder
Member
 
Registered: Nov 2020
Posts: 42

Rep: Reputation: Disabled
I've been battling this myself. @linuxsl are you updating from other package providers like slackbuilds.org as well?
 
Old 02-02-2024, 07:44 PM   #15
babydr
Member
 
Registered: Aug 2015
Location: Fairbanks , Alaska
Distribution: Slackware-14.2 & 15.0
Posts: 229

Rep: Reputation: 45
@ALL , Babydr Thanks you all for previous insights & knowledge transfering .

@chrisretusn , I am going to open ONE more topic on slackpkg . I beleive that you remember this thread ... https://www.linuxquestions.org/quest...light=slackpkg
And the other threads around the same date (ie: 20120406 - 20210610) .

My script mention in the above is still in use . Thanks to chrisretusn .
I am in hopes of finding out some more items that may not be available or recommended , But of which I'd like to be availed of for the script . In light of the items brought up here .

Agn , Thank you all . JimL
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Almost open: BIOS and firmware update tips for Linux users LXer Syndicated Linux News 0 08-23-2016 09:51 AM
Need tips on using Ethernet to power WiFi network, and tips on setting up WiFi crabpot8 Linux - Networking 2 08-24-2009 06:42 PM
Slackware tips and tricks monkeymartin Slackware 3 11-12-2003 04:17 AM
Some Slackware tips tangle Slackware 3 08-02-2003 12:17 PM
Slackware Tips Artimus Slackware 2 02-28-2003 06:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration