Re: [Dorset] Problem with 'full' Root partition

2021-01-29 Thread Ralph Corderoy
Hi Clive,

> The tmp folder has 11.3GB of data
> ...
> and all Flatpack... folders.

Flatpak has a bug.  Well, one so severe I'd argue it's not fit for
purpose.  It gradually fills /var/tmp.  Probably a bit more on every
boot so if it's a machine which gets booted a lot then it will fill up
more quickly.

As I understand it, a /run/user symlink points the current
/var/tmp/flatpak-cache-* directory but /run is lost, by design, when the
machine stops so when it starts up again a new cache directory is
created and the symlink remade.

The problem with deleting all of those /var/tmp/flatpak-cache-*
directories is that a few of them may be in use at the time.  I don't
have a good suggestion for determining which ones because I don't have
access to a system with Flatpak in use so the best thing I can suggest
is to quit most programs, e.g. LibreOffice and Firefox, then delete the
Flatpak caches, and then reboot so if anything was upset by the deletion
it won't have had long to stay confused.

This will do the delete.

cd /var/tmp &&
sudo find -maxdepth 1 -name 'flatpak-cache-*' -exec rm -rf {} +

-- 
Cheers, Ralph.

-- 
  Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Problem with 'full' Root partition

2021-01-29 Thread Keith Edmunds
On Fri, 29 Jan 2021 15:16:43 +, ci...@cewland.uk said:

> Thanks.  I've taken a copy as 'Root' into my /home/copyvartmp folder; 
> had to enter each folder a root.

You could have just (either as root or with 'sudo' in front):

# cp -a /var/tmp/* /home/copyvartmp

That would copy all files and folders under /var/tmp.

> what's putting them in there? And how can I stop it happening[?]

Well, those two questions are related. I don't know how flatpack works -
I've never used it, but maybe someone else can help (Ralph?). Generally,
/var/tmp is used for ephemeral files.
-- 
Linux Tips: https://www.tiger-computing.co.uk/category/techtips/

-- 
  Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Problem with 'full' Root partition

2021-01-29 Thread C Wills
Even more info; lokking into the /var/tmp folder at the end are 5 
folders all starting 'systemd-private-' then a long line of numbers 
letters followed by either:

  colord.hex numbers
  ModemManager. service.hex numbers
  rtkit-daemon. service.hex numbers
  systemd-resolived. service.hex numbers
  systemd-time syncd.hex numbers
No details on number of files included but all dated since 15 Jan his 
may be since the notifications started.

Any help?

C A Wills

On 29/01/2021 15:32, C Wills wrote:
Adding to the last reply.  The tmp folder has 11.3GB of data - is that 
a copy of the whole file system as it's certainly a large proportion 
and all Flatpack... folders.  See original email for sample.
If that can all be deleted then that would put me back to about what 
the original file system was.

Taking over 25 mins to copy so will have a cuppa!

C A Wills

On 29/01/2021 15:16, C Wills wrote:

Hi Keith

Thanks.  I've taken a copy as 'Root' into my /home/copyvartmp folder; 
had to enter each folder a root.  It took a long time to copy the 
267538 files!
When done will delete and see what happens but what's putting them in 
there? And how can I stop it happening or doing an auto delete?

Still waiting si will look at other comments from DLUG now.

C A Wills

On 29/01/2021 14:07, Keith Edmunds wrote:

On Fri, 29 Jan 2021 13:04:35 +, ci...@cewland.uk said:


12G /tmp/var

I suspect you mean '/var/tmp'

You're unlikely to need anything in there. Take a look first, but 
probably

safe to delete.

If you want to take a copy just in case, you could copy to somewhere on
/home (but delete it later if you don't need it).






--
 Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Problem with 'full' Root partition

2021-01-29 Thread C Wills
Adding to the last reply.  The tmp folder has 11.3GB of data - is that a 
copy of the whole file system as it's certainly a large proportion and 
all Flatpack... folders.  See original email for sample.
If that can all be deleted then that would put me back to about what the 
original file system was.

Taking over 25 mins to copy so will have a cuppa!

C A Wills

On 29/01/2021 15:16, C Wills wrote:

Hi Keith

Thanks.  I've taken a copy as 'Root' into my /home/copyvartmp folder; 
had to enter each folder a root.  It took a long time to copy the 
267538 files!
When done will delete and see what happens but what's putting them in 
there? And how can I stop it happening or doing an auto delete?

Still waiting si will look at other comments from DLUG now.

C A Wills

On 29/01/2021 14:07, Keith Edmunds wrote:

On Fri, 29 Jan 2021 13:04:35 +, ci...@cewland.uk said:


12G /tmp/var

I suspect you mean '/var/tmp'

You're unlikely to need anything in there. Take a look first, but 
probably

safe to delete.

If you want to take a copy just in case, you could copy to somewhere on
/home (but delete it later if you don't need it).




--
 Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Problem with 'full' Root partition

2021-01-29 Thread C Wills

Hi Keith

Thanks.  I've taken a copy as 'Root' into my /home/copyvartmp folder; 
had to enter each folder a root.  It took a long time to copy the 267538 
files!
When done will delete and see what happens but what's putting them in 
there? And how can I stop it happening or doing an auto delete?

Still waiting si will look at other comments from DLUG now.

C A Wills

On 29/01/2021 14:07, Keith Edmunds wrote:

On Fri, 29 Jan 2021 13:04:35 +, ci...@cewland.uk said:


12G /tmp/var

I suspect you mean '/var/tmp'

You're unlikely to need anything in there. Take a look first, but probably
safe to delete.

If you want to take a copy just in case, you could copy to somewhere on
/home (but delete it later if you don't need it).


--
 Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Assistance debugging Python on Raspberry Pi.

2021-01-29 Thread PeterMerchant

On 29/01/2021 10:36, PeterMerchant wrote:

And I forgot to say, Thanks to Keith and Ralph for the help.



--
 Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Assistance debugging Python on Raspberry Pi.

2021-01-29 Thread PeterMerchant

I'm Getting somewhere.

I changed the Logging.basic config to have a filename of 
/home/pi/mqtt/debug_log.txt  and took out the asctime and levelname formatting 
bits.   I added  the Logging. debug  lines in a couple of the functions. It 
worked in that the file is in that location, and one of the debug messages has 
printed. Have to look at the others now.
Anyway, progress!

Still have to figure out how to add the ultrasonic functions and get them to 
work. I will probably add a do-nothing function to the program for testing 
first.
P.

On 29/01/2021 10:36, PeterMerchant wrote:

You should find that file given your first debug() call as those lines

work for me here.

 $ cat >peter.py
 import logging
 logging.basicConfig(filename='debug_log.txt', level=logging.DEBUG, 
format='%(asctime)s - %(levelname)s - %(message)s')
 logging.debug('This is a log message.')
 $
 $ python peter.py
 $ cat debug_log.txt
 2021-01-29 09:42:35,195 - DEBUG - This is a log message.


I added those three lines to my file after the import time line,

and now it does not work, and I cannot find the logfile.


--
 Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Problem with 'full' Root partition

2021-01-29 Thread Keith Edmunds
On Fri, 29 Jan 2021 13:04:35 +, ci...@cewland.uk said:

> 12G /tmp/var

I suspect you mean '/var/tmp'

You're unlikely to need anything in there. Take a look first, but probably
safe to delete.

If you want to take a copy just in case, you could copy to somewhere on
/home (but delete it later if you don't need it).
-- 
Linux Tips: https://www.tiger-computing.co.uk/category/techtips/

-- 
  Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Problem with 'full' Root partition

2021-01-29 Thread C Wills

Hi all

Report from commands given by Keith and Ralph are below.  Sorry a long 
email but:


Keith:
df -h:-
  size used   avail    % mounted
udev  1.5G    0 1.5G    0 /dev
tmpfs    299M    2.8M    296M    1 /run
/dev/sda1  26G          23G 1.4G    95    /
tmpfs    1.5G    0    1.5G 0 /dev/shm
tmpfs 5M    4K   5M    1    /run/lock
tmpfs 1.5G   0 1.5G  0 /sys/fs/cgroup

/dev/sda3  194G   63G    121G 35   /Home
tmpfs 299M  36K 299M  1 /run/use/1000

Output of sudo du -sh/var/*
17M   /var/backups
146M    /var/cache
3.9G /var/lib
4K /var/local
0 /var/lock
1.2G /var/log
4K /var/mail
0 /var/run
109M /var/spool
12G /tmp/var

Ralph's commands:
df / .
filesys 1K blocks used avail   %  Mount
/dev/sda1      26934204 24111280   1431724 95   /
/dev/sda3    -   -- --             -- /Home (not 
listed figes as it's Home


sudo apt-get clean  & sudo apt-get autorun    gave no figures other 
than o


End of reports
Thanks for the help but does it show anything?


C A Wills

On 29/01/2021 10:49, C Wills wrote:

Hi Tim

Just got to see your reply and also Ralphs.  He's correct in that 
there is no space between '/' & 'Home': I've already reduced half of 
the small swap file.  I've been told not to try to move the front of 
Home forward as it's very risky and Gparted warns of this.  If I was 
redoing the partitioning then I could give root a larger space.  When 
I did original install I gave it 20GiB as I had never used more than 
13/14GiB.  Also I'd like to know why this is happening, i.e. have I 
got a rough program running 'frequently' which is fill up the space? 
(It's not only on Lily space as it's happening on my Home as well).
 The only additional Programmes add to the clean install have been 
Digikam & Hardinfo.  Those two progs have never given any problems 
before.  When I've made some space it appears to be partially used up 
immediately without running anything else - see previous comments.
I see Ralph has given me two other commands to do which I'll do later 
and report back.


C A Wills
On 28/01/2021 20:17, Tim wrote:

Hi Clive

Can I ask why you cant reduce your home partition and then extend the 
root into the free space ?



Tim H

On 27/01/2021 14:37, C Wills wrote:
Sorry the original copy was sent from another email address which is 
not authorised by DLUG system. Sending from the correct address, 
hope you don't get it twice!!

Clive

Hi All

Yesterday my wife started her PC and got a warning notice saying 
there was on 1GiB on space left on the 'root' partition.

Checking today the following was reported:-

sda1  Ext4 / size - 24.5GiB,  Used - 22.7GiB (93%)  Free - 1.71GiB 
(7%).


There is plenty of space for the /Home  partition but no space on 
sda1 and I can't extend it.
I checked with the disk analyser tool and it showed that the 'var' 
file has used most of the space; it's full of Flatpack folders. All 
the other folders look OK.
I remember seeing a tool that can 'clean' folder/discs but can't 
find it now.  Thought it may be the temp folder fill up the space 
but that looks OK.
Can't work out what has happened to fill the 'root' folder, no extra 
software installed and last time I looked it was only about 50% full.


If I don't do something soon then the PC will lock up And she will 
do her 'nut' (doesn't like computers  that go wrong!)



What's happening please and can I recover the space.  All above by 
using a GUI desktop, Mint 19.2 Cinnamon.






--
 Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Problem with 'full' Root partition

2021-01-29 Thread C Wills

Hi Tim

Just got to see your reply and also Ralphs.  He's correct in that there 
is no space between '/' & 'Home': I've already reduced half of the small 
swap file.  I've been told not to try to move the front of Home forward 
as it's very risky and Gparted warns of this.  If I was redoing the 
partitioning then I could give root a larger space.  When I did original 
install I gave it 20GiB as I had never used more than 13/14GiB.  Also 
I'd like to know why this is happening, i.e. have I got a rough program 
running 'frequently' which is fill up the space? (It's not only on Lily 
space as it's happening on my Home as well).
 The only additional Programmes add to the clean install have been 
Digikam & Hardinfo.  Those two progs have never given any problems 
before.  When I've made some space it appears to be partially used up 
immediately without running anything else - see previous comments.
I see Ralph has given me two other commands to do which I'll do later 
and report back.


C A Wills
On 28/01/2021 20:17, Tim wrote:

Hi Clive

Can I ask why you cant reduce your home partition and then extend the 
root into the free space ?



Tim H

On 27/01/2021 14:37, C Wills wrote:
Sorry the original copy was sent from another email address which is 
not authorised by DLUG system. Sending from the correct address, hope 
you don't get it twice!!

Clive

Hi All

Yesterday my wife started her PC and got a warning notice saying 
there was on 1GiB on space left on the 'root' partition.

Checking today the following was reported:-

sda1  Ext4 / size - 24.5GiB,  Used - 22.7GiB (93%)  Free - 1.71GiB (7%).

There is plenty of space for the /Home  partition but no space on 
sda1 and I can't extend it.
I checked with the disk analyser tool and it showed that the 'var' 
file has used most of the space; it's full of Flatpack folders. All 
the other folders look OK.
I remember seeing a tool that can 'clean' folder/discs but can't find 
it now.  Thought it may be the temp folder fill up the space but that 
looks OK.
Can't work out what has happened to fill the 'root' folder, no extra 
software installed and last time I looked it was only about 50% full.


If I don't do something soon then the PC will lock up And she will do 
her 'nut' (doesn't like computers  that go wrong!)



What's happening please and can I recover the space.  All above by 
using a GUI desktop, Mint 19.2 Cinnamon.




--
 Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Assistance debugging Python on Raspberry Pi.

2021-01-29 Thread PeterMerchant

You should find that file given your first debug() call as those lines

work for me here.

 $ cat >peter.py
 import logging
 logging.basicConfig(filename='debug_log.txt', level=logging.DEBUG, 
format='%(asctime)s - %(levelname)s - %(message)s')
 logging.debug('This is a log message.')
 $
 $ python peter.py
 $ cat debug_log.txt
 2021-01-29 09:42:35,195 - DEBUG - This is a log message.
 


I added those three lines to my file after the import time line,

and now it does not work, and I cannot find the logfile. I have connected the 
pi to the internet to do an update.  i'll look around and see if I have to load 
logger on to the pi separately.

Interesting statement on update:

"release file for 'update' is not valid yet(invalid for another 6d 23h  xmin 
30sec)   Not seen that before.


--
 Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Assistance debugging Python on Raspberry Pi.

2021-01-29 Thread Ralph Corderoy
Hi Peter,

> > Can you attach the output of
> >
> >  diff -u working.py broken.py
> >
> > where you've done some simple change which breaks it, e.g...
>
> I can't do that because every time it fails I back it out to the
> working code.

I don't see why that means you can't have two files, one of which is a
copy of the faulty code before you back up to the working code.

> Attached is the Python with the Logger code inserted.  It also
> contains the Ultrasonic detection and action [Distance() and
> us_act()].

So I'm assuming this is the faulty code.

> Perhaps I don't know where to find the debug_log.txt.

It will be in the current directory when you run your program.
If you want it somewhere specific, make it '/tmp/debug_log.txt' in the
code.

You should find that file given your first debug() call as those lines
work for me here.

$ cat >peter.py
import logging
logging.basicConfig(filename='debug_log.txt', level=logging.DEBUG, 
format='%(asctime)s - %(levelname)s - %(message)s')
logging.debug('This is a log message.')
$
$ python peter.py 
$ cat debug_log.txt 
2021-01-29 09:42:35,195 - DEBUG - This is a log message.
$

> def distance():
>      logger.debug('Start distance sampling')
>
>      # set Trigger to HIGH
>      GPIO.output(GPIO_TRIGGER, True)
>
>      # set Trigger after 0.01ms to LOW
>      time.sleep(0.1)
>      GPIO.output(GPIO_TRIGGER, False)
>
>      StartTime = time.time()
>      StopTime = time.time()
>
>      # save StartTime
>      while GPIO.input(GPIO_ECHO) == 0:
>      StartTime = time.time()

What if that loop takes a very long time to exit?

>      # save time of arrival
>      while GPIO.input(GPIO_ECHO) == 1:
>      StopTime = time.time()

Or that one.

I'd add extra logic to limit both to either a number of iterations or an
amount of time.  If the limit is reached then that's a fault to log as
you don't expect it.

-- 
Cheers, Ralph.

-- 
  Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Assistance debugging Python on Raspberry Pi.

2021-01-29 Thread PeterMerchant

On 29/01/2021 09:22, Ralph Corderoy wrote:

Hi Peter,


BUT anytime I add anything to the program the subscriber stops firing
the LEDs.

‘Anything’ is very vague.  Can you attach the output of

 diff -u working.py broken.py

where you've done some simple change which breaks it, e.g...


I can't do that because every time it fails I back it out to the working code. 
Attached is the Python with the Logger code inserted.  It also contains the 
Ultrasonic detection and action [Distance() and us_act()].  Perhaps I don't 
know where to find the debug_log.txt.


#!python3
# 2020-09-14  This is a change to  RC car-7 from using Flask and HTML to using 
Mosquitto
# 2020-11-06  Edited to remove all the calculations leading up to the PWM 
percentage
# 2121-01-08  Adding Ultrasonic detection to forward motion, then halt, 
reverse, turn left,halt and back to forward
# 2121-01-16  Adding debug statements


# *** SET UP MQTT   ***

# from https://techtutorialsx.com/2017/04/23/python-subscribing-to-mqtt-topic/
import paho.mqtt.client as mqtt
import time
import logging
logging.basicConfig(filename='debug_log.txt', level=logging.DEBUG, 
format='%(asctime)s - %(levelname)s - %(message)s')
logging.debug('This is a log message.')

Connected = False #global variable for the state of the connection

broker_address= "192.168.4.1"
port = 1883
user = "rc-car-11"
password = "carr0t"

# Create client   --?? Is this the same as User?
client = mqtt.Client(client_id="rc-car-11")

# Connect to broker
client.connect(broker_address,1883,60)

# Subscriber to topic
client.subscribe("rc-car-pwm")

# *** SET UP R-Pi GPIO    ***

# This gives us control of the Raspberry Pi's pins.
import RPi.GPIO as GPIO

# Tell it which pin number we'll  be using to refer to the GPIO pins.
# We will use the physical pin ordering. Set initial state of pins
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)

MotorFwd = 18
MotorBack = 12
MotorLeft = 19
MotorRight = 23

GPIO.setup(MotorFwd, GPIO.OUT)
GPIO.setup(MotorBack, GPIO.OUT)
GPIO.setup(MotorLeft, GPIO.OUT)
GPIO.setup(MotorRight, GPIO.OUT)

# PWM pin = Motor Forward
u_d_pin_no = 18
GPIO.setup(u_d_pin_no, GPIO.OUT)

# Ultrasonic setup
GPIO_TRIGGER = 13
GPIO_ECHO = 15

GPIO.setup(GPIO_TRIGGER, GPIO.OUT)
GPIO.setup(GPIO_ECHO, GPIO.IN)


frequency_hertz = 50
pwm = GPIO.PWM(u_d_pin_no, frequency_hertz)

PWM_Stop = 0
PWM_value = 0
PWM_increment = 15
# becomes 15 after calculations  [old comment]
# set to 15, removed calculations
# can remove  duty_cycle_percentage as it is same as PWM_Value

# reverse control   Nov 11 2020
# from 
https://www.electronicwings.com/raspberry-pi/raspberry-pi-pwm-generation-using-python-and-c
Backpin = 12
GPIO.setup(Backpin,GPIO.OUT)   # can remove this as it is MotorBack above
back_pwm = GPIO.PWM(Backpin,1000)

# ***    SET UP Functions   ***

def on():    # STOP!
    global PWM_value
    PWM_value = 0
    pwm.start(PWM_value)
    GPIO.output(MotorBack, GPIO.LOW)
    back_pwm.start(0)    # added to stop pwm reverse
    logger.debug('STOP')

def up_15():
    global PWM_value
    PWM_value = PWM_value + PWM_increment
    pwm.start(PWM_value)
    logger.debug('Forward 15, now Distance test')
    if distance() < 40:
    us_act()


def down_15():
    global PWM_value
    logger.debug('Slow Down')
    if  PWM_value > 0 :
    PWM_value = PWM_value - PWM_increment
    pwm.start(PWM_value)
    else :
    PWM_value  = 0


def motorleft():
    GPIO.output(MotorLeft,GPIO.HIGH)
    GPIO.output(MotorRight, GPIO.LOW)
    logger.debug('Turn Left')
    time.sleep(1)
    GPIO.output(MotorLeft, GPIO.LOW)


def motorright():
    GPIO.output(MotorLeft, GPIO.LOW)
    GPIO.output(MotorRight, GPIO.HIGH)
    logger.debug('Turn Right')
    time.sleep(1)
    GPIO.output(MotorRight, GPIO.LOW)
    return ()


def mbackwards():
# stop forward motion
    global PWM_value
    PWM_value = 0
    pwm.start(PWM_value)
# wait a short time
    time.sleep(0.3)
# now go backwards
#    GPIO.output(MotorBack, GPIO.HIGH)
    back_pwm.start(30)  #30% duty cycle
    return ()

def on_message(client, userdata, message):
   logger.debug('Wait for button')
   if message.payload  == b'forward':
  up_15()
   elif message.payload  == b'slow':
  down_15()
   elif message.payload  == b'stop':
  on()
   elif message.payload  == b'motorleft':
  motorleft()
   elif message.payload  == b'motorright':
  motorright()
   elif message.payload  == b'backwards':
  mbackwards()
   else:
  print(message.payload)

def distance():
    logger.debug('Start distance sampling')

    # set Trigger to HIGH
    GPIO.output(GPIO_TRIGGER, True)

    # set Trigger after 0.01ms to LOW
    time.sleep(0.1)
    GPIO.output(GPIO_TRIGGER, False)

    StartTime = time.time()
    StopTime = time.time()

    # save StartTime
    while GPIO.input(GPIO_ECHO) == 0:
    StartTime = time.time()

    # save time of arrival
    while GPIO.input(GPIO_ECHO) == 1:
    StopTime = time.time()

  

Re: [Dorset] Problem with 'full' Root partition

2021-01-29 Thread Ralph Corderoy
Hi Tim,

> Can I ask why you cant reduce your home partition and then extend the
> root into the free space ?

Probably because they're ordered as

[-root-][--home--]

and extending /home by moving its start backwards requires re-writing
the whole partition, last I knew, which is a more risky operation than
moving the end of /home forwards.

-- 
Cheers, Ralph.

-- 
  Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Problem with 'full' Root partition

2021-01-29 Thread Ralph Corderoy
Hi Clive,

> SGkgUmFscGgKClJhbiB0aGUgY29tbWFuZCBhbmQgaXQgZGVsZXRlZCB0aGUgZmlsZXMuwqDCoCBE

> Ran the command and it deleted the files.   Did a complete re-boot and
> checked, it does not seem to have done much in reducing the partition
> file size.

No reboot required, either for that command or the suggestions below.

To measure the amount of disk free, a

df /
df /home

etc, as appropriate, naming the filesystem's mount point, before and
after the command will show the change.

> Should that command be run in that folder (.var/tmp) or did it not matter?

No, the command can be run anywhere and the space it cleared wouldn't
normally be freed on rebooting so it would have made some improvement,
even if it's too slight to notice.

> The notice is still coming up saying less than 430Mb free.

Have you tried the normal

sudo apt-get clean
sudo apt-get autoremove

to clean up downloaded Mint package files?

> If I can't find out what is happening then I'll re-install Mint 19.2
> files system into that partition and leave the '/Home' folder in the
> other partition.

It will likely just fill up again in time.  Best to pursue the cause.

-- 
Cheers, Ralph.

-- 
  Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Assistance debugging Python on Raspberry Pi.

2021-01-29 Thread Ralph Corderoy
Hi Peter,

> BUT anytime I add anything to the program the subscriber stops firing
> the LEDs.

‘Anything’ is very vague.  Can you attach the output of

diff -u working.py broken.py

where you've done some simple change which breaks it, e.g...

> I tried to print to stdout in each function, but nothing happened.

...printing to stdout from one of the functions.

And also tell us how you're running in the program.

> Can one have an 'orphan' function in a Python program?

No.

> This morning my thought was to rewrite the whole subscriber program
> into a lot fewer function calls, which I don't fancy doing.

And wouldn't determine the problem which might simply reoccur.  :-)

-- 
Cheers, Ralph.

-- 
  Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


[Dorset] Assistance debugging Python on Raspberry Pi.

2021-01-29 Thread PeterMerchant

I have a program on my Raspberry Pi  (subscriber) that gets MQTT messages from 
a broker (Mosquitto) also on the Pi, and lights LEDS depending on the content 
of the messages.  My final intention is to add my ultrasonic detector to this 
program. Note that these LEDs are the test rig for my RC car, so eventually I 
would want the U/S to detect possible collisions.

The R-Pi was headless, but now has a screen attached.

BUT anytime I add anything to the program the subscriber stops firing the LEDs. 
I can't tell if it is still working. I tried to print  to stdout in each 
function, but nothing happened. I tried in one function to write to a logfile, 
and that function's LED didn't fire. Good point there is that other functions 
still worked. I had added the functions to detect the U/S but ended up 
commenting them out as it seemed to stop the system. Even having a function in 
the program that did nothing seemed to stop operation. Can one have an 'orphan' 
function in a Python program?  The R-Pi LOGGER function also stops it.

Appreciate any thoughts and suggestions.  This morning my thought was to 
rewrite the whole subscriber program into a lot fewer function calls, which I 
don't fancy doing.

Peter M.




--
 Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk