Results 1 to 4 of 4

Thread: Race bug in xsession-knoppix

  1. #1
    Member registered user
    Join Date
    Jul 2003
    Posts
    39

    Race bug in xsession-knoppix

    I encountered a race bug in the xsession-knoppix package, in /etc/X11/Xsession.d/45xsession.

    At first, I thought something was wrong with my remastering. See discussion in http://www.knoppix.net/forum/viewtopic.php?t=3558.

    After failing to find a change I made which caused KDE configuration to reset to default while loading, I created a new remaster, starting from knoppix 3.2, and made sure I'm not making any changes other than running some daemon I need from some rc file which is totally unrelated to KDE or X11. The bug was still there but was not persistent. Sometimes the environment was ok and sometimes it wasn't.

    After a lot of digging and adding debug messages all over the place (which made the problem worse), I realized that when 45xsession copies the kde config files in this line:

    Code:
    \cp -ua /etc/skel/{.kde*,Desktop} $HOME/
    it fails to copy some important files from /etc/skel/.kde/share/config/, claiming that the directory already exists in the ramdisk homedir and has no write permission. I added
    Code:
    rm -rf /ramdisk/home/knoppix/.kde
    right before the above line, and still, sometimes these config files were created before the cp had a chance to put the real files there. Some other process was racing with 45xsession on the creation of some files in .kde.

    Looking a bit up in 45xsession reveals a
    Code:
    sleep 2
    right before the cp takes place, after ksplash is executed. Playing with the sleep time solves the problem here, but on slower hardware or with mode processes using the CPU during init, the problem can reappear.

    To sum it up, ksplash, at a certain point, creates .kde/share/config if its not there yet, and prevents cp from putting the real files there.

    I don't know why ksplash has to be loaded so early instead of after the non-persistent homedir is created, but in the meantime, here's a real work-around which isn't time-based (so the sleep 2 can be eliminated):

    Right before ksplash is executed, I do
    Code:
    mkdir -p $HOME/.kde/share/config
    .

    This is ugly but solves it for now. As a real solution, ksplash has to be executed AFTER the creation of the non-persistent homedir, or be patched to create these dirs with proper permissions.

    Who maintains this package ?

    Mack

  2. #2
    Senior Member registered user
    Join Date
    Feb 2003
    Location
    Nova Scotia, Canada
    Posts
    2,479

    Re: Race bug in xsession-knoppix

    Quote Originally Posted by mack

    Who maintains this package ?

    Mack
    Not sure who maintains it but the bugzilla is the place to report bugs I'm sure someone will look at it once the problem is known to them.

  3. #3
    Senior Member registered user
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    297

    Re: Race bug in xsession-knoppix

    Quote Originally Posted by mack
    I encountered a race bug in the xsession-knoppix package, in /etc/X11/Xsession.d/45xsession.

    At first, I thought something was wrong with my remastering. See discussion in http://www.knoppix.net/forum/viewtopic.php?t=3558.

    After failing to find a change I made which caused KDE configuration to reset to default while loading, I created a new remaster, starting from knoppix 3.2, and made sure I'm not making any changes other than running some daemon I need from some rc file which is totally unrelated to KDE or X11. The bug was still there but was not persistent. Sometimes the environment was ok and sometimes it wasn't.

    After a lot of digging and adding debug messages all over the place (which made the problem worse), I realized that when 45xsession copies the kde config files in this line:

    Code:
    \cp -ua /etc/skel/{.kde*,Desktop} $HOME/
    it fails to copy some important files from /etc/skel/.kde/share/config/, claiming that the directory already exists in the ramdisk homedir and has no write permission. I added
    Code:
    rm -rf /ramdisk/home/knoppix/.kde
    right before the above line, and still, sometimes these config files were created before the cp had a chance to put the real files there. Some other process was racing with 45xsession on the creation of some files in .kde.

    Looking a bit up in 45xsession reveals a
    Code:
    sleep 2
    right before the cp takes place, after ksplash is executed. Playing with the sleep time solves the problem here, but on slower hardware or with mode processes using the CPU during init, the problem can reappear.

    To sum it up, ksplash, at a certain point, creates .kde/share/config if its not there yet, and prevents cp from putting the real files there.

    I don't know why ksplash has to be loaded so early instead of after the non-persistent homedir is created, but in the meantime, here's a real work-around which isn't time-based (so the sleep 2 can be eliminated):

    Right before ksplash is executed, I do
    Code:
    mkdir -p $HOME/.kde/share/config
    .

    This is ugly but solves it for now. As a real solution, ksplash has to be executed AFTER the creation of the non-persistent homedir, or be patched to create these dirs with proper permissions.

    Who maintains this package ?

    Mack
    Klaus Knopper - master himself -, thank you for your bug report and your detailed error analysis. I had this problem today too and asked my what it could be. I think the mkdir is no workaround, but the solution. its ksplash problem if it creates "wrong" permissions.

    You ask, why the ksplash is loaded so early ?

    Well, its all about psychology, yo know. Joe user, sees an grey screen (standard x) and waits and nothing happens, and he turns the computer off or is angry or bored.

    But if there is quick visual feedback "Something is happening" Joe User is happy and waits for it ...

    Thats the whole secret about why people can wait about microsoft boot (There is some bar moving), but not if there is just text. It stands there for already 1 minute, nothing happens.

    Klaus Knopper, does not make Knoppix so good, because it has only great hardware-detection like many think. No, its the small details, that matter and of which Klaus Knoper takes care. (Like with openoffice also an quick screen is started to keep the user happy)

    There _must_ be some magic in Knoppix ) <=

    cu

    Fabian

  4. #4
    Member registered user
    Join Date
    Jul 2003
    Posts
    39

    Re: Race bug in xsession-knoppix

    Quote Originally Posted by Fabianx
    Klaus Knopper - master himself -, thank you for your bug report and your detailed error analysis. I had this problem today too and asked my what it could be. I think the mkdir is no workaround, but the solution. its ksplash problem if it creates "wrong" permissions.
    I'm glad to have saved you the need to hunt this bug.
    It was a particularly tricky one to track down. I actually remastered again for it, with the original KNOPPIX filesystem - no files changed - just some extra driver in initrd. When the bug still appeareded in a system with nothing changed but a driver which is totally unrelated to KDE or X11, I figured it must be some weird timing thing. Took days to figure out!

    Re mkdir, I guess we could call it a solution, at least until ksplash is fixed. The funny thing is that I didn't even find where ksplash calls mkdir(2) for it. I straced it from 45xsession, didn't see an mkdir call, but the dirs were just there after a few seconds. I guess it triggers some other process which causes it, by some IPC method. (It doesn't fork anything that causes it - strace followed forks).

    Quote Originally Posted by Fabianx
    You ask, why the ksplash is loaded so early ?

    Well, its all about psychology, yo know. Joe user, sees an grey screen (standard x) and waits and nothing happens, and he turns the computer off or is angry or bored.

    But if there is quick visual feedback "Something is happening" Joe User is happy and waits for it ...

    Thats the whole secret about why people can wait about microsoft boot (There is some bar moving), but not if there is just text. It stands there for already 1 minute, nothing happens.
    Yes, I know all that - I read the comment before ksplash is executed.

    Me, I'd prefer to just eliminate the 'quiet' keyword from the kernel params and read the kernel messages while booting. Its much more fun than watching a bar. But than again, thats me

    Quote Originally Posted by Fabianx
    Klaus Knopper, does not make Knoppix so good, because it has only great hardware-detection like many think. No, its the small details, that matter and of which Klaus Knoper takes care. (Like with openoffice also an quick screen is started to keep the user happy)

    There _must_ be some magic in Knoppix ) <=

    cu

    Fabian
    I totally agree. Knoppix rocks.

    On a side note, I still think openoffice takes way too much time to load. A splash screen is not enough for that. They should splash some tetris or something for the user to play with, as openoffice loads.

Similar Threads

  1. yeahy i fuk0red xsession, help plz.
    By o0oO in forum Hardware & Booting
    Replies: 4
    Last Post: 09-28-2004, 11:49 PM
  2. kdm, gdm, xdm, xsession, etc.
    By bamarob in forum General Support
    Replies: 0
    Last Post: 07-08-2004, 07:44 PM
  3. xsession
    By linuxusr in forum Hdd Install / Debian / Apt
    Replies: 0
    Last Post: 06-05-2004, 08:31 PM
  4. Problem with boot of knoppix in xsession-> ... xinitrc...
    By rylcomputer in forum Customising & Remastering
    Replies: 0
    Last Post: 02-13-2004, 03:09 PM
  5. Xsession and KDM -adding WM's
    By theARE in forum Hdd Install / Debian / Apt
    Replies: 0
    Last Post: 08-29-2003, 07:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


LENOVO THINKPAD T14s GEN 2a Ryzen 7 PRO 5850U 1.9GHz 16GB 256GB TOUCH - NO OS picture

LENOVO THINKPAD T14s GEN 2a Ryzen 7 PRO 5850U 1.9GHz 16GB 256GB TOUCH - NO OS

$299.95



Lenovo ThinkPad L14 Gen 3 Laptop 14” FHD Core i5 12th 16GB RAM 512GB SSD Win 11 picture

Lenovo ThinkPad L14 Gen 3 Laptop 14” FHD Core i5 12th 16GB RAM 512GB SSD Win 11

$374.99



Lenovo Thinkpad T14 Gen 2 14

Lenovo Thinkpad T14 Gen 2 14" 16GB, Thunder Black

$313.00



Lenovo ThinkPad Business Laptop 14

Lenovo ThinkPad Business Laptop 14" AMD Ryzen 7 16GB RAM 256GB SSD Windows 11

$229.99



Lenovo Yoga 11e Gen 5 2-in-1 Touchscreen 11

Lenovo Yoga 11e Gen 5 2-in-1 Touchscreen 11" HD Laptop 4GB 128GB SSD Windows 11

$99.99



Lenovo ThinkPad L14 Gen 1 i5-10210U 16GB 512GB SSD Win 11 Pro Very Good picture

Lenovo ThinkPad L14 Gen 1 i5-10210U 16GB 512GB SSD Win 11 Pro Very Good

$229.99



Lenovo ThinkPad T14 Gen 1 Core i5  1.70GHz, 16GB RAM , 256GB SSD picture

Lenovo ThinkPad T14 Gen 1 Core i5 1.70GHz, 16GB RAM , 256GB SSD

$239.99



Lenovo ThinkPad T14 Gen 3 14

Lenovo ThinkPad T14 Gen 3 14" WUXGA Ryzen 5 6650U Pro 16GB 256GB Radeon 660M

$449.00



Lenovo Thinkpad E15 Gen 2 8GB RAM 256GB SSD Intel Core i5-1135G7@2.40GHz Laptop picture

Lenovo Thinkpad E15 Gen 2 8GB RAM 256GB SSD Intel Core [email protected] Laptop

$220.36



Lenovo ThinkPad T580 15.6

Lenovo ThinkPad T580 15.6" FHD W11 Pro Laptop i5-8250U 8GB 256GB Backlit / USB C

$175.00