You are not logged in.
After poking around a bit, I looked in /etc/cron.daily/apt-compat. That gets used for unattended upgrades and also auto-updates the cache. One of the nice things it does is check to see if you're on battery power and cancels any actions if you are.
I have another install from the first time we played with this that I set up to use the daily auto-updates. Create /etc/apt/apt.conf.d/10periodic with the following contents:
APT::Periodic::Enable "1";
# - Enable the update/upgrade script (0=disable)
APT::Periodic::Update-Package-Lists "1";
# - Do "apt-get update" automatically every n-days (0=disable)
The package cache will get updated once a day.
Edit: Changed 10_periodic to 10periodic. (see /usr/lib/apt/apt.systemd.daily and don't freak out over the name.)
Offline
My modified upgrade-yes is not working in my openbox/lxterminal. The terminal comes up empty and does nothing. Did someone else mention that this happened to them?
It does work if I use 'xterm -hold -e <command>'.
I'm having trouble getting x-terminal-emulator to run commands, even when I start it in a terminal, and this happens in openbox/lxterminal as well as xfce/xfce4-terminal.
x-terminal-emulator -e xclock works correctly in both systems.
x-terminal-emulator -e 'echo message' does not work. In ob/lx I get the blank terminal; in xfce I get nothing.
If I use the following for /usr/bin/upgrade-yes, it works with sudo nopasswd and with root. I don't have a sudo with passwd to test. I changed the command to gparted for testing, so it doesn't actually do the upgrade. Comment/uncomment the 'command=' lines as desired. One potential problem is that some terminals need the -hold or --hold option and some don't.
#!/bin/bash
#command="apt dist-upgrade"
command="gparted"
message="If user password fails, use root password"
sudo_allowed=$(sudo -n uptime 2>&1 | grep load | wc -l)
# for sudo with no password
if [[ $sudo_allowed -ne 0 ]] ; then
sudo "$command"
# for sudo with password
elif $(groups $USER | grep -qs sudo); then
x-terminal-emulator -e 'echo "$message" && sudo "$command"'
else
x-terminal-emulator -e 'echo "$message" && su -c "$command"'
fi
Offline
I've been playing around with making it open synaptic again (like the pointlinux update notifier did). It'll open synaptic, but I haven't yet figured out how to get it to automatically show the updates like pointlinux did.
Still working on it...
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
I've been playing around with making it open synaptic again (like the pointlinux update notifier did). It'll open synaptic, but I haven't yet figured out how to get it to automatically show the updates like pointlinux did.
Still working on it...
Got it! I was trying to make it a lot harder than it had to be.
Have this in my upgrade-yes file now...
pkexec /usr/sbin/synaptic --dist-upgrade-mode true --non-interactive
Just like opening synaptic normally, you have to enter your password. Synaptic opens and shows the available updates. Click "Mark", and it immediately downloads and installs the updates. When it finished, Synaptic closed automatically for me...I think that depends on whether the user has previously marked Synaptic's "installation" window to close automatically.
I've only tested it on ASCII. I see no reason that it shouldn't work on beowulf, but I won't be able to try it until later this evening.
Would solve the issue with different terminals needing different coding, but synaptic would need to be added as a dependency to the .deb package.
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
When I read that you were playing with synaptic, I thought there should be a choice of synaptic or terminal. That's a real possiblity.
Doesn't the original python script have a way to run synaptic? (Guess I'll look at that.)
Will test the new line.
Edit: It works! Nice.
Offline
Synaptic could be a Recommends instead of a Depends. Those who install without Recommends are likely to have xterm installed. That could be a Suggests. Most people will get synaptic without trying.
This tests for synaptic and pkexec and falls back to xterm if they aren't both installed, and if xterm isn't there you get a popup error message.
if [ -e /usr/sbin/synaptic ] && [ -e /usr/bin/pkexec ] ; then
pkexec /usr/sbin/synaptic --dist-upgrade-mode true --non-interactive
elif [ -e /var/lib/dpkg/info/xterm.list ] ; then
sudo_allowed=$(sudo -n uptime 2>&1 | grep load | wc -l)
# for sudo with no password
if [[ $sudo_allowed -ne 0 ]] ; then
xterm -fa mono -fs 12 -hold -e 'sudo "$command"'
# for sudo with password
elif $(groups $USER | grep -qs sudo); then
xterm -fa mono -fs 12 -hold -e 'echo "Enter your password" && sudo "$command"'
else
xterm -fa mono -fs 12 -hold -e 'echo "Enter root password" && su -c "$command"'
fi
else notify-send "Error:
You need to install synaptic or xterm."
fi
Note: I tried synaptic-pkexec instead of pkexec /usr/sbin/synaptic and the window came up for a fraction of a second and disappeared.
Correction: It now disappears with either line for starting synaptic. If I drop the 'non-interactive' the window stays, but it doesn't show the available upgrades. (You already knew that.)
I'm stumped. Where are you finding these synaptic options?
Oh, duh! Corrected correction: It won't show available upgrades if there aren't any. And the synaptic window will go away. Looks like this is working after all. (without the non-interactive option, the synaptic window stays up if you cancel the upgrades.)
Offline
Is that upgrade-yes?
I got the synaptic options from the pointlinux-update-notifier.py script. That's also what was throwing me off. The pointlinux notifier used gksu. Where I have pkexec in the command, it had /usr/bin/gksu. I was following the same logic and using /usr/bin/synaptic-pkexec, but it wasn't working right. Tried /usr/bin/pkexec, but that didn't work right either. I messed around with everything else in the command with worse results. I finally tried it with just pkexec out of frustration...and it stinkin' worked. LOLOL!
I was thinking about using xterm instead of x-terminal-emulator after you noted the issues. I'll try your script above later tonight. I have stanz's mini-i2p-mimo that I haven't upgraded yet (Ascii) and a 32 bit beowulf that I haven't upgraded in over a month.
Thanks fsr!
Oh...I've also gone back to the cron job (for syncing the repos) for now...I haven't yet taken time to explore those other options you mentioned.
Last edited by MiyoLinux (2019-09-08 22:06:47)
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
Yes, that was upgrade-yes.
That script is working for me now with either of these lines:
pkexec /usr/sbin/synaptic --dist-upgrade-mode true --non-interactive
synaptic-pkexec --dist-upgrade-mode true --non-interactive
"working" means it brings up the pkexec auth window and then it brings up synaptic and shows the updates. I keep canceling so I can do it again.
Currently testing in beowulf.
Offline
First try: my 32 bit beowulf with LXQt
I wanted to test it thoroughly, so I removed both xterm and synaptic before installing the notifier.
After removing them and installing the notifier, I replaced upgrade-yes and show-updates.
Clicking on Yes didn't produce another notification saying that I needed to install xterm or synaptic. I tried running upgrade-yes in the terminal, and received this output...
dan@deboowulf:~$ /usr/bin/upgrade-yes
/usr/bin/upgrade-yes: line 9: xterm: command not found
So, I went ahead and installed xterm.
Clicking Yes opened xterm. However, when I entered my sudo password, it gave me this output...
Enter your password
[sudo] password for dan:
sudo: : command not found
...and I could do nothing else. I just had to close xterm.
I let it run again for a third time and tried entering the root password just in case, but it just said Sorry, try again. I entered a wrong password, and it said Sorry, try again. So I entered the sudo password, and got the same output as in the code above. So I just closed xterm.
So, I installed synaptic.
Synaptic worked.
Now to try stanz's mini-i2p-mimo...
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
Second try: on my mini-i2p-mimo
I was hoping that perhaps some of the items I described above may have been related to using Qt, but I got all of the same as described above on this GTK system.
The only difference was that mini-i2p-mimo doesn't include synaptic out of the box, so I only had to remove xterm before starting the tests.
Since I hadn't used synaptic on this system before, it didn't close automatically after the updates were finished. So it does look like that "perk" is dependent upon a user ticking the box to close the "installing packages" window during the normal installation of a package.
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
Clicking on Yes didn't produce another notification saying that I needed to install xterm or synaptic. I tried running upgrade-yes in the terminal, and received this output...
dan@deboowulf:~$ /usr/bin/upgrade-yes /usr/bin/upgrade-yes: line 9: xterm: command not found
That's weird. Does /var/lib/dpkg/info/xterm.list exist after you remove xterm? If so, the test needs to be changed.
Clicking Yes opened xterm. However, when I entered my sudo password, it gave me this output...
Enter your password [sudo] password for dan: sudo: : command not found
Again, weird. Script tests to see if you're in the sudo group. I don't think that group exists if sudo is not installed.
.
Offline
It'll have to be when more updates come down, because stupid me...I installed the updates on both systems to make sure synaptic worked as it should.
I have sudo privileges on both systems.
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
Add set -x to the top of the script and run it from terminal. You'll get output for every command. I checked, and they didn't move sudo. It's still in /usr/bin. I want to see where this is screwing up.
Offline
I installed mini-i2p-mimo on another computer so I could test again.
I got the pop up this time saying that I needed to install xterm or synaptic. My mistake earlier was that I only removed xterm...I didn't purge it.
So I installed xterm, but I'm still having the issue about sudo command not found. Even though I have sudo privileges, I looked at /etc/group and there I was in the sudo group.
Here's the output you requested...
dan@mini-mimo:~$ /usr/bin/upgrade-yes
+ '[' -e /usr/sbin/synaptic ']'
+ '[' -e /var/lib/dpkg/info/xterm.list ']'
++ wc -l
++ grep load
++ sudo -n uptime
+ sudo_allowed=1
+ [[ 1 -ne 0 ]]
+ xterm -fa mono -fs 12 -hold -e 'sudo "$command"'
I won't upgrade this system for awhile so I can keep testing on it.
Last edited by MiyoLinux (2019-09-10 00:19:39)
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
Maybe xterm needs the full path. Change 'sudo "$command"' to '/usr/bin/sudo "$command"' in all three xterm lines.
Offline
The change didn't solve it for me; I got the same result.
I'm more stumped by the update-sync script. If I run it in the terminal (and leave the terminal open), it runs at the assigned intervals...as does the launcher in /etc/xdg/autostart (when I run it in the terminal). I left the terminal open for HOURS, and it ran like clockwork in both cases.
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
I'm more stumped by the update-sync script.
Me too. It shouldn't work unless you're running it as root. When I split that up into two functions, I had it record the exit code of 'apt-get update', and while it kept running at the expected interval, it spit out an error code every time.
Also stumped by the inability to find sudo. Maybe the quoting needs to be changed? "sudo $command" instead of 'sudo "$command"' with or without the full path. (grasping at straws here.)
Offline
I've been checking, and apparently the kernel has it built in to not allow scripts to run as root. There are ways around it but none that I'm comfortable with. So, I think I would prefer implementing the cron job again. I know that it works.
I think I've already tried switching the quotation marks around...I tried various things with it to see if I can get it to work last night, but I'll try that to make sure.
...maybe this is why pointlinux relied on synaptic alone? LOL!
Thanks fsr!
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
Okay, I tried moving the quotation marks around in upgrade-yes, but it didn't solve it.
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
After poking around a bit, I looked in /etc/cron.daily/apt-compat. That gets used for unattended upgrades and also auto-updates the cache. One of the nice things it does is check to see if you're on battery power and cancels any actions if you are.
I have another install from the first time we played with this that I set up to use the daily auto-updates. Create /etc/apt/apt.conf.d/10periodic with the following contents:
APT::Periodic::Enable "1"; # - Enable the update/upgrade script (0=disable) APT::Periodic::Update-Package-Lists "1"; # - Do "apt-get update" automatically every n-days (0=disable)
The package cache will get updated once a day.
Edit: Changed 10_periodic to 10periodic. (see /usr/lib/apt/apt.systemd.daily and don't freak out over the name.)
I haven't tried this yet. Do you know "when" the update happens? Does it get logged somewhere in /var/log/?
Nevermind about the log question; I found the answer on this web page...
https://wiki.debian.org/UnattendedUpgrades
...but that brings up another question...does the unattended-upgrades package need to be installed for the 10periodic file to work?
Last edited by MiyoLinux (2019-09-13 06:44:04)
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
Also, I think I've found an easy solution to the upgrade-sync script issue. I started thinking...if a cron job can run apt-get update as root, I don't see why one can't run the script as root...so I made a cron job for it in /etc/cron.d/...
@reboot root /usr/bin/update-sync
So, update-sync performs an apt-get update at system start-up and should run apt-get update in the specified intervals thereafter. It showed in /var/log/cron.log without any type of error...
I wanted to know that it's actually running, but I don't know what to make of all this gobbledygook or if I've even done the command correctly. LOLOLOL!!!
dan@miyolinux:~$ ps aux | grep update-sync
root 1640 0.0 0.0 4276 744 ? Ss 03:57 0:00 /bin/sh -c /usr/local/bin/update-sync
root 1677 0.0 0.0 11164 2840 ? S 03:57 0:00 bash /usr/local/bin/update-sync
dan 3319 0.0 0.0 12780 1028 pts/1 S+ 04:08 0:00 grep update-sync
I think it's running...well...sleeping (according to the S), which is what it should've been doing when I ran the command. From man ps...
S interruptible sleep (waiting for an event to complete)
Last edited by MiyoLinux (2019-09-13 08:56:55)
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
You don't need to install unattended-upgrades to use the periodic update function. Just adding 10periodic to /etc/apt/apt.conf.d/ is enough. The script that runs it is in /etc/cron.daily and runs once a day. In my case, it's running around 6:30am. The actual time it updates is randomized, so that everyone is not hitting on the servers at the same time. In other words, if you use a cron job with a set time, a million miyolinux users will burn out the server on the next update.
It logs in /var/log/syslog. Look for 'cron.daily' to see when it ran.
Oh, I like the @reboot trick. That might be especially useful on a laptop that is asleep at 6:30am. Of course, the usual way to run stuff at boot is to put it in rc.local.
Offline
Well, after a lot of work, I was about to announce the release of the "latest version" of the Update Notifier.
I have the apt-get update working correctly now, and I have it working with Synaptic again, and that's great, because by using Synaptic and pkexec, it does away with the issues of trying to use su or sudo with the terminal. However...then I started thinking...
If I can use pkexec for synaptic, why couldn't I use it for a terminal?
Well...I can. I think I've found a solution to using "a" terminal instead of Synaptic.
For update-yes (I'm calling it something different now in the final release of the update notifier, but that name will keep things on track within this thread), I've tried both of these commands for upgrade-yes, and both work in my testing...
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY xterm -fa mono -fs 12 -e 'apt dist-upgrade'
...or...
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY x-terminal-emulator -e 'apt dist-upgrade'
From what I've gathered, the env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY negates the need to create a pkexec file in /usr/share/polkit-1/actions/
Now...I don't know how this would be affected by the "hold" that fsmithred pointed out for xterm, nor do I know how it would affect the issues with x-terminal-emulator. I thought that the system itself determines which terminal is designated as the x-terminal-emulator, but I'm just a hack who hacks stuff in order to hack it. LOLOL!!!
So now I'm trying to decide whether to just go with Synaptic, go with just the terminal, or go with both...I was thinking of possibly adding an extra button to the window that allows the user to view the updates available and choose to install them or not. In other words, give the user the choice to upgrade through Synaptic or the terminal. So that would be four buttons instead of three...
Show Updates Synaptic Upgrade Terminal Upgrade Cancel
Any input would be appreciated.
Last edited by MiyoLinux (2019-09-18 09:40:55)
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
or go with both...I was thinking of possibly adding an extra button to the window that allows the user to view the updates available and choose to install them or not. In other words, give the user the choice to upgrade through Synaptic or the terminal. So that would be four buttons instead of three...
Show Updates Synaptic Upgrade Terminal Upgrade Cancel
I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.
Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned.
Offline
x-terminal-emulator is set in the alternatives system. That will be a symlink to the actual terminal, which is probably the terminal that came with your desktop or possibly the last terminal you installed.
ls -l /etc/alternatives/x-terminal-emulator
The man page for x-terminal-emulator will be the man page for the actual terminal. On one of my systems, it shows me the man page for lxterminal, and on another it's xfce4-terminal. That means the available options for x-terminal-emulator will not be the same for everyone. If the hold is needed (I suspect it is, but I'm not certain) we can make a function to test which terminal is used and which is the appropriate 'hold' option.
I think it's perfectly reasonable to leave out the terminal. Anyone who prefers upgrading in a terminal already knows how to open one and get root.
Offline