Automated system checks at _n_ boots? (Edited)

I’m curious if the L5 does automatic checks after n number of shutdowns/reboots, as my other Linux system does…? Occasionally when I reboot the L5, the logo screen lingers for a very long time before finally rebooting to the login.

This (?depending what you are talking about) is a file system setting.

sudo tune2fs -l /dev/rootpartition | grep -i 'mount count'

where you replace rootpartition by whatever is the correct name in /dev

Set max-mount-counts with -c and, for testing (or other purposes), mount-count with -C

Of course be careful with tune2fs :slight_smile:

This will hardly be relevant to me once most of the bugs are shaken out. I don’t tend to ‘shutdown’ my phone at all. Just the odd ‘kernel’ update that requires a reboot. So that means that max-mount-counts will need to be set to a low number if that functionality is used.

Thanks. I guess what I’m asking is if Purism has already preset the L5 to run checks periodically at shutdown, and if that is why I sometimes get very long delays on my restarts.

Indeed. So if you execute the above command, that may answer the question. Post the output for the benefit of those of us without a phone yet. If you didn’t set the max-mount-counts then I guess Purism did. But what is it set to?

Note though that the file system check is on startup, not shutdown.

There can be other reasons for slow shutdown. In my recent experience, snaps don’t seem to shut down nicely a lot of the time and shutdown gives them 90 seconds to do so.

3 Likes

So should the root partition be “sda1”? That’s what the 32 GB drive shows.
Edit: the main partition, that is.

mount -l | grep ' / '

will tell you what device (partition) the root file system is on.

Note that you really need to do tune2fs -l on every ext file system. So if you have a µSD card in your phone then you should get the max-mount-counts parameter for that too. It is suggested that you keep your file systems out of sync so that they don’t all check at once (on the same boot) and that is one use of tune2fs -C

2 Likes

purism@pureos:~$ mount -l | grep ’ / ’
/dev/mmcblk0p2 on / type ext4 (rw,relatime,errors=remount-ro)
purism@pureos:~$

1 Like

purism@pureos:~$ sudo tune2fs -l /dev/mmcblk0p2 | grep -i ‘mount count’
Mount count: 268
Maximum mount count: -1
purism@pureos:~$

Edit1: Of course, I have no clue what I’m seeing here…
Edit2: BTW, disregard my mention of “sda1”. I was looking at my SD card, which happens to also be 32GB, like the hard drive.

Partition 1:

purism@pureos:~$ sudo tune2fs -l /dev/mmcblk0p1 | grep -i ‘mount count’grep: count’
grep: count’grep:: No such file or directory
grep: count’: No such file or directory
purism@pureos:~$

OK, that says that this checking is disabled. You have mounted the root file system 268 times but it will never check its integrity on account of ‘Maximum mount count’.

So you will also need to do

sudo tune2fs -l /dev/mmcblk0p2 | grep Check\ int

Except you need to do all this on /dev/sda1 too - so don’t disregard it. Checking a large SD card can be slooooooowwwww (not that 32GB is large).

1 Like

Looks like you messed up that command. But partition 1 may be a FAT file system anyway?? (for /boot)

Ext2

OK, then it needs to be checked too, both for max-mount-counts and for interval-between-checks

purism@pureos:~$ sudo tune2fs -l /dev/mmcblk0p1 | grep Check\ int
Check interval: 0 ()
purism@pureos:~$ sudo tune2fs -l /dev/mmcblk0p2 | grep Check\ int
Check interval: 0 ()

How would I set an interval for checks?

With tune2fs -i but I recommend using the man page to see the syntax to be used.

The result so far is to fail to explain a long pause at boot - because your eMMC drive, either partition, isn’t set to do an integrity check either by time or by number of mounts (roughly, number of boots). Unless the µSD card is set to do an integrity check.

How about this, staggered by 10:

purism@pureos:~$ sudo tune2fs -c 30 /dev/mmcblk0p2
tune2fs 1.44.5 (15-Dec-2018)
Setting maximal mount count to 30

purism@pureos:~$ sudo tune2fs -c 40 /dev/mmcblk0p1
tune2fs 1.44.5 (15-Dec-2018)
Setting maximal mount count to 40

The better way to do staggering is to set the two partitions to the same number and then use -C to fudge the partitions so that they are out of sync e.g. if you set both to -c 30 then also use e.g. -C 15 and -C 0 on the respective partitions to get them maximally out of sync. This is the only way to ensure that two or more partitions are never checked at the same boot. This assumes that both partitions mount on every boot.

As I said though, I don’t know how you have managed to reboot 268 times already! On my phone, 30 reboots could mean waiting many years between integrity checks, which would be pointless, and -i would be more appropriate. With your current operation, yes, -c 30 may be appropriate.

The boot(?) partition probably isn’t that big a deal either way. It is probably fairly small and will not take long to check and so there is no pressing need to keep it out of sync relative to the root partition. If the other partition is not the boot partition then ignore this paragraph.

1 Like

OK, so now I’m set to:

purism@pureos:~$ sudo tune2fs -c 30 /dev/mmcblk0p1
tune2fs 1.44.5 (15-Dec-2018)
Setting maximal mount count to 30

purism@pureos:~$ sudo tune2fs -c 30 /dev/mmcblk0p2
tune2fs 1.44.5 (15-Dec-2018)
Setting maximal mount count to 30

purism@pureos:~$ sudo tune2fs -C 15 /dev/mmcblk0p1
tune2fs 1.44.5 (15-Dec-2018)
Setting current mount count to 15

purism@pureos:~$ sudo tune2fs -C 0 /dev/mmcblk0p2
tune2fs 1.44.5 (15-Dec-2018)
Setting current mount count to 0

How’s that?

Yes, maybe it consists of my reboots plus all the in-shop testing and setup before I got the phone? Not sure.

P.S. My current microSD card is formatted as FAT, but I will probably either reformat it or replace it with something larger soon.

1 Like

Free Space 5.2 MB - Unallocated Space /dev/mmcblk0
Filesystem Partition 1 - 488 MB – 341 MB free - Linux (Bootable)
Filesystem Partition 2 - 31 GB – 19 GB free - Linux

mount -l | grep mmcblk0p1