Re: [gentoo-user] console scrollback (kernel 5.14)

2021-10-03 Thread Jorge Almeida
On Sat, Sep 25, 2021 at 12:44 AM Jorge Almeida  wrote:
>
> On Fri, Sep 24, 2021 at 5:29 PM Alan Mackenzie  wrote:
> >

>
> > attached.  Please start again from a gentoo-sources without any previous
> > traces of the scrollback patches, and apply that patch.  _Surely_ it
> > should work this time.
> >
> Sure enough, the patch was succesful. Unfortunately, I cannot test it,
>
> Anyway, I'll try again when I manage to fix or replace the computer
> and I'll report then.
>
OK, the patch is working for me, kernel 5.14.4 (not the same
computer---RIP the other one---, but same hard disk)

Thanks

Jorge Almeida



Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-27 Thread Jorge Almeida
On Mon, Sep 27, 2021 at 12:51 AM Dale  wrote:
>
> Jorge Almeida wrote:
> > On Sun, Sep 26, 2021 at 6:24 PM antlists  wrote:
> > Hello, Wol and Dale
> >> When you rebuild it, get a surge protector and then put a UPS behind
> >> that ... snag is that's all extra expense :-(
> >>


> Hope that info helps.  Also hope you can find something to prevent
> future problems.
>

Thanks, Dale and Wol. I'll give it some thought. First thing is to
replace the PSU and see how it goes. I may ask for your opinions
before buying UPS & surge protector when I'll have it sorted out.

Jorge



Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-26 Thread Dale
Jorge Almeida wrote:
> On Sun, Sep 26, 2021 at 6:24 PM antlists  wrote:
> Hello, Wol and Dale
>> When you rebuild it, get a surge protector and then put a UPS behind
>> that ... snag is that's all extra expense :-(
>>
> Surge protectors: I googled it and mostly got bad reviews. Do they
> _really_work?  What would you recommend? It probably should be
> something amazon-purchasable! Availability in my country is probably
> limited (and overpriced to boot, I bet).
>
> UPS: never gave it serious thought, I had the impression there was too
> much unclear stuff: for example, is it noisy (does it need a fan)? If
> (when) some component needs replacement will I know it before
> disaster? And does the replacement require a "qualified technician"? (
> Dale's description is not very reassuring!)
>
> Note that my lightning problem happened at night with both computer
> and monitor powered down (but still connected to a wall outlet through
> an interrupted extension; hence the "not-so-smart" self-qualifying...)
>
> Thanks for your suggestions
>
> Jorge
>
>

I had lightening strike right down the road, about 1,000 feet as a bird
flies.  It took out some stuff at my neighbors, including a freezer
which died a month later.  It even blew light bulbs, I mean literally
blew them.  They exploded and glass went all over the room.  I suggested
surge protection for their computer, TV and such a while before that. 
Even with a virtually direct hit, the surge protectors kept working. 
Not long after that, they wanted a UPS for their computer but also
wanted one for the TV, since the dish box takes a while to reload after
the power blinks.  So I helped them pick a fair sized UPS for the puter
and a smaller one for the TV.  The puter runs long enough to shutdown
normally and the TV is protected for those little blinks in power that
last just long enough to reset everything. 

One way to pick a decent surge device, look at the warranty.  If it
includes paying for items plugged in, then you're off to a good start at
least.  I just try to get as high a joule rating as I can.  The reason
for that, they can absorb more than one hit and still protect.  While
one large hit can disable protection, it can take out hundreds of
smaller hits and still work.  It all comes down to the quality of the
MOVs and the design of the protector. 

If you use Amazon: APC, Belkin and Tripp Lite are some brands I've heard
or seen are good.  I've used a couple of those brands myself.  I've
always heard that the Monster brand is also good but a bit pricey.  When
I researched them long ago, they are some heavy duty built products so
if a person has some serious power problems, they may be well worth the
expense.  I bought some on ebay that were Etekcity brand but it seems
they no longer make them.  I bought some that had a little over 5,000
joules of protection.  The only thing I didn't like, if power fails, it
stays off.  It doesn't have a hardware switch but a circuit switch that
resets on power loss.  That can be a good thing in some situations but I
don't like it. They are good protectors tho. 

Hope that info helps.  Also hope you can find something to prevent
future problems. 

Dale

:-)  :-) 





Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-26 Thread Wols Lists

On 26/09/2021 22:22, Jorge Almeida wrote:

On Sun, Sep 26, 2021 at 6:24 PM antlists  wrote:



Hello, Wol and Dale

When you rebuild it, get a surge protector and then put a UPS behind
that ... snag is that's all extra expense :-(



Surge protectors: I googled it and mostly got bad reviews. Do they
_really_work?  What would you recommend? It probably should be
something amazon-purchasable! Availability in my country is probably
limited (and overpriced to boot, I bet).


Surge protectors are tricky. In the UK, our power supply is pretty clean 
so they're (almost) a waste of time. They should have a status on them, 
usually they're good for one shock and that's it. The big danger in many 
places is a lightning hit on overhead power lines. And if it's a storm 
you can have several hits in quick succession which will overwhelm the 
protector ...


UPS: never gave it serious thought, I had the impression there was too
much unclear stuff: for example, is it noisy (does it need a fan)? If
(when) some component needs replacement will I know it before
disaster? And does the replacement require a "qualified technician"? (
Dale's description is not very reassuring!)


Again, you need a decent unit. And they're mostly a lot cheaper than a 
computer, so if they take the hit rather than your computer you're quids 
in whatever. But even if they're a not-very-good unit, if your local 
power is crappy they should clean it up and protect your computer to 
some extent.


Note that my lightning problem happened at night with both computer
and monitor powered down (but still connected to a wall outlet through
an interrupted extension; hence the "not-so-smart" self-qualifying...)

The problem is, I'm in an area where the protection these things provide 
is pretty redundant - I'd probably be fine without them. If you need 
them, as I said the danger is they're overwhelmed right at the start and 
then your kit gets damaged along with the surge protector and UPS ...


Cheers.
Wol



Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-26 Thread Jorge Almeida
On Sun, Sep 26, 2021 at 6:24 PM antlists  wrote:
>
Hello, Wol and Dale
> When you rebuild it, get a surge protector and then put a UPS behind
> that ... snag is that's all extra expense :-(
>

Surge protectors: I googled it and mostly got bad reviews. Do they
_really_work?  What would you recommend? It probably should be
something amazon-purchasable! Availability in my country is probably
limited (and overpriced to boot, I bet).

UPS: never gave it serious thought, I had the impression there was too
much unclear stuff: for example, is it noisy (does it need a fan)? If
(when) some component needs replacement will I know it before
disaster? And does the replacement require a "qualified technician"? (
Dale's description is not very reassuring!)

Note that my lightning problem happened at night with both computer
and monitor powered down (but still connected to a wall outlet through
an interrupted extension; hence the "not-so-smart" self-qualifying...)

Thanks for your suggestions

Jorge



Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-26 Thread Dale
antlists wrote:
> On 26/09/2021 13:36, Alan Mackenzie wrote:
>>> Sure enough, the patch was succesful. Unfortunately, I cannot test it,
>>> because my computer is out of luck (big thunderstorm, crappy power
>>> provider, not-so-smart owner).
>
>> I'm sorry to hear it.  I'm sure you've done it already, but get a decent
>> backup from that machine somehow while it is still even partly working.
>>
> Sounds like the drive is fine, but of course the question is "for how
> long? ..."
>
> When you rebuild it, get a surge protector and then put a UPS behind
> that ... snag is that's all extra expense :-(
>
> Cheers,
> Wol
>
>


I agree with that advise.  When I built my first system, I bought a UPS
a couple months later.  While most UPS's have a lot of surge protection
built in, I do have additional surge protection at the wall plug and I
also have a whole house surge protector in the breaker box as well.  I
make sure the light is green often, mostly check after a bad storm.
Having protection against momentary drops in either voltage or just a
outright outage for a few seconds or longer gives a lot of protection. 
File systems like to be unmounted and power failures are not good.  Most
file systems are good at recovering from problems but it does have risk.

After buying a UPS and other protections, I've had very few problems
that come from power issues.  The biggest problem I have is the
batteries in the UPS going bad and me not knowing it, even tho the UPS
is supposed to alert me of that.  Most computer power supplies can
handle a lot but having that protection outside the computer is best. 
Often, it is cheaper than a computer too.

If I had to pick one thing to protect my computer, it would be a UPS. 
It protects from most all the problems a computer can have with power. 
Protects against surges, brownouts and complete loss of power. 
Additional protection adds more protection but a UPS is a really good
start.  Even a small one that can only run a few minutes offers a lot. 

Just something to think on. 

Dale

:-)  :-) 

P. S.  I have a CyberPower UPS.  There are a lot of good brands out
there tho. 



Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-26 Thread antlists

On 26/09/2021 13:36, Alan Mackenzie wrote:

Sure enough, the patch was succesful. Unfortunately, I cannot test it,
because my computer is out of luck (big thunderstorm, crappy power
provider, not-so-smart owner).



I'm sorry to hear it.  I'm sure you've done it already, but get a decent
backup from that machine somehow while it is still even partly working.

Sounds like the drive is fine, but of course the question is "for how 
long? ..."


When you rebuild it, get a surge protector and then put a UPS behind 
that ... snag is that's all extra expense :-(


Cheers,
Wol



Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-26 Thread Alan Mackenzie
Hello, Jorge.

On Fri, Sep 24, 2021 at 23:44:51 +, Jorge Almeida wrote:
> On Fri, Sep 24, 2021 at 5:29 PM Alan Mackenzie  wrote:

> Hello, Alan

> > > $ patch -p0 <../patch_for_5.14.diff
> > > patching file ./drivers/tty/vt/vt.c
> > > Hunk #1 FAILED at 3208.
> > > 1 out of 1 hunk FAILED -- saving rejects to file ./drivers/tty/vt/vt.c.rej


> > attached.  Please start again from a gentoo-sources without any previous
> > traces of the scrollback patches, and apply that patch.  _Surely_ it
> > should work this time.

> Sure enough, the patch was succesful. Unfortunately, I cannot test it,
> because my computer is out of luck (big thunderstorm, crappy power
> provider, not-so-smart owner).

I'm sorry to hear it.  I'm sure you've done it already, but get a decent
backup from that machine somehow while it is still even partly working.

> I can ssh into it and it all seems fine, but VT's other than tty1 go
> dim after 1 or 2 seconds (showing the greeting) and then go black; I
> can login blindly!  I'm sure it has nothing to do with the patch,
> since I also booted the former kernel (for which the previous patch
> has been applied with success as expected) and it happens the same.
> Damaged UPS or MO, maybe...  Anyway, I'll try again when I manage to
> fix or replace the computer and I'll report then.

OK, thanks!

> Thanks,

> Jorge Almeida

> P.S. I just noticed you mention gentoo-sources. I use the vanilla
> kernel from kernel.org. Could that be a problem?

Highly unlikely.  I doubt very much there's any difference in the tty
code between vanilla and gentoo-sources, but even so, I'm now basing my
patches on a Linux repository cloned from their central repository
server.

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-25 Thread Peter Humphrey
On Friday, 24 September 2021 18:29:11 BST Alan Mackenzie wrote:

> To apply the patch (you surely know this already), cd to the top of the
> kernel tree, and use
> 
> $ patch -p1 < 5.14.5-scroll-20210924.diff
[...]
> ..  Please let me know again how it works out.  Thanks!

Works for me, Alan, against 5.14.7. Once I spotted the change to -p1, that is. 
:(

Thanks again.

-- 
Regards,
Peter.






Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-24 Thread Jorge Almeida
On Fri, Sep 24, 2021 at 5:29 PM Alan Mackenzie  wrote:
>
Hejjo, Alan

> > $ patch -p0 <../patch_for_5.14.diff
> > patching file ./drivers/tty/vt/vt.c
> > Hunk #1 FAILED at 3208.
> > 1 out of 1 hunk FAILED -- saving rejects to file ./drivers/tty/vt/vt.c.rej
>

> attached.  Please start again from a gentoo-sources without any previous
> traces of the scrollback patches, and apply that patch.  _Surely_ it
> should work this time.
>
Sure enough, the patch was succesful. Unfortunately, I cannot test it,
because my computer is out of luck (big thunderstorm, crappy power
provider, not-so-smart owner). I can ssh into it and it all seems
fine, but VT's other than tty1 go dim after 1 or 2 seconds (showing
the greeting) and then go black; I can login blindly!
I'm sure it has nothing to do with the patch, since I also booted the
former kernel (for which the previous patch has been applied with
success as expected) and it happens the same. Damaged UPS or MO,
maybe...
Anyway, I'll try again when I manage to fix or replace the computer
and I'll report then.

Thanks,

Jorge Almeida

P.S. I just noticed you mention gentoo-sources. I use the vanilla
kernel from kernel.org. Could that be a problem?



Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-24 Thread Alan Mackenzie
Hello, Jorge.

On Fri, Sep 24, 2021 at 09:22:45 +0100, Jorge Almeida wrote:
> On Thu, Sep 23, 2021 at 6:03 PM Alan Mackenzie  wrote:

[  ]

> It still fails:
> $ patch -p0 <../patch_for_5.14.diff
> patching file ./drivers/tty/vt/vt.c
> Hunk #1 FAILED at 3208.
> 1 out of 1 hunk FAILED -- saving rejects to file ./drivers/tty/vt/vt.c.rej

Apologies once more.  Late last night I managed to get a Linux kernel
git repository set up.  :-)  So, at least if there are any more
failures, they'll be systematic failures rather than erratic failures.
;-)

>From this I've constructed a complete clean 5.14.5 patch, which I've
attached.  Please start again from a gentoo-sources without any previous
traces of the scrollback patches, and apply that patch.  _Surely_ it
should work this time.

To apply the patch (you surely know this already), cd to the top of the
kernel tree, and use

$ patch -p1 < 5.14.5-scroll-20210924.diff

..  Alternatively, if you've got git, you could use

$ git apply 5.14.5-scroll-20210924.diff

..  Please let me know again how it works out.  Thanks!

[  ]

> Thanks,

> Jorge Almeida

-- 
Alan Mackenzie (Nuremberg, Germany).

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index ef981d3b7bb4..17b51bdc9f6e 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -134,6 +134,11 @@ const struct consw *conswitchp;
 #define DEFAULT_BELL_DURATION  (HZ/8)
 #define DEFAULT_CURSOR_BLINK_MS200
 
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+static unsigned int console_soft_scrollback_size =
+   1024 * CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_SIZE;
+#endif
+
 struct vc vc_cons [MAX_NR_CONSOLES];
 
 #ifndef VT_SINGLE_DRIVER
@@ -287,7 +292,7 @@ static inline unsigned short *screenpos(const struct 
vc_data *vc, int offset,
bool viewed)
 {
unsigned short *p;
-   
+
if (!viewed)
p = (unsigned short *)(vc->vc_origin + offset);
else if (!vc->vc_sw->con_screen_pos)
@@ -616,6 +621,218 @@ static void vc_uniscr_debug_check(struct vc_data *vc)
}
 }
 
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+static void con_update_softback(struct vc_data *vc)
+{
+   int l = vc->vc_softback_size / vc->vc_size_row;
+   if (l > 5)
+   {
+   vc->vc_softback_end = vc->vc_softback_buf + l * vc->vc_size_row;
+   vc->vc_softback_top = vc->vc_softback_buf;
+   }
+   else
+   /* Smaller scrollback makes no sense, and 0 would screw
+  the operation totally */
+   vc->vc_softback_top = 0;
+}
+
+static int concon_set_origin(struct vc_data *vc)
+{
+   if (vc->vc_softback_lines)
+   concon_scrolldelta(vc, vc->vc_softback_lines);
+   return 0;
+}
+
+#define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) 
* vc->vc_size_row)
+
+static void con_redraw_softback(struct vc_data *vc, /* struct display *p, */
+   long delta)
+{
+   int count = vc->vc_rows;
+   unsigned short *d, *s;
+   unsigned long n;
+   int line = 0;
+
+   if (!vc->vc_softback_lines)
+   vc->vc_char_at_pos = scr_readw((u16 *)vc->vc_pos);
+
+   d = (u16 *) vc->vc_softback_curr;
+   if (d == (u16 *) vc->vc_softback_in)
+   d = (u16 *) vc->vc_origin;
+   n = vc->vc_softback_curr + delta * vc->vc_size_row;
+   vc->vc_softback_lines -= delta;
+   if (delta < 0) {
+   if (vc->vc_softback_curr < vc->vc_softback_top
+   && n < vc->vc_softback_buf) {
+   n += vc->vc_softback_end - vc->vc_softback_buf;
+   if (n < vc->vc_softback_top) {
+   vc->vc_softback_lines -=
+   (vc->vc_softback_top - n) / vc->vc_size_row;
+   n = vc->vc_softback_top;
+   }
+   } else if (vc->vc_softback_curr >= vc->vc_softback_top
+  && n < vc->vc_softback_top) {
+   vc->vc_softback_lines -=
+   (vc->vc_softback_top - n) / vc->vc_size_row;
+   n = vc->vc_softback_top;
+   }
+   } else {
+   if (vc->vc_softback_curr > vc->vc_softback_in
+   && n >= vc->vc_softback_end) {
+   n += vc->vc_softback_buf - vc->vc_softback_end;
+   if (n > vc->vc_softback_in) {
+   n = vc->vc_softback_in;
+   vc->vc_softback_lines = 0;
+   }
+   } else if (vc->vc_softback_curr <= vc->vc_softback_in
+  && n > vc->vc_softback_in) {
+   n = vc->vc_softback_in;
+   vc->vc_softback_lines = 0;
+   }
+   }
+   if (n == vc->vc_softback_curr)
+   return;
+   vc->vc_softback_curr = n;
+ 

Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-24 Thread Jorge Almeida
On Thu, Sep 23, 2021 at 6:03 PM Alan Mackenzie  wrote:
>

>
> As for the two(?) versions of my patch, they differed mainly in the
> aesthetics - diff.20210405.diff had lots of ugly maintainer comments in
> it.  So, could I ask you please to try that 1-hunk patch I posted
> yesterday on top of the version you have.  Please then tell me whether
> or not it works.
>
It still fails:
$ patch -p0 <../patch_for_5.14.diff
patching file ./drivers/tty/vt/vt.c
Hunk #1 FAILED at 3208.
1 out of 1 hunk FAILED -- saving rejects to file ./drivers/tty/vt/vt.c.rej

$ cat ../patch_for_5.14.diff
--- ./drivers/tty/vt/vt.c.orig  2020-12-13 22:41:30.0 +
+++ ./drivers/tty/vt/vt.c   2021-04-05 16:20:32.624563241 +
@@ -3208,6 +3208,12 @@

param.vc = vc;

+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+   /* Undo any soft scrolling -  and  do
+  not pass through this function.  */
+   concon_set_origin (vc);
+#endif
+
while (!tty->flow.stopped && count) {
int orig = *buf;
buf++;

Thanks,

Jorge Almeida
--- ./drivers/tty/vt/vt.c.orig  2020-12-13 22:41:30.0 +
+++ ./drivers/tty/vt/vt.c   2021-04-05 16:20:32.624563241 +
@@ -3208,6 +3208,12 @@
 
param.vc = vc;
 
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+   /* Undo any soft scrolling -  and  do
+  not pass through this function.  */
+   concon_set_origin (vc);
+#endif
+
while (!tty->flow.stopped && count) {
int orig = *buf;
buf++;


Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-23 Thread Alan Mackenzie
Hello, Jorge.

On Wed, Sep 22, 2021 at 22:40:11 +0100, Jorge Almeida wrote:
> On Wed, Sep 22, 2021 at 9:29 PM Alan Mackenzie  wrote:

> Hi Alan, thanks for the reply

> > I must confess that somebody told me by private email that it fails on
> > systems which change their screen geometry during boot-up.  For example,
> > a system which first boots into 80x25, then changes to a frame buffer.
> > I know why this is happening, but I don't have a machine to debug it on,
> > so the debugging is happening slowly, with the help of my correspondent.

> > It also doesn't seem to work on machines with kernel parameters such as
> > vga=791.

> OK, I don't know much about this kind of stuff, but I don't think
> there's a problem there. I have an integrated GPU (intel), driver
> i915, resolution 1920x1080. It boots (via Refind) with the proper
> resolution, and that's it. All the VTs show the same resolution and
> font. I don't use a login manager. No problems, no change is supposed
> to happen. I start an X session from a login shell, in any VT except
> tty1, which I like to keep as console.

Sounds pretty much like my setup.  :-)

> > I'm assuming that the patch you tried to apply was
> > 5.10.49-scroll.20210715.diff.  If so, please leave it applied (with the
> > one failed hunk), and additionally apply this:

> I may have missed some announcement from you, I'm using
> diff.20210405.diff. I wasn't aware of newer versions. Is there an URL
> to download it? I would try it before trying to apply the patch
> included in your message.

I'm currently discovering what version control systems are for.  :-(
Even though I've only posted two or three versions of my patch, I'm
already having difficulty keeping track of it.  I no longer believe
keeping the patch informally is going to work.  I think I'm going to
have to clone the git repository of the kernel (about which I'm going to
ask on another thread).

Anyhow, back to the topic.  There's no URL with my patch; it's purely
posted on gentoo-users.  Maybe I should put it into the Gentoo wiki.
But first, I must get it into a proper VCS.

As for the two(?) versions of my patch, they differed mainly in the
aesthetics - diff.20210405.diff had lots of ugly maintainer comments in
it.  So, could I ask you please to try that 1-hunk patch I posted
yesterday on top of the version you have.  Please then tell me whether
or not it works.

I am going to get this unsystematic muddle sorted out.

> Thanks,

> Jorge Almeida

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-22 Thread Jorge Almeida
On Wed, Sep 22, 2021 at 9:29 PM Alan Mackenzie  wrote:
>
> Hello, Jorge.
>
Hi Alan, thanks for the reply

> I must confess that somebody told me by private email that it fails on
> systems which change their screen geometry during boot-up.  For example,
> a system which first boots into 80x25, then changes to a frame buffer.
> I know why this is happening, but I don't have a machine to debug it on,
> so the debugging is happening slowly, with the help of my correspondent.
>
> It also doesn't seem to work on machines with kernel parameters such as
> vga=791.

OK, I don't know much about this kind of stuff, but I don't think
there's a problem there. I have an integrated GPU (intel), driver
i915, resolution 1920x1080. It boots (via Refind) with the proper
resolution, and that's it. All the VTs show the same resolution and
font. I don't use a login manager. No problems, no change is supposed
to happen. I start an X session from a login shell, in any VT except
tty1, which I like to keep as console.

>

> I'm assuming that the patch you tried to apply was
> 5.10.49-scroll.20210715.diff.  If so, please leave it applied (with the
> one failed hunk), and additionally apply this:
>
I may have missed some announcement from you, I'm using
diff.20210405.diff. I wasn't aware of newer versions. Is there an URL
to download it? I would try it before trying to apply the patch
included in your message.

Thanks,

Jorge Almeida



Re: [gentoo-user] console scrollback (kernel 5.14)

2021-09-22 Thread Alan Mackenzie
Hello, Jorge.

On Sat, Sep 18, 2021 at 21:40:46 +0100, Jorge Almeida wrote:
> Hello, gentooers in general and Alan in particular

> I've been using Alan Mackenzie's patch until kernel 5.13, with
> success. It failed with 5.14.4 --yes, I know, but it doesn't hurt to
> try :)

I'm happy to know my patch is still useful.

I must confess that somebody told me by private email that it fails on
systems which change their screen geometry during boot-up.  For example,
a system which first boots into 80x25, then changes to a frame buffer.
I know why this is happening, but I don't have a machine to debug it on,
so the debugging is happening slowly, with the help of my correspondent.

It also doesn't seem to work on machines with kernel parameters such as
vga=791.

That said, I'm hoping that the failure of the patch on 5.14.4 is just a
simple struct change in 5.14, which I hope to have corrected (but in
5.14.5).  What used to be

while (!tty->stopped ...

has now become

while (!tty->flow.stopped ...

I'm assuming that the patch you tried to apply was
5.10.49-scroll.20210715.diff.  If so, please leave it applied (with the
one failed hunk), and additionally apply this:



--- ./drivers/tty/vt/vt.c.orig  2020-12-13 22:41:30.0 +
+++ ./drivers/tty/vt/vt.c   2021-04-05 16:20:32.624563241 +
@@ -3208,6 +3208,12 @@
 
param.vc = vc;
 
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+   /* Undo any soft scrolling -  and  do
+  not pass through this function.  */
+   concon_set_origin (vc);
+#endif
+
while (!tty->flow.stopped && count) {
int orig = *buf;
buf++;


As always, there are no guarantees.  Please let me know whether or not
the above hunk applies, and if so, whether or not the scrolling still
works.  (Also, feel free to send me private email if there're any
problems with the mechanics of applying the patch.)

Thanks!

> Jorge Almeida

> Just in case it is useful:

It was, thanks!

[  ]

> param.vc = vc;

> +   /* NEW STOUGH, 2021-04-03 */
> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
> +   /* Undo any soft scrolling -  and  do
> +  not pass through this function.  */
> +   concon_set_origin (vc);
> +#endif
> +   /* END OF NEW STOUGH */
> +
> while (!tty->stopped && count) {  <==
> int orig = *buf;
> buf++;

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Console scrollback is back again!

2021-07-15 Thread Alan Mackenzie
Hello, Gentoo.

A new kernel, gentoo-sources-5.10.49-r1 has become current.

For those who wish to have console soft scrolling, the patch which worked
with 5.10.27 actually still works in 5.10.49-r1.  But I've tidied that
patch up somewhat for 5.10.49-r1 and have attached the patch file to this
post.

The instructions for using it are basically unchanged, apart from file
names, etc.  Updating those instructions gives us:
(i) Extract the attached patch file to your
  /usr/src/linux-5.10.49-gentoo-r1 directory (or probably any 5.10
  kernel's).
(ii) From that directory run $ patch -p0 < 5.10.49-scroll.20210715.diff.
(iii)(a) If you've already got a working 5.10.49-r1, do a $ make oldconfig.
  That should bring up the new configuration items, for which you can
  accept the defaults.  These two items are a flag to enable the
  scrollback, and a buffer size defaulting to 128kB.
(iii)(b) If you haven't yet got a 5.10.49-r1, just configure your kernel
  in the usual way.  The two new items are under Device Drivers/Graphics
  support/Console display driver support.
(iv) Build the kernel.
(v) Put the new kernel into your usual boot manager.
(vi) Reboot and enjoy!

As before, it works for me, and there's nothing malicious in it, but if
it breaks for you, I'm sorry but I won't be responsible.

-- 
Alan Mackenzie (Nuremberg, Germany).



On Mon, Apr 05, 2021 at 17:12:07 +, Alan Mackenzie wrote:
> Hello, Gentoo.

> Yes, console soft scrolling is back!  That essential feature that was
> stripped out of the kernel at around 5.4.x has returned!

> Only this time, it's even better!  Instead of one scrollback buffer
> shared between all tty's, there's now a buffer for each tty.

> How to get it working:
> (i) Extract the enclosed patch file to your /usr/src/linux-5.10.27-gentoo
> directory (or probably any 5.10 kernel's).
> (ii) From that directory run $ patch -p0 < diff.20210405.diff.
> (iii)(a) If you've already got a working 5.10.27, do a $ make oldconfig.
>   That should bring up the new configuration items, for which you can
>   accept the defaults.  These two items are a flag to enable the
>   scrollback, and a buffer size defaulting to 128kB.
> (iii)(b) If you haven't yet got a 5.10.27, just configure your kernel in
>   the usual way.  The two new items are under Device Drivers/Graphics
>   support/Console display driver support.
> (iv) Build the kernel.
> (v) Put the new kernel into your usual boot manager.
> (vi) Reboot and enjoy!

> Admittedly, the exercise isn't quite finished - the patched source files
> still have my personal change markings in them, to make debugging easier.
> But the problems I reported here a few days ago are now solved.  One or
> two features haven't (yet) been implemented - having a single scroll
> buffer shared amongst all tty's isn't there, and there're no kernel
> command line parameters to control the feature.

> Also, you may wonder about how safe the patch is.  All I can say is that
> there is nothing malicious in it, and I am known on this list, but of
> course if it breaks I won't be to blame.

> Bug reports and other comments are welcome, of course.

> If anybody would like the corresponding patch which works on 5.4.n, for n
> >= 80, that is available, too.

> -- 
> Alan Mackenzie (Nuremberg, Germany).



--- ./include/linux/vt_kern.h.orig  2020-12-13 22:41:30.0 +
+++ ./include/linux/vt_kern.h   2021-04-05 15:22:28.445755234 +
@@ -127,6 +127,9 @@
 /* vt.c */
 void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
 int vt_waitactive(int n);
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+void concon_scrolldelta(struct vc_data *vc, int lines);
+#endif
 void change_console(struct vc_data *new_vc);
 void reset_vc(struct vc_data *vc);
 int do_unbind_con_driver(const struct consw *csw, int first, int last,
--- ./include/linux/console_struct.h.orig   2020-12-13 22:41:30.0 
+
+++ ./include/linux/console_struct.h2021-04-05 15:22:28.432755234 +
@@ -109,6 +109,17 @@
unsigned short  *vc_screenbuf;  /* In-memory 
character/attribute buffer */
unsigned intvc_screenbuf_size;
unsigned char   vc_mode;/* KD_TEXT, ... */
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+   unsigned intvc_softback_size;   /* Size in bytes of scrollback 
buffer. */
+   unsigned long   vc_softback_buf;/* Address of scrollback 
buffer. */
+   unsigned long   vc_softback_end;/* (Just past) end of buffer. */
+   unsigned long   vc_softback_in; /* Head pointer into circular 
buffer. */
+   unsigned long   vc_softback_top;/* Tail pointer into circular 
buffer. */
+   unsigned long   vc_softback_curr;   /* Pos in vc_screenbuf or 
vc_softback_buf
+  corresponding to visible 
screen. */
+   int vc_softback_lines;  /* Number of lines currently 
scrolled. */
+   

Re: [gentoo-user] Console scrollback is back again!

2021-04-08 Thread konsolebox
On Tue, Apr 6, 2021 at 1:12 AM Alan Mackenzie  wrote:
> How to get it working:
> (i) Extract the enclosed patch file to your /usr/src/linux-5.10.27-gentoo
> directory (or probably any 5.10 kernel's).

Works with 5.10.28-gentoo. Thanks again.

I finally can uninstall my 5.8.6 which still has the old scrollback.

-- 
konsolebox



Re: [gentoo-user] Console scrollback is back again!

2021-04-06 Thread Michael Jones
On Tue, Apr 6, 2021 at 4:54 AM Alan Mackenzie  wrote:

> Hello, Michael.
>
> On Mon, Apr 05, 2021 at 18:08:58 -0500, Michael Jones wrote:
>
> [  ]
>
> > Without looking at the patch itself:
>
> > Have you considered something like kmscon as a userland alternative?
>
> To be honest, no.  I wasn't really aware of it when I starting working on
> the Linux console.
>
> According to Wikipedia, the last release was in 2013, and development
> stopped altogether in 2015.  The Gentoo package for it is masked.
>

Good points, and I can't speak to the code cleanliness of kmscon, or
potential security problems.

That being said, even though I was annoyed when the scrollback was removed
from the kernel, I do understand the reason for it being removed. It does
seem like the kind of functionality that would be better provided by
userspace.


> > I installed it on my laptop, and aside from not working with gpmd or
> > consolation for mouse support, it's a perfectly functional local tty.
>
> I suppose it's one of these programs that once working, pretty much
> carries on working for ever.
>

That's entirely possible :-)
Maybe someone (not necessarily you) will find the removal of the scrollback
buffer to be enough motivation to bring kmscon back to life as a project.


Re: [gentoo-user] Console scrollback is back again!

2021-04-06 Thread Alan Mackenzie
Hello, John

On Tue, Apr 06, 2021 at 10:13:39 -0400, John Covici wrote:

> On Tue, 06 Apr 2021 09:14:23 -0400,
> Peter Humphrey wrote:

> > On Monday, 5 April 2021 19:13:18 BST Alan Mackenzie wrote:

> > > We'll see how people react to it here, first.

> > You're my hero!

> Would this patch work on 5.4.96 and following?

No, there is a slight difference (two struct fields moved and renamed)
between 5.4 and 5.10.

For 5.4, please use the attached patch instead.  It has been tested on
5.4.80-r1 and 5.4.97.

> -- 
> Your life is like a penny.  You're going to lose it.  The question is:
> How do
> you spend it?

>  John Covici wb2una
>  cov...@ccs.covici.com

-- 
Alan Mackenzie (Nuremberg, Germany).

--- drivers/video/console/Kconfig.orig  2021-03-31 19:14:48.186140856 +
+++ drivers/video/console/Kconfig   2021-04-05 13:41:20.967713154 +
@@ -79,6 +79,55 @@
help
  Low-level framebuffer-based console driver.
 
+config FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+   bool "Enable Scrollback Buffer in System RAM"
+   depends on FB=y && FRAMEBUFFER_CONSOLE
+   default y
+   select FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT
+   help
+ This option creates scrollback buffers for each framebuffer console,
+ or one buffer for them all.  These buffers are allocated dynamically
+ during initialisation.
+
+ If you want this feature, say 'Y' here and enter the amount of
+ RAM to allocate for this buffer.  If unsure, say 'N'.
+
+config FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_SIZE
+   int "Scrollback Buffer Size (in KB)"
+   depends on FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+   range 1 1024
+   default "128"
+   help
+ Enter the amount of System RAM to allocate for each scrollback
+ buffer of framebuffer consoles in kilobytes.  Each character
+ position on the video takes 2 bytes of storage.  128k will give you
+ approximately 4 240x67 screenfuls of scrollback buffer.
+
+config FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT
+   bool "Persistent Scrollback History for each framebuffer console by 
default"
+   depends on FB=y && FRAMEBUFFER_CONSOLE && 
FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+   default y
+   help
+
+ Note: this option's value N has not (?yet) been implemented (2021-04).
+
+ Say Y here if the scrollback history should persist by default when
+ switching between consoles. Otherwise, the scrollback history will
+ be flushed the first time a scroll-up operation occurs on the new
+ console after the console is switched. STOUGH!!!  FIXME!!! This
+ feature can also be enabled using the boot command line parameter
+ 'vgacon.scrollback_persistent=1'.
+
+ This feature might break your tool of choice to flush the scrollback
+ buffer, e.g. clear(1) will work fine but Debian's clear_console(1)
+ will be broken, which might cause security issues.
+ You can use the escape sequence \e[3J instead if this feature is
+ activated.
+
+ Note that a buffer of VGACON_SOFT_SCROLLBACK_SIZE is taken for each
+ created tty device.
+ So if you use a RAM-constrained system, say N here.
+
 config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
bool "Map the console to the primary display device"
depends on FRAMEBUFFER_CONSOLE
--- drivers/tty/vt/vt.orig.c2020-11-28 17:14:38.523649992 +
+++ drivers/tty/vt/vt.c 2021-04-05 14:33:47.743786578 +
@@ -142,6 +142,13 @@
 #define DEFAULT_BELL_DURATION  (HZ/8)
 #define DEFAULT_CURSOR_BLINK_MS200
 
+/* NEW STOUGH, 2021-04-01 */
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+static unsigned int console_soft_scrollback_size =
+   1024 * CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_SIZE;
+#endif
+/* END OF NEW STOUGH */
+
 struct vc vc_cons [MAX_NR_CONSOLES];
 
 #ifndef VT_SINGLE_DRIVER
@@ -294,7 +301,7 @@
 static inline unsigned short *screenpos(struct vc_data *vc, int offset, int 
viewed)
 {
unsigned short *p;
-   
+
if (!viewed)
p = (unsigned short *)(vc->vc_origin + offset);
else if (!vc->vc_sw->con_screen_pos)
@@ -623,6 +630,232 @@
}
 }
 
+/* NEW STOUGH, 2021-03-31 */
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+/* NEW STOUGH, 2021-04-01 */
+static void con_update_softback(struct vc_data *vc)
+{
+   int l = vc->vc_softback_size / vc->vc_size_row;
+   if (l > 5)
+   {
+   vc->vc_softback_end = vc->vc_softback_buf + l * vc->vc_size_row;
+   vc->vc_softback_top = vc->vc_softback_buf; /* STOUGH, 
2021-04-04 */
+   }
+   else
+   /* Smaller scrollback makes no sense, and 0 would screw
+  the operation totally */
+   vc->vc_softback_top = 0;
+}
+
+static int concon_set_origin(struct vc_data *vc)
+{
+   if 

Re: [gentoo-user] Console scrollback is back again!

2021-04-06 Thread John Covici


On Tue, 06 Apr 2021 09:14:23 -0400,
Peter Humphrey wrote:
> 
> On Monday, 5 April 2021 19:13:18 BST Alan Mackenzie wrote:
> 
> > We'll see how people react to it here, first.
> 
> You're my hero!

Would this patch work on 5.4.96 and following?

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

 John Covici wb2una
 cov...@ccs.covici.com



Re: [gentoo-user] Console scrollback is back again!

2021-04-06 Thread Peter Humphrey
On Monday, 5 April 2021 19:13:18 BST Alan Mackenzie wrote:

> We'll see how people react to it here, first.

You're my hero!

-- 
Regards,
Peter.






Re: [gentoo-user] Console scrollback is back again!

2021-04-06 Thread J. Roeleveld
On Monday, April 5, 2021 7:12:07 PM CEST Alan Mackenzie wrote:
> Hello, Gentoo.
> 
> Yes, console soft scrolling is back!  That essential feature that was
> stripped out of the kernel at around 5.4.x has returned!
> 
> Only this time, it's even better!  Instead of one scrollback buffer
> shared between all tty's, there's now a buffer for each tty.
> 
> How to get it working:
> (i) Extract the enclosed patch file to your /usr/src/linux-5.10.27-gentoo
> directory (or probably any 5.10 kernel's).
> (ii) From that directory run $ patch -p0 < diff.20210405.diff.
> (iii)(a) If you've already got a working 5.10.27, do a $ make oldconfig.
>   That should bring up the new configuration items, for which you can
>   accept the defaults.  These two items are a flag to enable the
>   scrollback, and a buffer size defaulting to 128kB.
> (iii)(b) If you haven't yet got a 5.10.27, just configure your kernel in
>   the usual way.  The two new items are under Device Drivers/Graphics
>   support/Console display driver support.
> (iv) Build the kernel.
> (v) Put the new kernel into your usual boot manager.
> (vi) Reboot and enjoy!
> 

Thank you!

I will add this to my "/etc/portage/patches/sys-kernel/gentoo-sources" 
directory. Right next to the gpl-defang patch.








Re: [gentoo-user] Console scrollback is back again!

2021-04-06 Thread Alan Mackenzie
Hello, Karl.

On Mon, Apr 05, 2021 at 21:58:37 +0200, k...@aspodata.se wrote:
> Alan Mackenzie:
> > Yes, console soft scrolling is back!  That essential feature that was
> > stripped out of the kernel at around 5.4.x has returned!

> It is commit 087b6cb17df5834d395ab72da3f937380470ba15,
> between v5.4.65 and 66.
> Perhaps also 0d123a8c64fde433a, cf5a7ded53652c3d63d72, and possible
> other stuff.

I will confess that I don't actually have a git repository of Linux on
my machine.  I'd have to back it up, somehow.  It would be a fair amount
of work to write an efficient back-up procedure - the one I have at the
moment for git repos backs up the entire repository, which would
probably be excessive for Linux.

Currently, I've changed a mere five files, for which I'm getting by with
symbolic links in the kernel tree pointing into my home directory.

> > Only this time, it's even better!  Instead of one scrollback buffer
> > shared between all tty's, there's now a buffer for each tty.

> Great, no more missing data when switching vts.

> Btw, wasn't that added in commit aabd31c421ddc730edf6d89c4ed3885e4fca5e30
> but turned off by default.

There was no capability at all for one buffer per tty in framebuffer
consoles.  It was there for VGA consoles, and, I think, one or two
others.  The configuration page for it was confusing - the option for
"persistent scrollback" was purely for VGAcon, though that wasn't
obvious.  I spent time in the past trying to get multiple buffers
working, and was even considering reporting a bug.

> ...
> > One or two features haven't (yet) been implemented - having a
> > single scroll buffer shared amongst all tty's isn't there,
> ...

> Is there any reason to share the buffer ?

Not that I can think of.  The only reason might be if somebody wanted a
very large scrollback buffer, but didn't have a lot of RAM.  But even
so, the current default takes a total of less than 1 MB of RAM with the
standard 7 tty's.  Even increasing the buffer size to 10 MB, that would
only come to 70 MB.  Such a size of buffer would really need more
sophisticated handling, with search facilities, some marking of
positions, and so on.  That would be a large project.

> > Bug reports and other comments are welcome, of course.

> git log drivers/video/console/vgacon.c etc. can give some ideas
> what one is up against.

Once I find some way to read it.  ;-(

Anyhow, the patch I have is working software, and is not going away any
time soon.  It means I can carry on using Linux.

Just in case you're interested, the problem I had with no scrolling on
tty1 was due to the way the console was initialised early on in the boot
process.  Its structures were initialised in a separate place from the
normal init function, thus bypassing the scrollbuffer's init.  When it
came to re-initialising it for scrollbuffer, this partial initialisation
acted as a flag not to carry on with the init.  At least it caused me to
learn about printk.  ;-)

> Regards,
> /Karl Hammar

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Console scrollback is back again!

2021-04-06 Thread Jorge Almeida
On Tue, Apr 6, 2021 at 10:56 AM Alan Mackenzie  wrote:
>

>
>
> > I just tested it with kernel 5.11.11. Seems fine.
>
> Thanks!
>
Thank _you_!

It is regrettable that console scrolling is out of the kernel. Even if
one doesn't use the console that much, it is used once in a while, and
those occasions tend to be  precisely the ones back scrolling will be
most missed.

Jorge Almeida



Re: [gentoo-user] Console scrollback is back again!

2021-04-06 Thread Alan Mackenzie
Hello, Jorge.

On Mon, Apr 05, 2021 at 19:38:57 +0100, Jorge Almeida wrote:
> On Mon, Apr 5, 2021 at 6:12 PM Alan Mackenzie  wrote:

> > Hello, Gentoo.

> > Yes, console soft scrolling is back!  That essential feature that was
> > stripped out of the kernel at around 5.4.x has returned!

> > Only this time, it's even better!  Instead of one scrollback buffer
> > shared between all tty's, there's now a buffer for each tty.


> I just tested it with kernel 5.11.11. Seems fine.

Thanks!

> Jorge Almeida

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Console scrollback is back again!

2021-04-06 Thread Alan Mackenzie
Hello, Michael.

On Mon, Apr 05, 2021 at 18:08:58 -0500, Michael Jones wrote:

[  ]

> Without looking at the patch itself:

> Have you considered something like kmscon as a userland alternative?

To be honest, no.  I wasn't really aware of it when I starting working on
the Linux console.

According to Wikipedia, the last release was in 2013, and development
stopped altogether in 2015.  The Gentoo package for it is masked.

> I installed it on my laptop, and aside from not working with gpmd or
> consolation for mouse support, it's a perfectly functional local tty.

I suppose it's one of these programs that once working, pretty much
carries on working for ever.

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Console scrollback is back again!

2021-04-05 Thread konsolebox
On Tue, Apr 6, 2021 at 1:12 AM Alan Mackenzie  wrote:
>
> Hello, Gentoo.
>
> Yes, console soft scrolling is back!  That essential feature that was
> stripped out of the kernel at around 5.4.x has returned!

Thank you. I'll try to make this work in 5.10.28 once it's released.

-- 
konsolebox



Re: [gentoo-user] Console scrollback is back again!

2021-04-05 Thread Michael Jones
On Mon, Apr 5, 2021, 13:13 Alan Mackenzie  wrote:

> Hello, Wol.
>
> On Mon, Apr 05, 2021 at 18:44:15 +0100, antlists wrote:
> > On 05/04/2021 18:12, Alan Mackenzie wrote:
> > > Bug reports and other comments are welcome, of course.
> > >
> > > If anybody would like the corresponding patch which works on 5.4.n,
> for n
> > >> = 80, that is available, too.
>
> > Why did it get removed from the kernel?
>
> Allegedly, there were security problems with it.  I think the kernel
> people had a program which fired random inputs at lots of components,
> and noted when things went wrong; and things went wrong in the scroll
> back component.  And they couldn't find anybody to look into these
> problems.
>
> That's the official position.  I'm a bit more cynical about it.
>
> > If you want to get it back in, couldn't you ping Greg KH and get some
> > help - or even just advice - getting it accepted?
>
> I have no reason to believe all the "security problems" will have been
> resolved by my hacking.  I took the algorithmic bits from 4.19.97
> basically unchanged.
>
> Maybe there's not much enthusiasm for this feature, in which case I will
> keep it working for myself.  Linux is basically unusable to me without
> it.  There are probably quite a few patches to restore the scrollback
> floating around the web by now: the changes were not particularly
> difficult to anybody who knows the code, but getting to know the code
> was unusually difficult.
>
> We'll see how people react to it here, first.
>
> > Cheers,
> > Wol
>
> --
> Alan Mackenzie (Nuremberg, Germany).


Without looking at the patch itself:

Have you considered something like kmscon as a userland alternative?

I installed it on my laptop, and aside from not working with gpmd or
consolation for mouse support, it's a perfectly functional local tty.


Re: [gentoo-user] Console scrollback is back again!

2021-04-05 Thread karl
Alan Mackenzie:
> Yes, console soft scrolling is back!  That essential feature that was
> stripped out of the kernel at around 5.4.x has returned!

It is commit 087b6cb17df5834d395ab72da3f937380470ba15,
between v5.4.65 and 66.
Perhaps also 0d123a8c64fde433a, cf5a7ded53652c3d63d72, and possible
other stuff.

> Only this time, it's even better!  Instead of one scrollback buffer
> shared between all tty's, there's now a buffer for each tty.

Great, no more missing data when switching vts.

Btw, wasn't that added in commit aabd31c421ddc730edf6d89c4ed3885e4fca5e30
but turned off by default.

...
> One ord two features haven't (yet) been implemented - having a
> single scroll buffer shared amongst all tty's isn't there,
...

Is there any reason to share the buffer ?

> Bug reports and other comments are welcome, of course.

git log drivers/video/console/vgacon.c etc. can give some ideas
what one is up against.

Regards,
/Karl Hammar





Re: [gentoo-user] Console scrollback is back again!

2021-04-05 Thread Jorge Almeida
On Mon, Apr 5, 2021 at 6:12 PM Alan Mackenzie  wrote:
>
> Hello, Gentoo.
>
> Yes, console soft scrolling is back!  That essential feature that was
> stripped out of the kernel at around 5.4.x has returned!
>
> Only this time, it's even better!  Instead of one scrollback buffer
> shared between all tty's, there's now a buffer for each tty.
>

I just tested it with kernel 5.11.11. Seems fine.

Jorge Almeida



Re: [gentoo-user] Console scrollback is back again!

2021-04-05 Thread Alan Mackenzie
Hello, Wol.

On Mon, Apr 05, 2021 at 18:44:15 +0100, antlists wrote:
> On 05/04/2021 18:12, Alan Mackenzie wrote:
> > Bug reports and other comments are welcome, of course.
> > 
> > If anybody would like the corresponding patch which works on 5.4.n, for n
> >> = 80, that is available, too.

> Why did it get removed from the kernel?

Allegedly, there were security problems with it.  I think the kernel
people had a program which fired random inputs at lots of components,
and noted when things went wrong; and things went wrong in the scroll
back component.  And they couldn't find anybody to look into these
problems.

That's the official position.  I'm a bit more cynical about it.

> If you want to get it back in, couldn't you ping Greg KH and get some 
> help - or even just advice - getting it accepted?

I have no reason to believe all the "security problems" will have been
resolved by my hacking.  I took the algorithmic bits from 4.19.97
basically unchanged.

Maybe there's not much enthusiasm for this feature, in which case I will
keep it working for myself.  Linux is basically unusable to me without
it.  There are probably quite a few patches to restore the scrollback
floating around the web by now: the changes were not particularly
difficult to anybody who knows the code, but getting to know the code
was unusually difficult.

We'll see how people react to it here, first.

> Cheers,
> Wol

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Console scrollback is back again!

2021-04-05 Thread antlists

On 05/04/2021 18:12, Alan Mackenzie wrote:

Bug reports and other comments are welcome, of course.

If anybody would like the corresponding patch which works on 5.4.n, for n

= 80, that is available, too.


Why did it get removed from the kernel?

If you want to get it back in, couldn't you ping Greg KH and get some 
help - or even just advice - getting it accepted?


Cheers,
Wol



Re: [gentoo-user] Console scrollback

2021-04-02 Thread Alan Mackenzie
Hello, Karl.

Thanks for the reply.

On Fri, Apr 02, 2021 at 21:32:04 +0200, k...@aspodata.se wrote:
> Alan Mackenzie:
> ...
> > I've now cobbled together a working console scroll on Linux
> > 5.4.80-gentoo-r1.  In the end, I reused much of the old machinery which
> > was still present in 4.19.97.  Once I've tidied it up, I hope that the
> > resulting patch file will apply cleanly also to later versions than
> > 5.4.80-r1.
> ...

> Nice, where is the patch so I can try ?

I've attached a patch to this post.  To apply it, the following seems to
work from the top directory of a kernel source tree, e.g. 5.4.80-r1:

$ patch -p0 < diff.20210402.diff

..  Then you'll need to run make menuconfig (or whatever), going down to
Device Drivers/Graphic support/Console display driver support and there
accepting the defaults for the new config variables.  (This is assuming
you've got FRAMEBUFFER support enabled in a neighbouring page.)

Then build the kernel as normal, and put the new version into whatever
boot loader you use.  It should (??) run, with a scrollback buffer on
each virtual terminal.

Just a word about the current state of the source - it is rough, with
things unfinished.  The "word" STOUGH (pronounced "stuff") is just a
word I use which appears nowhere else and enables me to find changes
quickly and unambiguously.

As I said, I'm not finished with the changes, and swapping from and back
to a scrolled tty isn't completely satisfactory.  Nevertheless, I hope
it works for you and you have fun with it.

> > (i) The scrolling doesn't work on /dev/tty1 aka the console.
> > (ii) When, e.g., /dev/tty6 has been scrolled upwards a bit, and then
> >pressed to go to /dev/tty2, on returning to /dev/tty6, the
> >   scrolling has been cancelled and the cursor is no longer visible.
> >   However, the scrollback buffer is still present.
> > 
> > I think I'm fairly likely to be able to solve (ii).  However, (i), the
> > problem with /dev/tty1, has me baffled.  I don't know where to start
> > looking for the problem.  If anybody with some kernel knowledge could
> > make any suggestions, I'd be very grateful.

> What happens if you set /dev/console to be /dev/ttyS0, i.e. make sure 
> that tty1 is the only one using the first virtual console.

I will try than.  Thanks!

> Regards,
> /Karl Hammar

-- 
Alan Mackenzie (Nuremberg, Germany).

--- drivers/video/console/Kconfig.orig  2021-03-31 19:14:48.186140856 +
+++ drivers/video/console/Kconfig   2021-03-31 12:39:08.090301096 +
@@ -79,6 +79,52 @@
help
  Low-level framebuffer-based console driver.
 
+config FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+   bool "Enable Scrollback Buffer in System RAM"
+   depends on FB=y && FRAMEBUFFER_CONSOLE
+   default y
+   help
+ This option creates scrollback buffers for each framebuffer console,
+ or one buffer for them all.  These buffers are allocated dynamically
+ during initialisation.
+
+If you want this feature, say 'Y' here and enter the amount of
+RAM to allocate for this buffer.  If unsure, say 'N'.
+
+config FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_SIZE
+   int "Scrollback Buffer Size (in KB)"
+   depends on FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+   range 1 1024
+   default "128"
+   help
+ Enter the amount of System RAM to allocate for scrollback 
buffers of
+ framebuffer consoles.  Each character position on the video takes 2
+ bytes of storage.  128k will give you approximately 4 240x67
+ screenfuls of scrollback buffer.
+
+config FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT
+   bool "Persistent Scrollback History for each framebuffer console by 
default"
+   depends on FB=y && FRAMEBUFFER_CONSOLE && 
FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+   default y
+   help
+
+ Say Y here if the scrollback history should persist by default when
+ switching between consoles. Otherwise, the scrollback history will
+ be flushed the first time a scroll-up operation occurs on the new
+ console after the console is switched. STOUGH!!!  FIXME!!! This
+ feature can also be enabled using the boot command line parameter
+ 'vgacon.scrollback_persistent=1'.
+
+ This feature might break your tool of choice to flush the scrollback
+ buffer, e.g. clear(1) will work fine but Debian's clear_console(1)
+ will be broken, which might cause security issues.
+ You can use the escape sequence \e[3J instead if this feature is
+ activated.
+
+ Note that a buffer of VGACON_SOFT_SCROLLBACK_SIZE is taken for each
+ created tty device.
+ So if you use a RAM-constrained system, say N here.
+
 config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
bool "Map the console to the primary display device"
depends on FRAMEBUFFER_CONSOLE
--- drivers/tty/vt/vt.orig.c2020-11-28 

Re: [gentoo-user] Console scrollback

2021-04-02 Thread karl
Alex Mackenzie:
...
> I've now cobbled together a working console scroll on Linux
> 5.4.80-gentoo-r1.  In the end, I reused much of the old machinery which
> was still present in 4.19.97.  Once I've tidied it up, I hope that the
> resulting patch file will apply cleanly also to later versions than
> 5.4.80-r1.
...

Nice, where is the patch so I can try ?

> (i) The scrolling doesn't work on /dev/tty1 aka the console.
> (ii) When, e.g., /dev/tty6 has been scrolled upwards a bit, and then
>pressed to go to /dev/tty2, on returning to /dev/tty6, the
>   scrolling has been cancelled and the cursor is no longer visible.
>   However, the scrollback buffer is still present.
> 
> I think I'm fairly likely to be able to solve (ii).  However, (i), the
> problem with /dev/tty1, has me baffled.  I don't know where to start
> looking for the problem.  If anybody with some kernel knowledge could
> make any suggestions, I'd be very grateful.

What happens if you set /dev/console to be /dev/ttyS0, i.e. make sure 
that tty1 is the only one using the first virtual console.

Regards,
/Karl Hammar





Re: [gentoo-user] Console scrollback

2021-04-02 Thread Alan Mackenzie
Hello, Gentoo.

On Wed, Jan 20, 2021 at 19:59:09 +, Alan Mackenzie wrote:

[Context: Scrolling on the Linux text console using the keys
 and  has been removed from the kernel.  This
is not a Good Thing.]

> What I have in mind now is writing a Linux driver, a small piece of code
> which would piggy-back on the existing virtual terminal drivers, and
> simply pass everything through to and from the main driver, filtering out
> things relevant to scrolling, and processing these in my new driver.
> I've spent the last few evenings reading up on drivers, and reading the
> relevant source code from 4.19.97.  I can understand the kernel
> maintainers not being enthusiastic about the existing code.  But that
> dates from, I believe, the 1990s, when RAM was measured in megabytes, and
> processor speeds in megahertz.  Optimisation for speed and store usage
> just isn't important any more.

I finally got around to looking into this seriously in the last couple
of weeks.  The above plan turned out not to be the right thing.

I've now cobbled together a working console scroll on Linux
5.4.80-gentoo-r1.  In the end, I reused much of the old machinery which
was still present in 4.19.97.  Once I've tidied it up, I hope that the
resulting patch file will apply cleanly also to later versions than
5.4.80-r1.

As a matter of interest, the kernel code for the console is not the
easiest in the world to deal with, having too many abstractions and too
few comments.  ;-(

I've enhanced the mechanism so that each tty has its own scrollback
buffer, rather than one buffer being shared between all tty's.  The
default size of these buffers is now 128kB, but can be set in make
menuconfig.  I'm intending to make sharing a buffer between all tty's be
an option, but haven't implemented that yet.

The code, as yet, is a bit scruffy (in fact, very scruffy), and I have
several technical problems:

(i) The scrolling doesn't work on /dev/tty1 aka the console.
(ii) When, e.g., /dev/tty6 has been scrolled upwards a bit, and then
   pressed to go to /dev/tty2, on returning to /dev/tty6, the
  scrolling has been cancelled and the cursor is no longer visible.
  However, the scrollback buffer is still present.

I think I'm fairly likely to be able to solve (ii).  However, (i), the
problem with /dev/tty1, has me baffled.  I don't know where to start
looking for the problem.  If anybody with some kernel knowledge could
make any suggestions, I'd be very grateful.

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Console scrollback

2021-01-25 Thread Alan Mackenzie
Hello, Wol.

On Thu, Jan 21, 2021 at 09:32:13 +, Wols Lists wrote:
> On 20/01/21 19:59, Alan Mackenzie wrote:
> > I can understand the kernel maintainers not being enthusiastic about
> > the existing code.  But that dates from, I believe, the 1990s, when
> > RAM was measured in megabytes, and processor speeds in megahertz.
> > Optimisation for speed and store usage just isn't important any more.

> I think you're being highly optimistic. Bear in mind that this is the
> code that was responsible for Alan Cox ceasing linux development, it's
> such a pile of steaming manure ...

It is indeed a tortuous mess of code, with far too many abstractions, and
far too little overview.

> Don't ask me why it is, but I think it's got so much stuff wrong with it
> that the entire system is marked "beware here be dragons".

Over the weekend, I achieved the first part of my task, getting a
transparent new driver into the kernel, which would merely pass through
to and from /dev/sctty3 to and from /dev/tty3, etc.  This works.

Now I have to hook up with the /dev/vcs drivers to buffer the text
written to the screen, so as to be able to output it again in the event
of a -.

I would guess I'm around 50% through the task (as in the first 50% takes
the first 90% of the time, and the second 50% takes the second 90% of the
time).

> https://lwn.net/Articles/842415/

> Take a read, as it's mentioned in this article.

The website said it would become freely available on 2021-01-28, so I'll
read it then.

> Cheers,
> Wol

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Console scrollback

2021-01-21 Thread Jorge Almeida
On Thu, Jan 21, 2021 at 12:40 PM Remco Rijnders  wrote:
>
> On Thu, Jan 21, 2021 at 08:58:42AM +, Jorge wrote in
> :
> >On Thu, Jan 21, 2021 at 8:53 AM Wols Lists  wrote:
> >>
> >
> >> https://lwn.net/Articles/842415/
> >>
> >> Take a read, as it's mentioned in this article.
> >>
> >Paywalled... :(
>
> Try this link: https://lwn.net/SubscriberLink/842415/5bc3e39b4d4f52fe/
>
Works. Thanks.

Jorge Almeida



Re: [gentoo-user] Console scrollback

2021-01-21 Thread Remco Rijnders
On Thu, Jan 21, 2021 at 08:58:42AM +, Jorge wrote in 
:

On Thu, Jan 21, 2021 at 8:53 AM Wols Lists  wrote:





https://lwn.net/Articles/842415/

Take a read, as it's mentioned in this article.


Paywalled... :(


Try this link: https://lwn.net/SubscriberLink/842415/5bc3e39b4d4f52fe/



Re: [gentoo-user] Console scrollback

2021-01-21 Thread Jorge Almeida
On Thu, Jan 21, 2021 at 8:53 AM Wols Lists  wrote:
>

> https://lwn.net/Articles/842415/
>
> Take a read, as it's mentioned in this article.
>
Paywalled... :(

Jorge Almeida



Re: [gentoo-user] Console scrollback

2021-01-21 Thread Wols Lists
On 20/01/21 19:59, Alan Mackenzie wrote:
> I can understand the kernel
> maintainers not being enthusiastic about the existing code.  But that
> dates from, I believe, the 1990s, when RAM was measured in megabytes, and
> processor speeds in megahertz.  Optimisation for speed and store usage
> just isn't important any more.

I thin you're being highly optimistic. Bear in mind that this is the
code that was responsible for Alan Cox ceasing linux development, it's
such a pile of steaming manure ...

Don't ask me why it is, but I think it's got so much stuff wrong with it
that the entire system is marked "beware here be dragons".

https://lwn.net/Articles/842415/

Take a read, as it's mentioned in this article.

Cheers,
Wol



Re: [gentoo-user] Console scrollback

2021-01-20 Thread Alan Mackenzie
Hello, Laurence.

On Tue, Jan 19, 2021 at 17:09:03 +, Laurence Perkins wrote:


> On Sun, 2021-01-17 at 05:17 +, Thomas Mueller wrote:
> > On Sat, 16 Jan 2021 12:01:48 +, Alan Mackenzie wrote:

> > > I don't know what I'll be doing, long term.  For the moment, I'll
> > > be hanging onto the working kernel I've got, old though it may be
> > > (4.19.97).  It might be possible (I'm not sure) to hook up a user
> > > space program to the keys - which would take
> > > care of the scrolling.  This would obviously not work with early
> > > kernel messages, but would be better than nothing.  I had a look at
> > > the GNU screen source code yesterday to see how it managed such
> > > things, but it is very sparsely commented, and thus hard work to
> > > understand.  Maybe I should just cut my losses, and convert to
> > > using one of the BSDs.

> > 2000 posts per day on Linux kernel list would be more than
> > unmanageable for me!  I wouldn't say "almost"!

> > Is Linus Torvalds' removal of console scrolling the reason why Scroll
> > Lock does not work on the console with System Rescue CD or USB, while
> > with FreeBSD and NetBSD, I can press Scroll Lock and scroll back?

> > I like that ability but don't think Linus Torvalds is listening or
> > reading this.

> > Further, with System Rescue console, the lines/text go only partway
> > down.

> > Using screen, now at v4.8, means having to remember a lot of key
> > functions, you need a separate reference screen to look them up.

> > There is also tmux, which is part of the base system in NetBSD but
> > not FreeBSD.

> > If Linus cared about his users, he could make the kernel headers more
> > user-friendly, installing kernel headers should not be any more
> > complicated than copying or downloading.

> > Console scrolling is especially useful with an OS or distro that is
> > built from the ground up, like Gentoo, Void or Arch, as opposed to
> > being installed all at once.

> > If more Linux users would go to and try NetBSD or FreeBSD, those OSes
> > would have more users, more ideas, more ability to improve.

> > You can even cross-compile NetBSD from Linux.  You'd need NetBSD
> > source tree, but don't have to do anything special to install kernel
> > headers.

> > Tom


> You're getting this second-hand since it was my brother who actually
> looked into it, so pardon anything I misremember, but the big problem
> is that adding unicode support to vgacon would need a near total
> rewrite, and nobody wants to do that since it's a terrible hackjob to
> start with.

> kmscon is slated to be the replacement.  You might want to see if that
> can do what you need.

I looked kmscon up on Wikipedia, and apparently development ceased
several years ago.

What I have in mind now is writing a Linux driver, a small piece of code
which would piggy-back on the existing virtual terminal drivers, and
simply pass everything through to and from the main driver, filtering out
things relevant to scrolling, and processing these in my new driver.
I've spent the last few evenings reading up on drivers, and reading the
relevant source code from 4.19.97.  I can understand the kernel
maintainers not being enthusiastic about the existing code.  But that
dates from, I believe, the 1990s, when RAM was measured in megabytes, and
processor speeds in megahertz.  Optimisation for speed and store usage
just isn't important any more.

> LMP

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Console scrollback

2021-01-19 Thread Laurence Perkins



On Sun, 2021-01-17 at 05:17 +, Thomas Mueller wrote:
> On Sat, 16 Jan 2021 12:01:48 +, Alan Mackenzie wrote:
> 
> > Hello, Gentoo.
> > On Thu, Jan 14, 2021 at 16:06:38 +, Alan Mackenzie wrote:
> > > On Wed, Jan 13, 2021 at 22:15:25 -, Grant Edwards wrote:
> > > > On 2021-01-13, Alan Mackenzie  wrote:
> > > > > I think bringing up a new Gentoo system absolutely requires
> > > > > working in
> > > > > the console, certainly up to the point where X11 and a Window
> > > > > Manager
> > > > > have been installed and debugged.
> > > > I usually install Gentoo via ssh.
> > > > The article I read about the removal of Linux console's
> > > > backscrolling
> > > > feature said it was mostly due to lack of a maintainer for that
> > > > code,
> > > > and that if somebody stepped forward to maintain it, it could
> > > > be revived.
> > > I'm doing my best to step forward, but I suspect that will be
> > > almost as
> > > difficult as fixing the bugs in it.  ;-)
> > And so it transpired.  I subscribed to the linux-kernel list for a
> > short
> > time, and offered my services in a post.  Not one single reply did
> > I get.
> > That list is not a friendly one.  It gets an almost unmanageable
> > ~2000
> > posts a day, the vast bulk of which are patches, fragmented into,
> > perhaps, one diff hunk per post.
> > > I'm disappointed that the decision to cut out this important
> > > feature was
> > > taken without any serious attempt to find a maintainer.  I have
> > > the
> > > impression (though I may be wrong), that the problem was talked
> > > about on
> > > the linux kernel mailing list, but nobody there took it upon
> > > himself to
> > > post on any of the more hard-core distributions' mailing lists,
> > > such as
> > > gentoo's.
> > I've come to realise that Linus Torvalds, who personally took the
> > decision to remove the scrolling, doesn't care about users, and
> > indeed
> > regards them with disdain.  He cares about _customers_, and Linux's
> > customers are RedHat, Suse, IBM, Intel, and the other HW
> > manufacturers.
> > RedHat customers don't use the console, therefore the console isn't
> > important.  It's a bit like Microsoft's attitude towards users.
> > Sure, Linus went through the motions of pretending to try to find a
> > maintainer, but didn't put any serious effort into it.  He argued
> > that
> > "nobody" uses it anyway, therefore it is unimportant, which is an
> > ironic
> > echo of the argument that nobody uses Linux on a desktop PC.
> > Even if the bugs came to be fixed, I doubt the scrolling would be
> > allowed
> > back into the kernel, for the above reasons.  Exactly what the bugs
> > are
> > in the scrolling code wasn't gone into on the list, despite more
> > than one
> > contributor asking.
> > > > FWOW, if you really want backscrolling on the console, you can
> > > > get
> > > > that with screen, but doing so would drive me nuts, since I'd
> > > > have to
> > > > break all my fingers to stop them from typeing ctrl-A to move
> > > > the
> > > > start of a line. I've switched screen's meta-character a few
> > > > times,
> > > > but everytime I try that I find my fingers already have
> > > > something else
> > > > assigned to that control character (which I had forgotten
> > > > about). It
> > > > would be nice if I could print out my fingers' assignment table
> > > > to
> > > > find an unused control character, but that doesn't seem to be
> > > > how it
> > > > works.
> > > Can one set up a "basic" screen which doesn't use a meta-
> > > character?
> > I don't know what I'll be doing, long term.  For the moment, I'll
> > be
> > hanging onto the working kernel I've got, old though it may be
> > (4.19.97).
> > It might be possible (I'm not sure) to hook up a user space program
> > to
> > the keys - which would take care of the
> > scrolling.
> > This would obviously not work with early kernel messages, but would
> > be
> > better than nothing.  I had a look at the GNU screen source code
> > yesterday to see how it managed such things, but it is very
> > sparsely
> > commented, and thus hard work to understand.
> > Maybe I should just cut my losses, and convert to using one of the
> > BSDs.
> 
> 2000 posts per day on Linux kernel list would be more than
> unmanageable for me!  I wouldn't say "almost"!
> 
> Is Linus Torvalds' removal of console scrolling the reason why Scroll
> Lock does not work on the console with System Rescue CD or USB, while
> with FreeBSD and NetBSD, I can press Scroll Lock and scroll back?
> 
> I like that ability but don't think Linus Torvalds is listening or
> reading this.
> 
> Further, with System Rescue console, the lines/text go only partway
> down.
> 
> Using screen, now at v4.8, means having to remember a lot of key
> functions, you need a separate reference screen to look them up.
> 
> There is also tmux, which is part of the base system in NetBSD but
> not FreeBSD.
> 
> If Linus cared about his users, he could make the kernel headers more
> 

Re: [gentoo-user] Console scrollback

2021-01-17 Thread Philip Webb
On Sat, 16 Jan 2021 12:01:48 +, Alan Mackenzie wrote:
> I usually install Gentoo via ssh.
> The article I read about the removal of Linux console's backscrolling
> feature said it was mostly due to lack of a maintainer for that code,
> and that if somebody stepped forward to maintain it, it could be revived.
> I subscribed to the linux-kernel list for a short time
> and offered my services in a post.  Not one single reply did I get.
> Linus Torvalds personally took the decision to remove the scrolling.
> Sure, he went through the motions of pretending to try to find
> a maintainer, but didn't put any serious effort into it.
> He argued that "nobody" uses it anyway, therefore it is unimportant.
> Exactly what the bugs are in the scrolling code
> wasn't gone into on the list, despite more than one contributor asking.

You can't expect Linus to take any time over a minority of users
or for the kernel team generally to reply to someone they don't know.
In order to get attention, you need to come up with a set of patches
which you know work in a modified kernel in your own machine.
For that, you have to put in some work of your own,
searching out the bugs, examining the relevant code,
finding what is needed to fix the bugs & testing patched kernels.

If you try using Screen, you could print yourself a list of commands,
which would make it easier to get used to its features.
It may well be easier to go over to BSD instead.

When I installed this system in 2015, I needed to use raw terminals,
so I wonder whether this is a real problem for a lot of Gentoo users.
If so, an approach by a Gentoo dev to the kernel maintainers
would be likely to get the attention you can't get on your own.

HTH

-- 
,,
SUPPORT ___//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT`-O--O---'   purslowatcadotinterdotnet




Re: [gentoo-user] Console scrollback

2021-01-16 Thread Thomas Mueller
On Sat, 16 Jan 2021 12:01:48 +, Alan Mackenzie wrote:

> Hello, Gentoo.

> On Thu, Jan 14, 2021 at 16:06:38 +, Alan Mackenzie wrote:
> > On Wed, Jan 13, 2021 at 22:15:25 -, Grant Edwards wrote:
> > > On 2021-01-13, Alan Mackenzie  wrote:

> > > > I think bringing up a new Gentoo system absolutely requires working in
> > > > the console, certainly up to the point where X11 and a Window Manager
> > > > have been installed and debugged.

> > > I usually install Gentoo via ssh.

> > > The article I read about the removal of Linux console's backscrolling
> > > feature said it was mostly due to lack of a maintainer for that code,
> > > and that if somebody stepped forward to maintain it, it could be revived.

> > I'm doing my best to step forward, but I suspect that will be almost as
> > difficult as fixing the bugs in it.  ;-)

> And so it transpired.  I subscribed to the linux-kernel list for a short
> time, and offered my services in a post.  Not one single reply did I get.
> That list is not a friendly one.  It gets an almost unmanageable ~2000
> posts a day, the vast bulk of which are patches, fragmented into,
> perhaps, one diff hunk per post.

> > I'm disappointed that the decision to cut out this important feature was
> > taken without any serious attempt to find a maintainer.  I have the
> > impression (though I may be wrong), that the problem was talked about on
> > the linux kernel mailing list, but nobody there took it upon himself to
> > post on any of the more hard-core distributions' mailing lists, such as
> > gentoo's.

> I've come to realise that Linus Torvalds, who personally took the
> decision to remove the scrolling, doesn't care about users, and indeed
> regards them with disdain.  He cares about _customers_, and Linux's
> customers are RedHat, Suse, IBM, Intel, and the other HW manufacturers.
> RedHat customers don't use the console, therefore the console isn't
> important.  It's a bit like Microsoft's attitude towards users.

> Sure, Linus went through the motions of pretending to try to find a
> maintainer, but didn't put any serious effort into it.  He argued that
> "nobody" uses it anyway, therefore it is unimportant, which is an ironic
> echo of the argument that nobody uses Linux on a desktop PC.

> Even if the bugs came to be fixed, I doubt the scrolling would be allowed
> back into the kernel, for the above reasons.  Exactly what the bugs are
> in the scrolling code wasn't gone into on the list, despite more than one
> contributor asking.

> > > FWOW, if you really want backscrolling on the console, you can get
> > > that with screen, but doing so would drive me nuts, since I'd have to
> > > break all my fingers to stop them from typeing ctrl-A to move the
> > > start of a line. I've switched screen's meta-character a few times,
> > > but everytime I try that I find my fingers already have something else
> > > assigned to that control character (which I had forgotten about). It
> > > would be nice if I could print out my fingers' assignment table to
> > > find an unused control character, but that doesn't seem to be how it
> > > works.

> > Can one set up a "basic" screen which doesn't use a meta-character?

> I don't know what I'll be doing, long term.  For the moment, I'll be
> hanging onto the working kernel I've got, old though it may be (4.19.97).
> It might be possible (I'm not sure) to hook up a user space program to
> the keys - which would take care of the scrolling.
> This would obviously not work with early kernel messages, but would be
> better than nothing.  I had a look at the GNU screen source code
> yesterday to see how it managed such things, but it is very sparsely
> commented, and thus hard work to understand.

> Maybe I should just cut my losses, and convert to using one of the BSDs.

2000 posts per day on Linux kernel list would be more than unmanageable for me! 
 I wouldn't say "almost"!

Is Linus Torvalds' removal of console scrolling the reason why Scroll Lock does 
not work on the console with System Rescue CD or USB, while with FreeBSD and 
NetBSD, I can press Scroll Lock and scroll back?

I like that ability but don't think Linus Torvalds is listening or reading this.

Further, with System Rescue console, the lines/text go only partway down.

Using screen, now at v4.8, means having to remember a lot of key functions, you 
need a separate reference screen to look them up.

There is also tmux, which is part of the base system in NetBSD but not FreeBSD.

If Linus cared about his users, he could make the kernel headers more 
user-friendly, installing kernel headers should not be any more complicated 
than copying or downloading.

Console scrolling is especially useful with an OS or distro that is built from 
the ground up, like Gentoo, Void or Arch, as opposed to being installed all at 
once.

If more Linux users would go to and try NetBSD or FreeBSD, those OSes would 
have more users, more ideas, more ability to improve.

You can even 

Re: [gentoo-user] Console scrollback

2021-01-14 Thread karl
Grant:
> On 1/13/21 2:56 PM, Alan Mackenzie wrote:
...
> > Doing text work in X is   s l u g g i s h.  Changing from one 
> > application to another, which would be achieved by, say Alt-F4 on a 
> > console takes more key sequences in X, and is less than instantaneous.

I'm using fvwm set up with 9 virtual screens and so I can swith between
them with ctr-arrow, fast enought for me.

...
> > On an Emacs session, in three columns on a console, I can display 
> > 195 consecutive lines of a source file simultaneously.
...

I get 260x97 chars in emacs on a 1600x1280 display. With three
columns, w82,82,83chars, I get 3x95=285 lines of text.

///

Alan, how do you set up your console (I'd like to try) ?

Regards,
/Karl Hammar




Re: [gentoo-user] Console scrollback

2021-01-14 Thread Alan Mackenzie
Hello, Neil.

On Wed, Jan 13, 2021 at 18:44:15 +, Neil Bothwick wrote:
> On Wed, 13 Jan 2021 18:14:39 +, Alan Mackenzie wrote:

> > > I see that the kernel code to scroll the console has been stripped out
> > > [1].   

> > This is appalling.  I do all my work on the console (apart from web
> > browsing), and with this development, Linux effectively becomes unusable
> > to me.  I will NOT be bullied into using second rate alternatives like
> > X-Windows terminals.

> What about screen/tmux?

I suppose they'd do at a pinch, but they're both things which get
between Linux and my applications, and like X-Windows, they offer
"features" which I don't need and don't want, and hijack key sequences.

But I will look into it if I have to.  For the moment, I can get by by
not updating my kernel.

> -- 
> Neil Bothwick

> WinErr 00D: Window closed - Do not look outside

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Console scrollback

2021-01-13 Thread Grant Taylor

On 1/13/21 2:56 PM, Alan Mackenzie wrote:

Hello, Grant.


Hi Alan,

Well, there's really not much that can't be done in a terminal 
emulator.  But it's the manner of the doing that's important.


Okay.  I can appreciate and respect that response.

Doing text work in X is   s l u g g i s h.  Changing from one 
application to another, which would be achieved by, say Alt-F4 on a 
console takes more key sequences in X, and is less than instantaneous.


I don't know that I've ever experienced the sluggishness that you're 
talking about.  But that doesn't mean it doesn't exist.  I will admit 
that Alt-Tabing through windows is an additional step vs Alt-F# in that 
you have the intermediary list that you cycle through vs just jumping 
directly to the desired window.


The X terminal emulator tends not to occupy the whole screen - it tends 
to have title bars, menu items, tabs even, which just distract from 
the task at hand.  Maybe it can be set up to take the whole screen, 
but that's work.  And the fonts used tend to be less distinct and 
helpful than the 16 x 8 bitmaps I have on the console.


Those seem more like preferences / settings to me.  But preferences are 
still sufficient to drive decisions.



And X windows steals useful key sequences, such as Alt-Tab.


True.

On an Emacs session, in three columns on a console, I can display 
195 consecutive lines of a source file simultaneously.


I would expect that to be the same possibility in X and on the console. 
Or quite close counterparts.



I could go on, but ...

That's not to say there aren't problems with the tty console - even 
before the screen scrolling was removed altogether, it wasn't exactly 
anything to write home about.  And it would be nice to have more than 
16 colours available.  But, on balance, I'll stick with the console.


Fair enough.  To each their own.

I think bringing up a new Gentoo system absolutely requires working 
in the console, certainly up to the point where X11 and a Window 
Manager have been installed and debugged.


True.

Thank you Alan, for enlightening me to your work flow and how the 
console is better for you.




--
Grant. . . .
unix || die



Re: [gentoo-user] Console scrollback

2021-01-13 Thread Alan Mackenzie
Hello, Grant.

On Wed, Jan 13, 2021 at 12:32:28 -0700, Grant Taylor wrote:
> On 1/13/21 11:14 AM, Alan Mackenzie wrote:
> > This is appalling.  I do all my work on the console (apart from web 
> > browsing), and with this development, Linux effectively becomes 
> > unusable to me.  I will NOT be bullied into using second rate 
> > alternatives like X-Windows terminals.

> Wow.  I don't think I've run into someone that was a devout 
> {physical,virtual} /console/ user in quite a while.

> I'm curious what you do in the Linux console that can't be done in a 
> terminal emulator.

Well, there's really not much that can't be done in a terminal emulator.
But it's the manner of the doing that's important.  Doing text work in X
is   s l u g g i s h.  Changing from one application to another, which
would be achieved by, say Alt-F4 on a console takes more key sequences
in X, and is less than instantaneous.  The X terminal emulator tends not
to occupy the whole screen - it tends to have title bars, menu items,
tabs even, which just distract from the task at hand.  Maybe it can be
set up to take the whole screen, but that's work.  And the fonts used
tend to be less distinct and helpful than the 16 x 8 bitmaps I have on
the console.  And X windows steals useful key sequences, such as
Alt-Tab.  On an Emacs session, in three columns on a console, I can
display 195 consecutive lines of a source file simultaneously.

I could go on, but ...

That's not to say there aren't problems with the tty console - even
before the screen scrolling was removed altogether, it wasn't exactly
anything to write home about.  And it would be nice to have more than 16
colours available.  But, on balance, I'll stick with the console.

> I know that there is a lot of difference in different terminal 
> emulators.  --  I *strongly* prefer XTerm as it does things that other 
> terminal emulators have never heard of.

> Please share if you do things that /can/ be done in the Linux console 
> that /can't/ be done in a terminal emulator.

I think bringing up a new Gentoo system absolutely requires working in
the console, certainly up to the point where X11 and a Window Manager
have been installed and debugged.

> If it's just preference, then hat's off to you.



> -- 
> Grant. . . .
> unix || die

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Console scrollback

2021-01-13 Thread Grant Taylor

On 1/13/21 11:14 AM, Alan Mackenzie wrote:
This is appalling.  I do all my work on the console (apart from web 
browsing), and with this development, Linux effectively becomes 
unusable to me.  I will NOT be bullied into using second rate 
alternatives like X-Windows terminals.


Wow.  I don't think I've run into someone that was a devout 
{physical,virtual} /console/ user in quite a while.


I'm curious what you do in the Linux console that can't be done in a 
terminal emulator.


I know that there is a lot of difference in different terminal 
emulators.  --  I *strongly* prefer XTerm as it does things that other 
terminal emulators have never heard of.


Please share if you do things that /can/ be done in the Linux console 
that /can't/ be done in a terminal emulator.


If it's just preference, then hat's off to you.



--
Grant. . . .
unix || die



Re: [gentoo-user] Console scrollback

2021-01-13 Thread Peter Humphrey
On Wednesday, 13 January 2021 18:14:39 GMT Alan Mackenzie wrote:
> Hello, Peter.
> 
> On Wed, Jan 13, 2021 at 10:30:19 +, Peter Humphrey wrote:
> > Hello list,
> > 
> > I see that the kernel code to scroll the console has been stripped out
> > [1].
> 
> This is appalling.  I do all my work on the console (apart from web
> browsing), and with this development, Linux effectively becomes unusable
> to me.  I will NOT be bullied into using second rate alternatives like
> X-Windows terminals.
> 
> Thanks for the heads up!
> 
> > What do people use instead?
> 
> Well, it looks like I'll have to stop upgrading my kernel at 5.8.n.

Actually, the console-scrolling code has gone from 5.4.80 too. Also 5.4.72 I 
think.

-- 
Regards,
Peter.






Re: [gentoo-user] Console scrollback

2021-01-13 Thread Neil Bothwick
On Wed, 13 Jan 2021 18:14:39 +, Alan Mackenzie wrote:

> > I see that the kernel code to scroll the console has been stripped out
> > [1].   
> 
> This is appalling.  I do all my work on the console (apart from web
> browsing), and with this development, Linux effectively becomes unusable
> to me.  I will NOT be bullied into using second rate alternatives like
> X-Windows terminals.

What about screen/tmux?


-- 
Neil Bothwick

WinErr 00D: Window closed - Do not look outside


pgpHc6hSsCL0N.pgp
Description: OpenPGP digital signature


Re: [gentoo-user] Console scrollback

2021-01-13 Thread Alan Mackenzie
Hello, Peter.

On Wed, Jan 13, 2021 at 10:30:19 +, Peter Humphrey wrote:
> Hello list,

> I see that the kernel code to scroll the console has been stripped out
> [1]. 

This is appalling.  I do all my work on the console (apart from web
browsing), and with this development, Linux effectively becomes unusable
to me.  I will NOT be bullied into using second rate alternatives like
X-Windows terminals.

Thanks for the heads up!

> What do people use instead?

Well, it looks like I'll have to stop upgrading my kernel at 5.8.n.
That can only be a short term answer, though.

> This loss is a nuisance while installing a new system, as I am still
> trying to do on my old laptop.

> 1.  https://soylentnews.org/article.pl?sid=20/09/15/1824233=rss

Question: I'm a C hacker; how do I go about getting to restore (and
enhance) this essential facility myself?

> -- 
> Regards,
> Peter.

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Console scrollback

2021-01-13 Thread Peter Humphrey
On Wednesday, 13 January 2021 11:21:54 GMT Andreas Fink wrote:

> How about this (works with bash, not sure about other shells):
> emerge |& less
> 
> This should work with all shells:
> emerge 2>&1 | less

That's better; thanks Andreas.

-- 
Regards,
Peter.






Re: [gentoo-user] Console scrollback

2021-01-13 Thread Andreas Fink
On Wed, 13 Jan 2021 10:55:18 +
Peter Humphrey  wrote:

> On Wednesday, 13 January 2021 10:38:01 GMT Michael wrote:
> > On Wednesday, 13 January 2021 10:30:19 GMT Peter Humphrey wrote:
> > > Hello list,
> > >
> > > I see that the kernel code to scroll the console has been stripped out
> > > [1]. What do people use instead?
> > >
> > > This loss is a nuisance while installing a new system, as I am still
> > > trying to do on my old laptop.
> > >
> > > 1.  https://soylentnews.org/article.pl?sid=20/09/15/1824233=rss
> >
> > A relief to see I'm not alone in experiencing this problem - I thought I had
> > misconfigured something on my systems. :-)
> >
> > A way around it would be to use screen or tmux and use their internal
> > buffer. However, if you're already logged in a console and suddenly want to
> > Shift+PageUp, then it would be too late.  This suggestion won't help if you
> > want to look at the rc scripts output as the system boots, but you can
> > capture these separately in syslog.
>
> It's a pain in the neck while trying to emerge a base system and being thrown
> scores of lines of reasons why it can't be done, with the prime cause long
> gone. I tried using "| tee 2>&1 > /tmp/file" and then viewing the file on
> another vTTY, but there ought to be a neater way.
>


How about this (works with bash, not sure about other shells):
emerge |& less

This should work with all shells:
emerge 2>&1 | less

Cheers
Andreas



Re: [gentoo-user] Console scrollback

2021-01-13 Thread Peter Humphrey
On Wednesday, 13 January 2021 10:38:01 GMT Michael wrote:
> On Wednesday, 13 January 2021 10:30:19 GMT Peter Humphrey wrote:
> > Hello list,
> > 
> > I see that the kernel code to scroll the console has been stripped out
> > [1]. What do people use instead?
> > 
> > This loss is a nuisance while installing a new system, as I am still
> > trying to do on my old laptop.
> > 
> > 1.  https://soylentnews.org/article.pl?sid=20/09/15/1824233=rss
> 
> A relief to see I'm not alone in experiencing this problem - I thought I had
> misconfigured something on my systems. :-)
> 
> A way around it would be to use screen or tmux and use their internal
> buffer. However, if you're already logged in a console and suddenly want to
> Shift+PageUp, then it would be too late.  This suggestion won't help if you
> want to look at the rc scripts output as the system boots, but you can
> capture these separately in syslog.

It's a pain in the neck while trying to emerge a base system and being thrown 
scores of lines of reasons why it can't be done, with the prime cause long 
gone. I tried using "| tee 2>&1 > /tmp/file" and then viewing the file on 
another vTTY, but there ought to be a neater way.

-- 
Regards,
Peter.






Re: [gentoo-user] Console scrollback

2021-01-13 Thread Michael
On Wednesday, 13 January 2021 10:30:19 GMT Peter Humphrey wrote:
> Hello list,
> 
> I see that the kernel code to scroll the console has been stripped out [1].
> What do people use instead?
> 
> This loss is a nuisance while installing a new system, as I am still trying
> to do on my old laptop.
> 
> 1.  https://soylentnews.org/article.pl?sid=20/09/15/1824233=rss

A relief to see I'm not alone in experiencing this problem - I thought I had 
misconfigured something on my systems. :-)

A way around it would be to use screen or tmux and use their internal buffer.  
However, if you're already logged in a console and suddenly want to 
Shift+PageUp, then it would be too late.  This suggestion won't help if you 
want to look at the rc scripts output as the system boots, but you can capture 
these separately in syslog.

signature.asc
Description: This is a digitally signed message part.