Difference between revisions of "AndLinux"

From YobiWiki
Jump to navigation Jump to search
m (Reverted edits by JasonAnderson (talk) to last revision by PhilippeTeuwen)
 
(16 intermediate revisions by 3 users not shown)
Line 21: Line 21:
 
<br>And right-click on a folder allows it to be opened in Konqueror or Konsole.
 
<br>And right-click on a folder allows it to be opened in Konqueror or Konsole.
 
<br>To do that it is creating the path file:///mnt/win/... so be sure that /mnt/win points to your data partition.
 
<br>To do that it is creating the path file:///mnt/win/... so be sure that /mnt/win points to your data partition.
  +
  +
If you want or need to hack into that part, have a look here:
  +
* [http://www.andlinux.org/faq.php last point of the FAQ: Changing the Launcher Port]
  +
* [http://andlinux.org/forum/viewtopic.php?p=939#939 a patched launcher.pl] to get it working with andCmd.exe too, as with [http://www.andlinux.org/forum/viewtopic.php?t=55 this example]
  +
  +
And here is a patch by Thierry Walrant to allow more than one share and to fix the andCmd.exe bug as well, you can [{{#file:launcher.patch}} get the patch here]
  +
<source lang=diff>
  +
--- launcher.pl 2008-07-03 05:26:40.000000000 -0400
  +
+++ launcher.pl 2008-07-03 05:52:45.000000000 -0400
  +
@@ -1,27 +1,44 @@
  +
#!/usr/bin/perl
  +
  +
use IO::Socket;
  +
+use strict;
  +
  +
+# Default settings.
  +
+our $localPort = 81;
  +
+our %pathPrefixes = (
  +
+ '/mnt/win/' => "C:\\"
  +
+ );
  +
  +
-$windowsPathPrefix = "C:\\";
  +
-$linuxPathPrefix = "/mnt/win/";
  +
+# Load config, if any.
  +
+my $conf = '/etc/launcher-conf.pl';
  +
+require $conf if -f $conf;
  +
  +
  +
-$sock = new IO::Socket::INET(LocalPort => 81, Reuse => 1, Listen => 20) or die("Error creating local socket: $@\n");
  +
+my $sock = new IO::Socket::INET(LocalPort => $localPort, Reuse => 1, Listen => 20) or die("Error creating local socket: $@\n");
  +
  +
-while($client = $sock->accept())
  +
+while(my $client = $sock->accept())
  +
{
  +
- $request = <$client>;
  +
+ my $request = <$client>;
  +
chomp $request;
  +
if($request =~ m/^cmd=(.+)&file=(.*)$/)
  +
{
  +
- $cmd = $1;
  +
- $file = $2;
  +
+ my $cmd = $1;
  +
+ my $file = $2;
  +
  +
- $escapedWindowsPathPrefix = $windowsPathPrefix;
  +
- $escapedWindowsPathPrefix =~ s/\\/\\\\/g;
  +
- $file =~ s/$escapedWindowsPathPrefix/$linuxPathPrefix/g;
  +
+ # Apply all mappings
  +
+ foreach my $linuxPathPrefix ( keys %pathPrefixes ) {
  +
+ my $windowsPathPrefix = $pathPrefixes{$linuxPathPrefix};
  +
+ $windowsPathPrefix =~ s/\\/\\\\/g;
  +
+ $file =~ s/$windowsPathPrefix/$linuxPathPrefix/g;
  +
+
  +
+ # Apply mapping to 'cmd' as well (circumvent issue with
  +
+ # andCmd.exe which passes all arguments in 'cmd').
  +
+ $cmd =~ s/$windowsPathPrefix/$linuxPathPrefix/g;
  +
+ }
  +
+
  +
+ # Finalize with back-slashes replacement.
  +
$file =~ s/\\/\//g;
  +
+ $cmd =~ s/\\/\//g;
  +
  +
system("$cmd $file &");
  +
</source>
  +
To use it you can use the hardcoded mapping as before or you can define your mappings in a config file /etc/launcher-conf.pl such as:
  +
<source lang=perl>
  +
# Configuration file for the launcher: /usr/local/sbin/launcher.pl
  +
  +
%pathPrefixes = (
  +
'/mnt/winC/' => 'C:\\',
  +
'/mnt/winD/' => 'D:\\',
  +
'/mnt/winZ/' => 'Z:\\'
  +
);
  +
  +
# A Perl library MUST return 1
  +
1;
  +
</source>
  +
  +
Please note this configuration assumes that the mount points /mnt/winC, /mnt/winD and /mnt/winZ are mounted on the root of the windows drives C:, D: and Z:. This allows you to launch KDE applications on any of your windows files and folders.
  +
 
===Starting Xming our own way===
 
===Starting Xming our own way===
 
By default Xming is started at boot time (cf folder Startup)
 
By default Xming is started at boot time (cf folder Startup)
Line 26: Line 106:
 
<source lang=dos>
 
<source lang=dos>
 
@echo off
 
@echo off
  +
setlocal ENABLEEXTENSIONS
   
 
rem Do we need to start xming?
 
rem Do we need to start xming?
Line 43: Line 124:
 
goto :EOF
 
goto :EOF
 
</source>
 
</source>
  +
===Port forwarding===
  +
To forward a port of the host to andLinux so it can run servers available to everybody: (instructions extracted from [http://colinux.wikia.com/wiki/Network#Forwarding_Ports_over_Slirp here])
  +
<br>Edit your settings.txt and append some port forwarding infos to eth0:
  +
#eth0=slirp,<MAC>,tcp:<from Hosting OS port>:<to coLinux OS port>/...
  +
eth0=slirp,,tcp:22:22/tcp:80:80
  +
  +
==Troubleshooting==
  +
===Startup delays===
  +
* '''Interaction with Anti-Virus software''' - AV software may interact with the startup of AndLinux, typically by maintaining a lock on the 4GB disk image file <tt>base.drv</tt> while it is scanned.
  +
** '''Solution''': To prevent this, one can exclude the andlinux directory from the AV on-access scanner. In McAfee, this is done by ''opening the '''VirusScan console''' &rarr; '''double-ckick''' On-Access Scanner &rarr; then select '''All Processes''' &rarr; open the pane '''Detection''' and click the button '''Exclusions...''' &rarr; click '''Add...''' to add a new exclusion &rarr; '''Browse''' to AndLinux directory and select '''Also exclude subfolders'''''.
  +
* '''Stalling when mounting /''' - You experience a huge delay during the startup process, and when launching the ''FLTK'' console, you observe that andlinux is stalling on the message below.
  +
<div style="padding-left:2em;"><pre>ReiserFS: cobd0: warning: sh-2021: reiserfs_fill_super: can not find reiserfs on cobd0
  +
kjournald starting. Commit interval 5 seconds
  +
EXT3-fs: mounted filesystem with ordered data mode.
  +
Modules already installed.
  +
Closing /
  +
kjournald starting. Commit interval 5 seconds
  +
</pre></div>
  +
:* '''Solution''': The fix proposed in [http://www.andlinux.org/forum/viewtopic.php?t=291&sid=7ef2f7b1234865dd3fabe645c1b48a25 this post] is to actually change the extension of the disk image file from <tt>.drv</tt> to something like <tt>.drive</tt> (ie. change <tt>./Drives/base.drv</tt> to <tt>./Drives/base.drive</tt> and <tt>./Drives/swap.drv</tt> to <tt>./Drives/swap.drive</tt>) and adapt the configuration files <tt>./settings.txt</tt> accordingly.

Latest revision as of 16:02, 2 March 2016

Intro

andLinux is a bundle of several pieces enabling a linux distribution to run with its kernel as a Windows service.

Tips

Adding a shared drive

Add sth like this to andLinux\settings.txt

cofs1=D:\

And in the /etc/fstab of the Ubuntu:

1 /mnt/d cofs defaults 0 0

Running kgpg

The problem is that once kgpg is iconified, I've no idea where this icon goes and I cannot maximize the window anymore (it's also true for e.g. klipper)
The trick is to use a dcop command to raise the window, you can play with kdcop to experiment
So I added to andLinux\Launcher\menu.txt the following:

Kgpg;kgpg.ico;pgrep kgpg > /dev/null || kgpg;dcop kgpg KeyInterface showKeyManager

The icon was converted from /usr/share/icons/hicolor/32x32/apps/kgpg.png with The Gimp

Windows Explorer integration

In the Windows Explorer there is now on right-click on a file a possibility to open it with Kate.
And right-click on a folder allows it to be opened in Konqueror or Konsole.
To do that it is creating the path file:///mnt/win/... so be sure that /mnt/win points to your data partition.

If you want or need to hack into that part, have a look here:

And here is a patch by Thierry Walrant to allow more than one share and to fix the andCmd.exe bug as well, you can [{{#file:launcher.patch}} get the patch here]

--- launcher.pl	2008-07-03 05:26:40.000000000 -0400
+++ launcher.pl	2008-07-03 05:52:45.000000000 -0400
@@ -1,27 +1,44 @@
 #!/usr/bin/perl
 
 use IO::Socket;
+use strict;
 
+# Default settings.
+our $localPort = 81;
+our %pathPrefixes = (
+    '/mnt/win/'	=> "C:\\"
+    );
 
-$windowsPathPrefix = "C:\\";
-$linuxPathPrefix = "/mnt/win/";
+# Load config, if any.
+my $conf = '/etc/launcher-conf.pl';
+require $conf if -f $conf;
 
 
-$sock = new IO::Socket::INET(LocalPort => 81, Reuse => 1, Listen => 20) or die("Error creating local socket: $@\n");
+my $sock = new IO::Socket::INET(LocalPort => $localPort, Reuse => 1, Listen => 20) or die("Error creating local socket: $@\n");
 
-while($client = $sock->accept())
+while(my $client = $sock->accept())
 {
-	$request = <$client>;
+	my $request = <$client>;
 	chomp $request;
 	if($request =~ m/^cmd=(.+)&file=(.*)$/)
 	{
-		$cmd = $1;
-		$file = $2;
+		my $cmd = $1;
+		my $file = $2;
 
-		$escapedWindowsPathPrefix = $windowsPathPrefix;
-		$escapedWindowsPathPrefix =~ s/\\/\\\\/g;
-		$file =~ s/$escapedWindowsPathPrefix/$linuxPathPrefix/g;
+		# Apply all mappings
+		foreach my $linuxPathPrefix ( keys %pathPrefixes ) {
+		    my $windowsPathPrefix = $pathPrefixes{$linuxPathPrefix};
+		    $windowsPathPrefix =~ s/\\/\\\\/g;
+		    $file =~ s/$windowsPathPrefix/$linuxPathPrefix/g;
+
+		    # Apply mapping to 'cmd' as well (circumvent issue with
+		    # andCmd.exe which passes all arguments in 'cmd').
+		    $cmd =~ s/$windowsPathPrefix/$linuxPathPrefix/g;
+		}
+
+		# Finalize with back-slashes replacement.
 		$file =~ s/\\/\//g;
+		$cmd =~ s/\\/\//g;
 
 		system("$cmd $file &");

To use it you can use the hardcoded mapping as before or you can define your mappings in a config file /etc/launcher-conf.pl such as:

# Configuration file for the launcher: /usr/local/sbin/launcher.pl

%pathPrefixes = (
	'/mnt/winC/'	=> 'C:\\',
	'/mnt/winD/'	=> 'D:\\',
	'/mnt/winZ/'	=> 'Z:\\'
    );

# A Perl library MUST return 1
1;

Please note this configuration assumes that the mount points /mnt/winC, /mnt/winD and /mnt/winZ are mounted on the root of the windows drives C:, D: and Z:. This allows you to launch KDE applications on any of your windows files and folders.

Starting Xming our own way

By default Xming is started at boot time (cf folder Startup)
If you don't want that and start Xming only when you need it, here is a replacement of andLinux/srvstart.bat

@echo off
setlocal ENABLEEXTENSIONS

rem Do we need to start xming?
set TASKNAME=xming.exe
tasklist /FI "IMAGENAME eq %TASKNAME%"  2> \nul | find /i "%TASKNAME%" > \nul

IF ERRORLEVEL 1 CALL :STARTXMING

net start andLinux
goto :EOF

:STARTXMING

echo Starting XMing...
start /D"C:\Program Files\andLinux" C:\Progra~1\andLinux\Xming\Xming.exe :0 -dpi 85 -ac -clipboard -notrayicon -c -multiwindow -reset -terminate -unixkill -logfile Xming.log

goto :EOF

Port forwarding

To forward a port of the host to andLinux so it can run servers available to everybody: (instructions extracted from here)
Edit your settings.txt and append some port forwarding infos to eth0:

#eth0=slirp,<MAC>,tcp:<from Hosting OS port>:<to coLinux OS port>/...
eth0=slirp,,tcp:22:22/tcp:80:80

Troubleshooting

Startup delays

  • Interaction with Anti-Virus software - AV software may interact with the startup of AndLinux, typically by maintaining a lock on the 4GB disk image file base.drv while it is scanned.
    • Solution: To prevent this, one can exclude the andlinux directory from the AV on-access scanner. In McAfee, this is done by opening the VirusScan consoledouble-ckick On-Access Scanner → then select All Processes → open the pane Detection and click the button Exclusions... → click Add... to add a new exclusion → Browse to AndLinux directory and select Also exclude subfolders.
  • Stalling when mounting / - You experience a huge delay during the startup process, and when launching the FLTK console, you observe that andlinux is stalling on the message below.
ReiserFS: cobd0: warning: sh-2021: reiserfs_fill_super: can not find reiserfs on cobd0
kjournald starting.  Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
Modules already installed.
Closing /
kjournald starting.  Commit interval 5 seconds
  • Solution: The fix proposed in this post is to actually change the extension of the disk image file from .drv to something like .drive (ie. change ./Drives/base.drv to ./Drives/base.drive and ./Drives/swap.drv to ./Drives/swap.drive) and adapt the configuration files ./settings.txt accordingly.