Welcome
Welcome to refracta

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

Refracta with GRUB2. Locales, keyboard boot options problem

Ask your questions here.

Re: Refracta with GRUB2. Locales, keyboard boot options prob

Postby dzz » Wed Feb 22, 2017 2:50 am

https://bugs.debian.org/cgi-bin/bugrepo ... bug=765077

The fix posted there works for me. This was done in Refracta Wheezy but not Jessie.
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: Refracta with GRUB2. Locales, keyboard boot options prob

Postby fsmithred » Wed Feb 22, 2017 4:05 am

Thanks. I did some more testing in console. In the refracta8.2 iso, LANG is not set for the user, but is set for root. If user does 'LANG=xx_XX.UTF-8' then the chosen language is used for system messages. In the 8.1 iso (Feb 18), LANG does get set for the user.

This is what I did. I don't know if this would change the behavior of 1065-refracta-lang. (From balloon's howto)
Code: Select all
apt-get remove localepurge asunder man-db
apt -u --reinstall --fix-missing install $(dpkg -S LC_MESSAGES | cut -d: -f1 | tr ', ' '\n' | sort -u)
apt install asunder man-db
apt-install locales-all


I haven't tried the workaround script in the bug report yet. Looks like it should work.
User avatar
fsmithred
 
Posts: 2082
Joined: Wed Mar 09, 2011 9:13 pm

Re: Refracta with GRUB2. Locales, keyboard boot options prob

Postby dzz » Wed Feb 22, 2017 5:07 pm

Update: (almost) this entire problem is lightdm. Or something else that affects lightdm, possibly related to pam or systemd. Additionally, the preconfigured .dmrc in ~ probably breaks the lightdm fix.

I used a hook to add the lightdm fix and booted 'findiso' with "hooks=file:///lib/live/findiso/refracta8/hookscript lang=hu" The user session is HU language, keyboard is hu with a choice of 3 others in the panel switcher.

0050-locales (and refracta-lang, which does nothing if locales= was used) already generate selected locales. They always did, I can't see any need to change them, nor any need to preconfigure extra locales in the iso.

I used the hook also to rm -f /home/user/.dmrc

Problems with any previous use of localepurge, that's another matter.

EDIT here is the hook I used. Take out the 2 instances of "#" in /#etc/ (forum post restrictions). You don't need to manually chmod +x a hook script, it can go on a fat drive.

Code: Select all
#!/bin/bash

# live-hook script to fix lightdm locale bug

# name: lightdm-fix-hook (or whatever you prefer)
#
# Put it somewhere accessable and invoke e.g. like this:
# hooks=file:///lib/live/mount/medium/lightdm-fix-hook

cat <<'EOF' > /#etc/X11/Xsession.d/21-lightdm-language-fix

# workaround for session language selection in lightdm greeter
# we need this only if lightdm is being used
if pidof lightdm
then
   # use Language setting from ~/.dmrc
   export LANG=`cat "$HOME/.dmrc" | grep '^Language=' | cut -d '=' -f 2- | sed 's/utf8/UTF-8/'`

   # if $LANGUAGE is set, sync it with chosen locale
   [ -n "$LANGUAGE" ] && export LANGUAGE=`echo $LANG | cut -d '.' -f 1`:`echo -n $LANG | cut -d '.' -f 1 | cut -d '_' -f 1`

   # remove untrustworthy $GDM_LANG
   [ -n "$GDM_LANG" ] && unset GDM_LANG
fi

EOF

chmod 755 /#etc/X11/Xsession.d/21-lightdm-language-fix
rm -f /home/user/.dmrc
exit 0


~/.dmrc will be generated by lightdm and defaults to the system locale unless you didn't autologin) and set another in the greeter.

And thanks Vladimir K for this fix..
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: Refracta with GRUB2. Locales, keyboard boot options prob

Postby felleg » Wed Feb 22, 2017 11:29 pm

Thanks for the information about the hooks, they are really very useful. Until now I had to boot a live system, open a file manager, find the live media partition, and click my main config script. Now, this can be done automatically.
Though I use only live systems I never heard about the possibility of setting the behaviour of a live system by passing hook-boot-options and using hook scripts. I did a Google search and didn't find any information. Is there any tutorial, link about this?

But I had some problems. Since the hook script is executed in a very early stage. For this I could not set the wifi. Surely, there are solutions. We can tell the hook script to execute an another script later.

1) First I created refracta script and copied into init.d. In hooks script:
Code: Select all
cp /lib/live/mount/medium/c-refracta8_xfce_i386-20170218_2229/refracta /etc/init.d/
ln -s /init.d/refracta /etc/rc2.d/S98refracta
ln -s /init.d/refracta /etc/rc3.d/S98refracta
ln -s /init.d/refracta /etc/rc4.d/S98refracta
ln -s /init.d/refracta /etc/rc5.d/S98refracta
ln -s /init.d/refracta /etc/rc0.d/K01refracta
ln -s /init.d/refracta /etc/rc1.d/K01refracta
ln -s /init.d/refracta /etc/rc6.d/K01refracta
The content of refracta script:
Code: Select all
#! /bin/sh
### BEGIN INIT INFO
# Provides:          refracta
# Required-Start:   
# Required-Stop:     
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Refracta configuration
# Description:       Refracta live configuration
### END INIT INFO

/lib/live/mount/medium/refracta8_xfce_i386-20170218_2229
refracta8_xfce_i386-20170218_2229 is my main config file which executes the config files (bookmarks.sh, geany.sh, etc.):
Code: Select all
#!/bin/bash

my_log=/tmp/$(basename $0).log
# Do not execute again when restarting X
[ -f $my_log ] && exit
touch $my_log

# Jelentések, hibaüzenetek átírányítása naplóba
# Redirect STDOUT file descriptor to log file
exec 1>>$my_log
# Redirect STDERR to log file
exec 2>>$my_log

echo "Executing all executable SH files in {1..3} subdirectories"

for i in {1..3}
do
   for f in $(dirname $(realpath $0))/c-$(basename $0)/$i/*.sh
   do
      [ -f $f ] && [ -x $f ] && echo -e "\n$(date +"%F %T")\n$f" && $f
   done
done

echo -e "\nAll done"
[[ $(echo $DISPLAY) = "" ]] || xmessage -timeout 2 "Refracta configuration executed"

exit 0

But the first method did not work:
Code: Select all
$ file /etc/rc3.d/S98refracta
/etc/rc3.d/S98refracta: broken symbolic link to /init.d/refracta

2) Then I hacked rc.local. In hooks script:
Code: Select all
echo "/lib/live/mount/medium/refracta8_xfce_i386-20170218_2229" >> /etc/init.d/rc.local
This solution is not working for setting the network:
Code: Select all
wlan0     Interface doesn't support scanning : Network is down
Although rc.local is executed last...

3) So, I choosed to execute when X starts. Although this is not exactly what I hoped to achieve since I wanted to set wifi also for TUI. In hooks script:
Code: Select all
ln -s /lib/live/mount/medium/c-refracta8_xfce_i386-20170218_2229/r.desktop /home/user/.config/autostart/r.desktop
The content of r.desktop:
Code: Select all
[Desktop Entry]
Exec=/lib/live/mount/medium/refracta8_xfce_i386-20170218_2229
This method works without any problem.

My new menuentry in grub.cfg:
Code: Select all
menuentry 'refracta8_xfce_i386-20170218_2229 hu-lang london hooks' {
   set OS=refracta8_xfce_i386-20170218_2229
   linux /boot/$OS/live/vmlinuz bootfrom=/dev/sda1 live-media-path=/boot/$OS/live/ \
   boot=live lang=hu_HU timezone=Europe/London noeject noprompt quiet \
   hooks=file:///lib/live/mount/medium/c-refracta8_xfce_i386-20170218_2229/hooks
   initrd /boot/$OS/live/initrd.img
}


About the locales later...
User avatar
felleg
 
Posts: 3
Joined: Mon Feb 20, 2017 2:10 am

Re: Refracta with GRUB2. Locales, keyboard boot options prob

Postby fsmithred » Thu Feb 23, 2017 1:15 am

Hey dzz, they fixed it! /etc /etc /etc

felleg, you might want to take a look at the debian-live manual.
https://debian-live.alioth.debian.org/l ... al.en.html

I don't understand what you're doing with /etc/init.d. If you want some custom desktop configs or browser bookmarks to be copied into place at boot, a hookscript should work. The hooks are run after all the other live-config scripts. For the accessibility configs, I made a live-config script, and it just unpacks and copies the config files into the user's home.

It might even make sense for you to make your own custom iso. You don't have to install the system to do that - you just need some storage space for the filesystem copy and for the iso you make. It could all be done with usb flash drives.

Another possibility would be to create a persistent volume. Normally, these are intended to be read/write, but I suppose you could remount it read-only. Or use some of the more esoteric persistence options that involve overlays (that I don't really know anything about.)

For the wifi issue - if you could get what you want from an entry in /etc/network/interfaces, then you could use the ip=frommedia boot option.

About the locale problem - I made another iso after removing locales-all and de-configuring all the locales. I think I may have fixed what I broke. I'm still experimenting with the fix for lightdm.
User avatar
fsmithred
 
Posts: 2082
Joined: Wed Mar 09, 2011 9:13 pm

Re: Refracta with GRUB2. Locales, keyboard boot options prob

Postby dzz » Thu Feb 23, 2017 3:47 am

Though I use only live systems I never heard about the possibility of setting the behaviour of a live system by passing hook-boot-options and using hook scripts. I did a Google search and didn't find any information. Is there any tutorial, link about this?

Your own imagination will create and use the hook.. that's not possible to document, beyond (man live-config) how to place and invoke such script(s)! An experimenter's paradise.

It is simple to cat a custom /etc/network/interfaces. One problem you might have is wicd (a law unto itself). You can disable it or use it, loading a custom wicd config from a hook. This all happens before networking (or anything in rcx.d) starts. I have used both methods successfully with hooks.. wlan autostarted, psk configured, nasty firmware loaded.. Custom browser profile also.

By contrast, initscripts are absolute ****s to deal with manually, maybe with unexpected repercussions.
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: Refracta with GRUB2. Locales, keyboard boot options prob

Postby fsmithred » Sun Feb 26, 2017 12:51 am

In live session, using the hookscript for lightdm, I can set the language at boot, and everything seems to be working correctly. I don't think I'm seeing a difference between the hook with and without the line to remove .dmrc. I'll have to test that some more to be sure.

I'm using autologin in the live sessions, so the only way to change language without rebooting is to edit /etc/default/locale.

In an install, using Xsession.d/21-lightdm-language-fix allows me to change language at the lightdm login screen. However, it does not go back to the defualt language if I log out and log in again, unless I remove .dmrc first.
User avatar
fsmithred
 
Posts: 2082
Joined: Wed Mar 09, 2011 9:13 pm

Re: Refracta with GRUB2. Locales, keyboard boot options prob

Postby dzz » Sun Feb 26, 2017 11:50 am

I'm using autologin in the live sessions, so the only way to change language without rebooting is to edit /etc/default/locale.

The fix script forces lightdm to use .dmrc. If it's blank the system default is highlighted, unless a diffent one is picked from the greeter. A new .dmrc is then written on login.

If you want autologin, try setting a delay in lightdm.conf (e.g. 5 seconds). The greeter (with language selector) should show for that time. The timeout stops as soon as you hit a key.

In an install, using Xsession.d/21-lightdm-language-fix allows me to change language at the lightdm login screen. However, it does not go back to the defualt language if I log out and log in again, unless I remove .dmrc first.

What happens if you reset it in the greeter? It should do what you set. I don't have install with lightdm available today, to test that. Check permissions on lightdm-language-fix (755?), I had a problem using cp.

On another note, I updated and tidied up the refracta-lang script. At the moment it includes the lightdm fix (as a "function", so easily disabled). It might be the best place to put the fix anyway, keeping "hacks" out of the main system.

It now only runs locale-gen on an ungenerated selection and shows it on the console.

I tested it with "nocomponents=refracta-lang" and calling the new one as a hook.
Last edited by dzz on Sun Feb 26, 2017 12:06 pm, edited 1 time in total.
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: Refracta with GRUB2. Locales, keyboard boot options prob

Postby fsmithred » Sun Feb 26, 2017 12:06 pm

In an install, using Xsession.d/21-lightdm-language-fix allows me to change language at the lightdm login screen. However, it does not go back to the defualt language if I log out and log in again, unless I remove .dmrc first.

What happens if you reset it in the greeter? It should do what you set. I don't have install with lightdm available today, to test that.


When the greeter comes up, it's set to default language. And when I log in, I get whatever language is still in .dmrc from the previous login. It does not get changed to the default language.
User avatar
fsmithred
 
Posts: 2082
Joined: Wed Mar 09, 2011 9:13 pm

Re: Refracta with GRUB2. Locales, keyboard boot options prob

Postby dzz » Sun Feb 26, 2017 12:16 pm

Check permissions on lightdm-language-fix (755?), I had a problem using cp.


you might have missed my edit. Other than that, ****.
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

PreviousNext

Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests

suspicion-preferred