Re: bash read and field separator

2022-12-09 Thread Max Nikulin

On 08/12/2022 23:52, Greg Wooledge wrote:

On Thu, Dec 08, 2022 at 09:53:37PM +0700, Max Nikulin wrote:


I have tried slash (a character disallowed in file
names) instead of space as field separator:


The "problem" with that is we have slashes in our pathnames (%p) in
almost all cases.  But if we carefully build the read command, I
think it should keep them intact.


I am trying to figure out if it is possible to avoid stripping of single 
(and only single) trailing slash. It is not an issue while "-type f" 
selector is used, but I am trying to evaluate if it may be used as a 
more general approach.


find dir dir/ dir// | sed -n l
dir$
dir/$
dir//$

find dir dir/ dir// -printf '%T@/%TY-%Tm-%Td/%TT/%p\0' | sort -zn |
while IFS=/ read -rd '' _ day time path; do
printf '%s %s %s\n' "$day" "${time%.*}" "$path";
done | sed -n l
2022-12-09 22:13:14 dir$
2022-12-09 22:13:14 dir$
2022-12-09 22:13:14 dir//$

Single trailing / disappeared. Using any other character may cause 
incorrect path in the output.




how to find the original install version

2022-12-09 Thread Bonno Bloksma
Hi,

Some of my Debian installations have been done several years ago and then 
gotten upgrades to a new version.
Like I have a system that started as a Debian 8 machine and is now at Debian 11,

But... how do I find out when a particular machine started it's life, is there 
a way to find out?
How do I find out which old libraries, that are probably not being used and... 
worse no longer getting security updates, are still around?

The upgrade in itself is not as problem but sometimes old libraries stay around 
and finding out which libraries can indeed be deleted safe might be too much 
work.
I can rebuild a Debian machine quite fast and have it up and running with for 
instance the DHCP service within the hour having all the correct config and 
other stuff I want.
I would like to know for which systems I realy need to do this. ;-)

Bonno Bloksma



Re: bash read and field separator

2022-12-09 Thread Greg Wooledge
On Fri, Dec 09, 2022 at 10:23:29PM +0700, Max Nikulin wrote:
> find dir dir/ dir// | sed -n l
> dir$
> dir/$
> dir//$
> 
> find dir dir/ dir// -printf '%T@/%TY-%Tm-%Td/%TT/%p\0' | sort -zn |
> while IFS=/ read -rd '' _ day time path; do
> printf '%s %s %s\n' "$day" "${time%.*}" "$path";
> done | sed -n l
> 2022-12-09 22:13:14 dir$
> 2022-12-09 22:13:14 dir$
> 2022-12-09 22:13:14 dir//$
> 
> Single trailing / disappeared. Using any other character may cause incorrect
> path in the output.

I can't reproduce your result.

unicorn:~$ mkdir tmp/leaf
unicorn:~$ find tmp/leaf tmp/leaf/ tmp/leaf//
tmp/leaf
tmp/leaf/
tmp/leaf//
unicorn:~$ find tmp/leaf tmp/leaf/ tmp/leaf// -printf 
'%T@/%TY-%Tm-%Td/%TT/%p\0' | while IFS=/ read -rd '' _ day time path; do printf 
'%s\n' "$path"; done
tmp/leaf
tmp/leaf/
tmp/leaf//

Which version of bash are you using, or is it some other shell?



Re: hard disk and sub flash disk issues

2022-12-09 Thread David Wright
On Thu 08 Dec 2022 at 16:38:55 (+0300), Semih Ozlem wrote:
> 
> (i) I accidentally turned one of the partitions on the hard disk of the
> machine I currently have to linux swap. That partition contained files that
> I may need to review or use later. Is there a way to recove those files and
> if so how

As others have suggested, and after taking precautions against its
further use, copy an image of the partition with dd, at which point
I would run md5sum over both partition and image to check they're
identical, particularly important in view of the following.

> (ii) I installed debian and ubuntu on various usb flash disks of size 64 gb
> or 32 gb or even I think 16 gb not live systems but either full
> installations or some persistence. Some of them broke down meaning they
> wont boot or run a full system they may drop to busybox or simply refuse to
> start at all. Some of those filesystems are still viewable if I start the
> machine with a live system or persistence system. Can they be fixed if so
> how and is it worth the effort
> 
> (iii) I have an external hard drive seagate that appears in lsusb command
> but the disk does not mount or appear under blkid or lsblk even with sudo.
> Can I recover that device external hard disk

Are you using the temporary i3 Casper machine for (ii) and (iii)?
If so, it may just be that your USB ports are mechanically unreliable.
That's my experience with consumer-grade laptops; I presume they make
their savings through cheap construction.

> (iv) I have another machine that was working with windows that no longer
> recognizes its usb ports or the hard drive. One of the ports copper wires I
> think got bent so I removed that usb port now the bios screen appears but
> windows wont boot and the hard disk does not get recognized by the bios
> this is a laptop i7 asus

Tearing down laptops (as opposed to desktops) is beyond my experience.

> the temporary machine I am running is i3 and is Casper

Cheers,
David.



Re: how to find the original install version

2022-12-09 Thread David Wright
On Fri 09 Dec 2022 at 12:40:48 (+), Bonno Bloksma wrote:
> 
> Some of my Debian installations have been done several years ago and then 
> gotten upgrades to a new version.
> Like I have a system that started as a Debian 8 machine and is now at Debian 
> 11,
> 
> But... how do I find out when a particular machine started it's life, is 
> there a way to find out?

I don't think that /var/log/installer/ ever gets rotated away, so
there should be a syslog of the original installation in there.

> How do I find out which old libraries, that are probably not being used 
> and... worse no longer getting security updates, are still around?

I run the following (extracted from a script):

  $ apt-cache dump | grep -a -e '^Package:' -e '^ Version:' -e '^ File: ' | 
sed -e '/Version:/{N;s/\n//}' | sed -e '/Package:/h;/Version:/{G;s/\n/ /}' | 
grep -v -e '^Package:' | grep -e 'File:' | sed -e 's/[ ]\+/ /g;s/ \([^ ]\+ [^ 
]\+ [^ ]\+ [^ ]\+\) \([^ ]\+ [^ ]\+\)/\2 \1/' | LC_ALL=C sort > some-file
  $ dpkg-query -W -f '^Package: ${Package} Version: ${Version} \n' | grep 
--file=- some-file | sed -e 's/^Package: //;s/ Version: /_/;s/ File: / /;'

If you pipe the output from the second command into less,
then you can find strays with the commands

  /_bullseye[-_]  ← this should match most lines
  /!  ← this will then match anything else

For example, my systems' output all contain the line:

  xtoolwait_1.3-6.2 /var/lib/dpkg/status

which I have preserved from squeeze, and install manually.

> The upgrade in itself is not as problem but sometimes old libraries stay 
> around and finding out which libraries can indeed be deleted safe might be 
> too much work.
> I can rebuild a Debian machine quite fast and have it up and running with for 
> instance the DHCP service within the hour having all the correct config and 
> other stuff I want.
> I would like to know for which systems I realy need to do this. ;-)

Cheers,
David.


Re: how to find the original install version

2022-12-09 Thread tomas
On Fri, Dec 09, 2022 at 12:40:48PM +, Bonno Bloksma wrote:
> Hi,
> 
> Some of my Debian installations have been done several years ago and then 
> gotten upgrades to a new version.
> Like I have a system that started as a Debian 8 machine and is now at Debian 
> 11,
> 
> But... how do I find out when a particular machine started it's life, is 
> there a way to find out?
> How do I find out which old libraries, that are probably not being used 
> and... worse no longer getting security updates, are still around?
> 
> The upgrade in itself is not as problem but sometimes old libraries stay 
> around and finding out which libraries can indeed be deleted safe might be 
> too much work.
> I can rebuild a Debian machine quite fast and have it up and running with for 
> instance the DHCP service within the hour having all the correct config and 
> other stuff I want.
> I would like to know for which systems I realy need to do this. ;-)

I would expect that if a Debian installed library stays around,
it's because there is no replacement for it. Anyway, you might
want to try something along the lines of

  find /usr/lib -printf "%T+ %p\n" | sort

(adjust starting dirs to taste). Then you could investigate with
aour package manager's help (e.g. `dpkg -S') where those oldies
are coming from. But note that the file dates are most probably
their time of build.

You coud take all of this from the "other side" and do this to
/var/cache/apt/archives, but then you might find entries for
packages long gone (if you never had to clean up your cache),
so you want again to double-check with your package manager.

Cheers
-- 
t


signature.asc
Description: PGP signature


Global- MSPs/MSSPs and CSPs Install Base

2022-12-09 Thread Hazel Johnson
Hi there,



Would you like to target accounts and users of the below install base in order 
to boost your sales and marketing goals in this last quarter?



We have hands in providing contact information of: -



Geography

North America

APAC

EMEA

LATAM

Technology

# A/C

# Contacts

# A/C

# Contacts

# A/C

# Contacts

# A/C

# Contacts

MSPs

29,206

141,380

18,493

113,765

14,430

81,030

9,056

52,450

MSSPs

17,025

93,410

11,850

70,125

9,307

58,295

5,493

21,593



Please review and let me know if you have any list requirement at this moment?



Best Regards,

Hazel

Demand Generation Manager



If you wish to not to receive further emails, change the subject line to 
Unsubscribe.



Re: hangs at boot

2022-12-09 Thread David Wright
I've removed [Solved] from the Subject: line as reinstallation
doesn't count as a solution, and any evidence is destroyed.

On Thu 08 Dec 2022 at 20:33:58 (-0500), Greg Wooledge wrote:
> On Fri, Dec 09, 2022 at 01:19:46AM +0100, email.list...@gmail.com wrote:
> > As it turns out I didn't need to but for future use, do you have any tips on
> > where one might find documentation about how agetty interacts with the rest
> > of the debian startup process? I've searched but the results have been
> > scant.
> 
> I don't know all of the pieces either.  There are a LOT of them.
> 
> By default, systemd is supposed to run a single getty on /dev/tty1, and
> also passively "listen" for activity on tty2 through tty6.  Switching
> to one of those VTs will cause a getty to be spawned there.  NOT switching
> to them leaves them with nothing visibly running.
> 
> Before pressing Ctrl-Alt-F3:
> 
> unicorn:~$ ps -ft tty3
> UID  PIDPPID  C STIME TTY  TIME CMD
> 
> After pressing Ctrl-Alt-F3:
> 
> unicorn:~$ ps -ft tty3
> UID  PIDPPID  C STIME TTY  TIME CMD
> root  852799   1  0 20:18 tty3 00:00:00 /sbin/agetty -o -p -- \u 
> --n
> 
> The number of passively launched getty processes is configurable in
> /etc/systemd/logind.conf.  I believe it's the NAutoVTs= parameter that
> controls this.
> 
> I've forgotten the details of your problem, but if switching to tty2
> gives you a login prompt, but switching back to tty1 does NOT give you
> one on tty1, then there must be something going wrong with the getty
> that's supposed to be started on tty1 at boot time -- but the passive
> gettys controlled by systemd-logind must be working.
> 
> I think the passive ones are controlled by getty@.service (the @ sign is
> some kind of wildcard).  If I read /lib/systemd/system/getty@.service
> I can see
> 
> ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear %I $TERM
> 
> which appears to match the process I'm seeing on tty3:
> 
> unicorn:~$ ps w -ft tty3
> UID  PIDPPID  C STIME TTY  STAT   TIME CMD
> root  852799   1  0 20:18 tty3 Ss+0:00 /sbin/agetty -o -p -- 
> \u --noclear tty3 linux
> 
> I don't know whether the initial getty on tty1 is also controlled by
> this service, or by some other service.  (I've already logged in on tty1
> and done a "startx", so my whole X session is running on tty1, instead
> of a getty.)

  $ tail -n 3 /lib/systemd/system/getty@.service 
  [Install]
  WantedBy=getty.target
  DefaultInstance=tty1
  $ 

This has the effect of installing the symlink
/etc/systemd/system/getty.target.wants/getty@tty1.service 
pointing to /lib/systemd/system/getty@.service, which
isn't used at runtime, but sets up the symlink that actually
starts the tty1 getty. AIUI it also prevents any /automatic/
(passive) instantiation on tty1.

(If you remember back to September, you can prevent the appearance
of the tty1 getty with   systemctl disable getty@tty1.service,
which removes the symlink above. See:

https://lists.debian.org/debian-user/2022/09/msg00661.html
)

> For grins:
> 
> unicorn:~$ systemctl status getty@tty1.service
> ● getty@tty1.service - Getty on tty1
>  Loaded: loaded (/lib/systemd/system/getty@.service; enabled; vendor 
> preset>
> Drop-In: /etc/systemd/system/getty@.service.d
>  └─noclear.conf
>  Active: active (running) since Thu 2022-11-17 18:05:49 EST; 3 weeks 0 
> days>
>Docs: man:agetty(8)
>  man:systemd-getty-generator(8)
>  http://0pointer.de/blog/projects/serial-console.html
>Main PID: 743 (login)
>   Tasks: 0 (limit: 14198)
>  Memory: 1.7M
> CPU: 48ms
>  CGroup: /system.slice/system-getty.slice/getty@tty1.service
>  ‣ 743 /bin/login -p --
> 
> Warning: some journal files were not opened due to insufficient permissions.
> 
> Ah, right, I configured that noclear.conf file on this system.
> 
> unicorn:~$ cat /etc/systemd/system/getty@.service.d/noclear.conf
> [Service]
> TTYVTDisallocate=no
> 
> So I guess getty@.service also controls the getty on tty1.  I have no idea
> why it would stop working.  Check your logs (systemctl/journalctl as root)
> and see what you can find.
> 
> Even though I'm still not clear on how all this stuff works, I hope some
> of this rambling and pasting might be helpful.

You and I presumably run our systems with multi-user as the final
target. I think the OP had graphical instead, but hadn't installed
a DM. That's how I interpret:

 "After that I installed a bunch of packages that I usually do after
  a fresh install, one of which was lightdm, and all of a sudden
  everything works and the problem is gone."

which implies they hadn't done this first time around.

Somebody might test this on a DM/DE system by removing the DM.
I imagine that tty1 will sit there waiting for the DM to appear.

Obviously I don't know how one would manage to get this with the d-i,
but as the OP appears to have had UEFI/BIOS issues, that m

Re: hangs at boot

2022-12-09 Thread Greg Wooledge
On Fri, Dec 09, 2022 at 01:57:44PM -0600, David Wright wrote:
> You and I presumably run our systems with multi-user as the final
> target. I think the OP had graphical instead, but hadn't installed
> a DM.

I didn't change the default target.

unicorn:~$ systemctl get-default
graphical.target

In the absence of a DM package of any kind, it gives me a getty/login
prompt on tty1.  It's never failed yet, so I've never had to dive deeply
into how it actually works.

> That's how I interpret:
> 
>  "After that I installed a bunch of packages that I usually do after
>   a fresh install, one of which was lightdm, and all of a sudden
>   everything works and the problem is gone."
> 
> which implies they hadn't done this first time around.
> 
> Somebody might test this on a DM/DE system by removing the DM.
> I imagine that tty1 will sit there waiting for the DM to appear.

I have no idea what would happen if one were to install a DM package,
reboot, and then remove it.  I'm not brave/curious/bored enough to
try it myself, either.

> Obviously I don't know how one would manage to get this with the d-i,
> but as the OP appears to have had UEFI/BIOS issues, that might mean
> that the d-i failed in a manner we haven't been told about.

Yeah.  And if the whole system has been wiped and reinstalled, I doubt
we'll ever learn the answer.



Re: hangs at boot

2022-12-09 Thread David Wright
On Fri 09 Dec 2022 at 15:22:23 (-0500), Greg Wooledge wrote:
> On Fri, Dec 09, 2022 at 01:57:44PM -0600, David Wright wrote:
> > You and I presumably run our systems with multi-user as the final^H^H^H^H^H
default
> > target. I think the OP had graphical instead, but hadn't installed
> > a DM.
> 
> I didn't change the default target.
> 
> unicorn:~$ systemctl get-default
> graphical.target
> 
> In the absence of a DM package of any kind, it gives me a getty/login
> prompt on tty1.  It's never failed yet, so I've never had to dive deeply
> into how it actually works.

You're right. I does appear that the postinst script of the DM
is what creates the symlink in /etc/to trigger the DM.

> > but as the OP appears to have had UEFI/BIOS issues, that might mean
> > that the d-i failed in a manner we haven't been told about.

… and I'd forgotten about the small matter of their lacking the home partition.

> Yeah.  And if the whole system has been wiped and reinstalled, I doubt
> we'll ever learn the answer.

Agreed.

Cheers,
David.


e-mail with line in body beginning with "From"

2022-12-09 Thread Greg Marks
I occasionally send e-mail from the command line via Postfix, using a
script containing the command

   /usr/sbin/sendmail -oi -f  -t  < file

In a recent instance, the body of the e-mail contained a line beginning
with the word "From"; the sendmail program prefixed the line with the
character ">" and a space (evidently interpreting "From" as a header line
that needed to be quoted).  This was more than just a trivial annoyance,
since it rendered my digital signature on the e-mail invalid.

I think I encountered a similar problem a couple decades ago using the
"mail" command on a FreeBSD machine, but I don't remember any solution
to the problem.

Is there a way to tell the Postfix sendmail command not to alter any
such lines in the body of the message?  (I'm afraid I wasn't able to
discern an answer in the man page for sendmail or by searching the
postfix.org site.)

Best regards,
Greg Marks


signature.asc
Description: PGP signature


Monitor traffic on a port.

2022-12-09 Thread peter

Debian 11 here.

Appears nettools is deprecated.

How is traffic on a specific port monitored now?

Thx, ... P.



Re: e-mail with line in body beginning with "From"

2022-12-09 Thread Teemu Likonen
* 2022-12-09 20:39:34-0600, Greg Marks wrote:

> Is there a way to tell the Postfix sendmail command not to alter any
> such lines ["From" lines] in the body of the message?

I can't answer your actual question but I think Postfix and other
"sendmails" do the right thing. In my opinion you shouldn't change them
do the wrong thing but fix the problem elsewhere.

Prepare your message in such way that it is encoded in quoted printable
or base64 so that there is no plain "From" in the beginning of any line
in the body. Letters in "From" don't need encoding in quoted printable
but email clients may still encode it because they know what sendmail
programs do.

Probably Mutt email client can automatically do all the encoding and
pass the fully compliant message to sendmail. Mutt can be used in
command line. I didn't test it because I don't have any sendmails
installed. A lower level option for constructing valid emails is
"mime-construct".

From letters are in the beginning of this line because I want to test my
own message and email client: the file that is saved locally in my
computer and the file which comes through the mailing list.

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 6965F03973F0D4CA22B9410F0F2CAE0E07608462


signature.asc
Description: PGP signature