Linux: Difference between revisions
From Wiki
(Created page with "= Linux Network Tricks = == Connecting to two networks - one Wi-Fi and one wired == Wi-Fi network has internet, wired does not. Then, disable the gateway of the Wired networ...") |
No edit summary |
||
Line 16: | Line 16: | ||
<code>$ sudo ip route del default via 192.168.1.1</code> | <code>$ sudo ip route del default via 192.168.1.1</code> | ||
= chroot into a Raspberry Pi = | |||
== Mount sequence == | |||
<pre> | |||
mount /dev/sdb3 /mnt | |||
mount /dev/sdb2 /mnt/boot | |||
mount /dev/sdb1 /mnt/boot/firmware | |||
mount -o bind /proc /mnt/proc | |||
mount -o bind /sys /mnt/sys | |||
mount -o bind /dev /mnt/dev | |||
mount -o bind /dev/pts /mnt/dev/pts | |||
cp /usr/bin/qemu-arm-static /mnt/usr/bin | |||
chroot /mnt | |||
</pre> | |||
== Doing stuff in chroot == | |||
Example: Fixing a broken apt install | |||
<pre> | |||
dpkg --configure -a | |||
apt -f install | |||
exit | |||
</pre> | |||
== Unmount sequence == | |||
<pre> | |||
umount /mnt/dev/pts | |||
umount /mnt/dev/ | |||
umount /mnt/sys | |||
umount /mnt/proc | |||
umount /mnt/boot/firmware | |||
umount /mnt/boot/ | |||
umount /mnt | |||
</pre> |
Revision as of 01:54, 15 December 2017
Linux Network Tricks
Connecting to two networks - one Wi-Fi and one wired
Wi-Fi network has internet, wired does not. Then, disable the gateway of the Wired network for internet access.
Show the networks
$ ip route show
Smaller metric number means higher priority for the gateway
Remove the gateway of the wired network
$ sudo ip route del default via 192.168.1.1
chroot into a Raspberry Pi
Mount sequence
mount /dev/sdb3 /mnt mount /dev/sdb2 /mnt/boot mount /dev/sdb1 /mnt/boot/firmware mount -o bind /proc /mnt/proc mount -o bind /sys /mnt/sys mount -o bind /dev /mnt/dev mount -o bind /dev/pts /mnt/dev/pts cp /usr/bin/qemu-arm-static /mnt/usr/bin chroot /mnt
Doing stuff in chroot
Example: Fixing a broken apt install
dpkg --configure -a apt -f install exit
Unmount sequence
umount /mnt/dev/pts umount /mnt/dev/ umount /mnt/sys umount /mnt/proc umount /mnt/boot/firmware umount /mnt/boot/ umount /mnt