Re: hard disk and sub flash disk issues

2022-12-08 Thread Christoph Brinkhaus
Am Thu, Dec 08, 2022 at 04:38:55PM +0300 schrieb Semih Ozlem:

Hello Semith,

I have deleted (i), (ii) and (iv) because I can not contribute to that
questions. Please tell me if this is not ok in this mailing list.

> (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

I have also an external hard drive which behaves similar.
It is an Intenso "something" with 250 GB or 500 GB.

The external disk works well if connected by a cheap USB hub with an
external 5V supply.

This is not mch feedback but I hope it helps.

Kind regards,
Christoph



Re: hard disk and sub flash disk issues

2022-12-08 Thread David Christensen

On 12/8/22 05:38, Semih Ozlem wrote:

Hi Everyone

Fist of all many thanks for sharing your knowledge and experience.

Here are the issues I am facing

(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



I concur with another reader's suggestions to stop using that partition 
for swap, to comment out any fstab(5) entry for that partition, and to 
backup the partition by taking an image.



For imaging/ cloning, the KISS approach is dd(1).  Clonezilla appears to 
add more capabilities, but I have not used it:


https://clonezilla.org/


Assuming the partition has an ext2/3/4 filesystem, I would STFW to see 
what recovery tools are available and how to use them.




(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



If there is data you want on the USB flash drives, I would insert them 
into a working Debian system, mount the file system(s) read-only, and 
copy out the data.



Broken OS instances can be fixed if you have the time and expertise.


I have found it is more practical to invest myself in backup and 
recovery skills and equipment (e.g. spare computers, spare disks, drive 
adapters, my own shell and Perl scripts, etc.).  If you have neither, 
you can put the USB flash drives on the shelf for later, or wipe them 
now and start over with a fresh install.




(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



I suggest using Seagate SeaTools to diagnose the HDD:

https://www.seagate.com/support/downloads/seatools/



(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



What is the model/ part number of the Asus laptop?  What options does it 
have?  Please provide a URL to the Asus technical support page.



What is the make and model of the HDD?


How did you remove the USB port?



the temporary machine I am running is i3 and is Casper

Any help would be great. Thanks



David



Re: hangs at boot [Solved]

2022-12-08 Thread Greg Wooledge
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.)  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.



Re: hangs at boot [Solved]

2022-12-08 Thread email . lists81

On 2022-12-01 19:27, Greg Wooledge wrote:

On Thu, Dec 01, 2022 at 07:25:24PM +0100, jd wrote:

On 2022-12-01 19:05, Tim Woodall wrote:

On Thu, 1 Dec 2022, jd wrote:


On 2022-11-30 18:52, Hans wrote:

Am Mittwoch, 30. November 2022, 18:33:49 CET schrieb jd:

Try to deinstall cups and remove any usb cameras. I had had the
problem, that
cups detected an usb camera as a printer and then stopped booting.

I tried removing all cups packages, then it just stalled at
Unattended upgrades shutdown instead.

So I tried disabling that, and now it stalls at Hostname Service.


is it stalled or just taking a very long time? DNS timing out can
sometimes cause issues like this.


That depends on how long it can get stuck due to DNS issues, I've left it
for several hours and it's still stuck in the same place. If it was a DNS
issue it should have gotten somewhere after several hours no?

But when you say "stuck", what you really mean is "I never get a login
prompt on tty1".  But you *are* getting login prompts on other TTYs,
right?

Yes exactly.

Which installation image did you use,


https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.5.0-amd64-netinst.iso


and how deeply have you investigated
the systemd getty/console startup stuff?


Not very, I wouldn't really know how.

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.



The problem is now solved, but unsatisfactorily I still don't know what 
the problem was or exactly what solved it.


Anyhow what I did was to reinstall in bios-mode instead of uefi mode. 
After that the problem remained but to my surprise startx now worked, 
which it didn't before. 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.


Thanks to everyone for all the help and suggestions along the way.


cheers

jd


Re: /boot/grub/grub.cfg menu entries

2022-12-08 Thread Felix Miata
Intense Red composed on 2022-12-08 16:42 (UTC-0600):

>That seems to be the problem -- os-prober only shows that /dev/sdf1 has an 
> OS on it, it seems to ignore the linux install on /dev/sdg1.

Did you install one in legacy mode and the other in UEFI mode?

Is GRUB_DISTRIBUTOR= in /etc/default/grub the same for both UEFI installations? 
If
yes, very likely this is the root problem, because you didn't touch it for 
either
installation. With UEFI, a directory in \EFI\ on the FAT ESP filesystem is
responsible for booting. If UEFI applies to both and there is only one ESP in 
the
PC, one of your installations has overwritten the first installed, because the
result of GRUB_DISTRIBUTOR= in both is \EFI\debian aka /boot/efi/EFI/debian. 
Your
BIOS only knows about the installation pointed to by whichever had last written 
to
that location.

Please provide output from

efibootmgr -v
lsblk -f
cat /etc/fstab  # from both installations
-- 
Evolution as taught in public schools is, like religion,
based on faith, not based on science.

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata



Re: /boot/grub/grub.cfg menu entries

2022-12-08 Thread Intense Red
> You can also try os-prober as root and see if it detects the other
> partitions.

   That seems to be the problem -- os-prober only shows that /dev/sdf1 has an 
OS on it, it seems to ignore the linux install on /dev/sdg1.

   IMO the next question becomes how do I convince os-prober to see /dev/sg1 
is bootable or to add it to grub.cfg? The man page for os-prober is non-
existent.


-- 
"To announce that there must be no criticism of the President, or that we are 
to stand by the President, right or wrong, is not only unpatriotic and 
servile, but is morally treasonable to the American public." -- Republican 
President Theodore (Teddy) Roosevelt.





OT: Thanks and Margaret Thatcher (was: Re: scripts, was Re: TBird mail)

2022-12-08 Thread rhkramer
Thanks to David Wright and Greg Wooledge for their replies.

Thanks also to David for the reference to the article on Margaret Thatcher -- 
I'm trying to obtain a copy through my local library (ILL).


On Wednesday, December 07, 2022 11:53:18 AM David Wright wrote:
...
> Margaret Thatcher is a prime example, even making the pages of Nature:
> 
> https://www.nature.com/articles/300744a0
> 
> Of course, an initial "Er…" can be an important cue that you're going
> to say something. Without it, someone not paying attention to you will
> likely miss the first part of your utterance, or at least have to
> replay it in their head before comprehending it. I believe our replay
> mechanism has been much researched.

-- 
rhk 

(sig revised 20221206)

If you reply: snip, snip, and snip again; leave attributions; avoid HTML; 
avoid top posting; and keep it "on list".  (Oxford comma (and semi-colon) 
included at no charge.)  If you revise the topic, change the Subject: line.  
If you change the topic, start a new thread.

Writing is often meant for others to read and understand (legal documents 
excepted?) -- make it easier for your reader by various means, including 
liberal use of whitespace (short paragraphs, separated by whitespace / blank 
lines) and minimal use of (obscure?) jargon, abbreviations, acronyms, and 
references.

If someone has already responded to a question, decide whether any response 
you add will be helpful or not ...

A picture is worth a thousand words.  A video (or "audio"): not so much -- 
divide by 10 for each minute of video (or audio) or create a transcript and 
edit it to 10% of the original.

A speaker who uses ahhs, ums, or such may have a real physical or mental 
disability, or may be showing disrespect for his listeners by not properly 
preparing in advance and thinking before speaking.  (Remember Cicero who did 
not have enough time to write a short missive.)  (That speaker might have been 
"trained" to do this by being interrupted often if he pauses.)

A radio (or TV) station which broadcasts speakers with high pitched voices (or 
very low pitched / gravelly voices) (which older people might not be able to 
hear properly) disrespects its listeners.   Likewise if it broadcasts 
extraneous or disturbing sounds (like gunfire or crying), or broadcasts 
speakers using their native language (with or without an overdubbed 
translation).

A person who writes a sig this long probably has issues and disrespects (and 
offends) a large number of readers. ;-)
'



Re: bash read and field separator

2022-12-08 Thread Greg Wooledge
On Thu, Dec 08, 2022 at 09:53:37PM +0700, Max Nikulin wrote:
> On 07/12/2022 19:18, Greg Wooledge wrote:
> > 
> > rlart() {
> >local day time path
> >find "${1:-.}" -type f -printf '%T@ %TY-%Tm-%Td %TT %p\0' |
> >  sort -zn |
> >  while read -rd '' _ day time path; do
> >printf '%s %s %s\n' "$day" "${time%.*}" "$path"
> >  done
> > }
> 
> I was not aware of the "read -d ''" feature that allows to work with
> null-terminated records, so thank you for the hint. However the read command
> strips leading and trailing spaces and newlines from path. What is the best
> way to preserve them?

Well, let's see.

unicorn:~$ find .bashrc -printf '%T@ %TY-%Tm-%Td %TT %p\0'
1670415288.2197120110 2022-12-07 07:14:48.2197120110 .bashrcunicorn:~$ 

> 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.

unicorn:~$ find ./.bashrc -printf '%T@/%TY-%Tm-%Td/%TT/%p\0' ; echo
1670415288.2197120110/2022-12-07/07:14:48.2197120110/./.bashrc

Yes, that looks OK for parsing with a fixed number of variables on the
read command.  Just gotta add IFS=/ and we're good to go.

After editing .bashrc to have this:

rlart() {
  local day time path
  find "${1:-.}" -type f -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
}

let's do a bit of testing:

unicorn:~$ rlart tmp | tail -n5 | sed -n l
2021-08-23 13:10:38 tmp/mawk-1.3.4-20200120/fcall.o$
2021-08-23 13:10:38 tmp/mawk-1.3.4-20200120/version.o$
2021-08-23 13:10:38 tmp/mawk-1.3.4-20200120/mawk$
2022-12-07 18:52:30 tmp/shot.png$
2022-12-08 11:46:11 tmp/  spaces  $

Looks correct.



bash read and field separator

2022-12-08 Thread Max Nikulin

On 07/12/2022 19:18, Greg Wooledge wrote:


rlart() {
   local day time path
   find "${1:-.}" -type f -printf '%T@ %TY-%Tm-%Td %TT %p\0' |
 sort -zn |
 while read -rd '' _ day time path; do
   printf '%s %s %s\n' "$day" "${time%.*}" "$path"
 done
}


I was not aware of the "read -d ''" feature that allows to work with 
null-terminated records, so thank you for the hint. However the read 
command strips leading and trailing spaces and newlines from path. What 
is the best way to preserve them? I have tried slash (a character 
disallowed in file names) instead of space as field separator:


printf 'a///1/1\n\000b/ 2/\000c/3/\000d/4//\000' |
  while IFS='/' read -r -d '' num path ; do
printf '%s %q\n' "$num" "$path" ;
  done
a $'//1/1\n'
b \ 2
c 3
d 4//

No problem with spaces, leading "//" are preserved, but single trailing 
slash is removed after "3".


Another question is if "$@" instead of "${1:-.}" may cause any problem.



Re: hard disk and sub flash disk issues

2022-12-08 Thread Max Nikulin

On 08/12/2022 20:38, 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


A chance is rather low.

1. swapoff for this partition (immediately)
2. change partition type to avoid automount it by e.g. live systems, 
edit /etc/fstab.
3. create an image for this partition. It will allow to restore current 
state after unsuccessful attempt to restore files.
4. install testdisk and run photorec as root. The tool is able to 
restore some types of files if they are not fragmented. File names would 
not be preserved, so high enough efforts may be required to sort 
recovered files.


Unsure if e.g. backup of file system superblock will help to recover at 
least a part of directory structures.


Check actual type of the partition (I am unsure concerning precise 
action for "turned one of the partitions ... to linux swap")

file -s /dev/sdX





hard disk and sub flash disk issues

2022-12-08 Thread Semih Ozlem
Hi Everyone

Fist of all many thanks for sharing your knowledge and experience.

Here are the issues I am facing

(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

(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

(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

the temporary machine I am running is i3 and is Casper

Any help would be great. Thanks


Re: apcupsd sc420i line voltage

2022-12-08 Thread Vukovics Mihály

Hi Alexander,

thanks for the tipp. NUT also reports wrong model name and line voltage.
The USB-Serial converter is probably OK, as I can access the UPS over 
ttyUSB and issue commands and get proper answers.


BR,
Mihaly

--
Köszönettel:
Vukovics Mihály

On 2022. 12. 07. 18:37, Alexander V. Makartsev wrote:

On 07.12.2022 19:47, Vukovics Mihály wrote:

Hello Community,

I am strugling with APC SmartUPS SC420I and apcupsd.
The UPS is connected via usb-to serial adapter and 940-0024E cable.

The UPS is recognized as "Back-UPS Pro 280" instead of SC420I and the 
line voltage is displayed as 120V instead of the real 230V.


UPSTYPE apcsmart
DEVICE /dev/ttyUSB0

Has any of  you experienced like this and know how to fix at least 
the line voltage value?


Maybe it would be better to try "nut-server" which could have a better 
apcsmart driver implementation?
I have APC SmartUPS SC1500I with similar setup, USB-to-COM adapter and 
self-made APC UPS Smart cable and it is working fine with nut-server, 
both monitoring and control.


Another thing to check could be an usb-to-serial adapter. I've seen 
some cheap low-quality adapters which were created with counterfeit ICs.


--
With kindest regards, Alexander.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀https://www.debian.org
⠈⠳⣄